Thread: [Patchanim-commit] SF.net SVN: patchanim: [119] trunk/patchanim/src/com/mebigfatguy/patchanim/ io/P
Brought to you by:
dbrosius
From: <dbr...@us...> - 2008-02-09 06:56:17
|
Revision: 119 http://patchanim.svn.sourceforge.net/patchanim/?rev=119&view=rev Author: dbrosius Date: 2008-02-08 22:56:20 -0800 (Fri, 08 Feb 2008) Log Message: ----------- comment out the validation for now as the xsd isn't loading Modified Paths: -------------- trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java 2008-02-09 06:46:49 UTC (rev 118) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java 2008-02-09 06:56:20 UTC (rev 119) @@ -147,9 +147,9 @@ } }); xmlIs = new BufferedInputStream(new FileInputStream(f)); - reader.setFeature("http://apache.org/xml/features/validation/schema", true); - reader.setFeature("http://xml.org/sax/features/validation", true); - reader.setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation", PatchAnimDocument.class.getResource(PATCHANIMDOC_SCHEMA).getPath()); + //reader.setFeature("http://apache.org/xml/features/validation/schema", true); + //reader.setFeature("http://xml.org/sax/features/validation", true); + //reader.setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation", PatchAnimDocument.class.getResource(PATCHANIMDOC_SCHEMA).getPath()); reader.parse(new InputSource(xmlIs)); return doc; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-02-09 15:24:50
|
Revision: 121 http://patchanim.svn.sourceforge.net/patchanim/?rev=121&view=rev Author: dbrosius Date: 2008-02-09 07:24:55 -0800 (Sat, 09 Feb 2008) Log Message: ----------- validate against the schema Modified Paths: -------------- trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java 2008-02-09 07:49:00 UTC (rev 120) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java 2008-02-09 15:24:55 UTC (rev 121) @@ -147,9 +147,9 @@ } }); xmlIs = new BufferedInputStream(new FileInputStream(f)); - //reader.setFeature("http://apache.org/xml/features/validation/schema", true); - //reader.setFeature("http://xml.org/sax/features/validation", true); - //reader.setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation", PatchAnimDocument.class.getResource(PATCHANIMDOC_SCHEMA).getPath()); + reader.setFeature("http://apache.org/xml/features/validation/schema", true); + reader.setFeature("http://xml.org/sax/features/validation", true); + reader.setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation", PatchAnimDocument.class.getResource(PATCHANIMDOC_SCHEMA).toString()); reader.parse(new InputSource(xmlIs)); return doc; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-02-24 16:01:01
|
Revision: 236 http://patchanim.svn.sourceforge.net/patchanim/?rev=236&view=rev Author: dbrosius Date: 2008-02-24 08:01:04 -0800 (Sun, 24 Feb 2008) Log Message: ----------- use save safe file idiom Modified Paths: -------------- trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java 2008-02-24 15:38:47 UTC (rev 235) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java 2008-02-24 16:01:04 UTC (rev 236) @@ -60,18 +60,18 @@ public static void saveFile(File f, PatchAnimDocument document) throws IOException { InputStream xslIs = null; OutputStream xmlOs = null; + File temporary = File.createTempFile("patchanim", "paf", f.getParentFile()); try { - document.setDirty(false); - TransformerFactory tf = TransformerFactory.newInstance(); xslIs = new BufferedInputStream(PatchAnimIO.class.getResourceAsStream("/com/mebigfatguy/patchanim/io/PatchAnimDoc.xsl")); Transformer t = tf.newTransformer(new StreamSource(xslIs)); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document d = db.newDocument(); - xmlOs = new BufferedOutputStream(new FileOutputStream(f)); + xmlOs = new BufferedOutputStream(new FileOutputStream(temporary)); t.setParameter("doc", document); t.transform(new DOMSource(d), new StreamResult(xmlOs)); + document.setDirty(false); } catch (IOException ioe) { throw ioe; } catch (Exception e) { @@ -81,6 +81,9 @@ } finally { Closer.close(xslIs); Closer.close(xmlOs); + f.delete(); + if (!temporary.renameTo(f)) + throw new IOException("Failed saving file " + f.getPath()); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-06-07 22:38:47
|
Revision: 242 http://patchanim.svn.sourceforge.net/patchanim/?rev=242&view=rev Author: dbrosius Date: 2008-06-07 15:38:55 -0700 (Sat, 07 Jun 2008) Log Message: ----------- DLS Modified Paths: -------------- trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java 2008-05-31 18:20:23 UTC (rev 241) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java 2008-06-07 22:38:55 UTC (rev 242) @@ -159,7 +159,6 @@ int order = doc.getOrder(); patchCoords.setCoordinate(coordIndex % order, coordIndex / order, c); coordIndex++; - c = null; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |