Hi, wguttmn!
I met a NullPointerException, the following is error log
Caused by: java.lang.NullPointerException
at org.exolab.castor.builder.info.CollectionInfo.<init>(CollectionInfo.java:100)
at org.exolab.castor.builder.info.CollectionInfoJ2.<init>(CollectionInfoJ2.java:70)
at org.exolab.castor.builder.factory.FieldInfoFactory.createCollection(FieldInfoFactory.java:208)
at org.exolab.castor.builder.factory.FieldInfoFactory.createCollection(FieldInfoFactory.java:181)
at org.exolab.castor.builder.factory.MemberFactory.createFieldInfoForContent(MemberFactory.java:229)
at org.exolab.castor.builder.factory.SourceFactory.processComplexType(SourceFactory.java:2076)
at org.exolab.castor.builder.factory.SourceFactory.processComplexType(SourceFactory.java:812)
at org.exolab.castor.builder.factory.SourceFactory.createSourceCode(SourceFactory.java:368)
at org.exolab.castor.builder.SourceGenerator.createClasses(SourceGenerator.java:932)
at org.exolab.castor.builder.SourceGenerator.generateAllClassFiles(SourceGenerator.java:786)
at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:744)
at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:690)
at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:587)
Based on the logs:
the error happend at CollectionInfo.java in line 100
public CollectionInfo(final XSType contentType, final String name, final String elementName,
final boolean useJava50, final FieldMemberAndAccessorFactory memberAndAccessorFactory,
final FieldMemberAndAccessorFactory contentMemberAndAccessorFactory) {
super(XSCollectionFactory.createCollection(SourceGeneratorConstants.FIELD_INFO_VECTOR,
contentType, useJava50), name, memberAndAccessorFactory);
**if (elementName.charAt(0) == '_') {// error occurred there**
this._elementName = elementName.substring(1);
} else {
this._elementName = elementName;
}
this._methodSuffix =
memberAndAccessorFactory.getJavaNaming().toJavaClassName(this.getElementName());
this._parameterPrefix =
memberAndAccessorFactory.getJavaNaming().toJavaMemberName(this.getElementName());
this._content =
new FieldInfo(contentType, "v" + this.getMethodSuffix(), contentMemberAndAccessorFactory);
// indicates that - per definition - we are dealing with multi-valuedness
new XMLInfoNature(this).setMultivalued(true);
} // -- CollectionInfo
source code of (MemberFactory.java:229), the input elementName is null
public FieldInfo createFieldInfoForContent(final XMLBindingComponent component,
final XSType xsType, final boolean useJava50) {
String fieldName = "content";// new xsType()???
if (getConfig().useOldFieldNaming()) {
StringUtils.leftPad(fieldName, 1, '_');
}
if (component.getContentMemberName() != null) {
fieldName = component.getContentMemberName();
}
FieldInfo fInfo = null;
if (xsType.isCollection()) {
fInfo = this.getInfoFactory().createCollection(((XSListType) xsType).getContentType(),
fieldName, null, getJavaNaming(), useJava50);// line 229
} else {
fInfo = this.getInfoFactory().createFieldInfo(xsType, fieldName);
}
fInfo.setComment("internal content storage");
if (xsType instanceof XSString) {
fInfo.setDefaultValue("\"\"");
}
if (fInfo.hasNature(XMLInfoNature.class.getName())) {
XMLInfoNature xmlNature = new XMLInfoNature(fInfo);
xmlNature.setNodeType(NodeType.TEXT);
xmlNature.setRequired(false);
xmlNature.setNodeName("#text");
}
return fInfo;
}
Can you help me find out the reson? Many thanks.
Hi, wguttmn!
I met a NullPointerException, the following is error log
Based on the logs:
the error happend at CollectionInfo.java in line 100
source code of (MemberFactory.java:229), the input elementName is null
Can you help me find out the reson? Many thanks.