Skip to content

Commit

Permalink
ARROW-9536: [Java] Miss parameters in PlasmaOutOfMemoryException.java
Browse files Browse the repository at this point in the history
Miss parameters in PlasmaOutOfMemoryException.java

Closes apache#7815 from offthewall123/miss_parameter_bug_fix

Authored-by: offthewall123 <dingyu.xu@intel.com>
Signed-off-by: Micah Kornfield <emkornfield@gmail.com>
  • Loading branch information
offthewall123 authored and kszucs committed Aug 11, 2020
1 parent abf6b07 commit ccecca6
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
Expand Up @@ -22,6 +22,14 @@
*/
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.");
}
Expand Down
Expand Up @@ -26,6 +26,7 @@

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 {
Expand Down Expand Up @@ -277,6 +278,20 @@ public void doByteBufferTest() {
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);
Expand All @@ -290,9 +305,9 @@ public String getStoreAddress() {
public static void main(String[] args) throws Exception {

PlasmaClientTest plasmaClientTest = new PlasmaClientTest();
plasmaClientTest.doPlasmaOutOfMemoryExceptionTest();
plasmaClientTest.doByteBufferTest();
plasmaClientTest.doTest();

}

}

0 comments on commit ccecca6

Please sign in to comment.