[
http://issues.apache.org/jira/browse/DERBY-1403?page=comments#action_12421267 ]
Myrna van Lunteren commented on DERBY-1403:
-------------------------------------------
I have looked at this some more, and I found the following to prove my initial
thoughts
- the problem does not occur with later builds (for example, SR5) of the ibm
1.4.2 jvm nor with other jvm versions/products
- the api doc say this about the need for charsetProvider RuntimePermission:
"Two NIO-related RuntimePermission targets were added in the 1.4 release of the
Java 2 SDK:
selectorProvider
charsetProvider
These RuntimePermissions are required to be granted to classes which subclass
and implement java.nio.channel.spi.SelectorProvider or
java.nio.charset.spi.CharsetProvider. The permission is checked during
invocation of the abstract base class constructor. These permissions ensure
trust in classes which implement these security-sensitive provider mechanisms. "
I did an eclipse java search on the derby source (incl. testing) and the string
java.nio is not present anywhere.
- After some digging I found the following section of the stack dump (this one
from the test iepnegativetests.sql, see DERBY-1404) that proves that we're not
calling those classes:
============= begin nested exception, level (2) ===========
java.security.AccessControlException: access denied
(java.lang.RuntimePermission charsetProvider)
at
java.security.AccessControlContext.checkPermission(AccessControlContext.java(Compiled
Code))
at
java.security.AccessController.checkPermission(AccessController.java:476)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:538)
\/ \/ \/ \/
\/ \/ \/ \/
at java.nio.charset.spi.CharsetProvider.<init>(CharsetProvider.java:94)
at com.ibm.nio.cs.IBMCharsets.<init>(IBMCharsets.java:101)
at sun.nio.cs.StandardCharsets.<init>(StandardCharsets.java:42)
at java.nio.charset.Charset.<clinit>(Charset.java:305)
at
sun.nio.cs.StreamEncoder.forOutputStreamWriter(StreamEncoder.java:115)
at java.io.OutputStreamWriter.<init>(OutputStreamWriter.java:102)
at
org.apache.derby.impl.load.ExportWriteData.openFile(ExportWriteData.java:72)
/\ /\ /\ /\
/\ /\ /\ /\
at
org.apache.derby.impl.load.ExportWriteData.run(ExportWriteData.java:59)
at java.security.AccessController.doPrivileged1(Native Method)
at
java.security.AccessController.doPrivileged(AccessController.java:351)
at
org.apache.derby.impl.load.ExportWriteData.<init>(ExportWriteData.java:51)
at org.apache.derby.impl.load.Export.getExportWriteData(Export.java:135)
at
org.apache.derby.impl.load.ExportAbstract.doAllTheWork(ExportAbstract.java:96)
at org.apache.derby.impl.load.Export.doExport(Export.java:48)
at org.apache.derby.impl.load.Export.exportTable(Export.java:102)
at
org.apache.derby.catalog.SystemProcedures.SYSCS_EXPORT_TABLE(SystemProcedures.java:1105)
at
org.apache.derby.exe.ac5e838074x010cx5ebexdd3ex00001b43a0ae2.g0(Unknown Source)
at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:62)
at java.lang.reflect.Method.invoke(Method.java:391)
at
org.apache.derby.impl.services.reflect.ReflectMethod.invoke(ReflectMethod.java:45)
at
org.apache.derby.impl.sql.execute.CallStatementResultSet.open(CallStatementResultSet.java:67)
at
org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:357)
at
org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1181)
at
org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(EmbedPreparedStatement.java:1506)
at
org.apache.derby.impl.jdbc.EmbedPreparedStatement.execute(EmbedPreparedStatement.java:1184)
at
org.apache.derbyTesting.functionTests.tests.tools.importExport.doExport(importExport.java:209)
at
org.apache.derbyTesting.functionTests.tests.tools.importExport.doImportAndExport(importExport.java:187)
at
org.apache.derbyTesting.functionTests.tests.tools.importExport.main(importExport.java:129)
============= end nested exception, level (2) ===========
Especially the section marked between \/ \/ \/ and /\ /\ /\ lines, I read
that to show we're only calling an OutputStreamWriter, and the jvm itself is
instantiating the charsetProvider class. I don't think we need to grant the
permission in that case.
That said, there is some esoteric circumstance kicking in in our setup, because
I could not duplicate the behavior with just ij & security manager, only when
running the tests.
The workaround, however, was to grant the "charsetProvider"
java.lang.RuntimePermission to derby.jar in derby_tests.policy.
We *could* add this permission to derby_tests.policy, or create individual
policy files for the 3 affected tests, but as the problem is fixed in a more
recent jvm version, I don't much see the point.
Also, I *could* go through the effort of trying to figure out why the problem
only occurs when we run through derbyTesting.jar and then report it, but again,
the problem is already fixed in newer jvm versions, so again, I don't much see
a point in spinning my wheels further on this.
I am closing this issue.
> importExport.java fails with ibm142 on linux
> --------------------------------------------
>
> Key: DERBY-1403
> URL: http://issues.apache.org/jira/browse/DERBY-1403
> Project: Derby
> Issue Type: Bug
> Components: Regression Test Failure
> Affects Versions: 10.2.0.0
> Environment: ------------------ Java Information ------------------
> Java Version: 1.4.2
> Java Vendor: IBM Corporation
> Java home: /local1/cloudtst/dev/src/ibm142/jre
> Java classpath:
> /local1/cloudtst/dev/src/jars/insane/derby.jar:/local1/cloudtst
> /dev/src/jars/insane/derbytools.jar:/local1/cloudtst/dev/src/jars/insane/derbyne
> t.jar:/local1/cloudtst/dev/src/jars/insane/derbyclient.jar:/local1/cloudtst/dev/
> src/jars/insane/derbyTesting.jar:/local1/cloudtst/dev/src/jcc/db2jcc.jar:/local1
> /cloudtst/dev/src/jcc/db2jcc_license_c.jar:/local1/cloudtst/dev/src/jars/insane/
> derbyTesting.jar:/local1/cloudtst/dev/src/tools/java/jakarta-oro-2.0.8.jar:/loca
> l1/cloudtst/dev/src/tools/java/junit.jar:/local1/cloudtst/dev/src/jars/insane/de
> rbyLocale_de_DE.jar:/local1/cloudtst/dev/src/jars/insane/derbyLocale_es.jar:/loc
> al1/cloudtst/dev/src/jars/insane/derbyLocale_fr.jar:/local1/cloudtst/dev/src/jar
> s/insane/derbyLocale_it.jar:/local1/cloudtst/dev/src/jars/insane/derbyLocale_ja_
> JP.jar:/local1/cloudtst/dev/src/jars/insane/derbyLocale_ko_KR.jar:/local1/cloudt
> st/dev/src/jars/insane/derbyLocale_pt_BR.jar:/local1/cloudtst/dev/src/jars/insan
> e/derbyLocale_zh_CN.jar:/local1/cloudtst/dev/src/jars/insane/derbyLocale_zh_TW.j
> ar:/local1/cloudtst/dev/src/jars/insane/derbyrun.jar:
> OS name: Linux
> OS architecture: x86
> OS version: 2.6.5-7.257-bigsmp
> Java user name: cloudtst
> Java user home: /u/cloudtst
> Java user dir:
> /local1/cloudtst/dev/src/NightlyBuildResults.2006-06-12/ibm142_
> derbyall
> java.specification.name: Java Platform API Specification
> java.specification.version: 1.4
> --------- Derby Information --------
> JRE - JDBC: J2SE 1.4.2 - JDBC 3.0
> [/local1/cloudtst/dev/src/jars/insane/derby.jar] 10.2.0.4 alpha - (413780)
> [/local1/cloudtst/dev/src/jars/insane/derbytools.jar] 10.2.0.4 alpha -
> (413780)
> [/local1/cloudtst/dev/src/jars/insane/derbynet.jar] 10.2.0.4 alpha - (413780)
> [/local1/cloudtst/dev/src/jars/insane/derbyclient.jar] 10.2.0.4 alpha -
> (413780)
> [/local1/cloudtst/dev/src/jcc/db2jcc.jar] 2.6 - (90)
> [/local1/cloudtst/dev/src/jcc/db2jcc_license_c.jar] 2.6 - (90)
> ------------------------------------------------------
> ----------------- Locale Information -----------------
> Current Locale : [English/United States [en_US]]
> Found support for locale: [de_DE]
> version: 10.2.0.4 alpha - (413780)
> Found support for locale: [es]
> version: 10.2.0.4 alpha - (413780)
> Found support for locale: [fr]
> version: 10.2.0.4 alpha - (413780)
> Found support for locale: [it]
> version: 10.2.0.4 alpha - (413780)
> Found support for locale: [ja_JP]
> version: 10.2.0.4 alpha - (413780)
> Found support for locale: [ko_KR]
> version: 10.2.0.4 alpha - (413780)
> Found support for locale: [pt_BR]
> version: 10.2.0.4 alpha - (413780)
> Found support for locale: [zh_CN]
> version: 10.2.0.4 alpha - (413780)
> Found support for locale: [zh_TW]
> version: 10.2.0.4 alpha - (413780)
> ------------------------------------------------------
> Reporter: Manjula Kutty
> Assigned To: Myrna van Lunteren
>
> 16 del
> < An IOException occurred while writing data to the file.
> 16a16
> > The exception 'java.lang.ExceptionInInitializerError' was thrown while
> > evaluat
> ing an expression. SQLSTATE: XJ001: Java exception: ':
> java.lang.ExceptionInInit
> ializerError'. SQLSTATE: XJ001: Java exception: 'access denied
> (java.lang.Runtim
> ePermission charsetProvider): java.security.AccessControlException'.
> Test Failed.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira