java.lang.ArrayIndexOutOfBoundsException by using of the geotools GML2 Parser

1 message Options
Embed this post
Permalink
pita

java.lang.ArrayIndexOutOfBoundsException by using of the geotools GML2 Parser

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)

Dear Forum,

 

I am trying to use the geotools GML2 Parser (geotools version 2.5.5) to parse the WFS GetFeatureResponse document and getting the java.lang.ArrayIndexOutOfBoundsException: 1 at line FeatureCollection fc = (FeatureCollection) parser.parse( xml );

There is my testcase:

 

 String namespace = "http://www.opengis.net/wfs";

             String schemaLocation =  getClass().getResource("/schema/wfs/1.0.0/WFS-basic.xsd").toString();

             //create the parser with the gml 2.0 configuration

             org.geotools.xml.Configuration configuration = new ApplicationSchemaConfiguration(namespace, schemaLocation);

             org.geotools.xml.Parser parser = new org.geotools.xml.Parser( configuration );

             //the xml instance document above

             InputStream xml = getClass().getResourceAsStream("GML2Italien.xml");

              //parse

              try {

                        FeatureCollection fc = (FeatureCollection) parser.parse( xml );

                        assertEquals(3, fc.size());

                  } catch {…}

                  }

 

I am getting the same error if I’m using  the GML2Configuration instead of the ApplicationSchemaConfiguration.

I have attached my testdata  as well as the full failer trace to this email.

 

What could be my problem?

 

Many thanks and kind regards,

 

 

 

Anna Pitaev
_________________________________________
Logica - Releasing your potential

Logica Deutschland GmbH & Co.
KG
Rheinstrasse 95
64295 Darmstadt
Germany
Tel.: +49 6151 36860-121
E-Mail:  [hidden email]
www.logica.com

Logica Deutschland GmbH & Co. KG
Zettachring 4, 70567 Stuttgart; Amtsgericht Stuttgart HRA 722072
Persönlich haftender Gesellschafter: Logica Verwaltungs GmbH

Geschäftsführer: Torsten Straß (Vors.) / Dr. Thomas Elsner / Eric Guyot / Andreas Manganaro / Olaf Scholz / Oliver Starzonek; Handelsregister  AG Stuttgart  HRB 724084

 


Please help Logica to respect the environment by not printing this email / Pour contribuer comme Logica au respect de l'environnement, merci de ne pas imprimer ce mail / Bitte drucken Sie diese Nachricht nicht aus und helfen Sie so Logica dabei, die Umwelt zu schützen. / Por favor ajude a Logica a respeitar o ambiente não imprimindo este correio electrónico. This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.
<?xml version="1.0" encoding="UTF-8"?>
<wfs:FeatureCollection xmlns="http://www.opengis.net/wfs"
        xmlns:wfs="http://www.opengis.net/wfs" wfs:schemaLocation="schema/wfs/1.0.0/WFS-basic.xsd"
        xmlns:gml="http://www.opengis.net/gml" gml:schemaLocation="schema/gml/2.1.2/feature.xsd"
        xmlns:hb="http://www.esdi-humboldt.eu"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.esdi-humboldt.eu http://localhost:8080/geoserver/wfs?service=WFS&version=1.0.0&request=DescribeFeatureType&typeName=hb:PROVINCE_25000 http://www.opengis.net/wfs">
        <gml:boundedBy>
                <gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml#3003">
                        <gml:coordinates xmlns:gml="http://www.opengis.net/gml" decimal="."
                                cs="," ts=" ">1379063.55,4847827.15
                                1585808.75,4947071.97</gml:coordinates>
                </gml:Box>
        </gml:boundedBy>
       
       
       
       
       
       
       
        <gml:featureMember>
                <hb:PROVINCE_25000 fid="PROVINCE_25000.8">
                        <hb:the_geom>
                                <gml:MultiPolygon
                                        srsName="http://www.opengis.net/gml/srs/epsg.xml#3003">
                                        <gml:polygonMember>
                                                <gml:Polygon>
                                                        <gml:outerBoundaryIs>
                                                                <gml:LinearRing>
                                                                        <gml:coordinates
                                                                                xmlns:gml="http://www.opengis.net/gml"
                                                                                decimal="." cs="," ts=" ">
                                                                                1437878.31,4875137.84
                                                                                1437899.48,4875143.53
                                                                                1437891.92,4875161.62
                                                                                1437937.48,4875194.27
                                                                                1437934.26,4875210.38
                                                                                1437896.3,4875221.13
                                                                                1437893.87,4875227.18
                                                                                1437898.51,4875230.53
                                                                                1437943.32,4875220.83
                                                                                1437947.63,4875200.72
                                                                                1437954.33,4875193.84
                                                                                1438022.71,4875160.07
                                                                                1438098.06,4875133.37
                                                                                1438111.49,4875120.12
                                                                                1438183.37,4875079.18
                                                                                1438187.94,4875069.82
                                                                                1438210.24,4875063.41
                                                                                1438245.11,4875043.19
                                                                                1438279.4,4875011.68
                                                                                1438284.49,4874985.12
                                                                                1438276.5,4874975.09
                                                                                1438238.87,4874967.09
                                                                                1438202.12,4874922.15
                                                                                1438191.99,4874915.45
                                                                                1438151.64,4874908.06
                                                                                1438120.93,4874884.74
                                                                                1438102.08,4874883.11
                                                                                1438076.67,4874887.67
                                                                                1438058.62,4874884.73
                                                                                1438012.28,4874866.45
                                                                                1437975.26,4874861.19
                                                                                1437966.69,4874853.95
                                                                                1437963.28,4874840.98
                                                                                1437965.05,4874814.36
                                                                                1437955.48,4874798.73
                                                                                1437955.41,4874787.54
                                                                                1438008.4,4874743.46 1438010.56,4874727.7
                                                                                1438002.96,4874720.58
                                                                                1437983.04,4874716.98
                                                                                1437951.45,4874721.88
                                                                                1437932.1,4874734.68
                                                                                1437916.97,4874755.93
                                                                                1437915.12,4874797.73
                                                                                1437905.7,4874823.72
                                                                                1437914.12,4874876.52
                                                                                1437912.35,4874897.77
                                                                                1437885.15,4874932.91
                                                                                1437881.52,4874965.45
                                                                                1437885.81,4874997.14
                                                                                1437845.12,4875035.97
                                                                                1437837.14,4875065.55
                                                                                1437843.97,4875098.19
                                                                                1437863.73,4875128.34
                                                                                1437857.82,4875201.83
                                                                                1437871.23,4875200.32
                                                                                1437878.31,4875137.84</gml:coordinates>
                                                                </gml:LinearRing>
                                                        </gml:outerBoundaryIs>
                                                </gml:Polygon>
                                        </gml:polygonMember>
                                </gml:MultiPolygon>
                        </hb:the_geom>
                        <hb:cod_reg>07</hb:cod_reg>
                        <hb:cod_prov>009</hb:cod_prov>
                        <hb:nome_prov>SAVONA</hb:nome_prov>
                        <hb:ID>8</hb:ID>
                </hb:PROVINCE_25000>
        </gml:featureMember>
        <gml:featureMember>
                <hb:PROVINCE_25000 fid="PROVINCE_25000.9">
                        <hb:the_geom>
                                <gml:MultiPolygon
                                        srsName="http://www.opengis.net/gml/srs/epsg.xml#3003">
                                        <gml:polygonMember>
                                                <gml:Polygon>
                                                        <gml:outerBoundaryIs>
                                                                <gml:LinearRing>
                                                                        <gml:coordinates
                                                                                xmlns:gml="http://www.opengis.net/gml"
                                                                                decimal="." cs="," ts=" ">
                                                                                1455639.74,4897985.4
                                                                                1455625.47,4897991.53
                                                                                1455602.61,4897998.83
                                                                                1455600.66,4898012.95
                                                                                1455618.48,4898034.92
                                                                                1455637.45,4898055.86
                                                                                1455639.17,4898068.32
                                                                                1455629.69,4898085.92
                                                                                1455628.37,4898124.02
                                                                                1455638.83,4898171.33
                                                                                1455656.85,4898162.84
                                                                                1455687.26,4898158.63
                                                                                1455712.28,4898135.21
                                                                                1455727.27,4898113.64
                                                                                1455788.61,4898102.32
                                                                                1455797.35,4898090.94
                                                                                1455798.67,4898072.11
                                                                                1455784.98,4898034.54
                                                                                1455764.56,4898011.44
                                                                                1455687.7,4897978.88
                                                                                1455639.74,4897985.4</gml:coordinates>
                                                                </gml:LinearRing>
                                                        </gml:outerBoundaryIs>
                                                </gml:Polygon>
                                        </gml:polygonMember>
                                </gml:MultiPolygon>
                        </hb:the_geom>
                        <hb:cod_reg>07</hb:cod_reg>
                        <hb:cod_prov>009</hb:cod_prov>
                        <hb:nome_prov>SAVONA</hb:nome_prov>
                        <hb:ID>9</hb:ID>
                </hb:PROVINCE_25000>
        </gml:featureMember>
        <gml:featureMember>
                <hb:PROVINCE_25000 fid="PROVINCE_25000.10">
                        <hb:the_geom>
                                <gml:MultiPolygon
                                        srsName="http://www.opengis.net/gml/srs/epsg.xml#3003">
                                        <gml:polygonMember>
                                                <gml:Polygon>
                                                        <gml:outerBoundaryIs>
                                                                <gml:LinearRing>
                                                                        <gml:coordinates
                                                                                xmlns:gml="http://www.opengis.net/gml"
                                                                                decimal="." cs="," ts=" ">
                                                                                1481992.54,4918053.51
                                                                                1482003.37,4918067.07
                                                                                1482019.8,4918065.58
                                                                                1482029.29,4918060.53
                                                                                1482028.29,4918048.83
                                                                                1482377.1,4917972.02
                                                                                1482776.65,4917889.45 1482917.39,4917856
                                                                                1483181.45,4917802.09
                                                                                1483441.47,4917743.59
                                                                                1483707.97,4917689.56
                                                                                1484332.64,4918397.52
                                                                                1484376.68,4918441.31
                                                                                1484393.78,4918429.1 1484350.1,4918387.38
                                                                                1483714.65,4917665.75
                                                                                1483453.3,4917719.66
                                                                                1482997.56,4917818.38
                                                                                1482902.13,4917837.26
                                                                                1482829.37,4917856.05
                                                                                1482356.77,4917953.23
                                                                                1482281.9,4917971.94
                                                                                1481985.29,4918031.09
                                                                                1481898.77,4918053.8
                                                                                1481689.92,4918099.82
                                                                                1481687.81,4918108.95
                                                                                1481696.59,4918133.48
                                                                                1481712.07,4918132.25
                                                                                1481716.19,4918128.45
                                                                                1481714.07,4918115.97
                                                                                1481749.46,4918105.23
                                                                                1481797.05,4918095.15
                                                                                1481992.54,4918053.51</gml:coordinates>
                                                                </gml:LinearRing>
                                                        </gml:outerBoundaryIs>
                                                </gml:Polygon>
                                        </gml:polygonMember>
                                </gml:MultiPolygon>
                        </hb:the_geom>
                        <hb:cod_reg>07</hb:cod_reg>
                        <hb:cod_prov>010</hb:cod_prov>
                        <hb:nome_prov>GENOVA</hb:nome_prov>
                        <hb:ID>10</hb:ID>
                </hb:PROVINCE_25000>
        </gml:featureMember>
       
       
       
       
       
</wfs:FeatureCollection>
There is the full Failure Trace:

java.lang.ArrayIndexOutOfBoundsException: 1
            at org.geotools.xml.impl.ParserHandler.startElement(ParserHandler.java:270)
            at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
            at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
            at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source)
            at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
            at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
            at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
            at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
            at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
            at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
            at org.geotools.xml.Parser.parse(Parser.java:180)
            at org.geotools.xml.Parser.parse(Parser.java:140)
            at test.eu.esdihumboldt.mediator.itf.servicehandler.impl.TestGeotoolsParser.testSimpleGML3Parser(TestGeotoolsParser.java:62)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at junit.framework.TestCase.runTest(TestCase.java:168)
            at junit.framework.TestCase.runBare(TestCase.java:134)
            at junit.framework.TestResult$1.protect(TestResult.java:110)
            at junit.framework.TestResult.runProtected(TestResult.java:128)
            at junit.framework.TestResult.run(TestResult.java:113)
            at junit.framework.TestCase.run(TestCase.java:124)
            at junit.framework.TestSuite.runTest(TestSuite.java:232)
            at junit.framework.TestSuite.run(TestSuite.java:227)
            at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81)
            at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
            at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
            at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
            at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
            at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
            at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users