[
https://issues.apache.org/jira/browse/DERBY-5173?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13014546#comment-13014546
]
Knut Anders Hatlen commented on DERBY-5173:
-------------------------------------------
To reproduce, follow these steps:
- create a new, unencrypted database
- remove the write permission from the db/seg0 directory (chmod 555 db/seg0)
- reboot the database with encryption enabled, and see it fail with a
ClassCastException:
ij> connect 'jdbc:derby:db;dataEncryption=true;bootPassword=abc1234xyz';
ERROR XJ040: Failed to start database 'db' with class loader
sun.misc.Launcher$AppClassLoader@1a336d5, see the next exception for details.
ERROR XJ001: Java exception: 'java.io.FileNotFoundException cannot be cast to
org.apache.derby.iapi.error.StandardException: java.lang.ClassCastException'.
> RAFContainer.privGetRandomAccessFile() unwraps wrong exception type
> -------------------------------------------------------------------
>
> Key: DERBY-5173
> URL: https://issues.apache.org/jira/browse/DERBY-5173
> Project: Derby
> Issue Type: Bug
> Components: Store
> Affects Versions: 10.7.1.1
> Reporter: Knut Anders Hatlen
> Assignee: Knut Anders Hatlen
>
> RAFContainer.privGetRandomAccessFile() catches and unwraps
> PrivilegedActionExceptions raised in the privileged code:
> catch( PrivilegedActionException pae){
> throw (StandardException) pae.getException();
> }
> The problem is that the privileged code is this:
> case GET_RANDOM_ACCESS_FILE_ACTION: {
> return actionFile.getRandomAccessFile("rw");
> } // end of case BACKUP_CONTAINER_ACTION
> getRandomAccessFile() only has one checked exception, and that is
> FileNotFoundException. If it ever happens to raise FNFE,
> privGetRandomAccessFile() will fail with a ClassCastException and hide the
> underlying error.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira