commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r883431 - in /commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp: DelegatingDatabaseMetaData.java DelegatingPreparedStatement.java DelegatingStatement.java
Date Mon, 23 Nov 2009 17:40:58 GMT
Author: sebb
Date: Mon Nov 23 17:40:58 2009
New Revision: 883431

URL: http://svn.apache.org/viewvc?rev=883431&view=rev
Log:
Don't return null from @NonNull methods: return should never be reached anyway, so throw AssertionError
instead

Modified:
    commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/DelegatingDatabaseMetaData.java
    commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/DelegatingPreparedStatement.java
    commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/DelegatingStatement.java

Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/DelegatingDatabaseMetaData.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/DelegatingDatabaseMetaData.java?rev=883431&r1=883430&r2=883431&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/DelegatingDatabaseMetaData.java
(original)
+++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/DelegatingDatabaseMetaData.java
Mon Nov 23 17:40:58 2009
@@ -156,7 +156,7 @@
         }
         catch (SQLException e) {
             handleException(e);
-            return null;
+            throw new AssertionError();
         }
     }
 
@@ -170,18 +170,18 @@
         }
         catch (SQLException e) {
             handleException(e);
-            return null;
+            throw new AssertionError();
         }
     }
 
     public String getCatalogSeparator() throws SQLException {
         { try { return _meta.getCatalogSeparator(); }
-        catch (SQLException e) { handleException(e); return null; } }
+        catch (SQLException e) { handleException(e); throw new AssertionError(); } }
     }
 
     public String getCatalogTerm() throws SQLException {
         { try { return _meta.getCatalogTerm(); }
-        catch (SQLException e) { handleException(e); return null; } }
+        catch (SQLException e) { handleException(e); throw new AssertionError(); } }
     }
 
     public ResultSet getCatalogs() throws SQLException {
@@ -192,7 +192,7 @@
         }
         catch (SQLException e) {
             handleException(e);
-            return null;
+            throw new AssertionError();
         }
     }
 
@@ -206,7 +206,7 @@
         }
         catch (SQLException e) {
             handleException(e);
-            return null;
+            throw new AssertionError();
         }
     }
 
@@ -221,7 +221,7 @@
         }
         catch (SQLException e) {
             handleException(e);
-            return null;
+            throw new AssertionError();
         }
     }
 
@@ -241,7 +241,7 @@
         }
         catch (SQLException e) {
             handleException(e);
-            return null;
+            throw new AssertionError();
         }
     }
 
@@ -257,12 +257,12 @@
 
     public String getDatabaseProductName() throws SQLException {
         { try { return _meta.getDatabaseProductName(); }
-        catch (SQLException e) { handleException(e); return null; } }
+        catch (SQLException e) { handleException(e); throw new AssertionError(); } }
     }
 
     public String getDatabaseProductVersion() throws SQLException {
         { try { return _meta.getDatabaseProductVersion(); }
-        catch (SQLException e) { handleException(e); return null; } }
+        catch (SQLException e) { handleException(e); throw new AssertionError(); } }
     }
 
     public int getDefaultTransactionIsolation() throws SQLException {
@@ -276,12 +276,12 @@
 
     public String getDriverName() throws SQLException {
         { try { return _meta.getDriverName(); }
-        catch (SQLException e) { handleException(e); return null; } }
+        catch (SQLException e) { handleException(e); throw new AssertionError(); } }
     }
 
     public String getDriverVersion() throws SQLException {
         { try { return _meta.getDriverVersion(); }
-        catch (SQLException e) { handleException(e); return null; } }
+        catch (SQLException e) { handleException(e); throw new AssertionError(); } }
     }
 
     public ResultSet getExportedKeys(String catalog, String schema, String table)
@@ -293,18 +293,18 @@
         }
         catch (SQLException e) {
             handleException(e);
-            return null;
+            throw new AssertionError();
         }
     }
 
     public String getExtraNameCharacters() throws SQLException {
         { try { return _meta.getExtraNameCharacters(); }
-        catch (SQLException e) { handleException(e); return null; } }
+        catch (SQLException e) { handleException(e); throw new AssertionError(); } }
     }
 
     public String getIdentifierQuoteString() throws SQLException {
         { try { return _meta.getIdentifierQuoteString(); }
-        catch (SQLException e) { handleException(e); return null; } }
+        catch (SQLException e) { handleException(e); throw new AssertionError(); } }
     }
 
     public ResultSet getImportedKeys(String catalog, String schema, String table)
@@ -316,7 +316,7 @@
         }
         catch (SQLException e) {
             handleException(e);
-            return null;
+            throw new AssertionError();
         }
     }
 
@@ -330,7 +330,7 @@
         }
         catch (SQLException e) {
             handleException(e);
-            return null;
+            throw new AssertionError();
         }
     }
 
@@ -446,7 +446,7 @@
 
     public String getNumericFunctions() throws SQLException {
         { try { return _meta.getNumericFunctions(); }
-        catch (SQLException e) { handleException(e); return null; } }
+        catch (SQLException e) { handleException(e); throw new AssertionError(); } }
     }
 
     public ResultSet getPrimaryKeys(String catalog, String schema, String table)
@@ -458,7 +458,7 @@
         }
         catch (SQLException e) {
             handleException(e);
-            return null;
+            throw new AssertionError();
         }
     }
 
@@ -473,13 +473,13 @@
         }
         catch (SQLException e) {
             handleException(e);
-            return null;
+            throw new AssertionError();
         }
     }
 
     public String getProcedureTerm() throws SQLException {
         { try { return _meta.getProcedureTerm(); }
-        catch (SQLException e) { handleException(e); return null; } }
+        catch (SQLException e) { handleException(e); throw new AssertionError(); } }
     }
 
     public ResultSet getProcedures(String catalog, String schemaPattern,
@@ -492,7 +492,7 @@
         }
         catch (SQLException e) {
             handleException(e);
-            return null;
+            throw new AssertionError();
         }
     }
 
@@ -503,7 +503,7 @@
 
     public String getSQLKeywords() throws SQLException {
         { try { return _meta.getSQLKeywords(); }
-        catch (SQLException e) { handleException(e); return null; } }
+        catch (SQLException e) { handleException(e); throw new AssertionError(); } }
     }
 
     public int getSQLStateType() throws SQLException {
@@ -513,7 +513,7 @@
 
     public String getSchemaTerm() throws SQLException {
         { try { return _meta.getSchemaTerm(); }
-        catch (SQLException e) { handleException(e); return null; } }
+        catch (SQLException e) { handleException(e); throw new AssertionError(); } }
     }
 
     public ResultSet getSchemas() throws SQLException {
@@ -524,18 +524,18 @@
         }
         catch (SQLException e) {
             handleException(e);
-            return null;
+            throw new AssertionError();
         }
     }
 
     public String getSearchStringEscape() throws SQLException {
         { try { return _meta.getSearchStringEscape(); }
-        catch (SQLException e) { handleException(e); return null; } }
+        catch (SQLException e) { handleException(e); throw new AssertionError(); } }
     }
 
     public String getStringFunctions() throws SQLException {
         { try { return _meta.getStringFunctions(); }
-        catch (SQLException e) { handleException(e); return null; } }
+        catch (SQLException e) { handleException(e); throw new AssertionError(); } }
     }
 
     public ResultSet getSuperTables(String catalog, String schemaPattern,
@@ -548,7 +548,7 @@
         }
         catch (SQLException e) {
             handleException(e);
-            return null;
+            throw new AssertionError();
         }
     }
 
@@ -562,13 +562,13 @@
         }
         catch (SQLException e) {
             handleException(e);
-            return null;
+            throw new AssertionError();
         }
     }
 
     public String getSystemFunctions() throws SQLException {
         { try { return _meta.getSystemFunctions(); }
-        catch (SQLException e) { handleException(e); return null; } }
+        catch (SQLException e) { handleException(e); throw new AssertionError(); } }
     }
 
     public ResultSet getTablePrivileges(String catalog, String schemaPattern,
@@ -581,7 +581,7 @@
         }
         catch (SQLException e) {
             handleException(e);
-            return null;
+            throw new AssertionError();
         }
     }
 
@@ -593,7 +593,7 @@
         }
         catch (SQLException e) {
             handleException(e);
-            return null;
+            throw new AssertionError();
         }
     }
 
@@ -607,13 +607,13 @@
         }
         catch (SQLException e) {
             handleException(e);
-            return null;
+            throw new AssertionError();
         }
     }
 
     public String getTimeDateFunctions() throws SQLException {
         { try { return _meta.getTimeDateFunctions(); }
-        catch (SQLException e) { handleException(e); return null; } }
+        catch (SQLException e) { handleException(e); throw new AssertionError(); } }
     }
 
     public ResultSet getTypeInfo() throws SQLException {
@@ -624,7 +624,7 @@
         }
         catch (SQLException e) {
             handleException(e);
-            return null;
+            throw new AssertionError();
         }
     }
 
@@ -638,18 +638,18 @@
         }
         catch (SQLException e) {
             handleException(e);
-            return null;
+            throw new AssertionError();
         }
     }
 
     public String getURL() throws SQLException {
         { try { return _meta.getURL(); }
-        catch (SQLException e) { handleException(e); return null; } }
+        catch (SQLException e) { handleException(e); throw new AssertionError(); } }
     }
 
     public String getUserName() throws SQLException {
         { try { return _meta.getUserName(); }
-        catch (SQLException e) { handleException(e); return null; } }
+        catch (SQLException e) { handleException(e); throw new AssertionError(); } }
     }
 
     public ResultSet getVersionColumns(String catalog, String schema,
@@ -661,7 +661,7 @@
         }
         catch (SQLException e) {
             handleException(e);
-            return null;
+            throw new AssertionError();
         }
     }
 
@@ -1139,7 +1139,7 @@
     
     public RowIdLifetime getRowIdLifetime() throws SQLException {
         { try { return _meta.getRowIdLifetime(); }
-        catch (SQLException e) { handleException(e); return null; } }
+        catch (SQLException e) { handleException(e); throw new AssertionError(); } }
     }
 
     public ResultSet getSchemas(String catalog, String schemaPattern)
@@ -1151,7 +1151,7 @@
         }
         catch (SQLException e) {
             handleException(e);
-            return null;
+            throw new AssertionError();
         }
     }
 
@@ -1173,7 +1173,7 @@
         }
         catch (SQLException e) {
             handleException(e);
-            return null;
+            throw new AssertionError();
         }
     }
 
@@ -1187,7 +1187,7 @@
         }
         catch (SQLException e) {
             handleException(e);
-            return null;
+            throw new AssertionError();
         }
     }
 
@@ -1202,7 +1202,7 @@
         }
         catch (SQLException e) {
             handleException(e);
-            return null;
+            throw new AssertionError();
         }
     }
 

Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/DelegatingPreparedStatement.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/DelegatingPreparedStatement.java?rev=883431&r1=883430&r2=883431&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/DelegatingPreparedStatement.java
(original)
+++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/DelegatingPreparedStatement.java
Mon Nov 23 17:40:58 2009
@@ -97,7 +97,7 @@
         }
         catch (SQLException e) {
             handleException(e);
-            return null;
+            throw new AssertionError();
         }
     }
 
@@ -190,7 +190,7 @@
     { checkOpen(); try { ((PreparedStatement)_stmt).setArray(i,x); } catch (SQLException
e) { handleException(e); } }
 
     public ResultSetMetaData getMetaData() throws SQLException
-    { checkOpen(); try { return ((PreparedStatement)_stmt).getMetaData(); } catch (SQLException
e) { handleException(e); return null; } }
+    { checkOpen(); try { return ((PreparedStatement)_stmt).getMetaData(); } catch (SQLException
e) { handleException(e); throw new AssertionError(); } }
 
     public void setDate(int parameterIndex, java.sql.Date x, Calendar cal) throws SQLException
     { checkOpen(); try { ((PreparedStatement)_stmt).setDate(parameterIndex,x,cal); } catch
(SQLException e) { handleException(e); } }
@@ -223,7 +223,7 @@
     { checkOpen(); try { ((PreparedStatement)_stmt).setURL(parameterIndex, x); } catch (SQLException
e) { handleException(e); } }
 
     public java.sql.ParameterMetaData getParameterMetaData() throws SQLException
-    { checkOpen(); try { return ((PreparedStatement)_stmt).getParameterMetaData(); } catch
(SQLException e) { handleException(e); return null; } }
+    { checkOpen(); try { return ((PreparedStatement)_stmt).getParameterMetaData(); } catch
(SQLException e) { handleException(e); throw new AssertionError(); } }
 /* JDBC_3_ANT_KEY_END */
 /* JDBC_4_ANT_KEY_BEGIN */
 

Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/DelegatingStatement.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/DelegatingStatement.java?rev=883431&r1=883430&r2=883431&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/DelegatingStatement.java (original)
+++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/DelegatingStatement.java Mon
Nov 23 17:40:58 2009
@@ -205,7 +205,7 @@
         }
         catch (SQLException e) {
             handleException(e);
-            return null;
+            throw new AssertionError();
         }
     }
 
@@ -216,7 +216,7 @@
         }
         catch (SQLException e) {
             handleException(e);
-            return null;
+            throw new AssertionError();
         }
     }
 
@@ -248,7 +248,7 @@
     { checkOpen(); try { _stmt.cancel(); } catch (SQLException e) { handleException(e); }
}
 
     public SQLWarning getWarnings() throws SQLException
-    { checkOpen(); try { return _stmt.getWarnings(); } catch (SQLException e) { handleException(e);
return null; } }
+    { checkOpen(); try { return _stmt.getWarnings(); } catch (SQLException e) { handleException(e);
throw new AssertionError(); } }
 
     public void clearWarnings() throws SQLException
     { checkOpen(); try { _stmt.clearWarnings(); } catch (SQLException e) { handleException(e);
} }
@@ -290,7 +290,7 @@
     { checkOpen(); try { _stmt.clearBatch(); } catch (SQLException e) { handleException(e);
} }
 
     public int[] executeBatch() throws SQLException
-    { checkOpen(); try { return _stmt.executeBatch(); } catch (SQLException e) { handleException(e);
return null; } }
+    { checkOpen(); try { return _stmt.executeBatch(); } catch (SQLException e) { handleException(e);
throw new AssertionError(); } }
 
     /**
      * Returns a String representation of this object.
@@ -316,7 +316,7 @@
             return DelegatingResultSet.wrapResultSet(this, _stmt.getGeneratedKeys());
         } catch (SQLException e) {
             handleException(e);
-            return null;
+            throw new AssertionError();
         }
     }
 



Mime
View raw message