Kaydet (Commit) 814f618c authored tarafından Vladimir Glazounov's avatar Vladimir Glazounov

INTEGRATION: CWS dbwizard3 (1.3.28); FILE MERGED

2005/01/28 11:38:48 bc 1.3.28.2: #i39885# transformerfile in Process.java now closed after transformation
2004/12/10 16:48:14 sb 1.3.28.1: #i38396# Fixed problem occuring when using Xalan-Java 2.6.0 and Java 1.5.0.
üst c64abe0f
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: Process.java,v $ * $RCSfile: Process.java,v $
* *
* $Revision: 1.3 $ * $Revision: 1.4 $
* *
* last change: $Author: obo $ $Date: 2004-09-08 14:12:54 $ * last change: $Author: vg $ $Date: 2005-02-21 14:08:32 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
package com.sun.star.wizards.web; package com.sun.star.wizards.web;
import java.io.File; import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.Iterator; import java.util.Iterator;
...@@ -287,36 +288,37 @@ public class Process implements Runnable, WebWizardConst, ProcessErrors { ...@@ -287,36 +288,37 @@ public class Process implements Runnable, WebWizardConst, ProcessErrors {
private boolean cleanup(Task task) { private boolean cleanup(Task task) {
task.setSubtaskName(TASK_FINISH); task.setSubtaskName(TASK_FINISH);
boolean b = cleanup(tempDir); boolean b = fileAccess.delete(tempDir);
if (!b) if (!b)
error(null,null,ERROR_CLEANUP,ErrorHandler.ERROR_WARNING); error(null,null,ERROR_CLEANUP,ErrorHandler.ERROR_WARNING);
task.advance(b); task.advance(b);
return b; return b;
} }
/** // /**
* deletes the given directory // * deletes the given directory
* @param dir the directory to delete // * @param dir the directory to delete
* @return true if should continue // * @return true if should continue
*/ // */
private boolean cleanup(String dir) { // private boolean cleanup(String dir) {
//
boolean success = true; // boolean success = true;
//
// if (dir != null && fileAccess.exists(dir,false)) {
//
// String[] files = fileAccess.listFiles(dir,true);
//
// for (int i = 0; i < files.length; i++) {
// if (fileAccess.isDirectory(files[i]))
// success = success && cleanup(files[i]);
// else
// success = success && fileAccess.delete(files[i]);
//
// }
// }
// return success && fileAccess.delete(dir);
// }
if (dir != null && fileAccess.exists(dir,false)) {
String[] files = fileAccess.listFiles(dir,true);
for (int i = 0; i < files.length; i++) {
if (fileAccess.isDirectory(files[i]))
success = success && cleanup(files[i]);
else
success = success && fileAccess.delete(files[i]);
}
}
return success && fileAccess.delete(dir);
}
/** /**
* This method is used to copy style files to a target * This method is used to copy style files to a target
...@@ -539,7 +541,6 @@ public class Process implements Runnable, WebWizardConst, ProcessErrors { ...@@ -539,7 +541,6 @@ public class Process implements Runnable, WebWizardConst, ProcessErrors {
Transformer transformer = ((Templates)templates.get(key)).newTransformer(); Transformer transformer = ((Templates)templates.get(key)).newTransformer();
doc.normalize(); doc.normalize();
task.advance(true); task.advance(true);
/* /*
...@@ -548,14 +549,16 @@ public class Process implements Runnable, WebWizardConst, ProcessErrors { ...@@ -548,14 +549,16 @@ public class Process implements Runnable, WebWizardConst, ProcessErrors {
*/ */
String fn = fileAccess.getPath( targetPath, key.substring(0,key.length()-4)); String fn = fileAccess.getPath( targetPath, key.substring(0,key.length()-4));
File f = new File(fn); File f = new File(fn);
FileOutputStream oStream = new FileOutputStream(f);
transformer.transform( new DOMSource(doc), new StreamResult(f) ); // Due to a problem occuring when using Xalan-Java 2.6.0 and
// Java 1.5.0, wrap f in a FileOutputStream here (otherwise, the
// StreamResult's getSystemId would return a "file:/..." URL while
// the Xalan code expects a "file:///..." URL):
transformer.transform(
new DOMSource(doc), new StreamResult(oStream) );
oStream.close();
task.advance(true); task.advance(true);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment