svn commit: r1338976 - in /ofbiz/branches/release12.04: ./ applications/accounting/src/org/ofbiz/accounting/thirdparty/clearcommerce/ applications/product/src/org/ofbiz/shipment/thirdparty/usps/ framework/base/src/org/ofbiz/base/util/

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1338976 - in /ofbiz/branches/release12.04: ./ applications/accounting/src/org/ofbiz/accounting/thirdparty/clearcommerce/ applications/product/src/org/ofbiz/shipment/thirdparty/usps/ framework/base/src/org/ofbiz/base/util/

jleroux@apache.org
Author: jleroux
Date: Wed May 16 02:44:26 2012
New Revision: 1338976

URL: http://svn.apache.org/viewvc?rev=1338976&view=rev
Log:
"Applied fix from trunk for revision: 1338974  "
------------------------------------------------------------------------
r1338974 | jleroux | 2012-05-16 04:42:09 +0200 (mer., 16 mai 2012) | 1 line

Deprecates w/out keepSpace versions of UtilXml.createOutputTransformer() and UtilXml.writeXmlDocument()
------------------------------------------------------------------------


Modified:
    ofbiz/branches/release12.04/   (props changed)
    ofbiz/branches/release12.04/applications/accounting/src/org/ofbiz/accounting/thirdparty/clearcommerce/CCPaymentServices.java
    ofbiz/branches/release12.04/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsMockApiServlet.java
    ofbiz/branches/release12.04/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java
    ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java

Propchange: ofbiz/branches/release12.04/
------------------------------------------------------------------------------
  Reverse-merged /ofbiz/trunk:r1338856
  Merged /ofbiz/trunk:r1338974

Modified: ofbiz/branches/release12.04/applications/accounting/src/org/ofbiz/accounting/thirdparty/clearcommerce/CCPaymentServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/applications/accounting/src/org/ofbiz/accounting/thirdparty/clearcommerce/CCPaymentServices.java?rev=1338976&r1=1338975&r2=1338976&view=diff
==============================================================================
--- ofbiz/branches/release12.04/applications/accounting/src/org/ofbiz/accounting/thirdparty/clearcommerce/CCPaymentServices.java (original)
+++ ofbiz/branches/release12.04/applications/accounting/src/org/ofbiz/accounting/thirdparty/clearcommerce/CCPaymentServices.java Wed May 16 02:44:26 2012
@@ -891,7 +891,7 @@ public class CCPaymentServices {
         OutputStream os = new ByteArrayOutputStream();
 
         try {
-            UtilXml.writeXmlDocument(requestDocument, os, "UTF-8", true, false, 0, false);
+            UtilXml.writeXmlDocument(requestDocument, os, "UTF-8", true, false, 0);
         } catch (TransformerException e) {
             throw new ClearCommerceException("Error serializing requestDocument: " + e.getMessage());
         }

Modified: ofbiz/branches/release12.04/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsMockApiServlet.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsMockApiServlet.java?rev=1338976&r1=1338975&r2=1338976&view=diff
==============================================================================
--- ofbiz/branches/release12.04/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsMockApiServlet.java (original)
+++ ofbiz/branches/release12.04/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsMockApiServlet.java Wed May 16 02:44:26 2012
@@ -127,7 +127,7 @@ public class UspsMockApiServlet extends
             OutputStream os = new ByteArrayOutputStream();
 
             try {
-                UtilXml.writeXmlDocument(responseDocument, os, "UTF-8", true, false, 0, false);
+                UtilXml.writeXmlDocument(responseDocument, os, "UTF-8", true, false, 0);
             } catch (TransformerException e) {
                 Debug.logInfo(e, module);
                 return;

Modified: ofbiz/branches/release12.04/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java?rev=1338976&r1=1338975&r2=1338976&view=diff
==============================================================================
--- ofbiz/branches/release12.04/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java (original)
+++ ofbiz/branches/release12.04/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java Wed May 16 02:44:26 2012
@@ -1713,7 +1713,7 @@ public class UspsServices {
         OutputStream os = new ByteArrayOutputStream();
 
         try {
-            UtilXml.writeXmlDocument(requestDocument, os, "UTF-8", true, false, 0, false);
+            UtilXml.writeXmlDocument(requestDocument, os, "UTF-8", true, false, 0);
         } catch (TransformerException e) {
             throw new UspsRequestException(
                     UtilProperties.getMessage(resourceError,

Modified: ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java?rev=1338976&r1=1338975&r2=1338976&view=diff
==============================================================================
--- ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java (original)
+++ ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/util/UtilXml.java Wed May 16 02:44:26 2012
@@ -159,6 +159,50 @@ public class UtilXml {
     // ----- TrAX Methods ----------------- //
 
     /**
+     * @deprecated : use the keepSpace version Creates a JAXP TrAX Transformer suitable for pretty-printing an XML document. This method is provided as
+     *             an alternative to the deprecated <code>org.apache.xml.serialize.OutputFormat</code> class.
+     * @param encoding
+     *            Optional encoding, defaults to UTF-8
+     * @param omitXmlDeclaration
+     *            If <code>true</code> the xml declaration will be omitted from the output
+     * @param indent
+     *            If <code>true</code>, the output will be indented
+     * @param indentAmount
+     *            If <code>indent</code> is <code>true</code>, the number of spaces to indent. Default is 4.
+     * @return A <code>Transformer</code> instance
+     * @see <a href="http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.html">JAXP TrAX</a>
+     * @throws TransformerConfigurationException
+     */
+    @Deprecated
+    public static Transformer createOutputTransformer(String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount)
+            throws TransformerConfigurationException {
+        StringBuilder sb = new StringBuilder();
+        sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+        sb.append("<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:xalan=\"http://xml.apache.org/xslt\" version=\"1.0\">\n");
+        sb.append("<xsl:output method=\"xml\" encoding=\"");
+        sb.append(encoding == null ? "UTF-8" : encoding);
+        sb.append("\"");
+        if (omitXmlDeclaration) {
+            sb.append(" omit-xml-declaration=\"yes\"");
+        }
+        sb.append(" indent=\"");
+        sb.append(indent ? "yes" : "no");
+        sb.append("\"");
+        if (indent) {
+            sb.append(" xalan:indent-amount=\"");
+            sb.append(indentAmount <= 0 ? 4 : indentAmount);
+            sb.append("\"");
+        }
+        sb.append("/>\n<xsl:strip-space elements=\"*\"/>\n");
+        sb.append("<xsl:template match=\"@*|node()\">\n");
+        sb.append("<xsl:copy><xsl:apply-templates select=\"@*|node()\"/></xsl:copy>\n");
+        sb.append("</xsl:template>\n</xsl:stylesheet>\n");
+        ByteArrayInputStream bis = new ByteArrayInputStream(sb.toString().getBytes());
+        TransformerFactory transformerFactory = TransformerFactory.newInstance();
+        return transformerFactory.newTransformer(new StreamSource(bis));
+    }
+
+    /**
      * Creates a JAXP TrAX Transformer suitable for pretty-printing an XML document. This method is provided as an alternative to the deprecated
      * <code>org.apache.xml.serialize.OutputFormat</code> class.
      *
@@ -223,6 +267,30 @@ public class UtilXml {
     }
 
     /**
+     * @deprecated : use the keepSpace version Serializes a DOM <code>Node</code> to an <code>OutputStream</code> using JAXP TrAX.
+     * @param node
+     *            The <code>Node</code> to serialize
+     * @param os
+     *            The <code>OutputStream</code> to serialize to
+     * @param encoding
+     *            Optional encoding, defaults to UTF-8
+     * @param omitXmlDeclaration
+     *            If <code>true</code> the xml declaration will be omitted from the output
+     * @param indent
+     *            If <code>true</code>, the output will be indented
+     * @param indentAmount
+     *            If <code>indent</code> is <code>true</code>, the number of spaces to indent. Default is 4.
+     * @see <a href="http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.html">JAXP TrAX</a>
+     * @throws TransformerException
+     */
+    @Deprecated
+    public static void writeXmlDocument(Node node, OutputStream os, String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount)
+            throws TransformerException {
+        Transformer transformer = createOutputTransformer(encoding, omitXmlDeclaration, indent, indentAmount);
+        transformDomDocument(transformer, node, os);
+    }
+
+    /**
      * Serializes a DOM <code>Node</code> to an <code>OutputStream</code> using JAXP TrAX.
      *
      * @param node