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 Tue, 10 May 2011 14:34:47 GMT

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

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

Hello Houx,

I believe that the ij code to format and display the exception is around line 600 of utilMain.java:

                        String st1 = JDBCDisplayUtil.mapNull(e.getSQLState(),langUtil.getTextMessage("IJ_NoSqls"));
                        String st2 = JDBCDisplayUtil.mapNull(e.getMessage(),langUtil.getTextMessage("IJ_NoMess"));
                        out.println(langUtil.getTextMessage("IJ_Erro012",  st1, st2, errorCode));

And I think that since your test results say ERROR 42Y55: [?DROP TABLE?????T1????????????],
this means that the IJ exceptions are being formatted in the English locale, since that's
where the
word "ERROR" at the start of that output is coming from (UT_Error012=ERROR {0}: {1}{2})

I see that this ij code calls "e.getMessage()".

Perhaps we should turn our attention to the code which is constructing and throwing the exception,
it may be building the exception with the wrong data in the first place.

I think this happens in DDLStatementNode.java, with the code:

        private TableDescriptor justGetDescriptor(TableName tableName)
        throws StandardException
        {
                String schemaName = tableName.getSchemaName();
                SchemaDescriptor sd = getSchemaDescriptor(schemaName);
                 
                TableDescriptor td = getTableDescriptor(tableName.getTableName(), sd);
        
                if (td == null)
                {       
                        throw StandardException.newException(SQLState.LANG_OBJECT_DOES_NOT_EXIST,
                                                statementToString(), tableName);
                }               
                return td;
        }               

Perhaps you might instrument this code path and see if you can see how StandardException.java
is deciding which locale to use when it constructs the original exception?


> 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-SystemPropertyTestSetup.patch,
DERBY-5217-log-LocalizedResource.patch, DERBY-5217-log-locale.patch
>
>
> 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