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/15 00:56:32 UTC
svn commit: r394223 - in /db/derby/code/branches/10.1/java:
drda/org/apache/derby/impl/drda/DRDAConnThread.java
engine/org/apache/derby/catalog/SystemProcedures.java
Author: kmarsden
Date: Fri Apr 14 15:56:27 2006
New Revision: 394223
URL: http://svn.apache.org/viewcvs?rev=394223&view=rev
Log:
DERBY-901 Remove use of String(byte[]) constructors in network server leading to non-portable behaviour
Contributed by Sunitha Kambhampati
port from trunk. patch 1 (partial)
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/branches/10.1/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java
db/derby/code/branches/10.1/java/engine/org/apache/derby/catalog/SystemProcedures.java
Modified: db/derby/code/branches/10.1/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java
URL: http://svn.apache.org/viewcvs/db/derby/code/branches/10.1/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java?rev=394223&r1=394222&r2=394223&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java (original)
+++ db/derby/code/branches/10.1/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java Fri Apr 14 15:56:27 2006
@@ -5163,17 +5163,24 @@
// 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});
+ * <code>SQLERRMC_TOKEN_DELIMITER</code> separates message argument tokens
+ */
+ 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
@@ -5190,6 +5197,18 @@
* 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/branches/10.1/java/engine/org/apache/derby/catalog/SystemProcedures.java
URL: http://svn.apache.org/viewcvs/db/derby/code/branches/10.1/java/engine/org/apache/derby/catalog/SystemProcedures.java?rev=394223&r1=394222&r2=394223&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/engine/org/apache/derby/catalog/SystemProcedures.java (original)
+++ db/derby/code/branches/10.1/java/engine/org/apache/derby/catalog/SystemProcedures.java Fri Apr 14 15:56:27 2006
@@ -93,7 +93,9 @@
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