OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 142 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 142 Rev 182
Line 1... Line 1...
1
/*
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 * 
3
 * 
4
 * Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
4
 * Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
5
 * 
5
 * 
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
7
 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
7
 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
8
 * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
8
 * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
9
 * language governing permissions and limitations under the License.
9
 * language governing permissions and limitations under the License.
Line 16... Line 16...
16
import org.openconcerto.utils.Base64;
16
import org.openconcerto.utils.Base64;
17
import org.openconcerto.utils.FileUtils;
17
import org.openconcerto.utils.FileUtils;
18
 
18
 
19
import java.io.BufferedInputStream;
19
import java.io.BufferedInputStream;
20
import java.io.BufferedOutputStream;
20
import java.io.BufferedOutputStream;
-
 
21
import java.io.ByteArrayInputStream;
21
import java.io.ByteArrayOutputStream;
22
import java.io.ByteArrayOutputStream;
22
import java.io.DataInputStream;
23
import java.io.DataInputStream;
23
import java.io.DataOutputStream;
24
import java.io.DataOutputStream;
24
import java.io.File;
25
import java.io.File;
25
import java.io.FileInputStream;
26
import java.io.FileInputStream;
Line 527... Line 528...
527
        wr.write(data);
528
        wr.write(data);
528
        wr.flush();
529
        wr.flush();
529
        wr.close();
530
        wr.close();
530
 
531
 
531
        // Get the response ASAP in order to not block the server while computing locally hash256
532
        // Get the response ASAP in order to not block the server while computing locally hash256
-
 
533
 
-
 
534
        // Copy the entire data first because DataInputStream will fail on partial buffer (mainly
-
 
535
        // readUTF)
-
 
536
        InputStream ins = conn.getInputStream();
-
 
537
        final ByteArrayOutputStream out = new ByteArrayOutputStream();
-
 
538
        StreamUtils.copy(ins, out);
-
 
539
        ins.close();
-
 
540
 
532
        DataInputStream in = new DataInputStream(new BufferedInputStream(conn.getInputStream()));
541
        DataInputStream in = new DataInputStream(new ByteArrayInputStream(out.toByteArray()));
-
 
542
 
533
        int fileCount = in.readInt();
543
        int fileCount = in.readInt();
534
        this.byteReceived += 4;
544
        this.byteReceived += 4;
535
        ArrayList<FileProperty> list = new ArrayList<FileProperty>();
545
        ArrayList<FileProperty> list = new ArrayList<FileProperty>();
536
        for (int i = 0; i < fileCount; i++) {
546
        for (int i = 0; i < fileCount; i++) {
537
            final String fileName = in.readUTF();
547
            final String fileName = in.readUTF();
Line 873... Line 883...
873
    }
883
    }
874
 
884
 
875
    public void setVerifyHost(boolean verify) {
885
    public void setVerifyHost(boolean verify) {
876
        this.verifyHost = verify;
886
        this.verifyHost = verify;
877
    }
887
    }
-
 
888
 
-
 
889
   
878
}
890
}