You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@empire-db.apache.org by "SaschaGeissler (via GitHub)" <gi...@apache.org> on 2023/09/07 09:18:54 UTC

[GitHub] [empire-db] SaschaGeissler opened a new pull request, #16: Bugfix ObjectUtils isZero method for type decimal

SaschaGeissler opened a new pull request, #16:
URL: https://github.com/apache/empire-db/pull/16

   In the method isZero in ObjectUtils is an likely copy past bug.
   The cast and check for instanceof double is Float.
   This leads to an exception if isZero is called for decimal values.
   
   I fixed this error and added an unit test for the method isZero.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@empire-db.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [empire-db] jan666 merged pull request #16: Bugfix ObjectUtils isZero method for type decimal

Posted by "jan666 (via GitHub)" <gi...@apache.org>.
jan666 merged PR #16:
URL: https://github.com/apache/empire-db/pull/16


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@empire-db.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [empire-db] jan666 commented on a diff in pull request #16: Bugfix ObjectUtils isZero method for type decimal

Posted by "jan666 (via GitHub)" <gi...@apache.org>.
jan666 commented on code in PR #16:
URL: https://github.com/apache/empire-db/pull/16#discussion_r1318374806


##########
empire-db/src/test/java/org/apache/empire/commons/ObjectUtilsTest.java:
##########
@@ -52,6 +53,21 @@ public void testIsEmpty()
 		assertFalse(ObjectUtils.isEmpty(new Object()));
 	}
 
+	@Test
+    public void testIsZero()
+    {
+        assertTrue(ObjectUtils.isZero(BigDecimal.ZERO));
+        assertTrue(ObjectUtils.isZero(0f));
+        assertTrue(ObjectUtils.isZero(Float.valueOf("0")));
+        assertTrue(ObjectUtils.isZero(0d));
+        assertTrue(ObjectUtils.isZero(0l));
+        assertTrue(ObjectUtils.isZero(0));
+		assertTrue(ObjectUtils.isZero(null));

Review Comment:
   please use tabs or spaces - not both



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@empire-db.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [empire-db] SaschaGeissler commented on a diff in pull request #16: Bugfix ObjectUtils isZero method for type decimal

Posted by "SaschaGeissler (via GitHub)" <gi...@apache.org>.
SaschaGeissler commented on code in PR #16:
URL: https://github.com/apache/empire-db/pull/16#discussion_r1318381740


##########
empire-db/src/test/java/org/apache/empire/commons/ObjectUtilsTest.java:
##########
@@ -52,6 +53,21 @@ public void testIsEmpty()
 		assertFalse(ObjectUtils.isEmpty(new Object()));
 	}
 
+	@Test
+    public void testIsZero()
+    {
+        assertTrue(ObjectUtils.isZero(BigDecimal.ZERO));
+        assertTrue(ObjectUtils.isZero(0f));
+        assertTrue(ObjectUtils.isZero(Float.valueOf("0")));
+        assertTrue(ObjectUtils.isZero(0d));
+        assertTrue(ObjectUtils.isZero(0l));
+        assertTrue(ObjectUtils.isZero(0));
+		assertTrue(ObjectUtils.isZero(null));

Review Comment:
   oh, that was not intended.
   Thanks i fixed it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@empire-db.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org