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 mi...@apache.org on 2010/07/21 00:48:17 UTC
svn commit: r966047 - in /db/derby/code/branches/10.5: ./
java/client/org/apache/derby/client/net/NetConnection.java
java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/DRDAProtocolTest.java
Author: mikem
Date: Tue Jul 20 22:48:17 2010
New Revision: 966047
URL: http://svn.apache.org/viewvc?rev=966047&view=rev
Log:
DERBY-4584: Unable to connect to network server if client thread name has Japanese characters
backporting change #929085 from trunk to 10.5 branch.
Patch contributed by Tiago R. Espinha.
Modified:
db/derby/code/branches/10.5/ (props changed)
db/derby/code/branches/10.5/java/client/org/apache/derby/client/net/NetConnection.java
db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/DRDAProtocolTest.java
Propchange: db/derby/code/branches/10.5/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jul 20 22:48:17 2010
@@ -1,2 +1,2 @@
/db/derby/code/branches/10.6:942027,957000,962738,965351
-/db/derby/code/trunk:757811,769596,769602,769606,769962,772090,772337,772449,772534,774281,777105,779681,782991,785131,785139,785163,785570,785662,788369,788670,788674,788968,789264,790218,791027,792434,793089,793588,794106,794303,794955,795166,795459,796020,796027,796316,796372,797147,798347,798742,800523,803548,803948,805696,808494,808850,809643,810860,812669,816531,816536,819006,822289,823659,824694,827505,829022,829410,830545,831304,831319,832379,833430,835286,881074,881444,882732,884163,885421,885659,887246,888311,892912,897161,898635,901165,901648,901760,902857,903108,905224,908418,908586,909176,910481,910511,911315,911793,915733,916075,916897,918152,918359,921028,927430,928065,934474,936215,938959,940462,940469,942286,942476,942480,942587,946794,948045,948069,951346,951366,952138,952581,954748,955001,955634,956075,956445,956659,958163,959550,962716
+/db/derby/code/trunk:757811,769596,769602,769606,769962,772090,772337,772449,772534,774281,777105,779681,782991,785131,785139,785163,785570,785662,788369,788670,788674,788968,789264,790218,791027,792434,793089,793588,794106,794303,794955,795166,795459,796020,796027,796316,796372,797147,798347,798742,800523,803548,803948,805696,808494,808850,809643,810860,812669,816531,816536,819006,822289,823659,824694,827505,829022,829410,830545,831304,831319,832379,833430,835286,881074,881444,882732,884163,885421,885659,887246,888311,892912,897161,898635,901165,901648,901760,902857,903108,905224,908418,908586,909176,910481,910511,911315,911793,915733,916075,916897,918152,918359,921028,927430,928065,929085,934474,936215,938959,940462,940469,942286,942476,942480,942587,946794,948045,948069,951346,951366,952138,952581,954748,955001,955634,956075,956445,956659,958163,959550,962716
Modified: db/derby/code/branches/10.5/java/client/org/apache/derby/client/net/NetConnection.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/client/org/apache/derby/client/net/NetConnection.java?rev=966047&r1=966046&r2=966047&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/client/org/apache/derby/client/net/NetConnection.java (original)
+++ db/derby/code/branches/10.5/java/client/org/apache/derby/client/net/NetConnection.java Tue Jul 20 22:48:17 2010
@@ -1299,7 +1299,14 @@ public class NetConnection extends org.a
private void constructExtnam() throws SqlException {
- extnam_ = "derbydnc" + java.lang.Thread.currentThread().getName();
+ /* Construct the EXTNAM based on the thread name */
+ char[] chars = java.lang.Thread.currentThread().getName().toCharArray();
+
+ /* DERBY-4584: Replace non-EBCDIC characters (> 0xff) with '?' */
+ for (int i = 0; i < chars.length; i++) {
+ if (chars[i] > 0xff) chars[i] = '?';
+ }
+ extnam_ = "derbydnc" + new String(chars);
}
private void constructPrddta() throws SqlException {
Modified: db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/DRDAProtocolTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/DRDAProtocolTest.java?rev=966047&r1=966046&r2=966047&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/DRDAProtocolTest.java (original)
+++ db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/DRDAProtocolTest.java Tue Jul 20 22:48:17 2010
@@ -38,6 +38,34 @@ import org.apache.derbyTesting.junit.Tes
*/
public class DRDAProtocolTest extends BaseJDBCTestCase {
+ private String threadName;
+
+ public void setUp() {
+ /* Save the thread name as it gets changed in one of the fixtures */
+ threadName = Thread.currentThread().getName();
+ }
+
+ public void tearDown() throws Exception {
+ /* Restore the original thread name */
+
+ super.tearDown();
+
+ Thread.currentThread().setName(threadName);
+ }
+
+ /**
+ * Tests the support for threads with characters not supported by EBCDIC
+ *
+ * @throws SQLException
+ */
+ public void testNonEBCDICCharacters() throws SQLException {
+ Thread.currentThread().setName("\u4e10");
+
+ /* Open a connection while the thread name has Japanese characters */
+ Connection conn2 = openConnection("FIRSTDB1");
+ conn2.close();
+ }
+
/**
* Tests whether multiple connections to different databases
* on the same Derby instance are working without exceptions.