coliver 2003/02/27 14:00:43
Modified: src/java/org/apache/cocoon/components/language/programming/java
EclipseJavaCompiler.java JavaLanguage.java
Log:
removed println's and tabs
Revision Changes Path
1.2 +70 -72
xml-cocoon2/src/java/org/apache/cocoon/components/language/programming/java/EclipseJavaCompiler.java
Index: EclipseJavaCompiler.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/language/programming/java/EclipseJavaCompiler.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- EclipseJavaCompiler.java 27 Feb 2003 21:27:55 -0000 1.1
+++ EclipseJavaCompiler.java 27 Feb 2003 22:00:43 -0000 1.2
@@ -109,8 +109,8 @@
sourceDir = null;
destDir = null;
sourceEncoding = null;
- source14 = true;
- target14 = true;
+ source14 = true;
+ target14 = true;
errors.clear();
}
@@ -180,19 +180,18 @@
}
public boolean compile() throws IOException {
- System.out.println("!!******* Compiling: " + sourceFile);
- final String targetClassName = makeClassName(sourceFile);
- final ClassLoader classLoader = ClassUtils.getClassLoader();
- String[] fileNames = new String[] {sourceFile};
- String[] classNames = new String[] {targetClassName};
+ final String targetClassName = makeClassName(sourceFile);
+ final ClassLoader classLoader = ClassUtils.getClassLoader();
+ String[] fileNames = new String[] {sourceFile};
+ String[] classNames = new String[] {targetClassName};
class CompilationUnit implements ICompilationUnit {
String className;
- String sourceFile;
+ String sourceFile;
CompilationUnit(String sourceFile, String className) {
this.className = className;
- this.sourceFile = sourceFile;
+ this.sourceFile = sourceFile;
}
public char[] getFileName() {
@@ -215,8 +214,8 @@
buf.getChars(0, result.length, result, 0);
}
} catch (IOException e) {
- handleError(className, -1, -1,
- e.getMessage());
+ handleError(className, -1, -1,
+ e.getMessage());
//e.printStackTrace();
}
return result;
@@ -281,16 +280,16 @@
return
new NameEnvironmentAnswer(compilationUnit);
}
- String resourceName =
- className.replace('.', '/') + ".class";
- InputStream is =
- classLoader.getResourceAsStream(resourceName);
- if (is != null) {
- byte[] classBytes;
- byte[] buf = new byte[8192];
- ByteArrayOutputStream baos =
- new ByteArrayOutputStream(buf.length);
- int count;
+ String resourceName =
+ className.replace('.', '/') + ".class";
+ InputStream is =
+ classLoader.getResourceAsStream(resourceName);
+ if (is != null) {
+ byte[] classBytes;
+ byte[] buf = new byte[8192];
+ ByteArrayOutputStream baos =
+ new ByteArrayOutputStream(buf.length);
+ int count;
while ((count = is.read(buf, 0, buf.length)) > 0) {
baos.write(buf, 0, count);
}
@@ -304,24 +303,24 @@
new NameEnvironmentAnswer(classFileReader);
}
} catch (IOException exc) {
- handleError(className, -1, -1,
- exc.getMessage());
+ handleError(className, -1, -1,
+ exc.getMessage());
} catch
(org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException exc) {
- handleError(className, -1, -1,
- exc.getMessage());
+ handleError(className, -1, -1,
+ exc.getMessage());
}
return null;
}
- private boolean isPackage(String result) {
- if (result.equals(targetClassName)) {
- return false;
- }
- String resourceName = result.replace('.', '/') + ".class";
- InputStream is =
- classLoader.getResourceAsStream(resourceName);
- return is == null;
- }
+ private boolean isPackage(String result) {
+ if (result.equals(targetClassName)) {
+ return false;
+ }
+ String resourceName = result.replace('.', '/') + ".class";
+ InputStream is =
+ classLoader.getResourceAsStream(resourceName);
+ return is == null;
+ }
public boolean isPackage(char[][] parentPackageName,
char[] packageName) {
@@ -330,20 +329,20 @@
if (parentPackageName != null) {
for (int i = 0; i < parentPackageName.length; i++) {
result += sep;
- String str = new String(parentPackageName[i]);
+ String str = new String(parentPackageName[i]);
result += str;
sep = ".";
}
}
- String str = new String(packageName);
- if (Character.isUpperCase(str.charAt(0))) {
- if (!isPackage(result)) {
- return false;
- }
- }
+ String str = new String(packageName);
+ if (Character.isUpperCase(str.charAt(0))) {
+ if (!isPackage(result)) {
+ return false;
+ }
+ }
result += sep;
result += str;
- return isPackage(result);
+ return isPackage(result);
}
public void cleanup() {
@@ -357,12 +356,12 @@
CompilerOptions.GENERATE);
settings.put(CompilerOptions.OPTION_SourceFileAttribute,
CompilerOptions.GENERATE);
- settings.put(CompilerOptions.OPTION_ReportDeprecation,
- CompilerOptions.IGNORE);
- if (sourceEncoding != null) {
- settings.put(CompilerOptions.OPTION_Encoding,
- sourceEncoding);
- }
+ settings.put(CompilerOptions.OPTION_ReportDeprecation,
+ CompilerOptions.IGNORE);
+ if (sourceEncoding != null) {
+ settings.put(CompilerOptions.OPTION_Encoding,
+ sourceEncoding);
+ }
if (debug) {
settings.put(CompilerOptions.OPTION_LocalVariableAttribute,
CompilerOptions.GENERATE);
@@ -388,9 +387,9 @@
String name =
new
String(problems[i].getOriginatingFileName());
handleError(name,
- problem.getSourceLineNumber(),
- -1,
- problem.getMessage());
+ problem.getSourceLineNumber(),
+ -1,
+ problem.getMessage());
}
} else {
ClassFile[] classFiles = result.getClassFiles();
@@ -407,15 +406,14 @@
sep = ".";
}
byte[] bytes = classFile.getBytes();
- String outFile = destDir + "/" +
- className.replace('.', '/') + ".class";
- System.out.println("****generating: " + outFile);
- FileOutputStream fout =
- new FileOutputStream(outFile);
- BufferedOutputStream bos =
- new BufferedOutputStream(fout);
- bos.write(bytes);
- bos.close();
+ String outFile = destDir + "/" +
+ className.replace('.', '/') + ".class";
+ FileOutputStream fout =
+ new FileOutputStream(outFile);
+ BufferedOutputStream bos =
+ new BufferedOutputStream(fout);
+ bos.write(bytes);
+ bos.close();
}
}
} catch (IOException exc) {
@@ -435,23 +433,23 @@
requestor,
problemFactory);
compiler.compile(compilationUnits);
- return errors.size() == 0;
+ return errors.size() == 0;
}
void handleError(String className, int line, int column, Object errorMessage) {
- String fileName =
- className.replace('.', File.separatorChar) + ".java";
- if (column < 0) column = 0;
- errors.add(new CompilerError(fileName,
- true,
- line,
- column,
- line,
- column,
- errorMessage.toString()));
+ String fileName =
+ className.replace('.', File.separatorChar) + ".java";
+ if (column < 0) column = 0;
+ errors.add(new CompilerError(fileName,
+ true,
+ line,
+ column,
+ line,
+ column,
+ errorMessage.toString()));
}
public List getErrors() throws IOException {
- return errors;
+ return errors;
}
}
1.17 +4 -4
xml-cocoon2/src/java/org/apache/cocoon/components/language/programming/java/JavaLanguage.java
Index: JavaLanguage.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/language/programming/java/JavaLanguage.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- JavaLanguage.java 27 Feb 2003 21:27:55 -0000 1.16
+++ JavaLanguage.java 27 Feb 2003 22:00:43 -0000 1.17
@@ -203,9 +203,9 @@
try {
LanguageCompiler compiler = (LanguageCompiler)
this.compilerClass.newInstance();
// AbstractJavaCompiler is LogEnabled
- if (compiler instanceof LogEnabled) {
- ((LogEnabled)compiler).enableLogging(getLogger());
- }
+ if (compiler instanceof LogEnabled) {
+ ((LogEnabled)compiler).enableLogging(getLogger());
+ }
int pos = name.lastIndexOf(File.separatorChar);
String filename = name.substring(pos + 1);