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

Commit 835b6746 authored by vince-bourgmayer's avatar vince-bourgmayer
Browse files

another decompress trial for GzipedPropfind

parent 763b71a1
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@ dependencies {
    api 'org.apache.jackrabbit:jackrabbit-webdav:2.12.6+'
    implementation 'org.parceler:parceler-api:1.1.12'
    annotationProcessor 'org.parceler:parceler:1.1.12'

    implementation "com.android.support:support-annotations:28.0.0"

    findbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.8.0'
@@ -31,7 +30,7 @@ dependencies {
}

android {
    compileSdkVersion 28
    compileSdkVersion 25

    sourceSets {
        main {
@@ -65,7 +64,7 @@ android {

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 28
        targetSdkVersion 25
    }

    task findbugs(type: FindBugs) {
+3 −2
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ import java.util.Locale;

public class OwnCloudClient extends HttpClient {


    private static final String TAG = OwnCloudClient.class.getSimpleName();
    public static final int MAX_REDIRECTIONS_COUNT = 3;
    private static final String PARAM_SINGLE_COOKIE_HEADER = "http.protocol.single-cookie-header";
+23 −3
Original line number Diff line number Diff line
package com.owncloud.android.lib.common.method;


import android.util.Log;

import org.apache.jackrabbit.webdav.client.methods.PropFindMethod;
import org.apache.jackrabbit.webdav.property.DavPropertyNameSet;
import org.apache.jackrabbit.webdav.xml.DomUtil;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;

import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.nio.charset.StandardCharsets;
import java.util.zip.GZIPInputStream;

import javax.xml.parsers.ParserConfigurationException;
@@ -23,9 +34,18 @@ public class GzipedPropfind extends PropFindMethod {
            // response has already been read
            return super.responseDocument;
        }*/
        GZIPInputStream in = null;
        in = new GZIPInputStream(getResponseBodyAsStream());
        //InputStream in = getResponseBodyAsStream();
        GZIPInputStream gzipis = null;
        gzipis = new GZIPInputStream(getResponseBodyAsStream());
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(gzipis));

        StringBuilder s = new StringBuilder();
        String line = null;
        while( (line =bufferedReader.readLine()) != null) {
            s.append(line);
        }
        Log.d("GzipedPropfind.java", s.toString() );

        InputStream in = new ByteArrayInputStream(s.toString().getBytes());
        if (in != null) {
            // read response and try to build a xml document
            try {
+7 −5
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@

package com.owncloud.android.lib.resources.files;

import android.util.Log;

import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.method.GzipedPropfind;
@@ -35,13 +34,12 @@ import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.files.model.RemoteFile;

import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.params.HttpParams;
import org.apache.jackrabbit.webdav.DavConstants;
import org.apache.jackrabbit.webdav.MultiStatus;
import org.apache.jackrabbit.webdav.client.methods.PropFindMethod;

import java.io.InputStream;
import java.util.ArrayList;
import java.util.zip.GZIPInputStream;

@@ -102,11 +100,15 @@ public class LightReadFolderRemoteOperation extends RemoteOperation {
            

            int status = client.executeMethod(query, "gzipUserAgent");

            // check and process response
            boolean isSuccess = (status == HttpStatus.SC_MULTI_STATUS || status == HttpStatus.SC_OK);
            
            if (isSuccess) {
                InputStream stream = query.getResponseBodyAsStream();




                // get data from remote folder
                MultiStatus dataInServer = query.getResponseBodyAsMultiStatus();
                readData(dataInServer, client);