OPENJPA-656: reusing existing error message key from a different package

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@676081 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Pinaki Poddar 2008-07-11 21:14:42 +00:00
parent 026c96d513
commit 85b0b0b45b
2 changed files with 10 additions and 7 deletions

View File

@ -60,6 +60,8 @@ public class DataSourceFactory {
private static final Localizer _loc = Localizer.forPackage
(DataSourceFactory.class);
protected static Localizer _eloc =
Localizer.forPackage(DelegatingDataSource.class);
/**
* Create a datasource using the given configuration.
@ -251,13 +253,11 @@ public class DataSourceFactory {
static OpenJPAException newConnectException(JDBCConfiguration conf,
boolean factory2, Exception cause) {
return new UserException(_loc.get("conn-failed", factory2
return new UserException(_eloc.get("poolds-null", factory2
? new Object[]{conf.getConnection2DriverName(),
conf.getConnection2URL(),
conf.getConnection2Properties()}
conf.getConnection2URL()}
: new Object[]{conf.getConnectionDriverName(),
conf.getConnectionURL(),
conf.getConnectionProperties()}),
conf.getConnectionURL()}),
cause).setFatal(true);
}

View File

@ -29,6 +29,7 @@ import java.util.List;
import java.util.Properties;
import org.apache.openjpa.jdbc.sql.DBDictionary;
import org.apache.openjpa.lib.jdbc.DelegatingDataSource;
import org.apache.openjpa.lib.util.J2DoPrivHelper;
import org.apache.openjpa.lib.util.Localizer;
import org.apache.openjpa.util.StoreException;
@ -51,6 +52,8 @@ public class SimpleDriverDataSource
protected static Localizer _loc =
Localizer.forPackage(SimpleDriverDataSource.class);
protected static Localizer _eloc =
Localizer.forPackage(DelegatingDataSource.class);
public Connection getConnection()
throws SQLException {
@ -77,8 +80,8 @@ public class SimpleDriverDataSource
throws SQLException {
Connection con = getDriver().connect(_connectionURL, props);
if (con == null) {
throw new SQLException(_loc.get("conn-failed",
_connectionDriverName, _connectionURL, props).getMessage());
throw new SQLException(_eloc.get("poolds-null",
_connectionDriverName, _connectionURL).getMessage());
}
return con;
}