JDK-6420464 : JSR 199: JavaFileObject.isNameCompatible throws unspecified exception (IllegalArgumentException)
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 6
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2006-05-02
  • Updated: 2011-01-19
  • Resolved: 2006-05-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6 b85Fixed
Related Reports
Relates :  
Description
javax.tools.JavaFileObject.isNameCompatible throws unspecified exception (IllegalArgumentException).
(I think it's small mistake in program)

test:
--------------------
import javax.tools.*;
import java.io.*;
import java.util.Collections;

public class test6 {

    public static void main(String[] argv){
        JavaCompilerTool compiler = ToolProvider.getSystemJavaCompilerTool();
        StandardJavaFileManager mgr = compiler.getStandardFileManager( new DiagnosticCollector<JavaFileObject>() );
        System.out.println( new File( new File(".").toURI() ).getAbsolutePath() );
        mgr.setLocation(StandardJavaFileManager.StandardLocation.SOURCE_PATH, 
                            Collections.singleton(new File( new File(".").toURI())));

        try {
            JavaFileObject f = mgr.getJavaFileForInput(
                        StandardJavaFileManager.StandardLocation.SOURCE_PATH, "test6", 
                        JavaFileObject.Kind.SOURCE );
            if( !f.isNameCompatible("test6", JavaFileObject.Kind.SOURCE) )
                System.out.println( "isNameCompatible(SOURCE) fails on " + f.toUri() );
            if( f.isNameCompatible("test6", JavaFileObject.Kind.OTHER) )
                System.out.println( "isNameCompatible(OTHER) fails on " + f.toUri() );
        } catch( IOException x ){
            x.printStackTrace(System.out);
        }
        System.out.println( "The test completed successfully if there are no error messages in the output." );
    }
}
--------------------
output:
--------------------
Z:\tests>z:/lnks/jdk6/bin/java.exe -cp . test6
Z:\tests\.
Exception in thread "main" java.lang.IllegalArgumentException
        at com.sun.tools.javac.util.DefaultFileManager.getExtension(DefaultFileManager.java:187)
        at com.sun.tools.javac.util.DefaultFileManager$RegularFileObject.isNameCompatible(DefaultFileManager.java:1074)
        at test6.main(test6.java:20)
--------------------
tests failed
api/javax_tools/JavaFileObject/index.html#All[isNameCompatible0001]

Comments
EVALUATION Fixed by cleaning up DefaultFileManager: use JavaFileObject.Kind.extension.
02-05-2006