Changeset 9995 in josm


Ignore:
Timestamp:
2016-03-14T22:15:51+01:00 (3 years ago)
Author:
bastiK
Message:

fixed #12264 - Add own CA's to Java cert-store

Location:
trunk
Files:
5 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r9396 r9995  
    5858import org.openstreetmap.josm.gui.preferences.server.ProxyPreference;
    5959import org.openstreetmap.josm.gui.util.GuiHelper;
     60import org.openstreetmap.josm.io.CertificateAmendment;
    6061import org.openstreetmap.josm.io.DefaultProxySelector;
    6162import org.openstreetmap.josm.io.MessageNotifier;
     
    401402        }
    402403
     404        try {
     405            CertificateAmendment.addMissingCertificates();
     406        } catch (IOException ex) {
     407            ex.printStackTrace();
     408            Main.warn(getErrorMessage(Utils.getRootCause(ex)));
     409        }
    403410        Authenticator.setDefault(DefaultAuthenticator.getInstance());
    404411        DefaultProxySelector proxySelector = new DefaultProxySelector(ProxySelector.getDefault());
  • trunk/src/org/openstreetmap/josm/io/CachedFile.java

    r9977 r9995  
    66import java.io.BufferedInputStream;
    77import java.io.BufferedReader;
     8import java.io.ByteArrayOutputStream;
    89import java.io.Closeable;
    910import java.io.File;
     
    213214
    214215    /**
     216     * Get the full content of the requested resource as a byte array.
     217     * @return the full content of the requested resource as byte array
     218     * @throws IOException in case of an I/O error
     219     */
     220    public byte[] getByteContent() throws IOException {
     221        try (InputStream is = getInputStream()) {
     222            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
     223            int nRead;
     224            byte[] data = new byte[8192];
     225            while ((nRead = is.read(data, 0, data.length)) != -1) {
     226                buffer.write(data, 0, nRead);
     227            }
     228            buffer.flush();
     229            return buffer.toByteArray();
     230        }
     231    }
     232
     233    /**
    215234     * Returns {@link #getInputStream()} wrapped in a buffered reader.
    216235     * <p>
Note: See TracChangeset for help on using the changeset viewer.