db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davi...@apache.org
Subject svn commit: r230900 - in /db/derby/code/trunk/java: engine/org/apache/derby/iapi/error/ engine/org/apache/derby/impl/db/ engine/org/apache/derby/impl/services/monitor/ engine/org/apache/derby/impl/sql/conn/ engine/org/apache/derby/impl/sql/execute/ eng...
Date Mon, 08 Aug 2005 21:37:10 GMT
Author: davidvc
Date: Mon Aug  8 14:36:48 2005
New Revision: 230900

URL: http://svn.apache.org/viewcvs?rev=230900&view=rev
Log:
Submitting Dyre Tjeldvoll's patch for DERBY-336

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/error/StandardException.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/db/BasicDatabase.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/PersistentServiceImpl.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionFactory.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/JarUtil.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/RawStore.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/InputStreamContainer.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/RAFContainer.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/LogAccessFile.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/authorize.out

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/error/StandardException.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/iapi/error/StandardException.java?rev=230900&r1=230899&r2=230900&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/error/StandardException.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/error/StandardException.java Mon
Aug  8 14:36:48 2005
@@ -89,8 +89,8 @@
 
 		if (SanityManager.DEBUG)
 		{
-			SanityManager.ASSERT(messageID != null,
-					"StandardException with no messageID");
+                    SanityManager.ASSERT(messageID != null,
+                                         "StandardException with no messageID");
 		}
 	}
 
@@ -321,6 +321,35 @@
 		Object[] oa = new Object[] {a1, a2};
 		return new StandardException(messageID, oa);
 	}
+
+    /**
+     * Dummy exception to catch incorrect use of
+     * StandardException.newException(), at compile-time. If you get a
+     * compilation error because this exception isn't caught, it means
+     * that you are using StandardException.newException(...)
+     * incorrectly. The nested exception should always be the second
+     * argument.
+     * @see StandardException#newException(String, Object, Throwable)
+     * @see StandardException#newException(String, Object, Object, Throwable)
+     */
+    public static class BadMessageArgumentException extends Throwable {}
+
+    /**
+     * Dummy overload which should never be called. Only used to
+     * detect incorrect usage, at compile time.
+     * @param messageID - the sql state id of the message
+     * @param a1 - Message arg
+     * @param t - Incorrectly placed exception to be nested
+     * @return nothing - always throws
+     * @throws BadMessageArgumentException - always (dummy)
+     */
+    public static StandardException newException(String messageID, 
+                                                 Object a1, 
+                                                 Throwable t) 
+        throws BadMessageArgumentException {
+        throw new BadMessageArgumentException();
+    }
+
 	public static StandardException newException(String messageID, Throwable t, Object a1, Object
a2) {
 		Object[] oa = new Object[] {a1, a2};
 		return new StandardException(messageID, t, oa);
@@ -332,6 +361,25 @@
 		Object[] oa = new Object[] {a1, a2, a3};
 		return new StandardException(messageID, oa);
 	}
+    
+    /**
+     * Dummy overload which should never be called. Only used to
+     * detect incorrect usage, at compile time.
+     * @param messageID - the sql state id of the message
+     * @param a1 - First message arg
+     * @param a2 - Second message arg
+     * @param t - Incorrectly placed exception to be nested
+     * @return nothing - always throws
+     * @throws BadMessageArgumentException - always (dummy)
+     */
+    public static StandardException newException(String messageID, 
+                                                 Object a1, 
+                                                 Object a2,
+                                                 Throwable t) 
+        throws BadMessageArgumentException {
+        throw new BadMessageArgumentException(); 
+    }
+
 	public static StandardException newException(String messageID, Throwable t, Object a1, Object
a2, Object a3) {
 		Object[] oa = new Object[] {a1, a2, a3};
 		return new StandardException(messageID, t, oa);
@@ -589,6 +637,7 @@
 	public String getMessage() {
 		if (textMessage == null)
 			textMessage = MessageService.getCompleteMessage(getMessageId(), getArguments());
+
 		return textMessage;
 	}
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/db/BasicDatabase.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/db/BasicDatabase.java?rev=230900&r1=230899&r2=230900&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/db/BasicDatabase.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/db/BasicDatabase.java Mon Aug  8
14:36:48 2005
@@ -826,7 +826,7 @@
 		try {
 			return fr.getAsStream(externalName, generationId);
 		} catch (java.io.IOException ioe) {
-			throw StandardException.newException(SQLState.LANG_FILE_ERROR, ioe.toString(),ioe);	
+            throw StandardException.newException(SQLState.LANG_FILE_ERROR, ioe, ioe.toString());
   
 		}
 	}
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/PersistentServiceImpl.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/PersistentServiceImpl.java?rev=230900&r1=230899&r2=230900&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/PersistentServiceImpl.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/PersistentServiceImpl.java
Mon Aug  8 14:36:48 2005
@@ -673,8 +673,7 @@
                                     throw ioe;
                                 }
                             }
-                            throw StandardException.newException(SQLState.SERVICE_DIRECTORY_CREATE_ERROR,
-                                                                 serviceDirectory, null);
+                            throw StandardException.newException(SQLState.SERVICE_DIRECTORY_CREATE_ERROR,
serviceDirectory);
                         }
                         finally { storageFactory.shutdown(); }
                     }
@@ -689,7 +688,7 @@
                 throw (StandardException) t;
         }
 
-        throw StandardException.newException(SQLState.SERVICE_DIRECTORY_CREATE_ERROR, name,
t);
+        throw StandardException.newException(SQLState.SERVICE_DIRECTORY_CREATE_ERROR, t,
name);
     } // end of createServiceRoot
 
     private String getDirectoryPath( String name)

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionFactory.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionFactory.java?rev=230900&r1=230899&r2=230900&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionFactory.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionFactory.java
Mon Aug  8 14:36:48 2005
@@ -412,7 +412,7 @@
 			String[] newList_a;
 			try {newList_a = IdUtil.parseIdList(value_s);}
 			catch (StandardException se) {
-				throw StandardException.newException(SQLState.AUTH_INVALID_AUTHORIZATION_PROPERTY, key,value_s,se);
+                throw StandardException.newException(SQLState.AUTH_INVALID_AUTHORIZATION_PROPERTY,
se, key,value_s);
 			}
 
 			/** Check the new list userIdList for duplicates. */

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/JarUtil.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/JarUtil.java?rev=230900&r1=230899&r2=230900&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/JarUtil.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/JarUtil.java Mon Aug
 8 14:36:48 2005
@@ -392,7 +392,7 @@
 		try {
 			return fr.getAsStream(JarDDL.mkExternalName(schemaName, sqlName, fr.getSeparatorChar()),
generationId);
 		} catch (IOException ioe) {
-			throw StandardException.newException(SQLState.LANG_FILE_ERROR, ioe.toString(),ioe);	
+            throw StandardException.newException(SQLState.LANG_FILE_ERROR, ioe, ioe.toString());
   
 		}
 	}
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/RawStore.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/RawStore.java?rev=230900&r1=230899&r2=230900&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/RawStore.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/RawStore.java Mon Aug
 8 14:36:48 2005
@@ -541,10 +541,10 @@
 
                 if (!privRenameTo(backupcopy,oldbackup))
                 {
-					renameFailed = true;
-					throw StandardException.newException(
-                        SQLState.RAWSTORE_ERROR_RENAMING_FILE,
-                        backupcopy, oldbackup, (Throwable)null);
+                    renameFailed = true;
+                    throw StandardException.
+                        newException(SQLState.RAWSTORE_ERROR_RENAMING_FILE,
+                                     backupcopy, oldbackup);
                 }
 				else
 				{
@@ -566,9 +566,9 @@
 
             if (!privCopyDirectory(dbase, backupcopy, (byte[])null, BACKUP_FILTER))
             {
-				throw StandardException.newException(
-                    SQLState.RAWSTORE_ERROR_COPYING_FILE,
-					dbase, backupcopy, (Throwable)null);
+                throw StandardException.
+                    newException(SQLState.RAWSTORE_ERROR_COPYING_FILE,
+                                 dbase, backupcopy);
             }
 
 			logHistory(historyFile,
@@ -633,14 +633,14 @@
             }
 
 		
-			// copy the log to the backup location
-			if(!logFactory.copyActiveLogFiles(logBackup))
-			{
-				throw StandardException.newException(
-													 SQLState.RAWSTORE_ERROR_COPYING_FILE,
-													 logdir, logBackup, (Throwable)null);
-			}	
-
+            // copy the log to the backup location
+            if(!logFactory.copyActiveLogFiles(logBackup))
+                {
+                    throw StandardException.
+                        newException(SQLState.RAWSTORE_ERROR_COPYING_FILE,
+                                     logdir, logBackup);
+                }       
+            
 			logHistory(historyFile,
                 MessageService.getTextMessage(
                     MessageId.STORE_COPIED_LOG,

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java?rev=230900&r1=230899&r2=230900&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java
Mon Aug  8 14:36:48 2005
@@ -276,7 +276,7 @@
         catch( IOException ioe)
         {
             if( create)
-                throw StandardException.newException( SQLState.SERVICE_DIRECTORY_CREATE_ERROR,
dataDirectory, ioe);
+                throw StandardException.newException( SQLState.SERVICE_DIRECTORY_CREATE_ERROR,
ioe, dataDirectory);
             else
                 throw StandardException.newException( SQLState.DATABASE_NOT_FOUND, ioe, dataDirectory);
         }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/InputStreamContainer.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/InputStreamContainer.java?rev=230900&r1=230899&r2=230900&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/InputStreamContainer.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/InputStreamContainer.java
Mon Aug  8 14:36:48 2005
@@ -92,11 +92,10 @@
 
 			return true;
 
-		} catch (IOException ioe) {
-
-			throw StandardException.newException(
-                    SQLState.FILE_CONTAINER_EXCEPTION, ioe, this, ioe);
-		} finally {
+        } catch (IOException ioe) {
+            throw StandardException.
+                newException(SQLState.FILE_CONTAINER_EXCEPTION, ioe, this);
+        } finally {
 			if (dis != null) {
 				try {
 					dis.close();

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/RAFContainer.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/RAFContainer.java?rev=230900&r1=230899&r2=230900&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/RAFContainer.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/RAFContainer.java
Mon Aug  8 14:36:48 2005
@@ -909,11 +909,11 @@
                  try {
                      fileDeleted = privRemoveFile(file);
                  } catch (SecurityException se) {
-                     throw StandardException.newException( SQLState.FILE_CREATE_NO_CLEANUP,
ioe, file, se);
+                     throw StandardException.newException( SQLState.FILE_CREATE_NO_CLEANUP,
ioe, file, se.toString());
                  }
 
                  if (!fileDeleted) {
-                     throw StandardException.newException( SQLState.FILE_CREATE_NO_CLEANUP,
ioe, file, null);
+                     throw StandardException.newException( SQLState.FILE_CREATE_NO_CLEANUP,
ioe, file, ioe.toString());
                  }
 
                  throw StandardException.newException( SQLState.FILE_CREATE, ioe, file);
@@ -973,9 +973,11 @@
 
                  if (isStub)
                  {
-                     throw dataFactory.markCorrupt(
-                         StandardException.newException(
-                             SQLState.FILE_CONTAINER_EXCEPTION, ioe, this, ioe));
+                     throw dataFactory.
+                         markCorrupt(StandardException.
+                                     newException(SQLState.
+                                                  FILE_CONTAINER_EXCEPTION, 
+                                                  ioe, this));
                  }
 
                  // maybe it is being stubbified... try that
@@ -995,18 +997,22 @@
                      }
                      catch (IOException ioe2)
                      {
-                         throw dataFactory.markCorrupt(
-                             StandardException.newException(
-                                 SQLState.FILE_CONTAINER_EXCEPTION, ioe2, this, ioe2));
+                         throw dataFactory.
+                             markCorrupt(StandardException.
+                                         newException(SQLState.
+                                                      FILE_CONTAINER_EXCEPTION,
+                                                      ioe2, this));
                      }
 
                      // RESOLVE: this is a temporary hack
 
                  }
                  else
-                     throw dataFactory.markCorrupt(
-                         StandardException.newException(
-                             SQLState.FILE_CONTAINER_EXCEPTION, ioe, this, ioe));
+                     throw dataFactory.
+                         markCorrupt(StandardException.
+                                     newException(SQLState.
+                                                  FILE_CONTAINER_EXCEPTION,
+                                                  ioe, this));
              }
 
              return this;
@@ -1066,8 +1072,9 @@
              }
              catch (SecurityException se)
              {
-                 throw StandardException.newException(
-                     SQLState.FILE_CANNOT_REMOVE_FILE, se, file, se);
+                 throw StandardException.
+                     newException(SQLState.FILE_CANNOT_REMOVE_FILE, se, file, 
+                                  se.toString());
              }
              catch (IOException ioe)
              {
@@ -1091,7 +1098,7 @@
                  catch (IOException ioe2)
                  {
                      throw StandardException.newException(
-                         SQLState.FILE_CANNOT_REMOVE_FILE, ioe2, file, ioe);
+                         SQLState.FILE_CANNOT_REMOVE_FILE, ioe2, file, ioe.toString());
                  }
                  catch (SecurityException se)
                  {

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/LogAccessFile.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/LogAccessFile.java?rev=230900&r1=230899&r2=230900&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/LogAccessFile.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/LogAccessFile.java
Mon Aug  8 14:36:48 2005
@@ -656,7 +656,7 @@
 
                 if( i > 20 )
                     throw StandardException.newException(
-                        SQLState.LOG_FULL, sfe, null);
+                        SQLState.LOG_FULL, sfe);
             }
         }
     }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java?rev=230900&r1=230899&r2=230900&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java Mon
Aug  8 14:36:48 2005
@@ -3816,7 +3816,7 @@
                 if( i > 20 )
                 {
                     throw StandardException.newException(
-                                SQLState.LOG_FULL, ioe, null );
+                                SQLState.LOG_FULL, ioe);
                 }
             }
         }

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/authorize.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/authorize.out?rev=230900&r1=230899&r2=230900&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/authorize.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/authorize.out
Mon Aug  8 14:36:48 2005
@@ -49,6 +49,7 @@
 --
 call SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.database.readOnlyAccessUsers','fred,0IsABadFirstLetter');
 ERROR 28501: Invalid database authorization property 'derby.database.readOnlyAccessUsers=fred,0IsABadFirstLetter'.
+ERROR XCXC0: Invalid id list.
 ij> VALUES SYSCS_UTIL.SYSCS_GET_DATABASE_PROPERTY('derby.database.readOnlyAccessUsers');
 1                                                                                       
                                       
 --------------------------------------------------------------------------------------------------------------------------------
@@ -58,6 +59,7 @@
 --
 call SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.database.fullAccessUsers','fred,0IsABadFirstLetter');
 ERROR 28501: Invalid database authorization property 'derby.database.fullAccessUsers=fred,0IsABadFirstLetter'.
+ERROR XCXC0: Invalid id list.
 ij> VALUES SYSCS_UTIL.SYSCS_GET_DATABASE_PROPERTY('derby.database.fullAccessUsers');
 1                                                                                       
                                       
 --------------------------------------------------------------------------------------------------------------------------------



Mime
View raw message