Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6999891

DefaultFileManager incorrect

XMLWordPrintable

    • b126
    • x86
    • windows_7
    • Verified

        FULL PRODUCT VERSION :
        java version "1.6.0_21"
        Java(TM) SE Runtime Environment (build 1.6.0_21-b07)
        Java HotSpot(TM) 64-Bit Server VM (build 17.0-b17, mixed mode)

        ADDITIONAL OS VERSION INFORMATION :
        Microsoft Windows [Wersja 6.1.7600]

        A DESCRIPTION OF THE PROBLEM :
        The bug appears when trying to create resource with filename '.' from annotation processor level. Folllowing line:

        processingEnv.getFiler().createResource(StandardLocation.CLASS_OUTPUT, "foo", ".foo2", element)

        throws Exception:

        java.lang.IllegalArgumentException: relativeName is invalid
        at com.sun.tools.javac.util.DefaultFileManager.getFileForOutput(DefaultFileManager.java:1050)

        In spec it is said:
        "A relative name is a non-null, non-empty sequence of path segments separated by '/'.; '.' or '..' are invalid path segments."

        But in that case '.' at the begining of filename is not the segment. There is a difference between ".foo2" and "./foo2". The first one seems to be correct filename. But I cannot create it with DefaultFileManager. There is no way to create resource starting with '.' character.


        REPRODUCIBILITY :
        This bug can be reproduced always.

              jjg Jonathan Gibbons
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: