cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntimof...@apache.org
Subject [3/4] cayenne git commit: Merge PR #332
Date Thu, 18 Oct 2018 13:30:22 GMT
Merge PR #332


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/adf9a80b
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/adf9a80b
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/adf9a80b

Branch: refs/heads/master
Commit: adf9a80b2de93d743c3ce31197a494a2b0a05a98
Parents: f8dfaa0
Author: Nikita Timofeev <stariy95@gmail.com>
Authored: Thu Oct 18 16:29:36 2018 +0300
Committer: Nikita Timofeev <stariy95@gmail.com>
Committed: Thu Oct 18 16:29:36 2018 +0300

----------------------------------------------------------------------
 RELEASE-NOTES.txt                               |  1 +
 .../org/apache/cayenne/CayenneException.java    | 18 ++++-------------
 .../apache/cayenne/CayenneRuntimeException.java |  3 +++
 .../apache/cayenne/access/jdbc/BatchAction.java | 11 ++++++----
 .../cayenne/dba/oracle/OracleBatchAction.java   |  3 +--
 .../apache/cayenne/CayenneExceptionTest.java    | 21 ++++++++++----------
 6 files changed, 27 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/adf9a80b/RELEASE-NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index 714a8ff..3c2dfc5 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -20,6 +20,7 @@ CAY-2473 Modeler: cleanup attributes and relationship editors
 CAY-2474 Modeler: swap buttons in dialog toolbar
 CAY-2475 Modeler: move inheritance icon to name column in objAttr table and objRel table
 CAY-2481 Methods to return Object[] after SQLTemplate and SQLExec perform
+CAY-2487 Removed usage of CayenneException.
 
 Bug Fixes:
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/adf9a80b/cayenne-server/src/main/java/org/apache/cayenne/CayenneException.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/CayenneException.java b/cayenne-server/src/main/java/org/apache/cayenne/CayenneException.java
index e951da1..017cf35 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/CayenneException.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/CayenneException.java
@@ -19,32 +19,22 @@
 
 package org.apache.cayenne;
 
-import org.apache.cayenne.util.LocalizedStringsHandler;
-
 
 /**
- * @deprecated please @since 4.1 use {@link CayenneRuntimeException}
- *
  * A generic checked exception that may be thrown by Cayenne framework. All checked
  * exceptions in Cayenne inherit from this class.
+ *
+ * @deprecated since 4.1 use {@link CayenneRuntimeException} instead
  */
 @Deprecated
 public class CayenneException extends Exception {
 
-    private static String exceptionLabel;
-
-    static {
-        String version = LocalizedStringsHandler.getString("cayenne.version");
-        String date = LocalizedStringsHandler.getString("cayenne.build.date");
-        exceptionLabel = "[v." + version + " " + date + "] ";
-    }
-
     /**
-     *   @deprecated please @since 4.1 use {@link CayenneRuntimeException#getExceptionLabel()}
+     * @deprecated since 4.1 use {@link CayenneRuntimeException#getExceptionLabel()}
      */
     @Deprecated
     public static String getExceptionLabel() {
-        return exceptionLabel;
+        return CayenneRuntimeException.getExceptionLabel();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/cayenne/blob/adf9a80b/cayenne-server/src/main/java/org/apache/cayenne/CayenneRuntimeException.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/CayenneRuntimeException.java
b/cayenne-server/src/main/java/org/apache/cayenne/CayenneRuntimeException.java
index 1d06614..02a8e89 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/CayenneRuntimeException.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/CayenneRuntimeException.java
@@ -35,6 +35,9 @@ public class CayenneRuntimeException extends RuntimeException {
         exceptionLabel = "[v." + version + " " + date + "] ";
     }
 
+    /**
+     * @since 4.1 moved from deprecated {@link CayenneException}
+     */
     public static String getExceptionLabel() {
         return exceptionLabel;
     }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/adf9a80b/cayenne-server/src/main/java/org/apache/cayenne/access/jdbc/BatchAction.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/access/jdbc/BatchAction.java
b/cayenne-server/src/main/java/org/apache/cayenne/access/jdbc/BatchAction.java
index 132c6be..da5d942 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/access/jdbc/BatchAction.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/access/jdbc/BatchAction.java
@@ -19,7 +19,6 @@
 
 package org.apache.cayenne.access.jdbc;
 
-import org.apache.cayenne.CayenneRuntimeException;
 import org.apache.cayenne.ResultIterator;
 import org.apache.cayenne.access.DataNode;
 import org.apache.cayenne.access.OperationObserver;
@@ -36,7 +35,11 @@ import org.apache.cayenne.query.BatchQuery;
 import org.apache.cayenne.query.BatchQueryRow;
 import org.apache.cayenne.query.InsertBatchQuery;
 
-import java.sql.*;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
 import java.util.Collection;
 import java.util.Collections;
 
@@ -88,7 +91,7 @@ public class BatchAction extends BaseSQLAction {
 		}
 	}
 
-	protected BatchTranslator createTranslator() throws CayenneRuntimeException {
+	protected BatchTranslator createTranslator() {
 		return dataNode.batchTranslator(query, null);
 	}
 
@@ -219,7 +222,7 @@ public class BatchAction extends BaseSQLAction {
 	 */
 	@SuppressWarnings({ "rawtypes", "unchecked" })
 	protected void processGeneratedKeys(Statement statement, OperationObserver observer, BatchQueryRow
row)
-			throws SQLException, CayenneRuntimeException {
+			throws SQLException {
 
 		ResultSet keysRS = statement.getGeneratedKeys();
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/adf9a80b/cayenne-server/src/main/java/org/apache/cayenne/dba/oracle/OracleBatchAction.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/dba/oracle/OracleBatchAction.java
b/cayenne-server/src/main/java/org/apache/cayenne/dba/oracle/OracleBatchAction.java
index b55f960..5c1f670 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/dba/oracle/OracleBatchAction.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/dba/oracle/OracleBatchAction.java
@@ -19,7 +19,6 @@
 
 package org.apache.cayenne.dba.oracle;
 
-import org.apache.cayenne.CayenneRuntimeException;
 import org.apache.cayenne.access.DataNode;
 import org.apache.cayenne.access.jdbc.BatchAction;
 import org.apache.cayenne.access.translator.batch.BatchTranslator;
@@ -38,7 +37,7 @@ class OracleBatchAction extends BatchAction {
     }
 
     @Override
-    protected BatchTranslator createTranslator() throws CayenneRuntimeException {
+    protected BatchTranslator createTranslator() {
         return dataNode.batchTranslator(query, OracleAdapter.TRIM_FUNCTION);
     }
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/adf9a80b/cayenne-server/src/test/java/org/apache/cayenne/CayenneExceptionTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/CayenneExceptionTest.java b/cayenne-server/src/test/java/org/apache/cayenne/CayenneExceptionTest.java
index 4772faa..d41ca73 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/CayenneExceptionTest.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/CayenneExceptionTest.java
@@ -26,49 +26,50 @@ import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
 
+@Deprecated
 public class CayenneExceptionTest {
 
     @Test
     public void testConstructor1() throws Exception {
-        CayenneRuntimeException ex = new CayenneRuntimeException();
+        CayenneException ex = new CayenneException();
         assertNull(ex.getCause());
-        assertTrue(ex.getMessage().startsWith(CayenneRuntimeException.getExceptionLabel()));
+        assertTrue(ex.getMessage().startsWith(CayenneException.getExceptionLabel()));
     }
 
     @Test
     public void testConstructor2() throws Exception {
-        CayenneRuntimeException ex = new CayenneRuntimeException("abc");
+        CayenneException ex = new CayenneException("abc");
         assertNull(ex.getCause());
-        assertEquals(CayenneRuntimeException.getExceptionLabel() + "abc", ex.getMessage());
+        assertEquals(CayenneException.getExceptionLabel() + "abc", ex.getMessage());
     }
 
     @Test
     public void testConstructor3() throws Exception {
         Throwable cause = new Throwable();
-        CayenneRuntimeException ex = new CayenneRuntimeException(cause);
+        CayenneException ex = new CayenneException(cause);
         assertSame(cause, ex.getCause());
-        assertEquals(CayenneRuntimeException.getExceptionLabel() + cause.toString(), ex
+        assertEquals(CayenneException.getExceptionLabel() + cause.toString(), ex
                 .getMessage());
     }
 
     @Test
     public void testConstructor4() throws Exception {
         Throwable cause = new Throwable();
-        CayenneRuntimeException ex = new CayenneRuntimeException("abc", cause);
+        CayenneException ex = new CayenneException("abc", cause);
         assertSame(cause, ex.getCause());
-        assertEquals(CayenneRuntimeException.getExceptionLabel() + "abc", ex.getMessage());
+        assertEquals(CayenneException.getExceptionLabel() + "abc", ex.getMessage());
     }
 
     @Test
     public void testMessageFormatting1() throws Exception {
-        CayenneRuntimeException ex = new CayenneRuntimeException("x%sx%sx", "a", "b");
+        CayenneException ex = new CayenneException("x%sx%sx", "a", "b");
         assertEquals("xaxbx", ex.getUnlabeledMessage());
     }
 
     @Test
     public void testMessageFormatting2() throws Exception {
         Throwable cause = new Throwable();
-        CayenneRuntimeException ex = new CayenneRuntimeException("x%sx%sx", cause, "a", "b");
+        CayenneException ex = new CayenneException("x%sx%sx", cause, "a", "b");
         assertEquals("xaxbx", ex.getUnlabeledMessage());
     }
 }


Mime
View raw message