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 km...@apache.org on 2006/04/14 23:41:00 UTC
svn commit: r394205 - in /db/derby/code/trunk/java:
drda/org/apache/derby/impl/drda/DRDAConnThread.java
engine/org/apache/derby/catalog/SystemProcedures.java
Author: kmarsden
Date: Fri Apr 14 14:40:56 2006
New Revision: 394205
URL: http://svn.apache.org/viewcvs?rev=394205&view=rev
Log:
DERBY-901 Remove use of String(byte[]) constructors in network server leading to non-portable behaviour
Contributed by Sunitha Kambhampati
patch1 - Remove use of String(byte[]) constructors in network server leading to non-portable behaviour
This fixes
- SQLERRMC_TOKEN_DELIMITER, SQLERRMC_MESSAGE_DELIMITER and the corresponding usage of it in SystemProcedures to not use the default string constructors that are non portable.
Modified:
db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java
db/derby/code/trunk/java/engine/org/apache/derby/catalog/SystemProcedures.java
Modified: db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java?rev=394205&r1=394204&r2=394205&view=diff
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java (original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java Fri Apr 14 14:40:56 2006
@@ -5288,17 +5288,25 @@
// Delimiters for SQLERRMC values.
-
+ // The token delimiter value will be used to parse the MessageId from the
+ // SQLERRMC in MessageService.getLocalizedMessage and the MessageId will be
+ // used to retrive the localized message. If this delimiter value is changed
+ // please make sure to make appropriate changes in
+ // MessageService.getLocalizedMessage that gets called from
+ // SystemProcedures.SQLCAMESSAGE
/**
* <code>SQLERRMC_TOKEN_DELIMITER</code> separates message argument tokens
*/
- private static String SQLERRMC_TOKEN_DELIMITER = new String(new byte[] {20});
-
- /**
+ private static String SQLERRMC_TOKEN_DELIMITER = new String(new char[] {(char)20});
+
+
+ // This token delimiter value is used to separate the tokens for multiple
+ // error messages. This is used in SystemProcedures.SQLCAMESSAGE.
+ /**
* <code>SQLERRMC_MESSAGE_DELIMITER</code> When message argument tokes are sent,
* this value separates the tokens for mulitiple error messages
*/
- private static String SQLERRMC_MESSAGE_DELIMITER = new String(new byte[] {20,20,20});
+ private static String SQLERRMC_MESSAGE_DELIMITER = new String(new char[] {(char)20,(char)20,(char)20});
/**
* <code>SQLERRMC_PREFORMATTED_MESSAGE_DELIMITER</code>, When full message text is
@@ -5315,6 +5323,19 @@
* This method will also truncate the value according the client capacity.
* CCC can only handle 70 characters.
*
+ * Server sends the sqlerrmc using UTF8 encoding to the client.
+ * To get the message, client sends back information to the server
+ * calling SYSIBM.SQLCAMESSAGE (see Sqlca.getMessage). Several parameters
+ * are sent to this procedure including the locale, the sqlerrmc that the
+ * client received from the server.
+ * On server side, the procedure SQLCAMESSAGE in SystemProcedures then calls
+ * the MessageService.getLocalizedMessage to retrieve the localized error message.
+ * In MessageService.getLocalizedMessage the sqlerrmc that is passed in,
+ * is parsed to retrieve the message id. The value it uses to parse the MessageId
+ * is char value of 20, otherwise it uses the entire sqlerrmc as the message id.
+ * This messageId is then used to retrieve the localized message if present, to
+ * the client.
+ *
* @param se SQLException to build SQLERRMC
*
* @return String which is either the message arguments to be passed to
Modified: db/derby/code/trunk/java/engine/org/apache/derby/catalog/SystemProcedures.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/catalog/SystemProcedures.java?rev=394205&r1=394204&r2=394205&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/catalog/SystemProcedures.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/catalog/SystemProcedures.java Fri Apr 14 14:40:56 2006
@@ -96,7 +96,10 @@
String[] msg, int[] rc)
{
int numMessages = 1;
- byte[] b = {20, 20, 20};
+
+ // This corresponds to the DRDAConnThread.SQLERRMC_MESSAGE_DELIMITER
+ // delimiter for multiple messages that are set in sqlerrmc.
+ char[] b = {(char)20, (char)20, (char)20};
String errSeparator = new String(b);
// Figure out if there are multiple exceptions in sqlerrmc. If so get each one