Skip to content
Permalink
Browse files
Fixing NPE caused by null enum TypeName. This closes #3
  • Loading branch information
lauroschuck authored and coheigea committed Oct 22, 2015
1 parent 4cfb27c commit d41ade4801ad30003e3fcffe4968e7a229700ede
Showing 1 changed file with 12 additions and 3 deletions.
@@ -20,9 +20,12 @@

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 @@ private void addJavadoc(EnumOutline enumOutline) {
}

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);
}

}

0 comments on commit d41ade4

Please sign in to comment.