From e42ba10a3d901948acb9c6e7c11d014c26b2a747 Mon Sep 17 00:00:00 2001 From: Gaston Dombiak Date: Tue, 1 Feb 2005 01:32:24 +0000 Subject: [PATCH] Fixed pretty printing of XML packet. SMACK-42 git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2452 b35dd754-fafc-0310-a699-88a17e54d16e --- .../org/jivesoftware/smackx/debugger/EnhancedDebugger.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/org/jivesoftware/smackx/debugger/EnhancedDebugger.java b/source/org/jivesoftware/smackx/debugger/EnhancedDebugger.java index 93641b934..61f35ae22 100644 --- a/source/org/jivesoftware/smackx/debugger/EnhancedDebugger.java +++ b/source/org/jivesoftware/smackx/debugger/EnhancedDebugger.java @@ -712,6 +712,12 @@ public class EnhancedDebugger implements SmackDebugger { try { // Use a Transformer for output TransformerFactory tFactory = TransformerFactory.newInstance(); + // Surround this setting in a try/catch for compatibility with Java 1.4. This setting is required + // for Java 1.5 + try { + tFactory.setAttribute("indent-number", new Integer(2)); + } + catch (IllegalArgumentException e) {} Transformer transformer = tFactory.newTransformer(); transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); transformer.setOutputProperty(OutputKeys.INDENT, "yes");