summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/databinding-jaxb/src/main
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2008-07-02 06:47:40 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2008-07-02 06:47:40 +0000
commit8d7cb21ef3c6cf4a39ee77e3358d2eeb129864fe (patch)
tree6bb016d2eaa7d5254232ffcb735872e94ab8c14c /java/sca/modules/databinding-jaxb/src/main
parent02f18503f2e2707b6ed535929bcd412877512419 (diff)
Fix for TUSCANY-2444
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@673298 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/databinding-jaxb/src/main')
-rw-r--r--java/sca/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/BeanXMLStreamReaderImpl.java15
1 files changed, 11 insertions, 4 deletions
diff --git a/java/sca/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/BeanXMLStreamReaderImpl.java b/java/sca/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/BeanXMLStreamReaderImpl.java
index 730f9e4a66..0fde2ee9a5 100644
--- a/java/sca/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/BeanXMLStreamReaderImpl.java
+++ b/java/sca/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/BeanXMLStreamReaderImpl.java
@@ -196,16 +196,24 @@ public class BeanXMLStreamReaderImpl extends XmlTreeStreamReaderImpl {
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 @@ public class BeanXMLStreamReaderImpl extends XmlTreeStreamReaderImpl {
ns.append('/');
return new QName(ns.toString(), cls.getSimpleName());
}
-
}
public BeanXMLStreamReaderImpl(QName name, Object bean) {