Today I was generating JavaDoc from withing IntelliJ idea, and I saw this error:
javadoc: error – Illegal package name: “”
I tracked it down here: http://www.jetbrains.net/jira/browse/IDEA-11773 and discovered it was the result of spaces in the name of paths in the class path. IMHO idea should be escaping spaces. But it doesn’t.
My [...]
Today I was generating JavaDoc from withing IntelliJ idea, and I saw this error:
javadoc: error – Illegal package name: “”
I tracked it down here: http://www.jetbrains.net/jira/browse/IDEA-11773 and discovered it was the result of spaces in the name of paths in the class path. IMHO idea should be escaping spaces. But it doesn’t.
My short term solution was to put the command from idea into a shell script and modify it there. What’s irritating about this is that the paths in question were IntelliJ’s own installation page. In my case:
/Applications/IntelliJ\ IDEA 8.1.app/lib/j2ee.jar
Ugh. So I can move the install dir for IntelliJ, provided that doesn’t cause additional problems, I should be OK.
Update: at least part of the problem was that I was javadoc’ing a package that included only groovy classes. When I excluded that package, things worked well again.
Some times the easy stuff requires custom code. Searching the web I found a few examples. This one was the most promising, but it has some typos: Example Dir Zip.
So I rolled my own. Note that I use commons logging. If you don’t use logging, just remove the log statements.
Also note [...]
Some times the easy stuff requires custom code. Searching the web I found a few examples. This one was the most promising, but it has some typos: Example Dir Zip.
So I rolled my own. Note that I use commons logging. If you don’t use logging, just remove the log statements.
Also note bad source or destination errors are silently swallowed. I will probably change this.
Also, it doesn’t do any sort of locking. Probably at a minimum the destination file should be locked.
/**
* Zips the directory and all contents from dir into a file named
* filename
*
* @param dirPath path of directory to zip; must exist
* @param filename filename to store contents
*/
public static void zipDir(String dirPath, String filename) {
File dir = new File(dirPath);
if (!dir.isDirectory()) {
log.error(dirPath + " is not a directory");
return;
}
ZipOutputStream out = null;
try {
log.trace("Creating : " + filename);
out = new ZipOutputStream(new FileOutputStream(filename));
addDir(dir, out);
} catch (IOException e) {
log.error(e);
} finally {
if (out != null) {
try {
out.close();
} catch (IOException e) {
log.error("failed to close output file: " + filename, e);
}
}
}
}
private static void addDir(File dir, ZipOutputStream out)
throws IOException {
byte[] tmpBuf = new byte[1024];
// add each file
// if file is a directory, move into it and add all contents recursively
// until done
for (File file : dir.listFiles()) {
if (file.isDirectory()) {
addDir(file, out);
continue;
}
FileInputStream in = new FileInputStream(file.getAbsolutePath());
log.trace("Adding: " + file.getAbsolutePath());
out.putNextEntry(new ZipEntry(file.getAbsolutePath()));
// Transfer from the file to the ZIP file
int len;
while ((len = in.read(tmpBuf)) > 0) {
out.write(tmpBuf, 0, len);
}
// Complete the entry
out.closeEntry();
in.close();
}
}
-
Calendar
February 2012 S M T W T F S « Nov 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 -
Meta
