904 |
* |
* |
905 |
* @throws IOException if the source directory couldn't be |
* @throws IOException if the source directory couldn't be |
906 |
* located. |
* located. |
907 |
|
* |
908 |
|
* @return List of File |
909 |
*/ |
*/ |
910 |
protected File getPackageSourceDir(PackageDoc packageDoc) |
protected List getPackageSourceDirs(PackageDoc packageDoc) |
911 |
throws IOException |
throws IOException |
912 |
{ |
{ |
913 |
if (null == sourcePaths) { |
if (null == sourcePaths) { |
929 |
|
|
930 |
String packageSubDir = packageDoc.name().replace('.', File.separatorChar); |
String packageSubDir = packageDoc.name().replace('.', File.separatorChar); |
931 |
Iterator it = sourcePaths.iterator(); |
Iterator it = sourcePaths.iterator(); |
932 |
|
List result = new LinkedList(); |
933 |
while (it.hasNext()) { |
while (it.hasNext()) { |
934 |
File pathComponent = (File)it.next(); |
File pathComponent = (File)it.next(); |
935 |
File packageDir = new File(pathComponent, packageSubDir); |
File packageDir = new File(pathComponent, packageSubDir); |
936 |
if (packageDir.exists()) { |
if (packageDir.exists()) { |
937 |
return packageDir; |
result.add(packageDir); |
938 |
} |
} |
939 |
} |
} |
940 |
throw new IOException("Couldn't locate source directory for package " + packageDoc.name()); |
if (result.isEmpty()) { |
941 |
|
throw new IOException("Couldn't locate source directory for package " + packageDoc.name()); |
942 |
|
} |
943 |
|
else { |
944 |
|
return result; |
945 |
|
} |
946 |
|
} |
947 |
|
|
948 |
|
protected File getSourceFile(ClassDoc classDoc) |
949 |
|
throws IOException |
950 |
|
{ |
951 |
|
List packageDirs = getPackageSourceDirs(classDoc.containingPackage()); |
952 |
|
Iterator it = packageDirs.iterator(); |
953 |
|
while (it.hasNext()) { |
954 |
|
File packageDir = (File)it.next(); |
955 |
|
File sourceFile = new File(packageDir, getOuterClassDoc(classDoc).name() + ".java"); |
956 |
|
if (sourceFile.exists()) { |
957 |
|
return sourceFile; |
958 |
|
} |
959 |
|
} |
960 |
|
|
961 |
|
throw new IOException("Couldn't locate source file for class " + classDoc.qualifiedTypeName()); |
962 |
} |
} |
963 |
|
|
964 |
protected void printError(String error) |
protected void printError(String error) |