Closed billtian closed 3 years ago
I had tested the serialization with a ProjectedCoordinateReferenceSystem and found no problems. What problems are you seeing that necessitated these changes?
I'd like to see a test that fails without this PR, so I can safeguard against future regressions
I had added a test testProjectedCrsCastToSerializable
in SerializableTest . You will see java.io.NotSerializableException
without this PR.
@Test
public void testProjectedCrsCastToSerializable() throws IOException, ClassNotFoundException {
ProjectedCoordinateReferenceSystem crs = CoordinateReferenceSystems.WEB_MERCATOR;
Serializable ser = (Serializable) crs;
File tempFile = Files.createTempFile("pcrs", ".ser").toFile();
tempFile.deleteOnExit();
try (ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(tempFile))){
out.writeObject(crs);
};
ProjectedCoordinateReferenceSystem deser;
try (ObjectInputStream ins = new ObjectInputStream(new FileInputStream(tempFile))) {
deser = (ProjectedCoordinateReferenceSystem) ins.readObject();
}
assertEquals(crs, deser);
}
Sorry, you're absolutely correct! My mistake.
Its' Ok. Thanks for your work !
fix bug #132 when cache ProjectedCoordinateReferenceSystem
(cherry picked from commit 263e0f0c08077c3f6c35897a4e036fc1340b33ab)