Я обнаружил исключение ArrayStoreException при синтаксическом анализе XML для классов Java в следующем сегменте кода:
757 StringReader in = new StringReader( xmlString );
758 XMLStreamReader reader = StAXUtils.createXMLStreamReader( in );
759
760 try
761 {
762 ManageContentRequest.Factory.parse( reader );
763 }
764 catch ( Exception e )
765 {
766 this.log.error( xmlString );
767 this.log.info( e.getLocalizedMessage(), e );
768 e.printStackTrace();
769 }
Отслеживание стека: (строка с префиксом ** соответствует указанному сегменту кода выше):
2011-11-21 15:37:05 INFO com.geometryit.blis.production.Publish - - java.lang.ArrayStoreException
org.apache.axis2.databinding.utils.ConverterUtil$ObjectConversionException: java.lang.ArrayStoreException
at org.apache.axis2.databinding.utils.ConverterUtil.ConvertToArbitraryObjectArray(ConverterUtil.java:1211)
at org.apache.axis2.databinding.utils.ConverterUtil.convertToArray(ConverterUtil.java:1172)
at au.gov.business.ablis._2011_09.data.ServiceType$Factory.parse(ServiceType.java:3864)
at au.gov.business.ablis._2011_09.messages.contentmanagement.RequestItemChoice_type0$Factory.parse(RequestItemChoice_type0.java:1202)
at au.gov.business.ablis._2011_09.messages.contentmanagement.RequestItem_type0$Factory.parse(RequestItem_type0.java:463)
at au.gov.business.ablis._2011_09.messages.contentmanagement.ManageContentRequest$Factory.parse(ManageContentRequest.java:544)
**at com.geometryit.blis.production.Publish.publishLicenceUsingWebService(Publish.java:762)
at com.geometryit.blis.production.Publish.publishCommonwealthLicence(Publish.java:616)
at com.geometryit.blis.production.Publish.publishLicence(Publish.java:489)
at com.geometryit.blis.production.Publish.processRequest(Publish.java:246)
at com.geometryit.blis.AppServlet.doPost(AppServlet.java:235)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:306)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:541)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:383)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:284)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:322)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1684)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.ArrayStoreException
at java.lang.System.arraycopy(Native Method)
at java.util.ArrayList.toArray(ArrayList.java:306)
at org.apache.axis2.databinding.utils.ConverterUtil.ConvertToArbitraryObjectArray(ConverterUtil.java:1207)
... 27 more
Из файлов wsdl и xsd я сгенерировал классы Java, используя Axis2 v1.6.1 на Java 1.6.0_24, Windows 7, 64bit.Соответствующий раздел xsd выделен префиксом **.
<xs:complexType name="ServiceType">
<xs:sequence>
<xs:element name="Id" type="tns:AblisId" />
<xs:element name="TierOfGovernment" type="tns:TierOfGovernmentType" minOccurs="0"/>
<xs:element name="Jurisdiction" type="tns:JurisdictionType" minOccurs="1" />
<xs:element name="Status" type="tns:ServiceStatusType" minOccurs="1" maxOccurs="unbounded" />
<xs:element name="Type" type="tns:ServiceTypeType" />
<xs:element name="Name" type="tns:String256" minOccurs="0"/>
<xs:element name="DescriptiveName" type="tns:String256" minOccurs="0" />
<xs:element name="AlternativeName" type="tns:String256" minOccurs="0" maxOccurs="1" />
<xs:element name="Description" type="xs:string" minOccurs="0"/>
<xs:element name="ShortDescription" type="tns:String250" minOccurs="0"/>
<xs:element name="EligibilityRequirements" type="xs:string" minOccurs="0"/>
<xs:element name="Coverage" type="xs:string" minOccurs="0"/>
<xs:element name="DisqualifiedPersonsOrEntities" type="xs:string" minOccurs="0" />
<xs:element name="Duration" type="tns:String255" minOccurs="0" />
<xs:element name="Exemptions" type="xs:string" minOccurs="0"/>
<xs:element name="MutualRecognition" type="xs:boolean" minOccurs="0" />
<xs:element name="OngoingEligibilityRequirements" type="xs:string" minOccurs="0" />
<xs:element name="StartDate" type="xs:dateTime" minOccurs="0" />
<xs:element name="EndDate" type="xs:dateTime" minOccurs="0" />
<xs:element name="Priority" type="xs:boolean" minOccurs="0" />
<xs:element name="ApprovedTime" type="tns:String255" minOccurs="0"/>
<xs:element name="WhenRequired" type="xs:string" minOccurs="0" />
<xs:element name="AdditionalInformation" type="xs:string" minOccurs="0" />
<xs:element name="Transfer" type="xs:string" minOccurs="0" />
**<xs:element name="URL" type="xs:anyURI" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="VersionNumber" type="xs:int" minOccurs="0" />
<xs:element name="AttributeOverride" type="tns:String100" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="BusinessStructure" type="tns:BusinessStructureType" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="TopicName" type="tns:String100" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="Term" type="tns:TermDefinitionType" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="AssociatedService" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:choice>
<xs:element name="ServiceId" type="tns:AblisId" />
<xs:element name="Service" type="tns:ServiceType" />
</xs:choice>
<xs:element name="Type" type="tns:ServiceAssociationTypeType" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="AssociatedBusinessActivity" minOccurs="0" maxOccurs="unbounded" >
<xs:complexType>
<xs:sequence>
<xs:element name="BusinessActivityCode" type="tns:BusinessActivityCodeType" />
<xs:element name="Principal" type="xs:boolean" minOccurs="0"/>
<xs:element name="AskYesNoAnswer" type="xs:boolean" minOccurs="0"/>
<xs:element name="AskMultiAnswer" type="xs:boolean" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="AssociatedKeyword" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:choice>
<xs:element name="KeywordId" type="tns:AblisId" />
<xs:element name="Keyword" type="tns:KeywordAliasType" />
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="AssociatedLegislation" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:choice>
<xs:element name="LegislationId" type="tns:AblisId" />
<xs:element name="Legislation" type="tns:LegislationType" />
</xs:choice>
<xs:element name="Reference" type="tns:String1024" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="AssociatedPrerequisite" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:choice>
<xs:element name="PrerequisiteId" type="tns:AblisId" />
<xs:element name="Prerequisite" type="tns:PrerequisiteType" />
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="AssociatedOrganisation" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:choice>
<xs:element name="OrganisationId" type="tns:AblisId" />
<xs:element name="Organisation" type="tns:OrganisationType" />
</xs:choice>
<xs:element name="Role" type="tns:OrganisationRoleType" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="AssociatedAnswer" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:choice>
<xs:element name="AnswerId" type="tns:AblisId" />
<xs:element name="Answer" type="tns:AnswerType" />
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
Я посмотрел исходный код org.apache.axis2.databinding.utils.ConverterUtil, чтобы понять, что происходиттам.Вышеупомянутый сегмент кода выполняется сотни раз (> 500).Я сильно подозреваю, что ConverterUtil.convertToArray был вызван ранее.
Есть идеи, что здесь происходит?
РЕДАКТИРОВАТЬ: Соответствующий раздел xmlString:
<Service>
<tns:Id>
<tns:InternalId xsi:nil="true" />
<tns:ExternalId>C0444</tns:ExternalId>
</tns:Id>
<tns:TierOfGovernment>Commonwealth</tns:TierOfGovernment>
<tns:Jurisdiction>WA</tns:Jurisdiction>
<tns:Status>Published</tns:Status>
<tns:Type>Licence</tns:Type>
<tns:Name>Certificate of Plant Breeder's Rights</tns:Name>
<tns:DescriptiveName></tns:DescriptiveName>
<tns:Description>You will require this certificate if you are the original breeder of a new variety of plant or if you are acquiring ownership rights from an original breeder.
This certificate will provide exclusive commercial rights to the new plant variety. It provide rights to exclude others from producing propagating material, conditioning propagating material (including cleaning, coating, sorting, packaging and grading), offering propagating material for sale, importing and exporting and stocking propagating material of protected varieties.
Please consult the Contact Officer for further details.</tns:Description>
<tns:EligibilityRequirements>As the applicant you must:
- be the original breeder or have acquired legal ownership;
- demonstrate that the plant variety is new or recently exploited and is unique (distinct, uniform, stable); and
- have an acceptable name; and
- pay the required fees.
A recently exploited variety is one which had been sold with the breeder's consent in either:
- Australia - not more than 12 months prior to lodging the application; or
- not more than 6 years (trees and vines) or 4 years (all other species) in another country which is a member of the International Union for the Protection of New Varieties of Plants.
In order to demonstrate that the plant is distinct, uniform and stable (DUS), the applicant will be required to nominate an accredited Qualified Person (QP) as part of the application process. This person will be responsible for conducting a comparative growing trial in order to demonstrate the DUS of the plant.
Please consult the Contact Officer for further details.</tns:EligibilityRequirements>
<tns:MutualRecognition>false</tns:MutualRecognition>
<tns:Priority>false</tns:Priority>
<tns:URL>http://www.ipaustralia.gov.au/get-the-right-ip/plant-breeders-rights/`</tns:URL>
<tns:BusinessStructure>SoleTrader</tns:BusinessStructure>
<tns:TopicName></tns:TopicName>
<tns:AssociatedKeyword>
<tns:Keyword>
<tns:Id>
<tns:InternalId xsi:nil="true" />
<tns:ExternalId xsi:nil="true" />
</tns:Id>
<tns:Keyword>Breeder's</tns:Keyword>
</tns:Keyword>
</tns:AssociatedKeyword>
<tns:AssociatedKeyword>
<tns:Keyword>
<tns:Id>
<tns:InternalId xsi:nil="true" />
<tns:ExternalId xsi:nil="true" />
</tns:Id>
<tns:Keyword>Certificate</tns:Keyword>
</tns:Keyword>
</tns:AssociatedKeyword>
<tns:AssociatedKeyword>
<tns:Keyword>
<tns:Id>
<tns:InternalId xsi:nil="true" />
<tns:ExternalId xsi:nil="true" />
</tns:Id>
<tns:Keyword>Plant</tns:Keyword>
</tns:Keyword>
</tns:AssociatedKeyword>
<tns:AssociatedKeyword>
<tns:Keyword>
<tns:Id>
<tns:InternalId xsi:nil="true" />
<tns:ExternalId xsi:nil="true" />
</tns:Id>
<tns:Keyword>Rights</tns:Keyword>
</tns:Keyword>
</tns:AssociatedKeyword>
<tns:AssociatedOrganisation>
<tns:OrganisationId>
<tns:InternalId xsi:nil="true" />
<tns:ExternalId>BDP_0</tns:ExternalId>
</tns:OrganisationId>
<tns:Role>Owner</tns:Role>
</tns:AssociatedOrganisation>
</Service>