tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rf...@apache.org
Subject svn commit: r673421 - in /tuscany/branches/sca-java-1.3: ./ modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/ modules/databinding/src/m...
Date Wed, 02 Jul 2008 15:37:06 GMT
Author: rfeng
Date: Wed Jul  2 08:37:05 2008
New Revision: 673421

URL: http://svn.apache.org/viewvc?rev=673421&view=rev
Log:
Fix for TUSCANY-2444, merged from trunk

Modified:
    tuscany/branches/sca-java-1.3/   (props changed)
    tuscany/branches/sca-java-1.3/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ContributionClassLoaderTestCase.java
    tuscany/branches/sca-java-1.3/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/BeanXMLStreamReaderImpl.java
    tuscany/branches/sca-java-1.3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/BeanXMLStreamReaderImpl.java
    tuscany/branches/sca-java-1.3/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JavaIntrospectionHelper.java
    tuscany/branches/sca-java-1.3/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiImplementationProvider.java
    tuscany/branches/sca-java-1.3/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestBundles.java
    tuscany/branches/sca-java-1.3/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/CodeGenerationHelper.java
    tuscany/branches/sca-java-1.3/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSFaultExceptionMapper.java
    tuscany/branches/sca-java-1.3/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java
    tuscany/branches/sca-java-1.3/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/WrapperBeanGenerator.java
    tuscany/branches/sca-java-1.3/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtil.java
    tuscany/branches/sca-java-1.3/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/JavaXMLMapper.java
    tuscany/branches/sca-java-1.3/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/SchemaBuilder.java

Propchange: tuscany/branches/sca-java-1.3/
------------------------------------------------------------------------------
    svn:mergeinfo = /tuscany/java/sca:673298

Modified: tuscany/branches/sca-java-1.3/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ContributionClassLoaderTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.3/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ContributionClassLoaderTestCase.java?rev=673421&r1=673420&r2=673421&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.3/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ContributionClassLoaderTestCase.java
(original)
+++ tuscany/branches/sca-java-1.3/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ContributionClassLoaderTestCase.java
Wed Jul  2 08:37:05 2008
@@ -134,6 +134,11 @@
         
     }
     
+    private static String getPackageName(Class<?> cls) {
+        String name = cls.getName();
+        int index = name.lastIndexOf('.');
+        return index == -1 ? "" : name.substring(0, index);
+    }
 
     @Test
     public void testClassLoadingFromImportedContribution() throws ClassNotFoundException,
MalformedURLException {
@@ -146,7 +151,7 @@
         exportContribList.add(contribC);
         
         JavaImport import_ = javaImportExportFactory.createJavaImport();
-        import_.setPackage(this.getClass().getPackage().getName());
+        import_.setPackage(getPackageName(getClass()));
         import_.setModelResolver(new JavaImportModelResolver(exportContribList, null));
         contribB.getImports().add(import_);
         import_ = javaImportExportFactory.createJavaImport();
@@ -155,7 +160,7 @@
         contribB.getImports().add(import_);
         
         JavaExport export = javaImportExportFactory.createJavaExport();
-        export.setPackage(this.getClass().getPackage().getName());
+        export.setPackage(getPackageName(getClass()));
         contribA.getExports().add(export);
         export = javaImportExportFactory.createJavaExport();
         export.setPackage("calculator");
@@ -197,7 +202,7 @@
         
         // Try to load non-existent class from imported package - should throw ClassNotFoundException
         try {
-            contribB.getClassLoader().loadClass(this.getClass().getPackage().getName() +
".NonExistentClass");
+            contribB.getClassLoader().loadClass(getPackageName(getClass()) + ".NonExistentClass");
             
             Assert.assertTrue("ClassNotFoundException not thrown as expected", false);
             
@@ -218,7 +223,7 @@
         exportContribList.add(contribC);
         
         JavaImport import_ = javaImportExportFactory.createJavaImport();
-        import_.setPackage(this.getClass().getPackage().getName());
+        import_.setPackage(getPackageName(getClass()));
         import_.setModelResolver(new JavaImportModelResolver(exportContribList, null));
         contribB.getImports().add(import_);
         JavaImport import1_ = javaImportExportFactory.createJavaImport();
@@ -227,7 +232,7 @@
         contribB.getImports().add(import1_);
         
         JavaExport export = javaImportExportFactory.createJavaExport();
-        export.setPackage(this.getClass().getPackage().getName());
+        export.setPackage(getPackageName(getClass()));
         contribA.getExports().add(export);
         JavaExport export1 = javaImportExportFactory.createJavaExport();
         export1.setPackage("calculator");

Modified: tuscany/branches/sca-java-1.3/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/BeanXMLStreamReaderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.3/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/BeanXMLStreamReaderImpl.java?rev=673421&r1=673420&r2=673421&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.3/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/BeanXMLStreamReaderImpl.java
(original)
+++ tuscany/branches/sca-java-1.3/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/BeanXMLStreamReaderImpl.java
Wed Jul  2 08:37:05 2008
@@ -196,16 +196,24 @@
             return getStringValue(value);
         }
 
+        private static String getPackageName(Class<?> cls) {
+            String name = cls.getName();
+            int index = name.lastIndexOf('.');
+            return index == -1 ? "" : name.substring(0, index);
+        }
+
         public static QName getName(Class<?> cls) {
             if (cls == null) {
                 return null;
             }
-            Package pkg = cls.getPackage();
-            if (pkg == null) {
+
+            String packageName = getPackageName(cls);
+
+            if ("".equals(packageName)) {
                 return new QName("", cls.getSimpleName());
             }
             StringBuffer ns = new StringBuffer("http://");
-            String[] names = pkg.getName().split("\\.");
+            String[] names = packageName.split("\\.");
             for (int i = names.length - 1; i >= 0; i--) {
                 ns.append(names[i]);
                 if (i != 0) {
@@ -215,7 +223,6 @@
             ns.append('/');
             return new QName(ns.toString(), cls.getSimpleName());
         }
-
     }
 
     public BeanXMLStreamReaderImpl(QName name, Object bean) {

Modified: tuscany/branches/sca-java-1.3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/BeanXMLStreamReaderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/BeanXMLStreamReaderImpl.java?rev=673421&r1=673420&r2=673421&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/BeanXMLStreamReaderImpl.java
(original)
+++ tuscany/branches/sca-java-1.3/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/BeanXMLStreamReaderImpl.java
Wed Jul  2 08:37:05 2008
@@ -150,17 +150,25 @@
         public String getValue() {
             return getStringValue(value);
         }
+        
+        private static String getPackageName(Class<?> cls) {
+            String name = cls.getName();
+            int index = name.lastIndexOf('.');
+            return index == -1 ? "" : name.substring(0, index);
+        }
 
         public static QName getName(Class<?> cls) {
             if (cls == null) {
                 return null;
             }
-            Package pkg = cls.getPackage();
-            if (pkg == null) {
+
+            String packageName = getPackageName(cls);
+
+            if ("".equals(packageName)) {
                 return new QName("", cls.getSimpleName());
             }
             StringBuffer ns = new StringBuffer("http://");
-            String[] names = pkg.getName().split("\\.");
+            String[] names = packageName.split("\\.");
             for (int i = names.length - 1; i >= 0; i--) {
                 ns.append(names[i]);
                 if (i != 0) {

Modified: tuscany/branches/sca-java-1.3/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JavaIntrospectionHelper.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.3/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JavaIntrospectionHelper.java?rev=673421&r1=673420&r2=673421&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.3/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JavaIntrospectionHelper.java
(original)
+++ tuscany/branches/sca-java-1.3/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JavaIntrospectionHelper.java
Wed Jul  2 08:37:05 2008
@@ -68,7 +68,7 @@
 
     private static void checkInvalidAnnotations(AnnotatedElement element) {
         for (Annotation a : element.getAnnotations()) {
-            if ("org.osoa.sca.annotations".equals(a.annotationType().getPackage().getName()))
{
+            if (a.annotationType().getName().startsWith("org.osoa.sca.annotations.")) {
                 logger.warning("Invalid annotation " + a + " is found on " + element);
             }
         }

Modified: tuscany/branches/sca-java-1.3/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiImplementationProvider.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.3/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiImplementationProvider.java?rev=673421&r1=673420&r2=673421&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.3/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiImplementationProvider.java
(original)
+++ tuscany/branches/sca-java-1.3/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiImplementationProvider.java
Wed Jul  2 08:37:05 2008
@@ -550,7 +550,7 @@
         String EOL = System.getProperty("line.separator");
 
         String interfaceName = interfaceClass.getName();
-        String packageName = interfaceClass.getPackage().getName();
+        String packageName = getPackageName(interfaceClass);
         String bundleName = "dummy.sca." + packageName;
 
         String manifestStr = "Manifest-Version: 1.0" + EOL
@@ -645,6 +645,11 @@
             return exp.getExportingBundle();
     }
     
+    private static String getPackageName(Class<?> cls) {
+        String name = cls.getName();
+        int index = name.lastIndexOf('.');
+        return index == -1 ? "" : name.substring(0, index);
+    }
     
     private Bundle installDummyBundle(Class<?> interfaceClass)
             throws Exception {
@@ -660,7 +665,7 @@
         ArrayList<Class<?>> dummyClasses = new ArrayList<Class<?>>();
         
         String interfaceName = interfaceClass.getName();
-        String packageName = interfaceClass.getPackage().getName();
+        String packageName = getPackageName(interfaceClass);
         String bundleName = "dummy.sca." + interfaceName;
         
         

Modified: tuscany/branches/sca-java-1.3/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestBundles.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.3/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestBundles.java?rev=673421&r1=673420&r2=673421&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.3/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestBundles.java
(original)
+++ tuscany/branches/sca-java-1.3/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestBundles.java
Wed Jul  2 08:37:05 2008
@@ -36,6 +36,11 @@
  * @version $Rev$ $Date$
  */
 public class OSGiTestBundles {
+    private static String getPackageName(Class<?> cls) {
+        String name = cls.getName();
+        int index = name.lastIndexOf('.');
+        return index == -1 ? "" : name.substring(0, index);
+    }
     
     public static void createBundle(String jarName,
             Class<?> interfaceClass, Class<?> implClass) throws Exception {
@@ -44,7 +49,7 @@
 
         String EOL = System.getProperty("line.separator");
         
-        String packageName = interfaceClass.getPackage().getName();
+        String packageName = getPackageName(interfaceClass);
         String bundleName = interfaceClass.getName();
 
         String manifestStr = "Manifest-Version: 1.0" + EOL

Modified: tuscany/branches/sca-java-1.3/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/CodeGenerationHelper.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.3/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/CodeGenerationHelper.java?rev=673421&r1=673420&r2=673421&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.3/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/CodeGenerationHelper.java
(original)
+++ tuscany/branches/sca-java-1.3/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/CodeGenerationHelper.java
Wed Jul  2 08:37:05 2008
@@ -261,5 +261,20 @@
         return Opcodes.ARETURN;
 
     }
+    
+    /**
+     * Get the package prefix for generated JAXWS artifacts
+     * @param cls
+     * @return
+     */
+    public static String getPackagePrefix(Class<?> cls) {
+        String name = cls.getName();
+        int index = name.lastIndexOf('.');
+        if (index == -1) {
+            return "jaxws.";
+        } else {
+            return name.substring(0, index) + ".jaxws.";
+        }
+    }
 
 }

Modified: tuscany/branches/sca-java-1.3/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSFaultExceptionMapper.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.3/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSFaultExceptionMapper.java?rev=673421&r1=673420&r2=673421&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.3/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSFaultExceptionMapper.java
(original)
+++ tuscany/branches/sca-java-1.3/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSFaultExceptionMapper.java
Wed Jul  2 08:37:05 2008
@@ -293,7 +293,7 @@
         }
 
         if (faultBean == null) {
-            final String faultBeanClassName = cls.getPackage().getName() + ".jaxws." + cls.getSimpleName()
+ "Bean";
+            final String faultBeanClassName = CodeGenerationHelper.getPackagePrefix(cls)
+ cls.getSimpleName() + "Bean";
             final QName qname = faultName;
             faultType = AccessController.doPrivileged(new PrivilegedAction<DataType<XMLType>>()
{
                 public DataType<XMLType> run() {

Modified: tuscany/branches/sca-java-1.3/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.3/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java?rev=673421&r1=673420&r2=673421&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.3/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java
(original)
+++ tuscany/branches/sca-java-1.3/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java
Wed Jul  2 08:37:05 2008
@@ -188,7 +188,7 @@
                     requestWrapper == null ? operationName : getValue(requestWrapper.localName(),
operationName);
                 String wrapperBeanName = requestWrapper == null ? "" : requestWrapper.className();
                 if ("".equals(wrapperBeanName)) {
-                    wrapperBeanName = clazz.getPackage().getName() + ".jaxws." + capitalize(method.getName());
+                    wrapperBeanName = CodeGenerationHelper.getPackagePrefix(clazz) + capitalize(method.getName());
                 }
 
                 DataType<XMLType> inputWrapperDT = null;
@@ -222,7 +222,7 @@
                 wrapperBeanName = responseWrapper == null ? "" : responseWrapper.className();
                 if ("".equals(wrapperBeanName)) {
                     wrapperBeanName =
-                        clazz.getPackage().getName() + ".jaxws." + capitalize(method.getName())
+ "Response";
+                        CodeGenerationHelper.getPackagePrefix(clazz) + capitalize(method.getName())
+ "Response";
                 }
 
                 DataType<XMLType> outputWrapperDT = null;

Modified: tuscany/branches/sca-java-1.3/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/WrapperBeanGenerator.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.3/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/WrapperBeanGenerator.java?rev=673421&r1=673420&r2=673421&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.3/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/WrapperBeanGenerator.java
(original)
+++ tuscany/branches/sca-java-1.3/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/WrapperBeanGenerator.java
Wed Jul  2 08:37:05 2008
@@ -46,7 +46,7 @@
         String wrapperNamespace = JavaInterfaceUtil.getNamespace(sei);
         String wrapperName = m.getName();
         String wrapperBeanName = capitalize(wrapperName);
-        String wrapperClassName = sei.getPackage().getName() + ".jaxws." + wrapperBeanName;
+        String wrapperClassName = CodeGenerationHelper.getPackagePrefix(sei) + wrapperBeanName;
 
         return generateRequestWrapper(m, wrapperClassName, wrapperNamespace, wrapperName,
cl);
     }
@@ -90,7 +90,7 @@
 
         String wrapperName = m.getName() + "Response";
         String wrapperBeanName = capitalize(wrapperName);
-        String wrapperClassName = sei.getPackage().getName() + ".jaxws." + wrapperBeanName;
+        String wrapperClassName = CodeGenerationHelper.getPackagePrefix(sei) + wrapperBeanName;
         return generateResponseWrapper(m, wrapperClassName, wrapperNamespace, wrapperName,
cl);
 
     }

Modified: tuscany/branches/sca-java-1.3/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtil.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.3/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtil.java?rev=673421&r1=673420&r2=673421&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.3/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtil.java
(original)
+++ tuscany/branches/sca-java-1.3/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtil.java
Wed Jul  2 08:37:05 2008
@@ -147,13 +147,19 @@
 
     }
     
+    private static String getPackageName(Class<?> cls) {
+        String name = cls.getName();
+        int index = name.lastIndexOf('.');
+        return index == -1 ? "" : name.substring(0, index);
+    }
+
     public static String getNamespace(Class<?> cls) {
-        Package pkg = cls.getPackage();
-        if (pkg == null) {
+        String packageName = getPackageName(cls);
+        if ("".equals(packageName)) {
             return "";
         }
         StringBuffer ns = new StringBuffer("http://");
-        String[] names = pkg.getName().split("\\.");
+        String[] names = packageName.split("\\.");
         for (int i = names.length - 1; i >= 0; i--) {
             ns.append(names[i]);
             if (i != 0) {

Modified: tuscany/branches/sca-java-1.3/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/JavaXMLMapper.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.3/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/JavaXMLMapper.java?rev=673421&r1=673420&r2=673421&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.3/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/JavaXMLMapper.java
(original)
+++ tuscany/branches/sca-java-1.3/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/JavaXMLMapper.java
Wed Jul  2 08:37:05 2008
@@ -117,13 +117,19 @@
         return JAVA2XML.get(javaType);
     }
     
+    private static String getPackageName(Class<?> cls) {
+        String name = cls.getName();
+        int index = name.lastIndexOf('.');
+        return index == -1 ? "" : name.substring(0, index);
+    }
+
     public static String getNamespace(Class<?> cls) {
-        Package pkg = cls.getPackage();
-        if (pkg == null) {
+        String packageName = getPackageName(cls);
+        if ("".equals(packageName)) {
             return "";
         }
         StringBuffer ns = new StringBuffer("http://");
-        String[] names = pkg.getName().split("\\.");
+        String[] names = packageName.split("\\.");
         for (int i = names.length - 1; i >= 0; i--) {
             ns.append(names[i]);
             if (i != 0) {

Modified: tuscany/branches/sca-java-1.3/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/SchemaBuilder.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.3/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/SchemaBuilder.java?rev=673421&r1=673420&r2=673421&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.3/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/SchemaBuilder.java
(original)
+++ tuscany/branches/sca-java-1.3/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/SchemaBuilder.java
Wed Jul  2 08:37:05 2008
@@ -554,14 +554,19 @@
         this.elementFormDefault = elementFormDefault;
     }
 
-
+    private static String getPackageName(Class<?> cls) {
+        String name = cls.getName();
+        int index = name.lastIndexOf('.');
+        return index == -1 ? "" : name.substring(0, index);
+    }
+    
     /**
      * Recognize the pattern of generated SDO type names vs. SDO factory names.
      * E.g. SDO class:   test.sca.w2j.gen.Company will be associated with 
      *      SDO factory: test.sca.w2j.gen.GenFactory
      */
     private void detectAndRegisterFactory(Class sdoClass) {
-        String pkgName = sdoClass.getPackage().getName();
+        String pkgName = getPackageName(sdoClass);
 
         // Find last segment, e.g. from 'test.sca.w2j.gen' produce 'gen'.
         int lastDot = pkgName.lastIndexOf('.');



Mime
View raw message