ICEpdf
  1. ICEpdf
  2. PDF-26

org.icepdf.core.util.Defs.setProperty will fail with stackoverflow exception if a SecurityException is produced

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: 4.3
    • Component/s: None
    • Labels:
      None
    • Environment:
      JDK1.6u7

      Description

      In org.icepdf.core.util.Defs.setProperty


      public static void setProperty(String property, Object value) {
              try {
                  Properties prop = System.getProperties();
                  if (value != null) {
                      prop.put(property, value);
                  }
              }
              catch (SecurityException ex) {
                 // recall method so that property change takes effect
                  setProperty(property, value);
              }
          }

      If (when?) a SecurityException is produced second time, the setProperty will be called again, and again, until a StackOverflow is thrown, and that will prevent the developer from seeing the message of the root cause of the problem, the SecurityException

        Activity

        Hide
        Francisco Peredo added a comment -

        This error is very similar to PDF-25, and the solution is very similar too... if you change the code to:

        public static void setProperty(String property, Object value) {
        try {
        Properties prop = System.getProperties();
        if (value != null)

        { prop.put(property, value); }

        }
        catch (SecurityException ex)

        { throw new RuntimeException(ex.getMessage(), ex); }

        }

        the problem will be solved.

        Show
        Francisco Peredo added a comment - This error is very similar to PDF-25 , and the solution is very similar too... if you change the code to: public static void setProperty(String property, Object value) { try { Properties prop = System.getProperties(); if (value != null) { prop.put(property, value); } } catch (SecurityException ex) { throw new RuntimeException(ex.getMessage(), ex); } } the problem will be solved.
        Hide
        Patrick Corless added a comment -

        Duplicate issue marking as fixed.

        Show
        Patrick Corless added a comment - Duplicate issue marking as fixed.

          People

          • Assignee:
            Patrick Corless
            Reporter:
            Francisco Peredo
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: