Ignore:
Timestamp:
2014-05-09T14:36:55+02:00 (11 years ago)
Author:
Don-vip
Message:

see #8465 - Use of new Java 7 zip constructors allowing to specify a charset for entries names

Location:
trunk/src/org/openstreetmap/josm/io
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/Compression.java

    r7033 r7089  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.io;
    3 
    4 import org.apache.tools.bzip2.CBZip2OutputStream;
    5 import org.openstreetmap.josm.tools.Utils;
    63
    74import java.io.File;
     
    129import java.io.OutputStream;
    1310import java.net.URL;
     11import java.nio.charset.StandardCharsets;
    1412import java.util.zip.GZIPOutputStream;
    1513import java.util.zip.ZipOutputStream;
     14
     15import org.apache.tools.bzip2.CBZip2OutputStream;
     16import org.openstreetmap.josm.tools.Utils;
    1617
    1718/**
     
    103104                return new GZIPOutputStream(out);
    104105            case ZIP:
    105                 return new ZipOutputStream(out);
     106                return new ZipOutputStream(out, StandardCharsets.UTF_8);
    106107            case NONE:
    107108            default:
  • trunk/src/org/openstreetmap/josm/io/FileImporter.java

    r6882 r7089  
    88import java.io.IOException;
    99import java.io.InputStream;
     10import java.nio.charset.StandardCharsets;
    1011import java.util.List;
    1112import java.util.zip.GZIPInputStream;
     
    162163            return null;
    163164        }
    164         ZipInputStream zis = new ZipInputStream(in);
     165        ZipInputStream zis = new ZipInputStream(in, StandardCharsets.UTF_8);
    165166        // Positions the stream at the beginning of first entry
    166167        ZipEntry ze = zis.getNextEntry();
  • trunk/src/org/openstreetmap/josm/io/MirroredInputStream.java

    r7081 r7089  
    1515import java.net.MalformedURLException;
    1616import java.net.URL;
     17import java.nio.charset.StandardCharsets;
    1718import java.util.ArrayList;
    1819import java.util.Arrays;
     
    3940    /**
    4041     * Constructs an input stream from a given filename, URL or internal resource.
    41      * 
     42     *
    4243     * @param name can be:<ul>
    4344     *  <li>relative or absolute file name</li>
     
    5455    /**
    5556     * Constructs an input stream from a given filename, URL or internal resource.
    56      * 
     57     *
    5758     * @param name can be:<ul>
    5859     *  <li>relative or absolute file name</li>
     
    7071    /**
    7172     * Constructs an input stream from a given filename, URL or internal resource.
    72      * 
     73     *
    7374     * @param name can be:<ul>
    7475     *  <li>relative or absolute file name</li>
     
    8687    /**
    8788     * Constructs an input stream from a given filename, URL or internal resource.
    88      * 
     89     *
    8990     * @param name can be:<ul>
    9091     *  <li>relative or absolute file name</li>
     
    103104    /**
    104105     * Constructs an input stream from a given filename, URL or internal resource.
    105      * 
     106     *
    106107     * @param name can be:<ul>
    107108     *  <li>relative or absolute file name</li>
     
    121122    /**
    122123     * Constructs an input stream from a given filename, URL or internal resource.
    123      * 
     124     *
    124125     * @param name can be:<ul>
    125126     *  <li>relative or absolute file name</li>
     
    200201        Pair<String, InputStream> res = null;
    201202        try {
    202             ZipFile zipFile = new ZipFile(file);
     203            ZipFile zipFile = new ZipFile(file, StandardCharsets.UTF_8);
    203204            ZipEntry resentry = null;
    204205            Enumeration<? extends ZipEntry> entries = zipFile.entries();
     
    239240        cleanup(name, null);
    240241    }
    241    
     242
    242243    public static void cleanup(String name, String destDir) {
    243244        URL url;
     
    349350     * <p>
    350351     * This can causes problems when downloading from certain GitHub URLs.
    351      * 
     352     *
    352353     * @param downloadUrl The resource URL to download
    353354     * @param httpAccept The accepted MIME types sent in the HTTP Accept header. Can be {@code null}
  • trunk/src/org/openstreetmap/josm/io/session/SessionReader.java

    r7083 r7089  
    1313import java.net.URI;
    1414import java.net.URISyntaxException;
     15import java.nio.charset.StandardCharsets;
    1516import java.util.ArrayList;
    1617import java.util.Collections;
     
    559560        if (zip) {
    560561            try {
    561                 zipFile = new ZipFile(sessionFile);
     562                zipFile = new ZipFile(sessionFile, StandardCharsets.UTF_8);
    562563                return getZipInputStream(zipFile);
    563564            } catch (ZipException ze) {
  • trunk/src/org/openstreetmap/josm/io/session/SessionWriter.java

    r7082 r7089  
    249249    public void write(OutputStream out) throws IOException {
    250250        if (zip) {
    251             zipOut = new ZipOutputStream(new BufferedOutputStream(out));
     251            zipOut = new ZipOutputStream(new BufferedOutputStream(out), StandardCharsets.UTF_8);
    252252        }
    253253        Document doc = createJosDocument(); // as side effect, files may be added to zipOut
Note: See TracChangeset for help on using the changeset viewer.