Simple, but useful patch. Commited.
Satheesh
Sending
java\engine\org\apache\derby\iapi\sql\dictionary\ColumnDescriptor.java
Sending
java\engine\org\apache\derby\impl\store\raw\data\FileContainer.java
Transmitting file data ..
Committed revision 188643.
Army wrote:
There
are two files in the codline that use SanityManager without first
checking to see if the compiler is running in SANE mode. 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.
Attached is a very simple patch that modifies the following two files
by adding an "if (SanityManager.DEBUG)" block around the code in
question:
org/apache/derby/iapi/sql/dictionary/ColumnDescriptor.java
org/apache/derby/impl/store/raw/data/FileContainer.java
Could a committer please commit?
Army
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");
+ }
}
}
|