You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by gd...@apache.org on 2001/12/05 19:33:55 UTC
cvs commit: xml-axis/java/src/org/apache/axis/configuration FileProvider.java
gdaniels 01/12/05 10:33:55
Modified: java/src/org/apache/axis/configuration FileProvider.java
Log:
Don't risk screwing up the persistent config in case of errors - save to
a String first then write it out from there.
Revision Changes Path
1.12 +10 -1 xml-axis/java/src/org/apache/axis/configuration/FileProvider.java
Index: FileProvider.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/configuration/FileProvider.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- FileProvider.java 2001/11/14 21:22:54 1.11
+++ FileProvider.java 2001/12/05 18:33:55 1.12
@@ -66,6 +66,7 @@
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
+import java.io.StringWriter;
import java.util.Properties;
/**
@@ -131,11 +132,19 @@
myInputStream = null;
}
+ /**
+ * Save the engine configuration. In case there's a problem, we
+ * write it to a string before saving it out to the actual file so
+ * we don't screw up the file.
+ */
public void writeEngineConfig(AxisEngine engine) throws Exception
{
Document doc = Admin.listConfig(engine);
+ StringWriter writer = new StringWriter();
+ XMLUtils.DocumentToWriter(doc, writer);
+ writer.close();
FileOutputStream fos = new FileOutputStream(basepath + sep + filename);
- XMLUtils.DocumentToStream(doc, fos);
+ fos.write(writer.getBuffer().toString().getBytes());
fos.close();
}
}