it will be string value. we are not facing this in marshalling. it is before
that while populating the JAXB Generated pojo.
.
This is error i am getting when we have some value other than defined in
enum like SA, SO. we are setting in the pojo "other" which is not defined
in enum
p2j1 - Exception while generating WFM information for order C10016B0
java.lang.IllegalArgumentException: No enum const class
com.bellsouth.snt.broadbandos.idm.xml.wfm.schema.SubSystemEnumDef.Other
at java.lang.Enum.valueOf(Enum.java:196)
at
com.bellsouth.snt.broadbandos.idm.xml.wfm.schema.SubSystemEnumDef.valueOf(SubSystemEnumDef.java:30)
at
com.bellsouth.snt.broadbandos.idm.xml.wfm.schema.SubSystemEnumDef.fromValue(SubSystemEnumDef.java:42)
at
com.bellsouth.snt.broadbandos.idm.xml.wfm.WfmHelper.buildCreateSoOperationResult(WfmHelper.java:253)
at
com.bellsouth.snt.broadbandos.idm.xml.wfm.WfmHelper.buildReturnOperationResult(WfmHelper.java:137)
at
com.bellsouth.snt.broadbandos.idm.xml.wfm.WfmHelper.buildPayload(WfmHelper.java:117)
at
com.bellsouth.snt.broadbandos.idm.xml.wfm.WfmHelper.buildJaxbObject(WfmHelper.java:108)
at
com.bellsouth.snt.broadbandos.idm.xml.wfm.WfmHelper.convertToXml(WfmHelper.java:347)
at
com.bellsouth.snt.broadbandos.external.wfm.MitsNotifyQueue.addToPipe(MitsNotifyQueue.java:71)
at
com.bellsouth.snt.persistence.jms.QueueFactory.addToPipeUsingQueueCache(QueueFactory.java:249)
at
com.bellsouth.snt.persistence.jms.QueueFactory.addToPipe(QueueFactory.java:309)
at
com.bellsouth.snt.broadbandos.external.wfm.WfmServiceImpl.deliver(WfmServiceImpl.java:178)
at
com.bellsouth.snt.broadbandos.external.wfm.WfmServiceImpl.deliver(WfmServiceImpl.java:127)
at
com.bellsouth.snt.broadbandos.external.wfm.WfmServiceImpl.sendWfmData(WfmServiceImpl.java:525)
at
com.bellsouth.snt.broadbandos.external.wfm.WfmServiceImpl.sendAndPersistWfmData(WfmServiceImpl.java:580)
at
com.bellsouth.snt.broadbandos.external.wfm.WfmServiceImpl.buildWfmData(WfmServiceImpl.java:437)
at
com.bellsouth.snt.broadbandos.external.wfm.WfmServiceImpl.serviceOrderFailed(WfmServiceImpl.java:251)
at
com.bellsouth.snt.broadbandos.external.SOStateChangeExternalService.sendFailedOrderToWFM(SOStateChangeExternalService.java:317)
at
com.bellsouth.snt.broadbandos.external.SOStateChangeExternalService.serviceOrderFailed(SOStateChangeExternalService.java:195)
at
com.bellsouth.snt.broadbandos.ejb.serviceorder.SOStateChangeMDB.processExternal(SOStateChangeMDB.java:149)
at
com.bellsouth.snt.broadbandos.ejb.serviceorder.SOStateChangeMDB.onMessage(SOStateChangeMDB.java:107)
at sun.reflect.GeneratedMethodAccessor420.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:281)
at
com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:187)
at
com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154)
at
com.bea.core.repackaged.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at
com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
at
com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:126)
at
com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:114)
at
com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
at
com.bea.core.repackaged.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
at $Proxy66.onMessage(Unknown Source)
at
weblogic.ejb.container.internal.MDListener.execute(MDListener.java:466)
at
weblogic.ejb.container.internal.MDListener.transactionalOnMessage(MDListener.java:371)
at
weblogic.ejb.container.internal.MDListener.onMessage(MDListener.java:327)
at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:4547)
at weblogic.jms.client.JMSSession.execute(JMSSession.java:4233)
at
weblogic.jms.client.JMSSession.executeMessage(JMSSession.java:3709)
at weblogic.jms.client.JMSSession.access$000(JMSSession.java:114)
at
weblogic.jms.client.JMSSession$UseForRunnable.run(JMSSession.java:5058)
at
weblogic.work.ExecuteRequestAdapter.execute(ExecuteRequestAdapter.java:21)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:145)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:117)
On Mon, May 3, 2010 at 9:46 PM, Wolfgang Laun <wolfgang.laun_at_gmail.com>wrote:
> As I wrote: It depends on how that enum type for ReturnCode is being used
> in
> other places.
>
> Which values do you need to process in input XML?
>
> I suppose you don't have problems while marshalling?
>
> What kind of "strange error" are you getting?
>
> I can't begin to think about a solution if all I know is "strange error".
>
> -W
>
>
> On Mon, May 3, 2010 at 5:05 PM, Rochak Gupta <rochak005_at_gmail.com> wrote:
> > problem is this is the way it was done in Jaxb1 and my application is
> > running with that. Now i am migrating this to jaxb2.0 and i cannot change
> > the XSD. What can i do now ?
> >
> > Is there any way to define external binding to add values for enum that
> are
> > not in XSD? or any other work around to overcome this ?
> > Thanks and regards,
> > Rochak
> > On Mon, May 3, 2010 at 5:35 PM, Wolfgang Laun <wolfgang.laun_at_gmail.com>
> > wrote:
> >>
> >> How an absent element or attribute is handled is not a question of the
> >> class of that element or attribute (and therefore the code of enum
> >> ReturnCode does not matter).
> >>
> >> If ReturnType is used as an attribute, the attribute definition may
> >> define use="optional" and default="whatever". Then, xjc will generate
> >> code giving you the default in return for an absent attribute.
> >>
> >> If ReturnCode is used as the type of an XML element, then XML Schema
> >> lets you specify minOccurs="0" with that element, indicating it may be
> >> absent, but there is no way to define a default value in XML Schema
> >> for that. (Any application that is not prepared to handle an absent
> >> element that may be omitted has a serious bug.)
> >>
> >> If the XML does contain a value, but not matching one of the
> >> <enumeration> values, then the XML is in error, and if this throws an
> >> exception, it is not a "strange error".
> >>
> >> -W
> >>
> >>
> >> On Mon, May 3, 2010 at 1:16 PM, Rochak Gupta <rochak005_at_gmail.com>
> wrote:
> >> > Hi ,
> >> >
> >> > We are getting strange error while upgrading our code from JAXB1.x to
> >> > JAXB2.x .
> >> >
> >> > Here
> >> >
> >> > <simpleType name="ReturnCode">
> >> >
> >> > <restriction base="string">
> >> >
> >> > <enumeration value="Mal-formed Input"/>
> >> >
> >> > <enumeration value="TN/CLS and SO combination is not
> >> > found"/>
> >> >
> >> > <enumeration value="SO failed provisioning"/>
> >> >
> >> > <enumeration value="SO not found"/>
> >> >
> >> > </restriction>
> >> >
> >> > </simpleType>
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > In JAXB2.X Returncode enum type is created. I have used the decompiler
> >> > and
> >> > pasted here
> >> >
> >> > // Decompiled by DJ v3.7.7.81 Copyright 2004 Atanas Neshkov Date:
> >> > 5/1/2010
> >> > 3:21:30 PM
> >> >
> >> > // Home Page : http://members.fortunecity.com/neshkov/dj.html -
> Check
> >> > often
> >> > for new version!
> >> >
> >> > // Decompiler options: packimports(3)
> >> >
> >> > // Source File Name: ReturnCode.java
> >> >
> >> > package com.bellsouth.snt.broadbandos.idm.xml.techaccess.schema;
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > public final class ReturnCode extends Enum
> >> >
> >> > {
> >> >
> >> >
> >> >
> >> > public static ReturnCode[] values()
> >> >
> >> > {
> >> >
> >> > return (ReturnCode[])$VALUES.clone();
> >> >
> >> > }
> >> >
> >> >
> >> >
> >> > public static ReturnCode valueOf(String name)
> >> >
> >> > {
> >> >
> >> > return
> >> >
> >> >
> (ReturnCode)Enum.valueOf(com/bellsouth/snt/broadbandos/idm/xml/techaccess/schema/ReturnCode,
> >> > name);
> >> >
> >> > }
> >> >
> >> >
> >> >
> >> > private ReturnCode(String s, int i, String v)
> >> >
> >> > {
> >> >
> >> > super(s, i);
> >> >
> >> > value = v;
> >> >
> >> > }
> >> >
> >> >
> >> >
> >> > public String value()
> >> >
> >> > {
> >> >
> >> > return value;
> >> >
> >> > }
> >> >
> >> >
> >> >
> >> > public static ReturnCode fromValue(String v)
> >> >
> >> > {
> >> >
> >> > ReturnCode arr$[] = values();
> >> >
> >> > int len$ = arr$.length;
> >> >
> >> > for(int i$ = 0; i$ < len$; i$++)
> >> >
> >> > {
> >> >
> >> > ReturnCode c = arr$[i$];
> >> >
> >> > if(c.value.equals(v))
> >> >
> >> > return c;
> >> >
> >> > }
> >> >
> >> >
> >> >
> >> > throw new IllegalArgumentException(v);
> >> >
> >> > }
> >> >
> >> >
> >> >
> >> > public static final ReturnCode MAL_FORMED_INPUT;
> >> >
> >> > public static final ReturnCode
> >> > TN_CLS_AND_SO_COMBINATION_IS_NOT_FOUND;
> >> >
> >> > public static final ReturnCode SO_FAILED_PROVISIONING;
> >> >
> >> > public static final ReturnCode SO_NOT_FOUND;
> >> >
> >> > private final String value;
> >> >
> >> > private static final ReturnCode $VALUES[];
> >> >
> >> >
> >> >
> >> > static
> >> >
> >> > {
> >> >
> >> > MAL_FORMED_INPUT = new ReturnCode("MAL_FORMED_INPUT", 0,
> >> > "Mal-formed
> >> > Input");
> >> >
> >> > TN_CLS_AND_SO_COMBINATION_IS_NOT_FOUND = new
> >> > ReturnCode("TN_CLS_AND_SO_COMBINATION_IS_NOT_FOUND", 1, "TN/CLS and SO
> >> > combination is not found");
> >> >
> >> > SO_FAILED_PROVISIONING = new
> >> > ReturnCode("SO_FAILED_PROVISIONING", 2,
> >> > "SO failed provisioning");
> >> >
> >> > SO_NOT_FOUND = new ReturnCode("SO_NOT_FOUND", 3, "SO not
> >> > found");
> >> >
> >> > $VALUES = (new ReturnCode[] {
> >> >
> >> > MAL_FORMED_INPUT, TN_CLS_AND_SO_COMBINATION_IS_NOT_FOUND,
> >> > SO_FAILED_PROVISIONING, SO_NOT_FOUND
> >> >
> >> > });
> >> >
> >> > }
> >> >
> >> > }
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > Now if there is any other value it throws exception . Our concern is
> can
> >> > we
> >> > some way or through some external binding some default value to the
> enum
> >> > so
> >> > that if its null it takes default value .
> >> >
> >> > Thanks and regards,
> >> >
> >> > Rochak
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> >> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
> >>
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>