cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [2/2] cxf-xjc-utils git commit: Fixing NPE caused by null enum TypeName. This closes #3
Date Thu, 22 Oct 2015 09:06:24 GMT
Fixing NPE caused by null enum TypeName.  This closes #3


Project: http://git-wip-us.apache.org/repos/asf/cxf-xjc-utils/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf-xjc-utils/commit/d41ade48
Tree: http://git-wip-us.apache.org/repos/asf/cxf-xjc-utils/tree/d41ade48
Diff: http://git-wip-us.apache.org/repos/asf/cxf-xjc-utils/diff/d41ade48

Branch: refs/heads/master
Commit: d41ade4801ad30003e3fcffe4968e7a229700ede
Parents: 4cfb27c
Author: Lauro Schuck <lauroschuck@gmail.com>
Authored: Wed Oct 21 21:41:20 2015 -0200
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Thu Oct 22 10:05:36 2015 +0100

----------------------------------------------------------------------
 .../org/apache/cxf/xjc/javadoc/JavadocInserter.java  | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf-xjc-utils/blob/d41ade48/javadoc/src/main/java/org/apache/cxf/xjc/javadoc/JavadocInserter.java
----------------------------------------------------------------------
diff --git a/javadoc/src/main/java/org/apache/cxf/xjc/javadoc/JavadocInserter.java b/javadoc/src/main/java/org/apache/cxf/xjc/javadoc/JavadocInserter.java
index 33382c4..269e613 100644
--- a/javadoc/src/main/java/org/apache/cxf/xjc/javadoc/JavadocInserter.java
+++ b/javadoc/src/main/java/org/apache/cxf/xjc/javadoc/JavadocInserter.java
@@ -20,9 +20,12 @@ package org.apache.cxf.xjc.javadoc;
 
 import java.util.Collection;
 
+import javax.xml.namespace.QName;
+
 import org.xml.sax.ErrorHandler;
 
 import com.sun.tools.xjc.Options;
+import com.sun.tools.xjc.model.CEnumLeafInfo;
 import com.sun.tools.xjc.outline.ClassOutline;
 import com.sun.tools.xjc.outline.EnumOutline;
 import com.sun.tools.xjc.outline.FieldOutline;
@@ -87,11 +90,17 @@ public class JavadocInserter {
     }
 
     private boolean isCustomBindingApplied(EnumOutline enumOutline) {
-        String defaultComment = Messages.format("ClassSelector.JavadocHeading", enumOutline.target
-            .getTypeName().getLocalPart());
+        CEnumLeafInfo target = enumOutline.target;
+        QName typeName = target.getTypeName();
+        // typeName may be null on anonymous simple types
+        if (typeName == null) {
+            return false;
+        }
+        String defaultComment = Messages.format("ClassSelector.JavadocHeading",
+                typeName.getLocalPart());
         // not very clean but the only way of determining whether Javadoc
         // customization has been applied
-        return !enumOutline.target.javadoc.startsWith(defaultComment);
+        return !target.javadoc.startsWith(defaultComment);
     }
 
 }


Mime
View raw message