From 093783d71519bd9081bde055677912d2cad65f23 Mon Sep 17 00:00:00 2001 From: Peter Bae Date: Wed, 21 Nov 2018 14:34:11 -0800 Subject: [PATCH] fix getLatitude() and getLongitude() --- src/main/java/com/microsoft/sqlserver/jdbc/Geography.java | 8 ++++---- .../jdbc/datatypes/SQLServerSpatialDatatypeTest.java | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/Geography.java b/src/main/java/com/microsoft/sqlserver/jdbc/Geography.java index d35e2a8b7..c572ad70b 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/Geography.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/Geography.java @@ -212,8 +212,8 @@ public boolean hasZ() { * @return double value that represents the latitude. */ public Double getLatitude() { - if (null != internalType && internalType == InternalSpatialDatatype.POINT && xValues.length == 1) { - return xValues[0]; + if (null != internalType && internalType == InternalSpatialDatatype.POINT && yValues.length == 1) { + return yValues[0]; } return null; } @@ -224,8 +224,8 @@ public Double getLatitude() { * @return double value that represents the longitude. */ public Double getLongitude() { - if (null != internalType && internalType == InternalSpatialDatatype.POINT && yValues.length == 1) { - return yValues[0]; + if (null != internalType && internalType == InternalSpatialDatatype.POINT && xValues.length == 1) { + return xValues[0]; } return null; } diff --git a/src/test/java/com/microsoft/sqlserver/jdbc/datatypes/SQLServerSpatialDatatypeTest.java b/src/test/java/com/microsoft/sqlserver/jdbc/datatypes/SQLServerSpatialDatatypeTest.java index 210184e47..a31fc75b5 100644 --- a/src/test/java/com/microsoft/sqlserver/jdbc/datatypes/SQLServerSpatialDatatypeTest.java +++ b/src/test/java/com/microsoft/sqlserver/jdbc/datatypes/SQLServerSpatialDatatypeTest.java @@ -968,8 +968,8 @@ public void testGetXGetY() throws SQLException { x = geog.getLatitude(); y = geog.getLongitude(); - assertEquals(x, 1); - assertEquals(y, 2); + assertEquals(x, 2); + assertEquals(y, 1); } @Test