Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 556c48fc authored by vince-bourgmayer's avatar vince-bourgmayer
Browse files

update GzipedPropfind

parent 5ccc460e
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@
package com.owncloud.android.lib.common.method;


import org.apache.commons.httpclient.Header;
import org.apache.jackrabbit.webdav.client.methods.PropFindMethod;
import org.apache.jackrabbit.webdav.property.DavPropertyNameSet;
import org.apache.jackrabbit.webdav.xml.DomUtil;
@@ -42,21 +43,23 @@ public class GzipedPropfind extends PropFindMethod {
    }

    /*
     * @inherited;
     * Uncompress the gzipSteam before to parse it with SAX
     * In the case of no "Content-Encoding:gzip" headers is found, the
     *
     */
    @Override
    public Document getResponseBodyAsDocument() throws IOException {
        if(getResponseHeader("Content-Encoding").getValue() != "gzip") {
        Header contentEncodingHeader= getResponseHeader("Content-Encoding");

        if(contentEncodingHeader != null && contentEncodingHeader.getValue() != "gzip") {
            return super.getResponseBodyAsDocument();
        }

        //@TOdo: look for potential optimisation like pipe gzipInputStream directly in InputStream in

        GZIPInputStream gzipis = null;
        gzipis = new GZIPInputStream(getResponseBodyAsStream());
        GZIPInputStream gzipis  = new GZIPInputStream(getResponseBodyAsStream());
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(gzipis));
        StringBuilder s = new StringBuilder();
        String line = null;
        String line;
        while( (line =bufferedReader.readLine()) != null) {
            s.append(line);
        }
@@ -83,7 +86,6 @@ public class GzipedPropfind extends PropFindMethod {
        return null;
    }


    public GzipedPropfind(String uri, DavPropertyNameSet propNameSet, int depth) throws IOException {
        super(uri, propNameSet, depth);
    }
@@ -95,6 +97,4 @@ public class GzipedPropfind extends PropFindMethod {
    public GzipedPropfind(String uri, int propfindType, DavPropertyNameSet propNameSet, int depth) throws IOException {
        super(uri, propfindType, propNameSet, depth);
    }


}