You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ks...@apache.org on 2020/08/11 15:57:48 UTC

[arrow] 19/22: ARROW-9536: [Java] Miss parameters in PlasmaOutOfMemoryException.java

This is an automated email from the ASF dual-hosted git repository.

kszucs pushed a commit to branch maint-1.0.x
in repository https://gitbox.apache.org/repos/asf/arrow.git

commit ccecca6b5c33fe93585786ce05ae72805fb18acd
Author: offthewall123 <di...@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 <di...@intel.com>
    Signed-off-by: Micah Kornfield <em...@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();
-
   }
 
 }