db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r430534 - /db/derby/code/branches/10.1/java/drda/org/apache/derby/impl/drda/DRDAProtocolException.java
Date Thu, 10 Aug 2006 21:20:53 GMT
Author: kmarsden
Date: Thu Aug 10 14:20:52 2006
New Revision: 430534

URL: http://svn.apache.org/viewvc?rev=430534&view=rev
Log:
DERBY-353 Network Server agentError calls log only to console and are hard to diagnose

merge from trunk (svn 428012)

Contributed by Sunitha Kambhampati 

Modified:
    db/derby/code/branches/10.1/java/drda/org/apache/derby/impl/drda/DRDAProtocolException.java

Modified: db/derby/code/branches/10.1/java/drda/org/apache/derby/impl/drda/DRDAProtocolException.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.1/java/drda/org/apache/derby/impl/drda/DRDAProtocolException.java?rev=430534&r1=430533&r2=430534&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/drda/org/apache/derby/impl/drda/DRDAProtocolException.java
(original)
+++ db/derby/code/branches/10.1/java/drda/org/apache/derby/impl/drda/DRDAProtocolException.java
Thu Aug 10 14:20:52 2006
@@ -31,6 +31,7 @@
 
 package org.apache.derby.impl.drda;
 import java.util.Hashtable;
+import org.apache.derby.iapi.services.sanity.SanityManager;
 
 public class DRDAProtocolException extends Exception
 {
@@ -77,7 +78,10 @@
 	// message arguments
 	private Object [] messageArgs;
 	
-	
+	// A verbose error message string, will be helpful
+	// when getMessage() is called on this Exception object
+	private String msg;
+    
 	private static Hashtable errorInfoTable;
 	
 	protected static String DRDA_Proto_CMDCHKRM=	"DRDA_Proto_CMDCHKRM";
@@ -186,10 +190,13 @@
 							 NO_ASSOC_ERRCD,
 							 false));
 
+    // Permanent Agent Error (AGNPRMRM) Reply Message indicates that the command
+    // requested could not be completed because of a permanent error
+    // condition detected at the target system.
 	errorInfoTable.put(DRDA_AgentError,
 			   new DRDAProtocolExceptionInfo(
-							 0,
-							 0,
+							 CodePoint.AGNPRMRM,
+							 CodePoint.SVRCOD_PRMDMG,
 							 NO_ASSOC_ERRCD,
 							 false));
 
@@ -233,14 +240,15 @@
 		this.errcd = errCdArg;
 		this.messageid = msgid;
 
-		String msg;
 		if (msgid.equals(DRDA_AgentError))
 		{
 			this.svrcod = ((Integer)args[0]).intValue();
 			this.rdbnam = (String)args[1];
-			msg = "Execution failed because of Permant Agent Error: SVRCOD = " +
+            // retrieve the server diagnostic error message 
+            String srvdgn = (String)args[2];
+			msg = "Execution failed because of Permanent Agent Error: SVRCOD = " +
 				java.lang.Integer.toHexString(this.svrcod) +
-				"; RDBNAM = "+ rdbnam;
+				"; RDBNAM = "+ rdbnam +"; diagnostic msg = "+ srvdgn;
 			agentError = true;
 		}
 		else if (msgid.equals(DRDA_Proto_RDBNFNRM))
@@ -314,7 +322,8 @@
 	protected static DRDAProtocolException newAgentError(DRDAConnThread agent,
 		int svrcod, String rdbnam, String srvdgn)
 	{
-		System.out.println("agent" + agent);
+        if ( SanityManager.DEBUG )
+            System.out.println("agentError in " + agent);
 		Object[] oa = {new Integer(svrcod), rdbnam, srvdgn};
 		return new DRDAProtocolException(DRDA_AgentError,
 										agent,
@@ -397,6 +406,15 @@
 		}
 		writer.endDdmAndDss();
 	}
+    
+    /**
+     * Override getMessage() 
+     * @return the server diagnostic error message for this exception
+     */
+    public String getMessage()
+    {
+        return msg;
+    }
 }
 
 



Mime
View raw message