File tree Expand file tree Collapse file tree
main/java/com/github/underscore
test/java/com/github/underscore Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2260,7 +2260,8 @@ public static FetchResponse fetch(
22602260 }
22612261 }
22622262
2263- public static int readWithRetry (java .io .InputStream inputStream , byte [] buffer ) throws java .io .IOException {
2263+ public static int readWithRetry (java .io .InputStream inputStream , byte [] buffer )
2264+ throws java .io .IOException {
22642265 java .io .IOException lastException = null ;
22652266 for (int attempt = 0 ; attempt < 2 ; attempt ++) {
22662267 try {
Original file line number Diff line number Diff line change @@ -1193,7 +1193,8 @@ private static void checkLocalMap(
11931193 || localMap2 .size () != 1
11941194 || XmlValue .getMapKey (localMap2 ).startsWith ("-" )
11951195 || XmlValue .getMapValue (localMap2 ) instanceof List ) {
1196- if (ROOT .equals (XmlValue .getMapKey (localMap2 ))) {
1196+ if (ROOT .equals (XmlValue .getMapKey (localMap2 ))
1197+ && XmlValue .getMapValue (localMap2 ) instanceof List ) {
11971198 writeArray ((List ) XmlValue .getMapValue (localMap2 ), builder , arrayTrue );
11981199 } else {
11991200 XmlObject .writeXml (
Original file line number Diff line number Diff line change @@ -1113,6 +1113,24 @@ void xmpToJson5() {
11131113 U .xmlToJson ("<Comment stringValue=\" ============================\" />" ));
11141114 }
11151115
1116+ @ Test
1117+ void xmpToJson6 () {
1118+ assertEquals (
1119+ "{\n "
1120+ + " \" root\" : {\n "
1121+ + " \" a\" : 1\n "
1122+ + " },\n "
1123+ + " \" omit-xml-declaration\" : \" yes\" \n "
1124+ + "}" ,
1125+ U .xmlToJson ("<?xml version=\" 1.0\" encoding=\" UTF-8\" ?>\n "
1126+ + "<root>\n "
1127+ + " <root>\n "
1128+ + " <a number=\" true\" >1</a>\n "
1129+ + " </root>\n "
1130+ + " <omit-xml-declaration>yes</omit-xml-declaration>\n "
1131+ + "</root>" ));
1132+ }
1133+
11161134 @ Test
11171135 void xmlToJsonMinimum () {
11181136 assertEquals (
You can’t perform that action at this time.
0 commit comments