ICEfaces
  1. ICEfaces
  2. ICE-2261

OutputChart NPE in WebLogic 9.2

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.6.1
    • Fix Version/s: 1.7DR#1, 1.7
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      win xp

      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)

        Issue Links

          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 ]
          Hide
          Philip Breau added a comment -

          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) {
          }

          Show
          Philip Breau added a comment - 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) { }
          Ken Fyten made changes -
          Assignee Sam Xiao [ sam.xiao ] Yip Ng [ yip.ng ]
          Hide
          yip.ng added a comment -

          Suggested fix will create a temp file outside of the app. context. How do you serve that temp file to the browser?

          Show
          yip.ng added a comment - Suggested fix will create a temp file outside of the app. context. How do you serve that temp file to the browser?
          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 -
          Link This issue duplicates ICE-2112 [ ICE-2112 ]
          Hide
          Ken Fyten added a comment -

          The fix for ICE-2112 also resolves this issue on WebLogic.

          Show
          Ken Fyten added a comment - The fix for ICE-2112 also resolves this issue on WebLogic.
          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 ]

            People

            • Assignee:
              Unassigned
              Reporter:
              Philip Breau
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: