users@jaxb.java.net

NPE when using SCD customization on anonymous types [Virus checked]

From: <jan.minaroviech_at_external.t-mobile.at>
Date: Tue, 27 May 2008 20:16:33 +0200

Hello,

usually i have an nullpointer exception with jaxb2.1.6 when xsd has
several anonymous (inner/nested) types and I want to make reference to
them using SCD to "name" them (especially for enumerations, because
otherwise only simple string is generated instead of java5 enum).

Following fix works for me:
com.sun.xml.xsom.impl.scd.Step
line 115-117
        protected boolean match(XSDeclaration d) {
            return d.getName()!=null && d.getName().equals(localName) &&
d.getTargetNamespace()!=null && d.getTargetNamespace().equals(nsUri);
        }
(added checks for nulls)

don't know if it's correct, don't know if it should be fixed here, but it
solved my problems.

example of used customization:
        <bindings
scd="//type::tns:MYTYPE1//element::tns:MYELEMENT1//type::0" xmlns:tns="
http://my.namespace/test/">
                <typesafeEnumClass name="NewNameTest">
                </typesafeEnumClass>
        </bindings>

best regards
jano