db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Satheesh Bandaram <sathe...@Sourcery.Org>
Subject Re: [PATCH] Add "if (SanityManager.DEBUG)" around two unprotected uses of SanityManager.
Date Tue, 07 Jun 2005 01:09:27 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Simple, but useful patch. Commited.<br>
<br>
Satheesh<br>
<br>
Sending&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
java\engine\org\apache\derby\iapi\sql\dictionary\ColumnDescriptor.java<br>
Sending&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
java\engine\org\apache\derby\impl\store\raw\data\FileContainer.java<br>
Transmitting file data ..<br>
Committed revision 188643.<br>
<br>
Army wrote:<br>
<blockquote cite="mid42A4EFBC.80501@sbcglobal.net" type="cite">There
are two files in the codline that use SanityManager without first
checking to see if the compiler is running in SANE mode.&nbsp; This means
that when the code is built in INSANE mode, the references to
SanityManager will still exist in the compiled class file, which is
wrong.
  <br>
  <br>
Attached is a very simple patch that modifies the following two files
by adding an "if (SanityManager.DEBUG)" block around the code in
question:
  <br>
  <br>
org/apache/derby/iapi/sql/dictionary/ColumnDescriptor.java
  <br>
org/apache/derby/impl/store/raw/data/FileContainer.java
  <br>
  <br>
Could a committer please commit?
  <br>
Army
  <br>
  <pre wrap="">
<hr size="4" width="90%">
Index: java/engine/org/apache/derby/impl/store/raw/data/FileContainer.java
===================================================================
--- java/engine/org/apache/derby/impl/store/raw/data/FileContainer.java	(revision 185885)
+++ java/engine/org/apache/derby/impl/store/raw/data/FileContainer.java	(working copy)
@@ -1748,12 +1748,14 @@
                 }
                 catch (StandardException se)
                 {
-                    SanityManager.DEBUG_PRINT("FileContainer",
-                        "got exception from initPage:"  +
-                        "\nreuse = " + reuse +
-                        "\ncreatePageArgs[1] = " + createPageArgs[1] +
-                        "\nallocPage = " + allocPage
-                        );
+                    if (SanityManager.DEBUG) {
+                        SanityManager.DEBUG_PRINT("FileContainer",
+                            "got exception from initPage:"  +
+                            "\nreuse = " + reuse +
+                            "\ncreatePageArgs[1] = " + createPageArgs[1] +
+                            "\nallocPage = " + allocPage
+                            );
+                    }
                     allocCache.dumpAllocationCache();
 
                     throw se;
Index: java/engine/org/apache/derby/iapi/sql/dictionary/ColumnDescriptor.java
===================================================================
--- java/engine/org/apache/derby/iapi/sql/dictionary/ColumnDescriptor.java	(revision 185885)
+++ java/engine/org/apache/derby/iapi/sql/dictionary/ColumnDescriptor.java	(working copy)
@@ -105,12 +105,9 @@
 			this.uuid = table.getUUID();
 		}
 
-		if (SanityManager.DEBUG)
-		{
-			assertAutoinc(autoinc,
-				      autoincInc,
-				      columnDefaultInfo);
-		}
+		assertAutoinc(autoinc,
+			      autoincInc,
+			      columnDefaultInfo);
 
 		this.autoincStart = autoincStart;
 		this.autoincInc = autoincInc;
@@ -153,12 +150,9 @@
 		this.uuid = uuid;
 		this.defaultUUID = defaultUUID;
 
-		if (SanityManager.DEBUG)
-		{
-			assertAutoinc(autoinc,
-				      autoincInc,
-				      columnDefaultInfo);
-		}
+		assertAutoinc(autoinc,
+			      autoincInc,
+			      columnDefaultInfo);
 		
 		this.autoincStart = autoincStart;
 		this.autoincInc = autoincInc;
@@ -397,19 +391,24 @@
 	private static void assertAutoinc(boolean autoinc,
 					  long autoincInc,
 					  DefaultInfo defaultInfo){
-		if (autoinc){
-			SanityManager.ASSERT((autoincInc != 0), "increment is zero for  autoincrement column");
-			SanityManager.ASSERT((defaultInfo == null ||
+
+		if (SanityManager.DEBUG) {
+			if (autoinc){
+				SanityManager.ASSERT((autoincInc != 0),
+					"increment is zero for  autoincrement column");
+				SanityManager.ASSERT((defaultInfo == null ||
 					      defaultInfo.isDefaultValueAutoinc()),
 					     "If column is autoinc and have defaultInfo, " + 
 					     "isDefaultValueAutoinc must be true.");
-		}
-		else{
-			SanityManager.ASSERT((autoincInc == 0), "increment is non-zero for non-autoincrement column");
-			SanityManager.ASSERT((defaultInfo == null ||
+			}
+			else{
+				SanityManager.ASSERT((autoincInc == 0),
+					"increment is non-zero for non-autoincrement column");
+				SanityManager.ASSERT((defaultInfo == null ||
 					      ! defaultInfo.isDefaultValueAutoinc()),
 					     "If column is not autoinc and have defaultInfo, " + 
 					     "isDefaultValueAutoinc can not be true");
+			}
 		}
 	}
 
  </pre>
</blockquote>
</body>
</html>


Mime
View raw message