A java error

Hi,

When I try to open a S2A image, I have an error message: “A java.lang.StringIndexOutOfBoundsException exception has occurred.” Can you plesase provide a solution?
Thank you very much in advance.

İdris Uslu

Hello İdris,
can you provide a few more information.
The name of the S2 product would be helpful for example and from which provider you have downloaded it.
And there is probably more information about the exception. The full stack trace is helpful to locate the error.
Would be good if you can provide the log file. How to find the log file is mentioned in the FAQ

Thank you for your quick reply. I downloaded the file from esa itself. This is an old data. The SNAP apllication is the version. There was not such an error before.

The file: S2A_MSIL2A_20200417T085601_N0214_R007_T35SMC_20200417T121157.zip

The error log:

java.lang.StringIndexOutOfBoundsException: String index out of range: 95
at java.lang.String.substring(String.java:1963)
at org.hsqldb.DatabaseURL.parseURL(Unknown Source)
at org.hsqldb.jdbc.JDBCDriver.getConnection(Unknown Source)
at org.hsqldb.jdbc.JDBCDataSource.getConnection(Unknown Source)
at org.hsqldb.jdbc.JDBCDataSource.getConnection(Unknown Source)
at org.geotools.referencing.factory.epsg.DirectEpsgFactory.getConnection(DirectEpsgFactory.java:3529)
at org.geotools.referencing.factory.epsg.ThreadedEpsgFactory.createBackingStore(ThreadedEpsgFactory.java:438)
at org.geotools.referencing.factory.DeferredAuthorityFactory.getBackingStore(DeferredAuthorityFactory.java:115)
at org.geotools.referencing.factory.BufferedAuthorityFactory.isAvailable(BufferedAuthorityFactory.java:219)
at org.geotools.referencing.factory.DeferredAuthorityFactory.isAvailable(DeferredAuthorityFactory.java:101)
at org.geotools.factory.FactoryRegistry.isAvailable(FactoryRegistry.java:809)
at org.geotools.factory.FactoryRegistry.isAcceptable(FactoryRegistry.java:632)
at org.geotools.factory.FactoryRegistry.lambda$getFactories$0(FactoryRegistry.java:301)
at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174)
at java.util.Spliterators$IteratorSpliterator.tryAdvance(Spliterators.java:1812)
at java.util.stream.StreamSpliterators$WrappingSpliterator.lambda$initPartialTraversalState$0(StreamSpliterators.java:295)
at java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.fillBuffer(StreamSpliterators.java:207)
at java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.doAdvance(StreamSpliterators.java:162)
at java.util.stream.StreamSpliterators$WrappingSpliterator.tryAdvance(StreamSpliterators.java:301)
at java.util.Spliterators$1Adapter.hasNext(Spliterators.java:681)
at org.geotools.resources.LazySet.size(LazySet.java:90)
at java.util.AbstractCollection.toArray(AbstractCollection.java:136)
at java.util.ArrayList.(ArrayList.java:178)
at org.geotools.referencing.DefaultAuthorityFactory.getBackingFactory(DefaultAuthorityFactory.java:95)
at org.geotools.referencing.DefaultAuthorityFactory.(DefaultAuthorityFactory.java:68)
at org.geotools.referencing.CRS.getAuthorityFactory(CRS.java:246)
at org.geotools.referencing.CRS.decode(CRS.java:517)
at org.geotools.referencing.CRS.decode(CRS.java:440)
at org.esa.s2tbx.dataio.s2.ortho.Sentinel2OrthoProductReader.readProduct(Sentinel2OrthoProductReader.java:232)
at org.esa.s2tbx.dataio.s2.Sentinel2ProductReader.readProductNodesImpl(Sentinel2ProductReader.java:198)
at org.esa.snap.core.dataio.AbstractProductReader.readProductNodes(AbstractProductReader.java:178)
at org.esa.s2tbx.dataio.s2.ortho.Sentinel2OrthoProductReaderProxy.readProductNodes(Sentinel2OrthoProductReaderProxy.java:90)
at org.esa.snap.core.dataio.ProductIO.readProduct(ProductIO.java:182)
at org.esa.snap.rcp.actions.file.ReadProductOperation.run(ReadProductOperation.java:61)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1443)
at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:68)
at org.openide.util.lookup.Lookups.executeWith(Lookups.java:303)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2058)

I’ve just tried this product and I had no issue.


I’ve directly used the zip file and the MTD_MSIL2A.xml file after unpacking.

The error you experience is strange. It happens when an external library (geotools) we use connects to its database.

Are you using SNAP 9?
Can you try to reinstall it? And when doing so please enable the option to remove all data.

1 Like

Hello Marco,

It is fine that you have opened the image. Although I have reinstalled SNAP 9.0 (deleting all the files as you had recommeded) and tried the latest image for the same area, I could not open. I think trying it on another computer. I used previous SNAP versions 2 years ago. Unfortunately, I can’t know.
Thank you so much for your help.

Hello again,
I have tried at another computer, but SNAP 9.0 did not open the file.
One of my friend said that this might be something related with language preferences of windows. The previous windows I use was in English. Do you thing this is reasonable?
Thank you very much for your attendance.