|
View:
New views
6 Messages
—
Rating Filter:
Alert me
|
|
|
ArrayIndexOutOfBoundsException was thrown from the sourceHi Niall,
I am using the SimpleXML to serialize / de-serialize the objects in my project. When I tried to serialize an object with a Map variable, I got the ArrayIndexOutOfBoundsException. I did some debugging in SimpleXML source codes and found the reason which may be a bug: In ElementMapLabel.java, the method getDependent() returns the items[0] without checking if the array "items" has element in advance. The "items" is grabbed from the method getDependents() of the Contact, where a new empty array may be returned. Please feel free to let me know if my debugging has problem or it can be avoided by other approaches. Best regards, ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Simple-support mailing list Simple-support@... https://lists.sourceforge.net/lists/listinfo/simple-support |
|
|
Re: ArrayIndexOutOfBoundsException was thrown from the sourceHi,
Can I see how you annotated your Map? Ill bet you did the following? @ElementMap Map map Here there is no information about the objects in the map, although I think ArrayIndexOutOfBounds is not good. Can you also provide the stack trace so I can investigate. Thanks Niall Niall Gallagher RBS Global Banking & Markets Office: +44 7879498724 -----Original Message----- From: Lin Han [mailto:lhan@...] Sent: 09 September 2009 19:04 To: simple-support@... Subject: [Simple-support] ArrayIndexOutOfBoundsException was thrown from the source Hi Niall, I am using the SimpleXML to serialize / de-serialize the objects in my project. When I tried to serialize an object with a Map variable, I got the ArrayIndexOutOfBoundsException. I did some debugging in SimpleXML source codes and found the reason which may be a bug: In ElementMapLabel.java, the method getDependent() returns the items[0] without checking if the array "items" has element in advance. The "items" is grabbed from the method getDependents() of the Contact, where a new empty array may be returned. Please feel free to let me know if my debugging has problem or it can be avoided by other approaches. Best regards, ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Simple-support mailing list Simple-support@... https://lists.sourceforge.net/lists/listinfo/simple-support *********************************************************************************** The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. Authorised and regulated by the Financial Services Authority. This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the recipient should carry out such virus and other checks as it considers appropriate. Visit our website at www.rbs.com *********************************************************************************** ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Simple-support mailing list Simple-support@... https://lists.sourceforge.net/lists/listinfo/simple-support |
|
|
Re: ArrayIndexOutOfBoundsException was thrown from the sourceThanks for your reply.
Here are the two annotations I had ever tried. @ElementMap(name="nic-types", entry="nic-type", key="key", keyType=String.class, valueType=NicType.class, attribute=false, inline=true) protected Map nicTypes = new HashMap(); AND @ElementMap protected Map nicTypes = new HashMap(); Both of them had the ArrayIndexOutOfBoundsException, the printed stack are same: java.lang.ArrayIndexOutOfBoundsException: 0 at org.simpleframework.xml.core.ElementMapLabel.getDependent(ElementMapLabel.java:183) at org.simpleframework.xml.core.CacheLabel.<init>(CacheLabel.java:114) at org.simpleframework.xml.core.LabelFactory.getInstance(LabelFactory.java:67) at org.simpleframework.xml.core.Scanner.process(Scanner.java:668) at org.simpleframework.xml.core.Scanner.scan(Scanner.java:601) at org.simpleframework.xml.core.Scanner.field(Scanner.java:560) at org.simpleframework.xml.core.Scanner.scan(Scanner.java:368) at org.simpleframework.xml.core.Scanner.<init>(Scanner.java:105) at org.simpleframework.xml.core.ScannerFactory.getInstance(ScannerFactory.java:67) at org.simpleframework.xml.core.Support.getScanner(Support.java:174) at org.simpleframework.xml.core.Source.getScanner(Source.java:241) at org.simpleframework.xml.core.Source.getCaller(Source.java:270) at org.simpleframework.xml.core.Composite.writeReplace(Composite.java:1050) at org.simpleframework.xml.core.Composite.writeElements(Composite.java:1025) at org.simpleframework.xml.core.Composite.write(Composite.java:934) at org.simpleframework.xml.core.Composite.write(Composite.java:910) at org.simpleframework.xml.core.Traverser.write(Traverser.java:221) at org.simpleframework.xml.core.CompositeArray.write(CompositeArray.java:225) at org.simpleframework.xml.core.Composite.writeElement(Composite.java:1158) at org.simpleframework.xml.core.Composite.writeElement(Composite.java:1139) at org.simpleframework.xml.core.Composite.writeElements(Composite.java:1028) at org.simpleframework.xml.core.Composite.write(Composite.java:934) at org.simpleframework.xml.core.Composite.write(Composite.java:910) at org.simpleframework.xml.core.Traverser.write(Traverser.java:221) at org.simpleframework.xml.core.Traverser.write(Traverser.java:194) at org.simpleframework.xml.core.Traverser.write(Traverser.java:172) at org.simpleframework.xml.core.Persister.write(Persister.java:923) at org.simpleframework.xml.core.Persister.write(Persister.java:905) at org.simpleframework.xml.core.Persister.write(Persister.java:886) at org.simpleframework.xml.core.Persister.write(Persister.java:1002) at org.simpleframework.xml.core.Persister.write(Persister.java:984) at org.simpleframework.xml.core.Persister.write(Persister.java:965) at org.simpleframework.xml.core.Persister.write(Persister.java:944) at OlmsExporter.exportPlatformType(OlmsExporter.java:177) at OlmsExporter.main(OlmsExporter.java:216) If you need any more info, please feel free to ask. Thanks again for your time and consideration. Best, niall.gallagher@... wrote: > Hi, > > Can I see how you annotated your Map? Ill bet you did the following? > > @ElementMap > Map map > > Here there is no information about the objects in the map, although I think ArrayIndexOutOfBounds is not good. Can you also provide the stack trace so I can investigate. > > Thanks > Niall > > > Niall Gallagher > RBS Global Banking & Markets > Office: +44 7879498724 > > -----Original Message----- > From: Lin Han [mailto:lhan@...] > Sent: 09 September 2009 19:04 > To: simple-support@... > Subject: [Simple-support] ArrayIndexOutOfBoundsException was thrown from the source > > Hi Niall, > > I am using the SimpleXML to serialize / de-serialize the objects in my project. > When I tried to serialize an object with a Map variable, I got the ArrayIndexOutOfBoundsException. > > I did some debugging in SimpleXML source codes and found the reason which may be a bug: > > In ElementMapLabel.java, the method getDependent() returns the items[0] without checking if the array "items" has element in advance. The "items" is grabbed from the method getDependents() of the Contact, where a new empty array may be returned. > > Please feel free to let me know if my debugging has problem or it can be avoided by other approaches. > > Best regards, > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ > Simple-support mailing list > Simple-support@... > https://lists.sourceforge.net/lists/listinfo/simple-support > > *********************************************************************************** > The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. > Authorised and regulated by the Financial Services Authority. > > This e-mail message is confidential and for use by the > addressee only. If the message is received by anyone other > than the addressee, please return the message to the sender > by replying to it and then delete the message from your > computer. Internet e-mails are not necessarily secure. The > Royal Bank of Scotland plc does not accept responsibility for > changes made to this message after it was sent. > > Whilst all reasonable care has been taken to avoid the > transmission of viruses, it is the responsibility of the recipient to > ensure that the onward transmission, opening or use of this > message and any attachments will not adversely affect its > systems or data. No responsibility is accepted by The > Royal Bank of Scotland plc in this regard and the recipient should carry > out such virus and other checks as it considers appropriate. > > Visit our website at www.rbs.com > > *********************************************************************************** > > ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Simple-support mailing list Simple-support@... https://lists.sourceforge.net/lists/listinfo/simple-support |
|
|
Re: ArrayIndexOutOfBoundsException was thrown from the sourceHi,
Ill look in to it, looks like a bug perhaps. You can avoid the but by using generics on the map. Niall Niall Gallagher RBS Global Banking & Markets Office: +44 7879498724 -----Original Message----- From: Lin Han [mailto:lhan@...] Sent: 10 September 2009 16:16 To: GALLAGHER, Niall, GBM Cc: simple-support@... Subject: Re: [Simple-support] ArrayIndexOutOfBoundsException was thrown from the source Thanks for your reply. Here are the two annotations I had ever tried. @ElementMap(name="nic-types", entry="nic-type", key="key", keyType=String.class, valueType=NicType.class, attribute=false, inline=true) protected Map nicTypes = new HashMap(); AND @ElementMap protected Map nicTypes = new HashMap(); Both of them had the ArrayIndexOutOfBoundsException, the printed stack are same: java.lang.ArrayIndexOutOfBoundsException: 0 at org.simpleframework.xml.core.ElementMapLabel.getDependent(ElementMapLabel.java:183) at org.simpleframework.xml.core.CacheLabel.<init>(CacheLabel.java:114) at org.simpleframework.xml.core.LabelFactory.getInstance(LabelFactory.java:67) at org.simpleframework.xml.core.Scanner.process(Scanner.java:668) at org.simpleframework.xml.core.Scanner.scan(Scanner.java:601) at org.simpleframework.xml.core.Scanner.field(Scanner.java:560) at org.simpleframework.xml.core.Scanner.scan(Scanner.java:368) at org.simpleframework.xml.core.Scanner.<init>(Scanner.java:105) at org.simpleframework.xml.core.ScannerFactory.getInstance(ScannerFactory.java:67) at org.simpleframework.xml.core.Support.getScanner(Support.java:174) at org.simpleframework.xml.core.Source.getScanner(Source.java:241) at org.simpleframework.xml.core.Source.getCaller(Source.java:270) at org.simpleframework.xml.core.Composite.writeReplace(Composite.java:1050) at org.simpleframework.xml.core.Composite.writeElements(Composite.java:1025) at org.simpleframework.xml.core.Composite.write(Composite.java:934) at org.simpleframework.xml.core.Composite.write(Composite.java:910) at org.simpleframework.xml.core.Traverser.write(Traverser.java:221) at org.simpleframework.xml.core.CompositeArray.write(CompositeArray.java:225) at org.simpleframework.xml.core.Composite.writeElement(Composite.java:1158) at org.simpleframework.xml.core.Composite.writeElement(Composite.java:1139) at org.simpleframework.xml.core.Composite.writeElements(Composite.java:1028) at org.simpleframework.xml.core.Composite.write(Composite.java:934) at org.simpleframework.xml.core.Composite.write(Composite.java:910) at org.simpleframework.xml.core.Traverser.write(Traverser.java:221) at org.simpleframework.xml.core.Traverser.write(Traverser.java:194) at org.simpleframework.xml.core.Traverser.write(Traverser.java:172) at org.simpleframework.xml.core.Persister.write(Persister.java:923) at org.simpleframework.xml.core.Persister.write(Persister.java:905) at org.simpleframework.xml.core.Persister.write(Persister.java:886) at org.simpleframework.xml.core.Persister.write(Persister.java:1002) at org.simpleframework.xml.core.Persister.write(Persister.java:984) at org.simpleframework.xml.core.Persister.write(Persister.java:965) at org.simpleframework.xml.core.Persister.write(Persister.java:944) at OlmsExporter.exportPlatformType(OlmsExporter.java:177) at OlmsExporter.main(OlmsExporter.java:216) If you need any more info, please feel free to ask. Thanks again for your time and consideration. Best, niall.gallagher@... wrote: > Hi, > > Can I see how you annotated your Map? Ill bet you did the following? > > @ElementMap > Map map > > Here there is no information about the objects in the map, although I think ArrayIndexOutOfBounds is not good. Can you also provide the stack trace so I can investigate. > > Thanks > Niall > > > Niall Gallagher > RBS Global Banking & Markets > Office: +44 7879498724 > > -----Original Message----- > From: Lin Han [mailto:lhan@...] > Sent: 09 September 2009 19:04 > To: simple-support@... > Subject: [Simple-support] ArrayIndexOutOfBoundsException was thrown > from the source > > Hi Niall, > > I am using the SimpleXML to serialize / de-serialize the objects in my project. > When I tried to serialize an object with a Map variable, I got the ArrayIndexOutOfBoundsException. > > I did some debugging in SimpleXML source codes and found the reason which may be a bug: > > In ElementMapLabel.java, the method getDependent() returns the items[0] without checking if the array "items" has element in advance. The "items" is grabbed from the method getDependents() of the Contact, where a new empty array may be returned. > > Please feel free to let me know if my debugging has problem or it can be avoided by other approaches. > > Best regards, > > ---------------------------------------------------------------------- > -------- Let Crystal Reports handle the reporting - Free Crystal > Reports 2008 30-Day trial. Simplify your report design, integration > and deployment - and focus on what you do best, core application > coding. Discover what's new with Crystal Reports now. > http://p.sf.net/sfu/bobj-july > _______________________________________________ > Simple-support mailing list > Simple-support@... > https://lists.sourceforge.net/lists/listinfo/simple-support > > ********************************************************************** > ************* The Royal Bank of Scotland plc. Registered in Scotland > No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. > Authorised and regulated by the Financial Services Authority. > > This e-mail message is confidential and for use by the addressee only. > If the message is received by anyone other than the addressee, please > return the message to the sender by replying to it and then delete the > message from your computer. Internet e-mails are not necessarily > secure. The Royal Bank of Scotland plc does not accept responsibility > for changes made to this message after it was sent. > > Whilst all reasonable care has been taken to avoid the transmission of > viruses, it is the responsibility of the recipient to ensure that the > onward transmission, opening or use of this message and any > attachments will not adversely affect its systems or data. No > responsibility is accepted by The Royal Bank of Scotland plc in this > regard and the recipient should carry out such virus and other checks > as it considers appropriate. > > Visit our website at www.rbs.com > > ********************************************************************** > ************* > > ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Simple-support mailing list Simple-support@... https://lists.sourceforge.net/lists/listinfo/simple-support |
|
|
Re: ArrayIndexOutOfBoundsException was thrown from the sourceAfter changing to use the generics on the map,
it works fine. Thanks a lot for your help. niall.gallagher@... wrote: > Hi, > > Ill look in to it, looks like a bug perhaps. You can avoid the but by using generics on the map. > > Niall > > > Niall Gallagher > RBS Global Banking & Markets > Office: +44 7879498724 > > -----Original Message----- > From: Lin Han [mailto:lhan@...] > Sent: 10 September 2009 16:16 > To: GALLAGHER, Niall, GBM > Cc: simple-support@... > Subject: Re: [Simple-support] ArrayIndexOutOfBoundsException was thrown from the source > > Thanks for your reply. > Here are the two annotations I had ever tried. > > @ElementMap(name="nic-types", entry="nic-type", key="key", keyType=String.class, valueType=NicType.class, attribute=false, inline=true) protected Map nicTypes = new HashMap(); > > AND > > @ElementMap > protected Map nicTypes = new HashMap(); > > Both of them had the ArrayIndexOutOfBoundsException, the printed stack are same: > > java.lang.ArrayIndexOutOfBoundsException: 0 > at > org.simpleframework.xml.core.ElementMapLabel.getDependent(ElementMapLabel.java:183) > at org.simpleframework.xml.core.CacheLabel.<init>(CacheLabel.java:114) > at > org.simpleframework.xml.core.LabelFactory.getInstance(LabelFactory.java:67) > at org.simpleframework.xml.core.Scanner.process(Scanner.java:668) > at org.simpleframework.xml.core.Scanner.scan(Scanner.java:601) > at org.simpleframework.xml.core.Scanner.field(Scanner.java:560) > at org.simpleframework.xml.core.Scanner.scan(Scanner.java:368) > at org.simpleframework.xml.core.Scanner.<init>(Scanner.java:105) > at > org.simpleframework.xml.core.ScannerFactory.getInstance(ScannerFactory.java:67) > at org.simpleframework.xml.core.Support.getScanner(Support.java:174) > at org.simpleframework.xml.core.Source.getScanner(Source.java:241) > at org.simpleframework.xml.core.Source.getCaller(Source.java:270) > at > org.simpleframework.xml.core.Composite.writeReplace(Composite.java:1050) > at > org.simpleframework.xml.core.Composite.writeElements(Composite.java:1025) > at org.simpleframework.xml.core.Composite.write(Composite.java:934) > at org.simpleframework.xml.core.Composite.write(Composite.java:910) > at org.simpleframework.xml.core.Traverser.write(Traverser.java:221) > at > org.simpleframework.xml.core.CompositeArray.write(CompositeArray.java:225) > at > org.simpleframework.xml.core.Composite.writeElement(Composite.java:1158) > at > org.simpleframework.xml.core.Composite.writeElement(Composite.java:1139) > at > org.simpleframework.xml.core.Composite.writeElements(Composite.java:1028) > at org.simpleframework.xml.core.Composite.write(Composite.java:934) > at org.simpleframework.xml.core.Composite.write(Composite.java:910) > at org.simpleframework.xml.core.Traverser.write(Traverser.java:221) > at org.simpleframework.xml.core.Traverser.write(Traverser.java:194) > at org.simpleframework.xml.core.Traverser.write(Traverser.java:172) > at org.simpleframework.xml.core.Persister.write(Persister.java:923) > at org.simpleframework.xml.core.Persister.write(Persister.java:905) > at org.simpleframework.xml.core.Persister.write(Persister.java:886) > at org.simpleframework.xml.core.Persister.write(Persister.java:1002) > at org.simpleframework.xml.core.Persister.write(Persister.java:984) > at org.simpleframework.xml.core.Persister.write(Persister.java:965) > at org.simpleframework.xml.core.Persister.write(Persister.java:944) > at OlmsExporter.exportPlatformType(OlmsExporter.java:177) > at OlmsExporter.main(OlmsExporter.java:216) > > If you need any more info, please feel free to ask. > > Thanks again for your time and consideration. > > Best, > > niall.gallagher@... wrote: > >> Hi, >> >> Can I see how you annotated your Map? Ill bet you did the following? >> >> @ElementMap >> Map map >> >> Here there is no information about the objects in the map, although I think ArrayIndexOutOfBounds is not good. Can you also provide the stack trace so I can investigate. >> >> Thanks >> Niall >> >> >> Niall Gallagher >> RBS Global Banking & Markets >> Office: +44 7879498724 >> >> -----Original Message----- >> From: Lin Han [mailto:lhan@...] >> Sent: 09 September 2009 19:04 >> To: simple-support@... >> Subject: [Simple-support] ArrayIndexOutOfBoundsException was thrown >> from the source >> >> Hi Niall, >> >> I am using the SimpleXML to serialize / de-serialize the objects in my project. >> When I tried to serialize an object with a Map variable, I got the ArrayIndexOutOfBoundsException. >> >> I did some debugging in SimpleXML source codes and found the reason which may be a bug: >> >> In ElementMapLabel.java, the method getDependent() returns the items[0] without checking if the array "items" has element in advance. The "items" is grabbed from the method getDependents() of the Contact, where a new empty array may be returned. >> >> Please feel free to let me know if my debugging has problem or it can be avoided by other approaches. >> >> Best regards, >> >> ---------------------------------------------------------------------- >> -------- Let Crystal Reports handle the reporting - Free Crystal >> Reports 2008 30-Day trial. Simplify your report design, integration >> and deployment - and focus on what you do best, core application >> coding. Discover what's new with Crystal Reports now. >> http://p.sf.net/sfu/bobj-july >> _______________________________________________ >> Simple-support mailing list >> Simple-support@... >> https://lists.sourceforge.net/lists/listinfo/simple-support >> >> ********************************************************************** >> ************* The Royal Bank of Scotland plc. Registered in Scotland >> No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. >> Authorised and regulated by the Financial Services Authority. >> >> This e-mail message is confidential and for use by the addressee only. >> If the message is received by anyone other than the addressee, please >> return the message to the sender by replying to it and then delete the >> message from your computer. Internet e-mails are not necessarily >> secure. The Royal Bank of Scotland plc does not accept responsibility >> for changes made to this message after it was sent. >> >> Whilst all reasonable care has been taken to avoid the transmission of >> viruses, it is the responsibility of the recipient to ensure that the >> onward transmission, opening or use of this message and any >> attachments will not adversely affect its systems or data. No >> responsibility is accepted by The Royal Bank of Scotland plc in this >> regard and the recipient should carry out such virus and other checks >> as it considers appropriate. >> >> Visit our website at www.rbs.com >> >> ********************************************************************** >> ************* >> >> >> > > ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Simple-support mailing list Simple-support@... https://lists.sourceforge.net/lists/listinfo/simple-support |
|
|
Re: ArrayIndexOutOfBoundsException was thrown from the sourceHi,
The real fix here is in ElementMapLabel.java. Set the method getDependent to the following. public Class getDependent() throws Exception { Contact contact = getContact(); if(items == null) { items = contact.getDependents(); } if(items == null) { throw new ElementException("Unable to determine type for %s", label); } if(items.length == 0) { return Object.class; } return items[0]; } Then you will no longer get an array index out of bounds whether there are generics or not. Niall Niall Gallagher RBS Global Banking & Markets Office: +44 7879498724 -----Original Message----- From: Lin Han [mailto:lhan@...] Sent: 10 September 2009 16:49 To: simple-support@... Cc: GALLAGHER, Niall, GBM Subject: Re: [Simple-support] ArrayIndexOutOfBoundsException was thrown from the source After changing to use the generics on the map, it works fine. Thanks a lot for your help. niall.gallagher@... wrote: > Hi, > > Ill look in to it, looks like a bug perhaps. You can avoid the but by using generics on the map. > > Niall > > > Niall Gallagher > RBS Global Banking & Markets > Office: +44 7879498724 > > -----Original Message----- > From: Lin Han [mailto:lhan@...] > Sent: 10 September 2009 16:16 > To: GALLAGHER, Niall, GBM > Cc: simple-support@... > Subject: Re: [Simple-support] ArrayIndexOutOfBoundsException was > thrown from the source > > Thanks for your reply. > Here are the two annotations I had ever tried. > > @ElementMap(name="nic-types", entry="nic-type", key="key", > keyType=String.class, valueType=NicType.class, attribute=false, > inline=true) protected Map nicTypes = new HashMap(); > > AND > > @ElementMap > protected Map nicTypes = new HashMap(); > > Both of them had the ArrayIndexOutOfBoundsException, the printed stack are same: > > java.lang.ArrayIndexOutOfBoundsException: 0 > at > org.simpleframework.xml.core.ElementMapLabel.getDependent(ElementMapLabel.java:183) > at org.simpleframework.xml.core.CacheLabel.<init>(CacheLabel.java:114) > at > org.simpleframework.xml.core.LabelFactory.getInstance(LabelFactory.java:67) > at org.simpleframework.xml.core.Scanner.process(Scanner.java:668) > at org.simpleframework.xml.core.Scanner.scan(Scanner.java:601) > at org.simpleframework.xml.core.Scanner.field(Scanner.java:560) > at org.simpleframework.xml.core.Scanner.scan(Scanner.java:368) > at org.simpleframework.xml.core.Scanner.<init>(Scanner.java:105) > at > org.simpleframework.xml.core.ScannerFactory.getInstance(ScannerFactory.java:67) > at org.simpleframework.xml.core.Support.getScanner(Support.java:174) > at org.simpleframework.xml.core.Source.getScanner(Source.java:241) > at org.simpleframework.xml.core.Source.getCaller(Source.java:270) > at > org.simpleframework.xml.core.Composite.writeReplace(Composite.java:1050) > at > org.simpleframework.xml.core.Composite.writeElements(Composite.java:1025) > at org.simpleframework.xml.core.Composite.write(Composite.java:934) > at org.simpleframework.xml.core.Composite.write(Composite.java:910) > at org.simpleframework.xml.core.Traverser.write(Traverser.java:221) > at > org.simpleframework.xml.core.CompositeArray.write(CompositeArray.java:225) > at > org.simpleframework.xml.core.Composite.writeElement(Composite.java:1158) > at > org.simpleframework.xml.core.Composite.writeElement(Composite.java:1139) > at > org.simpleframework.xml.core.Composite.writeElements(Composite.java:1028) > at org.simpleframework.xml.core.Composite.write(Composite.java:934) > at org.simpleframework.xml.core.Composite.write(Composite.java:910) > at org.simpleframework.xml.core.Traverser.write(Traverser.java:221) > at org.simpleframework.xml.core.Traverser.write(Traverser.java:194) > at org.simpleframework.xml.core.Traverser.write(Traverser.java:172) > at org.simpleframework.xml.core.Persister.write(Persister.java:923) > at org.simpleframework.xml.core.Persister.write(Persister.java:905) > at org.simpleframework.xml.core.Persister.write(Persister.java:886) > at org.simpleframework.xml.core.Persister.write(Persister.java:1002) > at org.simpleframework.xml.core.Persister.write(Persister.java:984) > at org.simpleframework.xml.core.Persister.write(Persister.java:965) > at org.simpleframework.xml.core.Persister.write(Persister.java:944) > at OlmsExporter.exportPlatformType(OlmsExporter.java:177) > at OlmsExporter.main(OlmsExporter.java:216) > > If you need any more info, please feel free to ask. > > Thanks again for your time and consideration. > > Best, > > niall.gallagher@... wrote: > >> Hi, >> >> Can I see how you annotated your Map? Ill bet you did the following? >> >> @ElementMap >> Map map >> >> Here there is no information about the objects in the map, although I think ArrayIndexOutOfBounds is not good. Can you also provide the stack trace so I can investigate. >> >> Thanks >> Niall >> >> >> Niall Gallagher >> RBS Global Banking & Markets >> Office: +44 7879498724 >> >> -----Original Message----- >> From: Lin Han [mailto:lhan@...] >> Sent: 09 September 2009 19:04 >> To: simple-support@... >> Subject: [Simple-support] ArrayIndexOutOfBoundsException was thrown >> from the source >> >> Hi Niall, >> >> I am using the SimpleXML to serialize / de-serialize the objects in my project. >> When I tried to serialize an object with a Map variable, I got the ArrayIndexOutOfBoundsException. >> >> I did some debugging in SimpleXML source codes and found the reason which may be a bug: >> >> In ElementMapLabel.java, the method getDependent() returns the items[0] without checking if the array "items" has element in advance. The "items" is grabbed from the method getDependents() of the Contact, where a new empty array may be returned. >> >> Please feel free to let me know if my debugging has problem or it can be avoided by other approaches. >> >> Best regards, >> >> --------------------------------------------------------------------- >> - >> -------- Let Crystal Reports handle the reporting - Free Crystal >> Reports 2008 30-Day trial. Simplify your report design, integration >> and deployment - and focus on what you do best, core application >> coding. Discover what's new with Crystal Reports now. >> http://p.sf.net/sfu/bobj-july >> _______________________________________________ >> Simple-support mailing list >> Simple-support@... >> https://lists.sourceforge.net/lists/listinfo/simple-support >> >> ********************************************************************* >> * >> ************* The Royal Bank of Scotland plc. Registered in Scotland >> No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. >> Authorised and regulated by the Financial Services Authority. >> >> This e-mail message is confidential and for use by the addressee only. >> If the message is received by anyone other than the addressee, please >> return the message to the sender by replying to it and then delete >> the message from your computer. Internet e-mails are not necessarily >> secure. The Royal Bank of Scotland plc does not accept responsibility >> for changes made to this message after it was sent. >> >> Whilst all reasonable care has been taken to avoid the transmission >> of viruses, it is the responsibility of the recipient to ensure that >> the onward transmission, opening or use of this message and any >> attachments will not adversely affect its systems or data. No >> responsibility is accepted by The Royal Bank of Scotland plc in this >> regard and the recipient should carry out such virus and other checks >> as it considers appropriate. >> >> Visit our website at www.rbs.com >> >> ********************************************************************* >> * >> ************* >> >> >> > > ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Simple-support mailing list Simple-support@... https://lists.sourceforge.net/lists/listinfo/simple-support |
| Free embeddable forum powered by Nabble | Forum Help |