TrueZIP
  1. TrueZIP
  2. TRUEZIP-304

InvalidPathException: Illegal char <:>

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Works as designed
    • Affects Version/s: TrueZIP 7.5.5
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      One of my users encountered this crash:

      program.name=DocFetcher
      program.version=1.1.3
      program.build=20120830-2321
      program.portable=false
      java.runtime.name=Java(TM) SE Runtime Environment
      java.runtime.version=1.7.0_07-b11
      java.version=1.7.0_07
      sun.arch.data.model=32
      os.arch=x86
      os.name=Windows 7
      os.version=6.1
      user.language=de
      java.nio.file.InvalidPathException: Illegal char <:>
      at index 5: Liste: Was für Arbeitsbedingungen mich an einem Angebot interessieren Vorlage Version 28401253882450907068.odt
      at sun.nio.fs.WindowsPathParser.normalize(Unknown Source)
      at sun.nio.fs.WindowsPathParser.parse(Unknown Source)
      at sun.nio.fs.WindowsPathParser.parse(Unknown Source)
      at sun.nio.fs.WindowsPath.parse(Unknown Source)
      at sun.nio.fs.WindowsFileSystem.getPath(Unknown Source)
      at sun.nio.fs.AbstractPath.resolve(Unknown Source)
      at de.schlichtherle.truezip.fs.nio.file.FileEntry.(FileEntry.java:60)
      at de.schlichtherle.truezip.fs.nio.file.FileController.getOutputSocket(FileController.java:161)
      at de.schlichtherle.truezip.file.TBIO.getOutputSocket(TBIO.java:311)
      at de.schlichtherle.truezip.file.TBIO.cp0(TBIO.java:218)
      at de.schlichtherle.truezip.file.TBIO.cp(TBIO.java:208)
      at de.schlichtherle.truezip.file.TFile.cp(TFile.java:2932)
      at net.sourceforge.docfetcher.model.parse.ParseService.doParse(ParseService.java:278)
      at net.sourceforge.docfetcher.model.parse.ParseService.parse(ParseService.java:229)
      at net.sourceforge.docfetcher.model.index.file.FileContext.index(FileContext.java:146)
      at net.sourceforge.docfetcher.model.index.file.FileIndex$1.handleFile(FileIndex.java:285)
      at net.sourceforge.docfetcher.model.index.file.HtmlFileLister.runWithHtmlPairing(HtmlFileLister.java:123)
      at net.sourceforge.docfetcher.model.index.file.HtmlFileLister.doRun(HtmlFileLister.java:56)
      at net.sourceforge.docfetcher.util.Stoppable.run(Stoppable.java:57)
      at net.sourceforge.docfetcher.model.index.file.FileIndex.visitDirOrZip(FileIndex.java:272)
      at net.sourceforge.docfetcher.model.index.file.FileIndex.access$200(FileIndex.java:50)
      at net.sourceforge.docfetcher.model.index.file.FileIndex$1.handleDir(FileIndex.java:383)
      at net.sourceforge.docfetcher.model.index.file.HtmlFileLister.runWithHtmlPairing(HtmlFileLister.java:144)
      at net.sourceforge.docfetcher.model.index.file.HtmlFileLister.doRun(HtmlFileLister.java:56)
      at net.sourceforge.docfetcher.util.Stoppable.run(Stoppable.java:57)
      ...

      According to the user, the crash occurred because:

      The bug occured when docfetcher on a windows machine was parsing a .tar.bz2-Archive created on a linux machine and found a colon character (":") in the filename of the file it was about to process.
      Windows does not allow a ":" in the filename, linux has no such requirement.

        Activity

        Hide
        Christian Schlichtherle added a comment -

        As you figured, on Windows you can't use a colon in a path name because it's supposed to separate a drive letter from a path name. This issue appears because your application tries to copy/extract the Linux-originated TAR file to a Windows directory. So maybe you can change this behavior?

        Show
        Christian Schlichtherle added a comment - As you figured, on Windows you can't use a colon in a path name because it's supposed to separate a drive letter from a path name. This issue appears because your application tries to copy/extract the Linux-originated TAR file to a Windows directory. So maybe you can change this behavior?
        Hide
        qforce added a comment -

        I can think of two solutions:
        1) Swallow the exception and report to the user that the file couldn't be extracted.
        2) Rename the file on the fly during extraction. For example, I could replace colons and other invalid characters with underscores.

        Does TrueZip support the second option?

        Show
        qforce added a comment - I can think of two solutions: 1) Swallow the exception and report to the user that the file couldn't be extracted. 2) Rename the file on the fly during extraction. For example, I could replace colons and other invalid characters with underscores. Does TrueZip support the second option?
        Hide
        Christian Schlichtherle added a comment -

        The TFile.cp methods don't support path name mapping. You could implement this feature in your application if you would replicate what this method does and vary appropriately. But honestly, I wouldn't recommend to do this because this task is more complex as it seems at first sight (have a look at the source code if you are interested in the details).

        So I'm afraid you are more or less left with the first option.

        Show
        Christian Schlichtherle added a comment - The TFile.cp methods don't support path name mapping. You could implement this feature in your application if you would replicate what this method does and vary appropriately. But honestly, I wouldn't recommend to do this because this task is more complex as it seems at first sight (have a look at the source code if you are interested in the details). So I'm afraid you are more or less left with the first option.
        Hide
        qforce added a comment -

        Okay, thanks for your help!

        Show
        qforce added a comment - Okay, thanks for your help!

          People

          • Assignee:
            Christian Schlichtherle
            Reporter:
            qforce
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: