484 |
//--- Create one file object each for a possible package directory |
//--- Create one file object each for a possible package directory |
485 |
// and a possible class file, and find out if they exist. |
// and a possible class file, and find out if they exist. |
486 |
|
|
487 |
File packageDir = rootDoc.findSourceFile(classOrPackageRelPath); |
List packageDirs = rootDoc.findSourceFiles(classOrPackageRelPath); |
488 |
File sourceFile = rootDoc.findSourceFile(classOrPackageRelPath |
List sourceFiles = rootDoc.findSourceFiles(classOrPackageRelPath + ".java"); |
489 |
+ ".java"); |
|
490 |
|
boolean packageDirExists = !packageDirs.isEmpty(); |
491 |
boolean packageDirExists = packageDir != null |
boolean sourceFileExists = !sourceFiles.isEmpty(); |
|
&& packageDir.exists() |
|
|
&& packageDir.getCanonicalFile().getAbsolutePath().endsWith( |
|
|
classOrPackageRelPath); |
|
|
|
|
|
boolean sourceFileExists = sourceFile != null |
|
|
&& sourceFile.exists() |
|
|
&& sourceFile.getCanonicalFile().getAbsolutePath().endsWith( |
|
|
classOrPackageRelPath + ".java"); |
|
492 |
|
|
493 |
//--- Complain if neither exists: not found |
//--- Complain if neither exists: not found |
494 |
|
|
512 |
//--- Otherwise, if the package directory exists, it is a package |
//--- Otherwise, if the package directory exists, it is a package |
513 |
|
|
514 |
else |
else |
515 |
if (packageDirExists) |
if (packageDirExists) { |
516 |
{ |
Iterator packageDirIt = packageDirs.iterator(); |
517 |
if (!packageDir.isDirectory()) |
boolean packageDirFound = false; |
518 |
{ |
while (packageDirIt.hasNext()) { |
519 |
reporter.printError("File \"" + packageDir |
File packageDir = (File)packageDirIt.next(); |
520 |
+ "\" doesn't have .java extension."); |
if (packageDir.isDirectory()) { |
521 |
shutdown(); |
rootDoc.addSpecifiedPackageName(classOrPackage); |
522 |
|
packageDirFound = true; |
523 |
|
break; |
524 |
|
} |
525 |
} |
} |
526 |
else |
if (!packageDirFound) { |
527 |
{ |
reporter.printError("No suitable file or directory found for" + classOrPackage); |
528 |
rootDoc.addSpecifiedPackageName(classOrPackage); |
shutdown(); |
529 |
} |
} |
530 |
} |
} |
531 |
|
|