You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by sh...@apache.org on 2008/03/26 16:56:20 UTC

svn commit: r641357 - /geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/JAXBUtils.java

Author: shivahr
Date: Wed Mar 26 08:56:15 2008
New Revision: 641357

URL: http://svn.apache.org/viewvc?rev=641357&view=rev
Log:
Fixing bug encountered during creation of j2ee project (deployment plan)

Modified:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/JAXBUtils.java

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/JAXBUtils.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/JAXBUtils.java?rev=641357&r1=641356&r2=641357&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/JAXBUtils.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/JAXBUtils.java Wed Mar 26 08:56:15 2008
@@ -61,9 +61,14 @@
 			Marshaller marshaller = jaxbContext.createMarshaller();
 			marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
 			marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
-			ByteArrayOutputStream buffer = new ByteArrayOutputStream();
-			marshaller.marshal(jaxbElement, buffer);
-			file.setContents(new ByteArrayInputStream(buffer.toByteArray()), IFile.FORCE, null);
+			ByteArrayOutputStream outBuffer = new ByteArrayOutputStream();
+			marshaller.marshal(jaxbElement, outBuffer);
+			ByteArrayInputStream inBuffer = new ByteArrayInputStream(outBuffer.toByteArray());
+			if(file.exists()) {
+				file.setContents(inBuffer, true, false, null);
+			} else {
+				file.create(inBuffer, true, null);
+			}
 		} catch (JAXBException jaxbException) {
 			Trace.tracePoint("JAXBException", "JAXBUtils.marshallToIFile()", file.getFullPath());
 			jaxbException.printStackTrace();