Bug 40505 - HSSFWorkbook
Summary: HSSFWorkbook
Status: RESOLVED WONTFIX
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: unspecified
Hardware: All Windows XP
: P2 minor (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-09-14 06:20 UTC by Evgeniy Hristov
Modified: 2007-04-19 10:29 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Evgeniy Hristov 2006-09-14 06:20:33 UTC
Hallo,

i have written the following code trying to access excel files (read and write):

URL url = new URL("file:/c:/Arbeit/Termine.xls");
URLConnection uc = url.openConnection();
POIFSFileSystem fis = new POIFSFileSystem(uc.getInputStream());
HSSFWorkbook hssfworkbook = new HSSFWorkbook(fis);

When using it in an java application it works fine. 
Then I put this line of code within an appplet, then I had signed the applet 
(in order to be allowed to read and write files on the hard disk). 
Unfortunately the last line of code, namely "HSSFWorkbook hssfworkbook = new 
HSSFWorkbook(fis);" still throw the following exception:
java.lang.ExceptionInInitializerError
  at java.lang.Class.forName0(Native Method)
  at java.lang.Class.forName(Class.java:141)
  at org.apache.poi.hssf.record.RecordFactory.class$(RecordFactory.java:50)
  at org.apache.poi.hssf.record.RecordFactory.<clinit>(RecordFactory.java:48)
  at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:163)
  .........
Caused by: java.security.AccessControlException: access denied 
(java.util.PropertyPermission poi.deserialize.escher read)
at
java.security.AccessControlContext.checkPermission(AccessControlContext.java:269)
at java.security.AccessController.checkPermission(AccessController.java:401)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:524)
at java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:1276)
at java.lang.System.getProperty(System.java:573)
at
org.apache.poi.hssf.record.AbstractEscherHolderRecord.<clinit>(AbstractEscherHolderRecord.java:40)
	... 19 more

I have solved the problem as I wrote the following line of code into the 
java.policy file: 
permission java.util.PropertyPermission "poi.deserialize.escher", "read";

Now it works fine, but when another person in the web use my applet I can't 
assume that he (or she) has the same line of code in the java.policy file.

My question: how should I handle this kind of error, without having to write 
into the java.policy file. Is this a HSSFWorkbook-bug?

Thanks

Evgeniy Hristov
Comment 1 Trejkaz (pen name) 2006-11-23 20:08:50 UTC
If the JVM is telling POI that it can't read that property, the best POI could
hope to do is catch it and assume that it's not set.

But you can work around this by signing the POI jar files, so I don't see this
as a major issue.
Comment 2 Yegor Kozlov 2007-04-19 10:29:55 UTC
Not a POI bug.

Regards,
Yegor