Bug 137053 - Better error reporting when the output directory is a file
Summary: Better error reporting when the output directory is a file
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2 RC2   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-17 14:44 EDT by Olivier Thomann CLA
Modified: 2006-04-28 14:30 EDT (History)
0 users

See Also:


Attachments
Proposed fix (6.32 KB, patch)
2006-04-17 14:45 EDT, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Thomann CLA 2006-04-17 14:44:21 EDT
Using HEAD, the batch compiler doesn't report very nicely that the output directory is a file.
It needs to be a directory.
Comment 1 Olivier Thomann CLA 2006-04-17 14:45:13 EDT
Created attachment 38704 [details]
Proposed fix
Comment 2 Olivier Thomann CLA 2006-04-17 14:46:09 EDT
With the fix:
The output directory is a file : d:\tests_sources\X.java
[compiled 2 lines in 781 ms: 2.5 lines/s]
[1 .class file generated]
No .class file created for file X.class in d:\tests_sources\X.java because of an IOException.

The outDir is a file : d:\tests_sources\X.java
[compiled 2 lines in 772 ms: 2.5 lines/s]
[1 .class file generated]
java.io.IOException: The outDir is a file not a directory.
	at org.eclipse.jdt.internal.compiler.ClassFile.buildAllDirectoriesInto(ClassFile.java:123)
	at org.eclipse.jdt.internal.compiler.ClassFile.writeToDisk(ClassFile.java:290)
	at org.eclipse.jdt.internal.compiler.batch.Main.outputClassFiles(Main.java:2779)
	at org.eclipse.jdt.internal.compiler.batch.Main$1.acceptResult(Main.java:2656)
	at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:405)
	at org.eclipse.jdt.internal.compiler.batch.Main.performCompilation(Main.java:2825)
	at org.eclipse.jdt.internal.compiler.batch.Main.compile(Main.java:1303)
	at org.eclipse.jdt.internal.compiler.batch.Main.compile(Main.java:1109)
	at org.eclipse.jdt.internal.compiler.batch.Main.compile(Main.java:1101)
	at org.eclipse.jdt.core.tools.compiler.Compile.main(Compile.java:19)
No .class file created for file named d:\tests_sources\X.javaX.class because of an IOException.
Comment 3 Olivier Thomann CLA 2006-04-17 14:46:37 EDT
The second part is the actual behavior without the patch.
Comment 4 Philipe Mulet CLA 2006-04-18 05:10:25 EDT
+1 for 3.2RC2
Comment 5 Olivier Thomann CLA 2006-04-18 14:38:26 EDT
Fixed and released in HEAD.
Now the batch compiler reports:
The output directory is a file : d:\tests_sources\X.java
[compiled 2 lines in 781 ms: 2.5 lines/s]
No .class file created for file X.class in d:\tests_sources\X.java because of
an IOException.
Comment 6 Olivier Thomann CLA 2006-04-18 15:17:01 EDT
Current code simply returns:
No .class file created for file X.class in d:\tests_sources\X.java because of an IOException: The output directory is a file : d:\tests_sources\X.java

I removed the usage of System.out.println(...) since this is polluting the console.
Comment 7 Olivier Thomann CLA 2006-04-28 14:30:54 EDT
Verified with I20060427-1600 for 3.2RC2