users@jaxb.java.net

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

From: <jan.minaroviech_at_external.t-mobile.at>
Date: Wed, 28 May 2008 15:32:18 +0200

Hello,

the same issue is valid also for 2.1.7.

best regards
jano

----- Weitergeleitet von Jan Minaroviech/IT/Extern/T-Mobile/AT am
05/28/2008 15:31 -----

Jan Minaroviech/IT/Extern/T-Mobile/AT
05/27/2008 20:16

An
users_at_jaxb.dev.java.net
Kopie

Thema
NPE when using SCD customization on anonymous types





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