Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

removed intendation for json

  • Loading branch information...
commit 188c1f24e72b0070c8e365657cda71fd3e1646ac 1 parent 8d01f68
Johannes Schneider authored March 27, 2012
4  stax-mate/src/main/java/com/cedarsoft/serialization/stax/mate/AbstractStaxMateSerializer.java
@@ -64,7 +64,9 @@ public void serialize( @Nonnull T object, @Nonnull OutputStream out ) throws IOE
64 64
     try {
65 65
       SMOutputFactory factory = StaxMateSupport.getSmOutputFactory();
66 66
       SMOutputDocument doc = factory.createOutputDocument( out );
67  
-      doc.setIndentation( INDENT_STR, 1, 2 );
  67
+      if (! StaxMateSupport.isJsonEnabled() ) {
  68
+        doc.setIndentation( INDENT_STR, 1, 2 );
  69
+      }
68 70
 
69 71
       String nameSpaceUri = getNameSpace();
70 72
       SMNamespace nameSpace = doc.getNamespace( nameSpaceUri );
4  stax-mate/src/main/java/com/cedarsoft/serialization/stax/mate/StaxMateSupport.java
@@ -92,4 +92,8 @@ public static void enableJson() {
92 92
     clear();
93 93
     StaxSupport.enableJson();
94 94
   }
  95
+
  96
+  public static boolean isJsonEnabled() {
  97
+    return StaxSupport.isJsonEnabled();
  98
+  }
95 99
 }
5  stax/src/main/java/com/cedarsoft/serialization/stax/StaxSupport.java
@@ -123,4 +123,9 @@ public static void enableJson() {
123 123
       throw new RuntimeException( e );
124 124
     }
125 125
   }
  126
+
  127
+  public static boolean isJsonEnabled() {
  128
+    XMLInputFactory factory = XML_INPUT_FACTORY.get();
  129
+    return factory.getClass().getName().equals( "org.codehaus.jettison.badgerfish.BadgerFishXMLInputFactory" );
  130
+  }
126 131
 }

0 notes on commit 188c1f2

Please sign in to comment.
Something went wrong with that request. Please try again.