From f3d12a6e5419bdabd4d290608c8e5701c18f0544 Mon Sep 17 00:00:00 2001 From: lynn Date: Fri, 4 Jan 2019 14:12:31 +0800 Subject: [PATCH 1/9] distinct plasma client create exception --- ...org_apache_arrow_plasma_PlasmaClientJNI.cc | 12 ++++---- .../plasma/DuplicateObjectException.java | 29 +++++++++++++++++++ .../apache/arrow/plasma/ObjectStoreLink.java | 5 +++- .../org/apache/arrow/plasma/PlasmaClient.java | 18 ++++-------- .../apache/arrow/plasma/PlasmaClientJNI.java | 6 +++- .../plasma/PlasmaOutOfMemoryException.java | 29 +++++++++++++++++++ 6 files changed, 79 insertions(+), 20 deletions(-) create mode 100644 java/plasma/src/main/java/org/apache/arrow/plasma/DuplicateObjectException.java create mode 100644 java/plasma/src/main/java/org/apache/arrow/plasma/PlasmaOutOfMemoryException.java diff --git a/cpp/src/plasma/lib/java/org_apache_arrow_plasma_PlasmaClientJNI.cc b/cpp/src/plasma/lib/java/org_apache_arrow_plasma_PlasmaClientJNI.cc index d552994e548..5308e0e92d8 100644 --- a/cpp/src/plasma/lib/java/org_apache_arrow_plasma_PlasmaClientJNI.cc +++ b/cpp/src/plasma/lib/java/org_apache_arrow_plasma_PlasmaClientJNI.cc @@ -104,15 +104,15 @@ JNIEXPORT jobject JNICALL Java_org_apache_arrow_plasma_PlasmaClientJNI_create( std::shared_ptr data; Status s = client->Create(oid, size, md, md_size, &data); if (s.IsPlasmaObjectExists()) { - jclass Exception = env->FindClass("java/lang/Exception"); - env->ThrowNew(Exception, - "An object with this ID already exists in the plasma store."); + jclass Exception = env->FindClass( + "org/apache/arrow/plasma/exceptions/DuplicateObjectException"); + env->ThrowNew(Exception, oid.hex().c_str()); return nullptr; } if (s.IsPlasmaStoreFull()) { - jclass Exception = env->FindClass("java/lang/Exception"); - env->ThrowNew(Exception, - "The plasma store ran out of memory and could not create this object."); + jclass Exception = env->FindClass( + "org/apache/arrow/plasma/exceptions/PlasmaOutOfMemoryException"); + env->ThrowNew(Exception, oid.hex().c_str()); return nullptr; } ARROW_CHECK(s.ok()); diff --git a/java/plasma/src/main/java/org/apache/arrow/plasma/DuplicateObjectException.java b/java/plasma/src/main/java/org/apache/arrow/plasma/DuplicateObjectException.java new file mode 100644 index 00000000000..18f87d2149d --- /dev/null +++ b/java/plasma/src/main/java/org/apache/arrow/plasma/DuplicateObjectException.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.arrow.plasma.exceptions; + +public class DuplicateObjectException extends RuntimeException { + + public DuplicateObjectException (String objectId) { + super("An object with ID " + objectId + " already exists in the plasma store."); + } + + public DuplicateObjectException (String objectId, Throwable t) { + super("An object with ID " + objectId + " already exists in the plasma store.", t); + } + +} \ No newline at end of file diff --git a/java/plasma/src/main/java/org/apache/arrow/plasma/ObjectStoreLink.java b/java/plasma/src/main/java/org/apache/arrow/plasma/ObjectStoreLink.java index 8d6eec02e75..1351b0b4c14 100644 --- a/java/plasma/src/main/java/org/apache/arrow/plasma/ObjectStoreLink.java +++ b/java/plasma/src/main/java/org/apache/arrow/plasma/ObjectStoreLink.java @@ -17,6 +17,8 @@ package org.apache.arrow.plasma; +import org.apache.arrow.plasma.exceptions.DuplicateObjectException; +import org.apache.arrow.plasma.exceptions.PlasmaOutOfMemoryException; import java.util.List; /** @@ -42,7 +44,8 @@ class ObjectStoreData { * @param value The value to put in the object store. * @param metadata encodes whatever metadata the user wishes to encode. */ - void put(byte[] objectId, byte[] value, byte[] metadata); + void put(byte[] objectId, byte[] value, byte[] metadata) + throws DuplicateObjectException, PlasmaOutOfMemoryException; /** * Get a buffer from the PlasmaStore based on the objectId. diff --git a/java/plasma/src/main/java/org/apache/arrow/plasma/PlasmaClient.java b/java/plasma/src/main/java/org/apache/arrow/plasma/PlasmaClient.java index d69b54df05e..30b5a13a98c 100644 --- a/java/plasma/src/main/java/org/apache/arrow/plasma/PlasmaClient.java +++ b/java/plasma/src/main/java/org/apache/arrow/plasma/PlasmaClient.java @@ -17,6 +17,9 @@ package org.apache.arrow.plasma; +import org.apache.arrow.plasma.exceptions.DuplicateObjectException; +import org.apache.arrow.plasma.exceptions.PlasmaOutOfMemoryException; + import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Arrays; @@ -45,18 +48,9 @@ public PlasmaClient(String storeSocketName, String managerSocketName, int releas // interface methods -------------------- @Override - public void put(byte[] objectId, byte[] value, byte[] metadata) { - ByteBuffer buf = null; - try { - buf = PlasmaClientJNI.create(conn, objectId, value.length, metadata); - } catch (Exception e) { - System.err.println("ObjectId " + objectId + " error at PlasmaClient put"); - e.printStackTrace(); - } - if (buf == null) { - return; - } - + public void put(byte[] objectId, byte[] value, byte[] metadata) + throws DuplicateObjectException, PlasmaOutOfMemoryException { + ByteBuffer buf = PlasmaClientJNI.create(threadConn.get(), objectId, value.length, metadata); buf.put(value); PlasmaClientJNI.seal(conn, objectId); PlasmaClientJNI.release(conn, objectId); diff --git a/java/plasma/src/main/java/org/apache/arrow/plasma/PlasmaClientJNI.java b/java/plasma/src/main/java/org/apache/arrow/plasma/PlasmaClientJNI.java index 4f7598eae22..166172826af 100644 --- a/java/plasma/src/main/java/org/apache/arrow/plasma/PlasmaClientJNI.java +++ b/java/plasma/src/main/java/org/apache/arrow/plasma/PlasmaClientJNI.java @@ -17,6 +17,9 @@ package org.apache.arrow.plasma; +import org.apache.arrow.plasma.exceptions.DuplicateObjectException; +import org.apache.arrow.plasma.exceptions.PlasmaOutOfMemoryException; + import java.nio.ByteBuffer; /** @@ -28,7 +31,8 @@ public class PlasmaClientJNI { public static native void disconnect(long conn); - public static native ByteBuffer create(long conn, byte[] objectId, int size, byte[] metadata); + public static native ByteBuffer create(long conn, byte[] objectId, int size, byte[] metadata) + throws DuplicateObjectException, PlasmaOutOfMemoryException; public static native byte[] hash(long conn, byte[] objectId); diff --git a/java/plasma/src/main/java/org/apache/arrow/plasma/PlasmaOutOfMemoryException.java b/java/plasma/src/main/java/org/apache/arrow/plasma/PlasmaOutOfMemoryException.java new file mode 100644 index 00000000000..b9186f456ff --- /dev/null +++ b/java/plasma/src/main/java/org/apache/arrow/plasma/PlasmaOutOfMemoryException.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.arrow.plasma.exceptions; + +public class PlasmaOutOfMemoryException extends RuntimeException { + + public PlasmaOutOfMemoryException () { + super("The plasma store ran out of memory and could not create object with ID."); + } + + public PlasmaOutOfMemoryException (Throwable t) { + super("The plasma store ran out of memory and could not create object with ID.", t); + } + +} \ No newline at end of file From 4710d59409699fc26c77cafad96dd179d62c78da Mon Sep 17 00:00:00 2001 From: yl187661 Date: Fri, 4 Jan 2019 17:26:43 +0800 Subject: [PATCH 2/9] fix --- .../java/org_apache_arrow_plasma_PlasmaClientJNI.cc | 2 +- .../org/apache/arrow/plasma/ObjectStoreLink.java | 4 +++- .../java/org/apache/arrow/plasma/PlasmaClient.java | 11 ++++++----- .../org/apache/arrow/plasma/PlasmaClientJNI.java | 4 ++-- .../{ => exceptions}/DuplicateObjectException.java | 8 ++++---- .../{ => exceptions}/PlasmaOutOfMemoryException.java | 12 ++++++------ 6 files changed, 22 insertions(+), 19 deletions(-) rename java/plasma/src/main/java/org/apache/arrow/plasma/{ => exceptions}/DuplicateObjectException.java (89%) rename java/plasma/src/main/java/org/apache/arrow/plasma/{ => exceptions}/PlasmaOutOfMemoryException.java (77%) diff --git a/cpp/src/plasma/lib/java/org_apache_arrow_plasma_PlasmaClientJNI.cc b/cpp/src/plasma/lib/java/org_apache_arrow_plasma_PlasmaClientJNI.cc index 5308e0e92d8..4afd49daf85 100644 --- a/cpp/src/plasma/lib/java/org_apache_arrow_plasma_PlasmaClientJNI.cc +++ b/cpp/src/plasma/lib/java/org_apache_arrow_plasma_PlasmaClientJNI.cc @@ -112,7 +112,7 @@ JNIEXPORT jobject JNICALL Java_org_apache_arrow_plasma_PlasmaClientJNI_create( if (s.IsPlasmaStoreFull()) { jclass Exception = env->FindClass( "org/apache/arrow/plasma/exceptions/PlasmaOutOfMemoryException"); - env->ThrowNew(Exception, oid.hex().c_str()); + env->ThrowNew(Exception, ""); return nullptr; } ARROW_CHECK(s.ok()); diff --git a/java/plasma/src/main/java/org/apache/arrow/plasma/ObjectStoreLink.java b/java/plasma/src/main/java/org/apache/arrow/plasma/ObjectStoreLink.java index 1351b0b4c14..81fa3681f46 100644 --- a/java/plasma/src/main/java/org/apache/arrow/plasma/ObjectStoreLink.java +++ b/java/plasma/src/main/java/org/apache/arrow/plasma/ObjectStoreLink.java @@ -17,9 +17,11 @@ package org.apache.arrow.plasma; +import java.util.List; + import org.apache.arrow.plasma.exceptions.DuplicateObjectException; import org.apache.arrow.plasma.exceptions.PlasmaOutOfMemoryException; -import java.util.List; + /** * Object store interface, which provides the capabilities to put and get raw byte array, and serves. diff --git a/java/plasma/src/main/java/org/apache/arrow/plasma/PlasmaClient.java b/java/plasma/src/main/java/org/apache/arrow/plasma/PlasmaClient.java index 30b5a13a98c..24779d0077f 100644 --- a/java/plasma/src/main/java/org/apache/arrow/plasma/PlasmaClient.java +++ b/java/plasma/src/main/java/org/apache/arrow/plasma/PlasmaClient.java @@ -17,14 +17,15 @@ package org.apache.arrow.plasma; -import org.apache.arrow.plasma.exceptions.DuplicateObjectException; -import org.apache.arrow.plasma.exceptions.PlasmaOutOfMemoryException; - import java.nio.ByteBuffer; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; +import org.apache.arrow.plasma.exceptions.DuplicateObjectException; +import org.apache.arrow.plasma.exceptions.PlasmaOutOfMemoryException; + + + /** * The PlasmaClient is used to interface with a plasma store and manager. @@ -50,7 +51,7 @@ public PlasmaClient(String storeSocketName, String managerSocketName, int releas @Override public void put(byte[] objectId, byte[] value, byte[] metadata) throws DuplicateObjectException, PlasmaOutOfMemoryException { - ByteBuffer buf = PlasmaClientJNI.create(threadConn.get(), objectId, value.length, metadata); + ByteBuffer buf = PlasmaClientJNI.create(conn, objectId, value.length, metadata); buf.put(value); PlasmaClientJNI.seal(conn, objectId); PlasmaClientJNI.release(conn, objectId); diff --git a/java/plasma/src/main/java/org/apache/arrow/plasma/PlasmaClientJNI.java b/java/plasma/src/main/java/org/apache/arrow/plasma/PlasmaClientJNI.java index 166172826af..7f8cf8287e5 100644 --- a/java/plasma/src/main/java/org/apache/arrow/plasma/PlasmaClientJNI.java +++ b/java/plasma/src/main/java/org/apache/arrow/plasma/PlasmaClientJNI.java @@ -17,11 +17,11 @@ package org.apache.arrow.plasma; +import java.nio.ByteBuffer; + import org.apache.arrow.plasma.exceptions.DuplicateObjectException; import org.apache.arrow.plasma.exceptions.PlasmaOutOfMemoryException; -import java.nio.ByteBuffer; - /** * JNI static methods for PlasmaClient. */ diff --git a/java/plasma/src/main/java/org/apache/arrow/plasma/DuplicateObjectException.java b/java/plasma/src/main/java/org/apache/arrow/plasma/exceptions/DuplicateObjectException.java similarity index 89% rename from java/plasma/src/main/java/org/apache/arrow/plasma/DuplicateObjectException.java rename to java/plasma/src/main/java/org/apache/arrow/plasma/exceptions/DuplicateObjectException.java index 18f87d2149d..464d54d6d5b 100644 --- a/java/plasma/src/main/java/org/apache/arrow/plasma/DuplicateObjectException.java +++ b/java/plasma/src/main/java/org/apache/arrow/plasma/exceptions/DuplicateObjectException.java @@ -14,16 +14,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.arrow.plasma.exceptions; public class DuplicateObjectException extends RuntimeException { - public DuplicateObjectException (String objectId) { + public DuplicateObjectException(String objectId) { super("An object with ID " + objectId + " already exists in the plasma store."); } - public DuplicateObjectException (String objectId, Throwable t) { + public DuplicateObjectException(String objectId, Throwable t) { super("An object with ID " + objectId + " already exists in the plasma store.", t); } - -} \ No newline at end of file +} diff --git a/java/plasma/src/main/java/org/apache/arrow/plasma/PlasmaOutOfMemoryException.java b/java/plasma/src/main/java/org/apache/arrow/plasma/exceptions/PlasmaOutOfMemoryException.java similarity index 77% rename from java/plasma/src/main/java/org/apache/arrow/plasma/PlasmaOutOfMemoryException.java rename to java/plasma/src/main/java/org/apache/arrow/plasma/exceptions/PlasmaOutOfMemoryException.java index b9186f456ff..831a4caf628 100644 --- a/java/plasma/src/main/java/org/apache/arrow/plasma/PlasmaOutOfMemoryException.java +++ b/java/plasma/src/main/java/org/apache/arrow/plasma/exceptions/PlasmaOutOfMemoryException.java @@ -14,16 +14,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.arrow.plasma.exceptions; public class PlasmaOutOfMemoryException extends RuntimeException { - public PlasmaOutOfMemoryException () { - super("The plasma store ran out of memory and could not create object with ID."); + public PlasmaOutOfMemoryException() { + super("The plasma store ran out of memory."); } - public PlasmaOutOfMemoryException (Throwable t) { - super("The plasma store ran out of memory and could not create object with ID.", t); + public PlasmaOutOfMemoryException(Throwable t) { + super("The plasma store ran out of memory.", t); } - -} \ No newline at end of file +} From 5699eff383315703cfaacc9b8f631679027cb103 Mon Sep 17 00:00:00 2001 From: yl187661 Date: Fri, 4 Jan 2019 18:22:00 +0800 Subject: [PATCH 3/9] blank line --- .../src/main/java/org/apache/arrow/plasma/ObjectStoreLink.java | 1 - .../src/main/java/org/apache/arrow/plasma/PlasmaClient.java | 3 --- 2 files changed, 4 deletions(-) diff --git a/java/plasma/src/main/java/org/apache/arrow/plasma/ObjectStoreLink.java b/java/plasma/src/main/java/org/apache/arrow/plasma/ObjectStoreLink.java index 81fa3681f46..f933c85b836 100644 --- a/java/plasma/src/main/java/org/apache/arrow/plasma/ObjectStoreLink.java +++ b/java/plasma/src/main/java/org/apache/arrow/plasma/ObjectStoreLink.java @@ -22,7 +22,6 @@ import org.apache.arrow.plasma.exceptions.DuplicateObjectException; import org.apache.arrow.plasma.exceptions.PlasmaOutOfMemoryException; - /** * Object store interface, which provides the capabilities to put and get raw byte array, and serves. */ diff --git a/java/plasma/src/main/java/org/apache/arrow/plasma/PlasmaClient.java b/java/plasma/src/main/java/org/apache/arrow/plasma/PlasmaClient.java index 24779d0077f..a708f41853d 100644 --- a/java/plasma/src/main/java/org/apache/arrow/plasma/PlasmaClient.java +++ b/java/plasma/src/main/java/org/apache/arrow/plasma/PlasmaClient.java @@ -24,9 +24,6 @@ import org.apache.arrow.plasma.exceptions.DuplicateObjectException; import org.apache.arrow.plasma.exceptions.PlasmaOutOfMemoryException; - - - /** * The PlasmaClient is used to interface with a plasma store and manager. * From acc7c06692932d42d8ea1efa76d49fe69fefbbff Mon Sep 17 00:00:00 2001 From: yl187661 Date: Fri, 4 Jan 2019 20:10:08 +0800 Subject: [PATCH 4/9] indentation --- .../lib/java/org_apache_arrow_plasma_PlasmaClientJNI.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cpp/src/plasma/lib/java/org_apache_arrow_plasma_PlasmaClientJNI.cc b/cpp/src/plasma/lib/java/org_apache_arrow_plasma_PlasmaClientJNI.cc index 4afd49daf85..e1c72915655 100644 --- a/cpp/src/plasma/lib/java/org_apache_arrow_plasma_PlasmaClientJNI.cc +++ b/cpp/src/plasma/lib/java/org_apache_arrow_plasma_PlasmaClientJNI.cc @@ -104,15 +104,15 @@ JNIEXPORT jobject JNICALL Java_org_apache_arrow_plasma_PlasmaClientJNI_create( std::shared_ptr data; Status s = client->Create(oid, size, md, md_size, &data); if (s.IsPlasmaObjectExists()) { - jclass Exception = env->FindClass( + jclass exceptionClass = env->FindClass( "org/apache/arrow/plasma/exceptions/DuplicateObjectException"); - env->ThrowNew(Exception, oid.hex().c_str()); + env->ThrowNew(exceptionClass, oid.hex().c_str()); return nullptr; } if (s.IsPlasmaStoreFull()) { - jclass Exception = env->FindClass( + jclass exceptionClass = env->FindClass( "org/apache/arrow/plasma/exceptions/PlasmaOutOfMemoryException"); - env->ThrowNew(Exception, ""); + env->ThrowNew(exceptionClass, ""); return nullptr; } ARROW_CHECK(s.ok()); From 10ff110f425421a544abce15894f2771ea38480c Mon Sep 17 00:00:00 2001 From: yl187661 Date: Fri, 4 Jan 2019 20:34:02 +0800 Subject: [PATCH 5/9] plasmaClientTest catch duplicate object exception --- .../java/org/apache/arrow/plasma/PlasmaClientTest.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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 70e277a61e4..a82d8db739f 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 @@ -23,6 +23,8 @@ import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; +import org.apache.arrow.plasma.exceptions.DuplicateObjectException; + public class PlasmaClientTest { private String storeSuffix = "/tmp/store"; @@ -142,8 +144,11 @@ public void doTest() { assert Arrays.equals(values.get(0), value1); assert Arrays.equals(values.get(1), value2); System.out.println("Plasma java client get multi-object test success."); - pLink.put(id1, value1, null); - System.out.println("Plasma java client put same object twice exception test success."); + try { + pLink.put(id1, value1, null); + } catch (DuplicateObjectException e) { + System.out.println("Plasma java client put same object twice exception test success."); + } byte[] id1Hash = pLink.hash(id1); assert id1Hash != null; System.out.println("Plasma java client hash test success."); From c4fe54fd3f0988ac8db383bbcc5072d7b3e6009c Mon Sep 17 00:00:00 2001 From: yl187661 Date: Mon, 7 Jan 2019 15:33:06 +0800 Subject: [PATCH 6/9] cpp lint --- .../lib/java/org_apache_arrow_plasma_PlasmaClientJNI.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cpp/src/plasma/lib/java/org_apache_arrow_plasma_PlasmaClientJNI.cc b/cpp/src/plasma/lib/java/org_apache_arrow_plasma_PlasmaClientJNI.cc index e1c72915655..a29b8df1942 100644 --- a/cpp/src/plasma/lib/java/org_apache_arrow_plasma_PlasmaClientJNI.cc +++ b/cpp/src/plasma/lib/java/org_apache_arrow_plasma_PlasmaClientJNI.cc @@ -105,13 +105,13 @@ JNIEXPORT jobject JNICALL Java_org_apache_arrow_plasma_PlasmaClientJNI_create( Status s = client->Create(oid, size, md, md_size, &data); if (s.IsPlasmaObjectExists()) { jclass exceptionClass = env->FindClass( - "org/apache/arrow/plasma/exceptions/DuplicateObjectException"); + "org/apache/arrow/plasma/exceptions/DuplicateObjectException"); env->ThrowNew(exceptionClass, oid.hex().c_str()); return nullptr; } if (s.IsPlasmaStoreFull()) { jclass exceptionClass = env->FindClass( - "org/apache/arrow/plasma/exceptions/PlasmaOutOfMemoryException"); + "org/apache/arrow/plasma/exceptions/PlasmaOutOfMemoryException"); env->ThrowNew(exceptionClass, ""); return nullptr; } From 5586036ac664c6ee99b4a087d3bbff4bb61354c5 Mon Sep 17 00:00:00 2001 From: yl187661 Date: Mon, 7 Jan 2019 16:27:52 +0800 Subject: [PATCH 7/9] cpp lint --- .../lib/java/org_apache_arrow_plasma_PlasmaClientJNI.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cpp/src/plasma/lib/java/org_apache_arrow_plasma_PlasmaClientJNI.cc b/cpp/src/plasma/lib/java/org_apache_arrow_plasma_PlasmaClientJNI.cc index a29b8df1942..8435907e8c9 100644 --- a/cpp/src/plasma/lib/java/org_apache_arrow_plasma_PlasmaClientJNI.cc +++ b/cpp/src/plasma/lib/java/org_apache_arrow_plasma_PlasmaClientJNI.cc @@ -104,14 +104,14 @@ JNIEXPORT jobject JNICALL Java_org_apache_arrow_plasma_PlasmaClientJNI_create( std::shared_ptr data; Status s = client->Create(oid, size, md, md_size, &data); if (s.IsPlasmaObjectExists()) { - jclass exceptionClass = env->FindClass( - "org/apache/arrow/plasma/exceptions/DuplicateObjectException"); + jclass exceptionClass = + env->FindClass("org/apache/arrow/plasma/exceptions/DuplicateObjectException"); env->ThrowNew(exceptionClass, oid.hex().c_str()); return nullptr; } if (s.IsPlasmaStoreFull()) { - jclass exceptionClass = env->FindClass( - "org/apache/arrow/plasma/exceptions/PlasmaOutOfMemoryException"); + jclass exceptionClass = + env->FindClass("org/apache/arrow/plasma/exceptions/PlasmaOutOfMemoryException"); env->ThrowNew(exceptionClass, ""); return nullptr; } From 88e1702baf04b0806cee53647ea74f28d9db1801 Mon Sep 17 00:00:00 2001 From: yl187661 Date: Mon, 7 Jan 2019 19:35:39 +0800 Subject: [PATCH 8/9] cpp lint --- .../lib/java/org_apache_arrow_plasma_PlasmaClientJNI.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cpp/src/plasma/lib/java/org_apache_arrow_plasma_PlasmaClientJNI.cc b/cpp/src/plasma/lib/java/org_apache_arrow_plasma_PlasmaClientJNI.cc index 8435907e8c9..1988742af9b 100644 --- a/cpp/src/plasma/lib/java/org_apache_arrow_plasma_PlasmaClientJNI.cc +++ b/cpp/src/plasma/lib/java/org_apache_arrow_plasma_PlasmaClientJNI.cc @@ -104,13 +104,13 @@ JNIEXPORT jobject JNICALL Java_org_apache_arrow_plasma_PlasmaClientJNI_create( std::shared_ptr data; Status s = client->Create(oid, size, md, md_size, &data); if (s.IsPlasmaObjectExists()) { - jclass exceptionClass = + jclass exceptionClass = env->FindClass("org/apache/arrow/plasma/exceptions/DuplicateObjectException"); env->ThrowNew(exceptionClass, oid.hex().c_str()); return nullptr; } if (s.IsPlasmaStoreFull()) { - jclass exceptionClass = + jclass exceptionClass = env->FindClass("org/apache/arrow/plasma/exceptions/PlasmaOutOfMemoryException"); env->ThrowNew(exceptionClass, ""); return nullptr; From 3e512b63c9748b22d7b3ab4ce27b9e53152b5748 Mon Sep 17 00:00:00 2001 From: yl187661 Date: Thu, 10 Jan 2019 20:20:40 +0800 Subject: [PATCH 9/9] add assert --- .../src/test/java/org/apache/arrow/plasma/PlasmaClientTest.java | 2 ++ 1 file changed, 2 insertions(+) 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 a82d8db739f..3f326d30d83 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 @@ -24,6 +24,7 @@ import java.util.stream.Collectors; import org.apache.arrow.plasma.exceptions.DuplicateObjectException; +import org.junit.Assert; public class PlasmaClientTest { @@ -146,6 +147,7 @@ public void doTest() { System.out.println("Plasma java client get multi-object test success."); try { pLink.put(id1, value1, null); + Assert.fail("Fail to throw DuplicateObjectException when put an object into plasma store twice."); } catch (DuplicateObjectException e) { System.out.println("Plasma java client put same object twice exception test success."); }