Skip to content
Open
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
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1484,7 +1484,8 @@ void readPointWkt() throws SQLServerException {

while (currentWktPos < wkt.length()
&& (Character.isDigit(wkt.charAt(currentWktPos)) || wkt.charAt(currentWktPos) == '.'
|| wkt.charAt(currentWktPos) == 'E' || wkt.charAt(currentWktPos) == 'e')) {
|| wkt.charAt(currentWktPos) == 'E' || wkt.charAt(currentWktPos) == 'e'
|| wkt.charAt(currentWktPos) == '-')) {
currentWktPos++;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2122,6 +2122,18 @@ public void testLargeCases() throws SQLException {
}
}

/**
* Tests Geography almost zero coordinates like 0.0001234. The string representation is "1.234E-4", which
* caused a bug when creating a Geography object.
*/
@Test
public void testGeographySmallCoordinates() throws SQLException {
Geography g = Geography.point(0.0001234, 1.234, 4326);

assertEquals(0.0001234, g.getLatitude());
assertEquals(1.234, g.getLongitude());
}

private void beforeEachSetup() throws SQLException {
try (Statement stmt = connection.createStatement()) {
TestUtils.dropTableIfExists(AbstractSQLGenerator.escapeIdentifier(geomTableName), stmt);
Expand Down