db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bryan Pendleton (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DERBY-5217) make ImportExportIJTest pass in non-English locale
Date Mon, 30 May 2011 15:52:48 GMT

    [ https://issues.apache.org/jira/browse/DERBY-5217?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13041175#comment-13041175
] 

Bryan Pendleton commented on DERBY-5217:
----------------------------------------

Yes, the traces are very interesting! The most important part appears to be around line 1975
in the trace output, where we see:

.------000------loc of StandardException:en_US
------------loc of StandardException:en_US
------------StandardException.getMessage() locale is:en_US
------------StandardException.getMessage() calling MessageService
MessageService.getCompleteMessage(42Y55, arguments)
BaseMonitor.getBundle(messageId=42Y55, messageLocale=zh_CN
MessageService.formatMessage(java.util.PropertyResourceBundle@229ed4,42Y55, arguments, true)
                            : bundle locale is zh_CN
------------StandardException.getMessage() returning: ¡°{0}¡±ÎÞ·¨ÔÚ¡°{1}¡±ÉÏÖ´ÐУ¬ÒòΪËü²»´æÔÚ¡£
ERROR null: ¡°{0}¡±ÎÞ·¨ÔÚ¡°{1}¡±ÉÏÖ´ÐУ¬ÒòΪËü²»´æÔÚ¡£
        at org.apache.derby.iapi.error.StandardException.newException(StandardException.java:308)
        at org.apache.derby.impl.sql.compile.DDLStatementNode.justGetDescriptor(DDLStatementNode.java:367)
        at org.apache.derby.impl.sql.compile.DDLStatementNode.getTableDescriptor(DDLStatementNode.java:337)
        at org.apache.derby.impl.sql.compile.DDLStatementNode.getTableDescriptor(DDLStatementNode.java:289)
        at org.apache.derby.impl.sql.compile.DropTableNode.bindStatement(DropTableNode.java:97)
        at org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:327)
        at org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:93)
        at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(GenericLanguageConnectionContext.java:1103)
        at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:610)
        at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:559)
        at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:367)
        at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:521)
        at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:363)
        at org.apache.derby.impl.tools.ij.utilMain.goScript(utilMain.java:279)
        at org.apache.derby.tools.ij.runScript(ij.java:124)
        at org.apache.derbyTesting.functionTests.util.ScriptTestCase.runTest(ScriptTestCase.java:188)
        at junit.framework.TestCase.runBare(TestCase.java:134)

It looks like BaseMonitor.getBundle() is returning the *Chinese* bundle, even though the system
locale has been set to en_us.

This appears to happen because the ContextManager class has remembered the message locale
in its 'messageLocale' variable, which was set very early in the test to the default initial
locale (Chinese)
when the auto-loaded driver needed to lookup messages during initial bootup.

I see that the ContextManager class has a method "setMessageLocale()" that appears to be
designed to allow higher levels of the system to reset the message locale.

But I searched the code tree and I can't find any code that calls this method.

I am wondering if we need to change LocaleTestSetup.setUp() so that it calls ContextManager.setMessageLocale(),
and whether that would help the test.

Can you try going to about line 49 of LocaleTestSetup.java, right after the line

      Locale.setDefault(newLocale);

and add something like:

       ContextService.getFactory().getCurrentContextManager().setMessageLocale(newLocale.toString());

Hopefully that code will force the ContextManager class to start using the English locale
for message
lookup for subsequent messages.

> make ImportExportIJTest pass in non-English locale
> --------------------------------------------------
>
>                 Key: DERBY-5217
>                 URL: https://issues.apache.org/jira/browse/DERBY-5217
>             Project: Derby
>          Issue Type: Sub-task
>          Components: Test
>            Reporter: Houx Zhang
>            Assignee: Houx Zhang
>              Labels: gsoc2011
>         Attachments: DERBY-5217-LocaleTestSetup.patch, DERBY-5217-StandardException.patch,
DERBY-5217-SystemPropertyTestSetup.patch, DERBY-5217-log-LocalizedResource.patch, DERBY-5217-log-locale.patch,
morePrints.txt, output-for-more-prints.txt
>
>
> ImportExportIJTest fails in Chinese locale, just like below:
> D:\derby\test>java junit.textui.TestRunner org.apache.derbyTesting.functionTests
> .tests.tools.ImportExportIJTest
> .F
> Time: 7.937
> There was 1 failure:
> 1) importExportIJ(org.apache.derbyTesting.functionTests.tests.tools.ImportExport
> IJTest)junit.framework.ComparisonFailure: Output at line 22 expected:<ERROR 42Y5
> 5: ['DROP TABLE' cannot be performed on 'T1' because it does not exist.]> but wa
> s:<ERROR 42Y55: [?DROP TABLE?????T1????????????]>
>         at org.apache.derbyTesting.functionTests.util.CanonTestCase.compareCanon
> (CanonTestCase.java:109)
>         at org.apache.derbyTesting.functionTests.util.ScriptTestCase.runTest(Scr
> iptTestCase.java:201)
>         at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:
> 112)
>         at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>         at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
>         at junit.extensions.TestSetup.run(TestSetup.java:27)
>         at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57
> )
>         at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>         at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
>         at junit.extensions.TestSetup.run(TestSetup.java:27)
> FAILURES!!!
> Tests run: 1,  Failures: 1,  Errors: 0

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message