Corey Puffalt created SIS-629:
---------------------------------

             Summary: DateTimeParseException in 
EPSGDataAccess.getOptionalTemporal when iterating EPSG GeographicCRS codes
                 Key: SIS-629
                 URL: https://issues.apache.org/jira/browse/SIS-629
             Project: Spatial Information Systems
          Issue Type: Bug
    Affects Versions: 1.6
         Environment:   - Apache SiS 1.6 (sis-referencing + sis-embedded-data, 
embedded EPSG 12.047)
  - Apache Derby 10.15.2.0 (derby, derbytools, derbyshared)
  - Java 11 (OpenJDK)
  - Linux (RHEL 8)
            Reporter: Corey Puffalt


After upgrading from SiS 1.4 to 1.6, code that iterates over all EPSG 
GeographicCRS authority codes and calls CRS.forCode(...) on each fails partway 
through with the stack trace below. The same code worked under 1.4:

 
{code:java}
  org.apache.sis.referencing.factory.FactoryDataException: Text 'March2011' 
could not be parsed at index 0
    at 
org.apache.sis.referencing.factory.sql.EPSGDataAccess.createDatum(EPSGDataAccess.java:2118)
    at 
org.apache.sis.referencing.factory.AuthorityFactoryProxy$3.create(AuthorityFactoryProxy.java:235)
    ...
    at 
org.apache.sis.referencing.factory.MultiAuthoritiesFactory.createCoordinateReferenceSystem(MultiAuthoritiesFactory.java:948)
    at org.apache.sis.referencing.CRS.forCode(CRS.java:296)
  Caused by: java.time.format.DateTimeParseException: Text 'March2011' could 
not be parsed at index 0
    at 
java.base/java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:2046)
    at 
java.base/java.time.format.DateTimeFormatter.parseBest(DateTimeFormatter.java:1994)
    at 
org.apache.sis.temporal.LenientDateFormat.parseBest(LenientDateFormat.java:123)
    at 
org.apache.sis.referencing.factory.sql.EPSGDataAccess.getOptionalTemporal(EPSGDataAccess.java:1046)
    at 
org.apache.sis.referencing.factory.sql.EPSGDataAccess.createDatum(EPSGDataAccess.java:2038)
{code}
Here's a simple reproducer:

 
{code:java}
import org.apache.sis.referencing.CRS;
import org.junit.jupiter.api.Test;
import org.opengis.referencing.crs.GeographicCRS;

public class IdentifyFailingDatumTest {
  @Test
  public void findFailingCode() throws Exception {
    var factory = CRS.getAuthorityFactory("EPSG");
    for (String code : factory.getAuthorityCodes(GeographicCRS.class)) {
      try {
        CRS.forCode("EPSG:" + code);
      } catch (Throwable t) {
        throw new AssertionError("EPSG:" + code + " failed", t);
      }
    }
  }
}
{code}
 

 

 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to