You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Deepal Jayasinghe (JIRA)" <ji...@apache.org> on 2006/05/07 11:18:22 UTC
[jira] Assigned: (AXIS2-674) Java2WSDLUtils fails to generate WSDL
where a class's package could not be found
[ http://issues.apache.org/jira/browse/AXIS2-674?page=all ]
Deepal Jayasinghe reassigned AXIS2-674:
---------------------------------------
Assign To: Deepal Jayasinghe
> Java2WSDLUtils fails to generate WSDL where a class's package could not be found
> --------------------------------------------------------------------------------
>
> Key: AXIS2-674
> URL: http://issues.apache.org/jira/browse/AXIS2-674
> Project: Apache Axis 2.0 (Axis2)
> Type: Bug
> Components: deployment
> Versions: 1.0
> Reporter: Steve Barham
> Assignee: Deepal Jayasinghe
> Priority: Critical
>
> The Java2WSDL class defines the following method to find the namespace for a class:
> public static StringBuffer namespaceFromClassName(String className , ClassLoader classLoader) throws Exception
> {
> return namespaceFromPackageName(Class.forName(className, true, classLoader).getPackage().getName());
> }
> Unfortunately, Class.getPackage() may return null when:
> 1. the package for a class does not exist (ie. a top level class)
> 2. where the package has not been loaded.
> Suggestion:
> 1. Document that classes must reside in a package, or define a default namespace to be assigned to top level classes
> 2. Add an alternate mechanism of determining the package of a class (see below)
> public static StringBuffer namespaceFromClassName(String className , ClassLoader classLoader) throws Exception
> {
> Class clazz = Class.forName(className, true, classLoader);
> Package pkg = clazz.getPackage();
> String name;
> if (pkg != null)
> name = pkg.getName();
> else
> name = packageNameFromClass(clazz.getName());
> return namespaceFromPackageName(name);
> }
> protected static String packageNameFromClass(String name)
> {
> String ret = new String();
> int lastDot = name.lastIndexOf ('.');
> if (lastDot != -1)
> ret = name.substring(lastDot + 1);
>
> return ret;
> }
> Rgds
> steve
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira