ICEpdf
  1. ICEpdf
  2. PDF-203

Minor Bug in generateNewSaveName

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.0.1, 4.1
    • Fix Version/s: 4.1.1
    • Component/s: Viewer RI
    • Labels:
      None
    • Environment:
      Win XP, JDK1.6.20,
    • Workaround Exists:
      Yes
    • Workaround Description:
      Do not open files without extensions.

      Description

      When having opened a pdf File without any extension (wich is possible via the openDocument() method, i use)
      I'll get a StringIndexOutOfBoundsException at the "Save As" Action

      Exception in thread "AWT-EventQueue-0" ]
      java.lang.StringIndexOutOfBoundsException: String index out of range: -2
              at java.lang.String.substring(String.java:1938)
              at org.icepdf.ri.common.SwingController.generateNewSaveName(SwingController.java:2234)
              at org.icepdf.ri.common.SwingController.saveFile(SwingController.java:2150)
              at org.icepdf.ri.common.SwingController$9.run(SwingController.java:3252)
              at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
              at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
              at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
              at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)]
              at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
              at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

      I'll attach a small patch later.

        Activity

        Hide
        Dirk Maass added a comment - - edited

        Added a junit test wich addresses this issue and a small patch to fix it.
        Could you please review it?

        Show
        Dirk Maass added a comment - - edited Added a junit test wich addresses this issue and a small patch to fix it. Could you please review it?
        Hide
        Patrick Corless added a comment -

        Applied the patch, thank you very much for pointing this out.

        Show
        Patrick Corless added a comment - Applied the patch, thank you very much for pointing this out.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: