You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2019/04/04 11:27:21 UTC

[tinkerpop] branch tp33 updated: TINKERPOP-2179: Have SerializationException extend IOException

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

spmallette pushed a commit to branch tp33
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git


The following commit(s) were added to refs/heads/tp33 by this push:
     new 06cc959  TINKERPOP-2179: Have SerializationException extend IOException
     new b59d779  Merge pull request #1083 from newkek/TINKERPOP-2179
06cc959 is described below

commit 06cc9593149d8fd962fa7d063049b93fdfce8340
Author: Kevin Gallardo <ke...@datastax.com>
AuthorDate: Mon Mar 18 15:36:29 2019 -0400

    TINKERPOP-2179: Have SerializationException extend IOException
---
 .../gremlin/driver/ser/SerializationException.java |  8 +++++-
 .../driver/SerializationExceptionTest.java}        | 30 +++++++++++++++-------
 2 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/SerializationException.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/SerializationException.java
index bf40374..be555da 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/SerializationException.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/SerializationException.java
@@ -18,10 +18,12 @@
  */
 package org.apache.tinkerpop.gremlin.driver.ser;
 
+import java.io.IOException;
+
 /**
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
-public class SerializationException extends Exception {
+public class SerializationException extends IOException {
     public SerializationException(final String msg) {
         super(msg);
     }
@@ -29,4 +31,8 @@ public class SerializationException extends Exception {
     public SerializationException(final Throwable t) {
         super(t);
     }
+
+    public SerializationException(String message, Throwable cause) {
+        super(message, cause);
+    }
 }
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/SerializationException.java b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/SerializationExceptionTest.java
similarity index 53%
copy from gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/SerializationException.java
copy to gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/SerializationExceptionTest.java
index bf40374..ba25279 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/SerializationException.java
+++ b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/SerializationExceptionTest.java
@@ -16,17 +16,29 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.tinkerpop.gremlin.driver.ser;
+package org.apache.tinkerpop.gremlin.driver;
 
-/**
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public class SerializationException extends Exception {
-    public SerializationException(final String msg) {
-        super(msg);
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
+import org.junit.Test;
+
+import java.io.IOException;
+
+public class SerializationExceptionTest {
+
+    @Test
+    public void testSerializationException() {
+        try {
+            throwException();
+            fail("Serialization exception should have been thrown and caught");
+        } catch (IOException e) {
+            assertEquals(e.getMessage(), "no bueno");
+        }
     }
 
-    public SerializationException(final Throwable t) {
-        super(t);
+    private static void throwException() throws SerializationException {
+        throw new SerializationException("no bueno");
     }
 }