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 bp...@apache.org on 2006/08/02 16:51:32 UTC
svn commit: r428012 -
/db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAProtocolException.java
Author: bpendleton
Date: Wed Aug 2 07:51:31 2006
New Revision: 428012
URL: http://svn.apache.org/viewvc?rev=428012&view=rev
Log:
DERBY-1456: Network Server agentError logs only to console
Patch contributed by Sunitha Kambhampati (ksunithaghm@gmail.com)
This patch does the following:
1. Use the correct errorCodePoint for agent errors. CodePoint.AGNPRMRM.
Agent errors will be logged ok.
2. In agent errors, retrieve the descriptive string passed in as argument.
3. override Exception.getMessage() , so call to
DRDAProtocolException.getMessage() will return the diagnostic message.
Modified:
db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAProtocolException.java
Modified: db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAProtocolException.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAProtocolException.java?rev=428012&r1=428011&r2=428012&view=diff
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAProtocolException.java (original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAProtocolException.java Wed Aug 2 07:51:31 2006
@@ -31,6 +31,7 @@
package org.apache.derby.impl.drda;
import java.util.Hashtable;
+import org.apache.derby.iapi.services.sanity.SanityManager;
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,
@@ -366,6 +375,15 @@
}
writer.endDdmAndDss();
}
+
+ /**
+ * Override getMessage()
+ * @return the server diagnostic error message for this exception
+ */
+ public String getMessage()
+ {
+ return msg;
+ }
}