db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Trejkaz (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DERBY-6696) ERROR XBM0X: Supplied territory description 'es_419' is invalid, expecting ln[_CO[_variant]]
Date Fri, 08 Aug 2014 01:22:12 GMT

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

Trejkaz commented on DERBY-6696:

Perhaps Derby should not be validating this string at all. Hypothetically, even if someone
adds support for 3-digit country codes, in 3 years' time, there might be 4-digit country codes,
3-letter country codes or something else nobody can predict.

Anyway, here's a test case:

import java.io.File;
import java.sql.Connection;
import java.util.Locale;

import org.apache.derby.jdbc.EmbeddedDataSource;
import org.junit.Test;

public class TestTrash
    public void test() throws Exception
        Locale.setDefault(new Locale("es", "419"));

        File dir = new File(System.getProperty("java.io.tmpdir"), "db");//TODO: find a better
place for it

        EmbeddedDataSource dataSource = new EmbeddedDataSource();
        // This workaround seems to make things work again:
//        dataSource.setConnectionAttributes("territory=en");

        try (Connection connection = dataSource.getConnection()) // <- error from here


> ERROR XBM0X: Supplied territory description 'es_419' is invalid, expecting ln[_CO[_variant]]
> --------------------------------------------------------------------------------------------
>                 Key: DERBY-6696
>                 URL: https://issues.apache.org/jira/browse/DERBY-6696
>             Project: Derby
>          Issue Type: Bug
>            Reporter: David Sitsky
> We have a customer in the South American Spanish locale, which in effect are using these
settings: -Duser.language=es -Duser.country=419.  I have seen DERBY-4854 and this comment:
> {quote}
> The problem seems to be that Locale.getDefault().getCountry() returns "8859_1" in this
locale, and that value confuses Derby. The javadoc for Locale.getCountry() says that it should
return an empty string or a two-letter uppercase country code, so I think it's a bug that
getCountry() returns "8859_1".
> {quote}
> However the Javadoc in fact states that 3 digit codes are permitted:
> {quote}
> Returns the country/region code for this locale, which should either be the empty string,
an uppercase ISO 3166 2-letter code, or a UN M.49 3-digit code.
> {quote}
> So it seems Derby requires adding support for the three digit country codes.
> As a workaround, I can apply territory=en_US to the connection parameters, but this is
not ideal.
> For the record, here is the stacktrace seen:
> {noformat}
> Thu Aug 07 12:13:27 CDT 2014 Thread[DefaultExecutorService-4,4,DefaultExecutorService]
Cleanup action starting
> ERROR XBM0X: Supplied territory description 'es_419' is invalid, expecting ln[_CO[_variant]]
> ln=lower-case two-letter ISO-639 language code, CO=upper-case two-letter ISO-3166 country
codes, see java.util.Locale.
> 	at org.apache.derby.iapi.error.StandardException.newException(StandardException.java:278)
> 	at org.apache.derby.impl.services.monitor.BaseMonitor.staticGetLocaleFromString(BaseMonitor.java:2020)
> 	at org.apache.derby.impl.services.monitor.BaseMonitor.setLocale(BaseMonitor.java:505)
> 	at org.apache.derby.impl.db.BasicDatabase.boot(BasicDatabase.java:156)
> 	at org.apache.derby.impl.services.monitor.BaseMonitor.boot(BaseMonitor.java:1993)
> 	at org.apache.derby.impl.services.monitor.TopService.bootModule(TopService.java:334)
> 	at org.apache.derby.impl.services.monitor.BaseMonitor.bootService(BaseMonitor.java:1827)
> 	at org.apache.derby.impl.services.monitor.BaseMonitor.createPersistentService(BaseMonitor.java:1013)
> 	at org.apache.derby.iapi.services.monitor.Monitor.createPersistentService(Monitor.java:596)
> 	at org.apache.derby.impl.jdbc.EmbedConnection.createDatabase(EmbedConnection.java:2604)
> 	at org.apache.derby.impl.jdbc.EmbedConnection.<init>(EmbedConnection.java:407)
> 	at org.apache.derby.impl.jdbc.EmbedConnection30.<init>(EmbedConnection30.java:73)
> 	at org.apache.derby.impl.jdbc.EmbedConnection40.<init>(EmbedConnection40.java:53)
> 	at org.apache.derby.jdbc.Driver40.getNewEmbedConnection(Driver40.java:70)
> 	at org.apache.derby.jdbc.InternalDriver.connect(InternalDriver.java:255)
> 	at org.apache.derby.jdbc.EmbeddedDataSource.getConnection(EmbeddedDataSource.java:480)
> 	at org.apache.derby.jdbc.EmbedPooledConnection.openRealConnection(EmbedPooledConnection.java:178)
> 	at org.apache.derby.jdbc.EmbedPooledConnection.<init>(EmbedPooledConnection.java:119)
> 	at org.apache.derby.jdbc.EmbedPooledConnection40.<init>(EmbedPooledConnection40.java:54)
> 	at org.apache.derby.jdbc.Driver40.getNewPooledConnection(Driver40.java:179)
> 	at org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource.createPooledConnection(EmbeddedConnectionPoolDataSource.java:129)
> 	at org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource.getPooledConnection(EmbeddedConnectionPoolDataSource.java:75)
> {noformat}

This message was sent by Atlassian JIRA

View raw message