8000 Fix element number estimation when parsing WKB of GEOMETRYCOLLECTION containing empty geometries by Kontinuation · Pull Request #905 · locationtech/jts · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix element number estimation when parsing WKB of GEOMETRYCOLLECTION containing empty geometries #905

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
< 8000 button type="submit" data-view-component="true" class="btn-sm btn"> Apply and reload
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ private static int hexToInt(char hex)

private static final String FIELD_NUMCOORDS = "numCoords";

private static final String FIELD_NUMRINGS = null;
private static final String FIELD_NUMRINGS = "numRings";

private static final String FIELD_NUMELEMS = null;
private static final String FIELD_NUMELEMS = "numElems";

private GeometryFactory factory;
private CoordinateSequenceFactory csFactory;
Expand Down Expand Up @@ -156,7 +156,7 @@ public Geometry read(byte[] bytes) throws ParseException
// possibly reuse the ByteArrayInStream?
// don't throw IOExceptions, since we are not doing any I/O
try {
return read(new ByteArrayInStream(bytes), bytes.length / 16);
return read(new ByteArrayInStream(bytes), bytes.length / 8);
}
catch (IOException ex) {
throw new RuntimeException("Unexpected IOException caught: " + ex.getMessage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ public void testLineStringEmpty()
{
runWKBTest("LINESTRING EMPTY");
}
public void testGeometryCollectionContainingEmptyGeometries()
throws IOException, ParseException
{
runWKBTest("GEOMETRYCOLLECTION (LINESTRING EMPTY, MULTIPOINT EMPTY)");
}

public void testBigPolygon()
throws IOException, ParseException
Expand Down
0