8072054: Cannot build langtools if checked-out in a directory ending with \"com\"

Making sure a proper package name is used when generating Properties classes

Reviewed-by: mcimadamore
This commit is contained in:
Jan Lahoda 2015-02-02 21:53:36 +01:00
parent 74f6de6859
commit 3aff88ae3b

View File

@ -192,8 +192,8 @@ public class ClassGenerator {
*/
String packageName(File file) {
String path = file.getAbsolutePath();
int begin = path.indexOf("com" + File.separatorChar);
String packagePath = path.substring(begin, path.lastIndexOf(File.separatorChar));
int begin = path.lastIndexOf(File.separatorChar + "com" + File.separatorChar);
String packagePath = path.substring(begin + 1, path.lastIndexOf(File.separatorChar));
String packageName = packagePath.replace(File.separatorChar, '.');
return packageName;
}