Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 1.6.1
-
Component/s: ICE-Components
-
Labels:None
-
Environment:win xp
-
Support Case References:
-
Workaround Exists:Yes
-
Workaround Description:use expanded war
Description
Problem Description: Using a simple example of charts on Weblogic 9.2:
<ice:outputChart type="pie2d" labels="pass, fail"
data="70, 30"
colors="green, red"/>
java.lang.NullPointerException
at java.io.File.<init>(File.java:194)
at com.icesoft.faces.component.outputchart.OutputChart.getFolder(OutputC
hart.java:529)
at com.icesoft.faces.component.outputchart.OutputChart.getNewOutputStrea
m(OutputChart.java:510)
<ice:outputChart type="pie2d" labels="pass, fail"
data="70, 30"
colors="green, red"/>
java.lang.NullPointerException
at java.io.File.<init>(File.java:194)
at com.icesoft.faces.component.outputchart.OutputChart.getFolder(OutputC
hart.java:529)
at com.icesoft.faces.component.outputchart.OutputChart.getNewOutputStrea
m(OutputChart.java:510)
Issue Links
- duplicates
-
ICE-2112 OutputChart throws java.lang.ClassCastException when running a portlet
- Closed
Activity
Philip Breau
created issue -
Philip Breau
made changes -
Field | Original Value | New Value |
---|---|---|
Support Case References | https://www.icesoft.ca:4443/supportilla/show_bug.cgi?id=4378 |
Ken Fyten
made changes -
Assignee | Adnan Durrani [ adnan.durrani ] |
Ken Fyten
made changes -
Assignee | Adnan Durrani [ adnan.durrani ] | Sam Xiao [ sam.xiao ] |
Ken Fyten
made changes -
Fix Version/s | 1.6.2 [ 10111 ] |
Ken Fyten
made changes -
Assignee | Sam Xiao [ sam.xiao ] | Yip Ng [ yip.ng ] |
Ken Fyten
made changes -
Fix Version/s | 1.7DR#1 [ 10100 ] | |
Fix Version/s | 1.6.2 [ 10111 ] | |
Assignee | Yip Ng [ yip.ng ] |
Ken Fyten
made changes -
Status | Open [ 1 ] | Resolved [ 5 ] |
Resolution | Fixed [ 1 ] |
Ken Fyten
made changes -
Fix Version/s | 1.7 [ 10080 ] |
Ken Fyten
made changes -
Status | Resolved [ 5 ] | Closed [ 6 ] |
The main issue here is that we rely on ServletContext.getRealPath() to determine the absolute file path on the server to write out the image files to. getRealPath() is not guaranteed by the servlet spec to return a non-null value, and will return null on WebLogic when running an unexploded war (which is why the workaround listed above works). My recommendation would be to avoid using ServletContext.getRealPath() and instead use the temporary file creation mechanism in java.io.File:
try
{ // Create temp file. File temp = File.createTempFile("pattern", ".suffix"); // Delete temp file when program exits. temp.deleteOnExit(); // Write to temp file BufferedWriter out = new BufferedWriter(new FileWriter(temp)); out.write("aString"); out.close(); }catch (IOException e) {
}