You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2015/10/22 11:06:24 UTC
[2/2] cxf-xjc-utils git commit: Fixing NPE caused by null enum
TypeName. This closes #3
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 <la...@gmail.com>
Authored: Wed Oct 21 21:41:20 2015 -0200
Committer: Colm O hEigeartaigh <co...@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);
}
}