Author: cziegeler
Date: Tue Mar 8 06:03:49 2005
New Revision: 156525
URL: http://svn.apache.org/viewcvs?view=rev&rev=156525
Log:
Fix problems with JDK 5.0 on windows :(
Modified:
cocoon/branches/BRANCH_2_1_X/tools/src/anttasks/DocumentCache.java
Modified: cocoon/branches/BRANCH_2_1_X/tools/src/anttasks/DocumentCache.java
URL:
http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/tools/src/anttasks/DocumentCache.java?view=diff&r1=156524&r2=156525
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/tools/src/anttasks/DocumentCache.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/tools/src/anttasks/DocumentCache.java Tue Mar
8 06:03:49 2005
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,6 +15,8 @@
*/
import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
import java.io.IOException;
import java.io.StringReader;
import java.util.HashMap;
@@ -88,7 +90,7 @@
if ( task != null ) {
task.log("Reading: " + fileName, Project.MSG_DEBUG);
}
- document = builder.parse(fileName);
+ document = builder.parse(file);
} catch (IOException e) {
throw new BuildException("IOException: "+e);
}
@@ -134,8 +136,15 @@
transformer.setOutputProperties(props);
try {
+ StreamResult s = new StreamResult(file);
+ // for JDK 5.0 we explicitly have to set the output stream
+ // otherwise we get FileNotFoundExceptions (at least on
+ // windows)
+ s.setOutputStream(new FileOutputStream(file));
transformer.transform(new DOMSource(document),
- new StreamResult(file));
+ s);
+ } catch (FileNotFoundException e) {
+ throw new BuildException("FileNotFoundException: "+e);
} catch (TransformerException e) {
throw new BuildException("TransformerException: "+e);
}