You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by dj...@apache.org on 2006/10/05 23:40:19 UTC

svn commit: r453395 - in /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn: GenericLanguageConnectionContext.java GenericStatementContext.java

Author: djd
Date: Thu Oct  5 14:40:18 2006
New Revision: 453395

URL: http://svn.apache.org/viewvc?view=rev&rev=453395
Log:
DERBY-1732 1. Make change to GenericStatementContext.isLastHandler() so it will return false for JVM errors thus
allowing the outer contexts to take corrective action.
2. Store transaction context treats JVM errors as session severity. To ensure consistency,
map severity for non StandardException instances to be SESSION_SEVERITY in GenericLanguageContext,
and GenericStatementContext.
Patch contributed by  Sunitha Kambhampati ksunithaghm@gmail.com

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericStatementContext.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java?view=diff&rev=453395&r1=453394&r2=453395
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java Thu Oct  5 14:40:18 2006
@@ -2634,12 +2634,17 @@
 
 		/*
 		** If it isn't a StandardException, then assume
-		** xact severity.  It is probably an unexpected
+		** session severity. It is probably an unexpected
 		** java error somewhere in the language.
-		*/
+        ** Store layer treats JVM error as session severity, 
+        ** hence to be consistent and to avoid getting rawstore
+        ** protocol violation errors, we treat java errors here
+        ** to be of session severity.
+        */  
+
 		int severity = (error instanceof StandardException) ?
 			((StandardException) error).getSeverity() :
-			ExceptionSeverity.TRANSACTION_SEVERITY;
+			ExceptionSeverity.SESSION_SEVERITY;
  
 		if (statementContexts[0] != null)
 		{

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericStatementContext.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericStatementContext.java?view=diff&rev=453395&r1=453394&r2=453395
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericStatementContext.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericStatementContext.java Thu Oct  5 14:40:18 2006
@@ -498,12 +498,16 @@
 
 		/*
 		** If it isn't a StandardException, then assume
-		** xact severity.  It is probably an unexpected
+		** session severity.  It is probably an unexpected
 		** java error somewhere in the language.
-		*/
+        ** Store layer treats JVM error as session severity, 
+        ** hence to be consistent and to avoid getting rawstore
+        ** protocol violation errors, we treat java errors here
+        ** to be of session severity.  
+        */
 		int severity = (error instanceof StandardException) ?
 			((StandardException) error).getSeverity() :
-			ExceptionSeverity.STATEMENT_SEVERITY;
+			ExceptionSeverity.SESSION_SEVERITY;
 
 
 		/**
@@ -592,8 +596,14 @@
 	 */
 	public boolean isLastHandler(int severity)
 	{
-		return inUse && !rollbackParentContext && ((severity == ExceptionSeverity.STATEMENT_SEVERITY) ||
-						(severity == ExceptionSeverity.NO_APPLICABLE_SEVERITY));
+        // For JVM errors, severity gets mapped to 
+        // ExceptionSeverity.NO_APPLICABLE_SEVERITY
+        // in ContextManager.cleanupOnError. It is necessary to 
+        // let outer contexts take corrective action for jvm errors, so 
+        // return false as this will not be the last handler for such 
+        // errors.
+		return inUse && !rollbackParentContext && 
+            ( severity == ExceptionSeverity.STATEMENT_SEVERITY );
 	}
 
 	/**