Java Code Examples for java.util.zip.ZipException#getMessage()

The following examples show how to use java.util.zip.ZipException#getMessage() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaseReportTask.java    From blynk-server with GNU General Public License v3.0 6 votes vote down vote up
private void addZipEntryAndWrite(ZipOutputStream zipStream,
                                    String onePinFileName, byte[] onePinDataCsv) throws IOException {
    ZipEntry zipEntry = new ZipEntry(onePinFileName);
    try {
        zipStream.putNextEntry(zipEntry);
        zipStream.write(onePinDataCsv);
        zipStream.closeEntry();
    } catch (ZipException zipException) {
        String message = zipException.getMessage();
        if (message != null && message.contains("duplicate")) {
            log.warn("Duplicate zip entry {}. Wrong report configuration.", onePinFileName);
        } else {
            log.error("Error compressing report file.", message);
            throw zipException;
        }
    } catch (IOException e) {
        log.error("Error compressing report file.", e.getMessage());
        throw e;
    }
}
 
Example 2
Source File: WARDirContext.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
/**
 * Content accessor.
 * 
 * @return InputStream
 */
@Override
public InputStream streamContent()
    throws IOException {
    try {
        if (binaryContent == null) {
            InputStream is = base.getInputStream(entry);
            inputStream = is;
            return is;
        }
    } catch (ZipException e) {
        throw new IOException(e.getMessage(), e);
    }
    return super.streamContent();
}
 
Example 3
Source File: WARDirContext.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
/**
 * Content accessor.
 * 
 * @return InputStream
 */
@Override
public InputStream streamContent()
    throws IOException {
    try {
        if (binaryContent == null) {
            InputStream is = base.getInputStream(entry);
            inputStream = is;
            return is;
        }
    } catch (ZipException e) {
        throw new IOException(e.getMessage(), e);
    }
    return super.streamContent();
}
 
Example 4
Source File: ZipArchive.java    From document-viewer with GNU General Public License v3.0 5 votes vote down vote up
public ZipArchive(final File zipfile) throws IOException {
    try {
        this.zipfile = new ZipFile(zipfile);
    } catch (final ZipException ex) {
        final IOException exx = new IOException(ex.getMessage());
        exx.initCause(ex);
        throw exx;
    }
}