This is an automated email from the ASF dual-hosted git repository. emkornfield pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/master by this push: new f40e287 ARROW-9536: [Java] Miss parameters in PlasmaOutOfMemoryException.java f40e287 is described below commit f40e2871919b577995a8e9e2419af2e494f574cb Author: offthewall123 <dingyu...@intel.com> AuthorDate: Fri Aug 7 19:51:43 2020 -0700 ARROW-9536: [Java] Miss parameters in PlasmaOutOfMemoryException.java Miss parameters in PlasmaOutOfMemoryException.java Closes #7815 from offthewall123/miss_parameter_bug_fix Authored-by: offthewall123 <dingyu...@intel.com> Signed-off-by: Micah Kornfield <emkornfi...@gmail.com> --- .../plasma/exceptions/PlasmaOutOfMemoryException.java | 8 ++++++++ .../java/org/apache/arrow/plasma/PlasmaClientTest.java | 17 ++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/java/plasma/src/main/java/org/apache/arrow/plasma/exceptions/PlasmaOutOfMemoryException.java b/java/plasma/src/main/java/org/apache/arrow/plasma/exceptions/PlasmaOutOfMemoryException.java index fd323fa..ffc4177 100644 --- a/java/plasma/src/main/java/org/apache/arrow/plasma/exceptions/PlasmaOutOfMemoryException.java +++ b/java/plasma/src/main/java/org/apache/arrow/plasma/exceptions/PlasmaOutOfMemoryException.java @@ -22,6 +22,14 @@ package org.apache.arrow.plasma.exceptions; */ public class PlasmaOutOfMemoryException extends RuntimeException { + public PlasmaOutOfMemoryException(String message) { + super("The plasma store ran out of memory." + message); + } + + public PlasmaOutOfMemoryException(String message, Throwable t) { + super("The plasma store ran out of memory." + message, t); + } + public PlasmaOutOfMemoryException() { super("The plasma store ran out of memory."); } diff --git a/java/plasma/src/test/java/org/apache/arrow/plasma/PlasmaClientTest.java b/java/plasma/src/test/java/org/apache/arrow/plasma/PlasmaClientTest.java index d3aebea..e02ee51 100644 --- a/java/plasma/src/test/java/org/apache/arrow/plasma/PlasmaClientTest.java +++ b/java/plasma/src/test/java/org/apache/arrow/plasma/PlasmaClientTest.java @@ -26,6 +26,7 @@ import java.util.stream.Collectors; import org.apache.arrow.plasma.exceptions.DuplicateObjectException; import org.apache.arrow.plasma.exceptions.PlasmaClientException; +import org.apache.arrow.plasma.exceptions.PlasmaOutOfMemoryException; import org.junit.Assert; public class PlasmaClientTest { @@ -277,6 +278,20 @@ public class PlasmaClientTest { client.release(id); } + public void doPlasmaOutOfMemoryExceptionTest() { + System.out.println("Start PlasmaOutOfMemoryException test."); + PlasmaClient client = (PlasmaClient) pLink; + byte[] objectId = new byte[20]; + Arrays.fill(objectId, (byte) 1); + try { + ByteBuffer byteBuffer = client.create(objectId, 200000000, null); + Assert.fail("Fail to create an object, The plasma store ran out of memory."); + } catch (PlasmaOutOfMemoryException e) { + System.out.println(String.format("Expected PlasmaOutOfMemoryException: %s", e)); + System.out.println("PlasmaOutOfMemoryException test success."); + } + } + private byte[] getArrayFilledWithValue(int arrayLength, byte val) { byte[] arr = new byte[arrayLength]; Arrays.fill(arr, val); @@ -290,9 +305,9 @@ public class PlasmaClientTest { public static void main(String[] args) throws Exception { PlasmaClientTest plasmaClientTest = new PlasmaClientTest(); + plasmaClientTest.doPlasmaOutOfMemoryExceptionTest(); plasmaClientTest.doByteBufferTest(); plasmaClientTest.doTest(); - } }