Commits

kal...@chimay.atlassian.pl  committed 1a828d9

PL-2731 - Cannot get Issues list from JIRA

  • Participants
  • Parent commits c23ba19

Comments (0)

Files changed (1)

File com.atlassian.connector.commons/src/main/java/com/atlassian/theplugin/commons/remoteapi/rest/AbstractHttpSession.java

 import org.jdom.xpath.XPath;
 import org.jetbrains.annotations.NotNull;
 
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
+import java.io.*;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.List;
             RemoteApiSessionExpiredException {
 
         final SAXBuilder builder = new SAXBuilder();
-        final Document doc = builder.build(new ByteArrayInputStream(doConditionalGet(urlString)));
-        //@todo: Comment it's only for  PL-1719 debug purposes
-        //XmlUtil.printXml(doc);
-        preprocessResult(doc);
-        return doc;
+
+        ByteArrayInputStream in = new ByteArrayInputStream(doConditionalGet(urlString));
+        InputStreamReader reader = new InputStreamReader(in);
+        BufferedReader br = new BufferedReader(reader);
+        StringBuilder allInput = new StringBuilder();
+        String line;
+        while((line = br.readLine()) != null) {
+            allInput.append(line);
+        }
+        in.close();
+        br.close();
+        reader.close();
+
+        try {
+            ByteArrayInputStream bis = new ByteArrayInputStream(allInput.toString().getBytes());
+            final Document doc = builder.build(bis);
+            preprocessResult(doc);
+            return doc;
+        } catch (JDOMException e) {
+            throw new JDOMException(e.getMessage() + "\n\n" + allInput.toString() + "\n");
+        }
     }
 
     /**