db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rick Hillegas (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (DERBY-5652) Assert failure when bootstrapping NATIVE with invalid provider string
Date Wed, 16 May 2012 17:37:09 GMT

     [ https://issues.apache.org/jira/browse/DERBY-5652?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Rick Hillegas updated DERBY-5652:
---------------------------------

    Attachment: derby-5652-01-ac-improveErrorMessage.diff

Attaching derby-5652-01-ac-improveErrorMessage.diff. This patch improves the error handling
for this situation. I am running regression tests now.

Previously, the NATIVE authentication service booted even though the colon-terminated database
name was an illegal name for a database. Now the NATIVE authentication service refuses to
boot if an illegal name is given for the credentials db. A new error message is passed up
to the Monitor in this case and the Monitor logs the error to derby.log. It looks something
like this:

"ERROR 4251L: The derby.authentication.provider property specifies 'db:' as the name of the
credentials database. This is not a valid name for a database."

This then caused an Assertion to be raised in InternalDriver on the initial attempt to connect
to a database. I removed the Assertion since I think Assertions are only appropriate for errors
which should not occur in production. This is an error which could occur in production and
it should be handled by proper error logic.

Now the user sees the following error. For details, the user needs to look in derby.log:

"ERROR 08004: Connection refused : FATAL: There is no Authentication Service for the system"


Touches the following files

--------

M       java/engine/org/apache/derby/impl/jdbc/authentication/NativeAuthenticationServiceImpl.java
M       java/engine/org/apache/derby/loc/messages.xml
M       java/shared/org/apache/derby/shared/common/reference/SQLState.java

New error message for situation when an illegal database name has been given for a credentials
db.

--------

M       java/engine/org/apache/derby/jdbc/InternalDriver.java

Removed an assertion so that normal error processing could occur.

--------

A       java/testing/org/apache/derbyTesting/functionTests/tests/lang/Derby5652.java
M       java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java

Regression test for this problem.

                
> Assert failure when bootstrapping NATIVE with invalid provider string
> ---------------------------------------------------------------------
>
>                 Key: DERBY-5652
>                 URL: https://issues.apache.org/jira/browse/DERBY-5652
>             Project: Derby
>          Issue Type: Bug
>          Components: Services
>    Affects Versions: 10.9.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Rick Hillegas
>         Attachments: derby-5652-01-ac-improveErrorMessage.diff
>
>
> I had accidentally put a colon at the end of the derby.authentication.provider property,
and then an assert failed during authentication:
> $ java -Dij.exceptionTrace=true -Dderby.authentication.provider=NATIVE:auth: -jar /code/derby/trunk/jars/sane/derbyrun.jar
ij
> ij version 10.9
> ij> connect 'jdbc:derby:db;create=true;user=test;password=test';
> ERROR XJ001: Java exception: 'ASSERT FAILED: org.apache.derby.shared.common.sanity.AssertFailure'.
> java.sql.SQLException: Java exception: 'ASSERT FAILED: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:98)
> 	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:142)
> 	at org.apache.derby.impl.jdbc.Util.javaException(Util.java:299)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:436)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:353)
> 	at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2360)
> 	at org.apache.derby.impl.jdbc.EmbedConnection.<init>(EmbedConnection.java:634)
> 	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.AutoloadedDriver.connect(AutoloadedDriver.java:143)
> 	at java.sql.DriverManager.getConnection(DriverManager.java:582)
> 	at java.sql.DriverManager.getConnection(DriverManager.java:154)
> 	at org.apache.derby.impl.tools.ij.ij.dynamicConnection(ij.java:1528)
> 	at org.apache.derby.impl.tools.ij.ij.ConnectStatement(ij.java:1358)
> 	at org.apache.derby.impl.tools.ij.ij.ijStatement(ij.java:1143)
> 	at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:347)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:245)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:229)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:184)
> 	at org.apache.derby.impl.tools.ij.Main.main(Main.java:75)
> 	at org.apache.derby.tools.ij.main(ij.java:59)
> 	at org.apache.derby.iapi.tools.run.main(run.java:53)
> Caused by: java.sql.SQLException: Java exception: 'ASSERT FAILED: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:42)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:122)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:71)
> 	... 23 more
> Caused by: org.apache.derby.shared.common.sanity.AssertFailure: ASSERT FAILED
> 	at org.apache.derby.shared.common.sanity.SanityManager.ASSERT(SanityManager.java:98)
> 	at org.apache.derby.impl.jdbc.Util.ASSERT(Util.java:179)
> 	at org.apache.derby.impl.jdbc.EmbedConnection.restoreContextStack(EmbedConnection.java:2570)
> 	at org.apache.derby.impl.jdbc.EmbedConnection.<init>(EmbedConnection.java:636)
> 	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.impl.jdbc.authentication.NativeAuthenticationServiceImpl.authenticateRemotely(NativeAuthenticationServiceImpl.java:417)
> 	at org.apache.derby.impl.jdbc.authentication.NativeAuthenticationServiceImpl.authenticateUser(NativeAuthenticationServiceImpl.java:312)
> 	at org.apache.derby.impl.jdbc.authentication.AuthenticationServiceBase.authenticate(AuthenticationServiceBase.java:257)
> 	at org.apache.derby.impl.jdbc.EmbedConnection.checkUserCredentials(EmbedConnection.java:1257)
> 	at org.apache.derby.impl.jdbc.EmbedConnection.<init>(EmbedConnection.java:404)
> 	... 17 more

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message