| Summary: | Generated Java code got error when the external type can not be instantiated | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Xin Wu <cdlwuxin> | ||||||
| Component: | EDT | Assignee: | Project Inbox <edt.javagen-inbox> | ||||||
| Status: | CLOSED INVALID | QA Contact: | |||||||
| Severity: | major | ||||||||
| Priority: | P3 | CC: | jqian, jvincens, margolis | ||||||
| Version: | unspecified | ||||||||
| Target Milestone: | --- | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows XP | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Xin Wu
Created attachment 206043 [details]
LdapRuiServices in EDT
A similar problem in same project. In generatedJava -> common -> LDAPLib.java line 34. "InitialLdapContext ctx = new InitialLdapContext();" got error unhandled exception. Which was declared as "null" in RBD. These two problem blocked some of the Green Thread testing, so I will reset severity to major. Created attachment 206191 [details]
The updated project, you may use this instead the old one
The Attributes external type represents an interface. An interface is not instantiatable, so the egl variable declaration should have a ?. A best practice when creating an external type that represents a Java Interface is to have a private constructor.
externalType Attributes type JavaObject
{ ExternalName = "Attributes", PackageName = "javax.naming.directory" }
private constructor();
function getAttribute( attrId String in ) returns( Attribute ) { ExternalName = "get" };
function getAll() returns ( NamingEnumeration );
function getIds() returns ( NamingEnumeration );
function size() returns ( int );
end
This forces the variable declaration to require a ?.
attrs Attributes?;
If you want InitialLdapContext to be initialized to null, then you need to define it as nullable. ie ctx InitialLdapContext?; Joe, thanks so much. The best practice you suggested that adding "private constructor();" solved the problem. And it will bring out a compile error to notify user to add a '?' in EGL. Closed this bug. |