Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6420464
Votes 0
Synopsis JSR 199: JavaFileObject.isNameCompatible throws unspecified exception (IllegalArgumentException)
Category java:compiler
Reported Against
Release Fixed mustang(b85)
State 10-Fix Delivered, Verified, bug
Priority: 2-High
Related Bugs 6409829
Submit Date 02-MAY-2006
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)
--------------------
Posted Date : 2006-05-02 09:28:16.0

tests failed
api/javax_tools/JavaFileObject/index.html#All[isNameCompatible0001]
Posted Date : 2006-05-31 11:51:21.0
Work Around
N/A
Evaluation
Fixed by cleaning up DefaultFileManager: use JavaFileObject.Kind.extension.
Posted Date : 2006-05-02 11:26:34.0
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang