summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.3/modules/interface-java/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'branches/sca-java-1.3/modules/interface-java/src/main')
-rw-r--r--branches/sca-java-1.3/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtil.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/branches/sca-java-1.3/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtil.java b/branches/sca-java-1.3/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtil.java
index f8d705be13..2a9e3c5329 100644
--- a/branches/sca-java-1.3/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtil.java
+++ b/branches/sca-java-1.3/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtil.java
@@ -147,13 +147,19 @@ public final class JavaInterfaceUtil {
}
+ 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) {