gpt4 book ai didi

java.util.zip.ZipException.getMessage()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 13:36:40 31 4
gpt4 key购买 nike

本文整理了Java中java.util.zip.ZipException.getMessage()方法的一些代码示例,展示了ZipException.getMessage()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipException.getMessage()方法的具体详情如下:
包路径:java.util.zip.ZipException
类名称:ZipException
方法名:getMessage

ZipException.getMessage介绍

暂无

代码示例

代码示例来源:origin: blynkkk/blynk-server

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;
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-filesystems

/**
 * @return the jar
 */
private JarFile getJar(boolean create) {
  assert Thread.holdsLock(closeSync);
  if (jar == null && create) {
    try {
      if (root.canRead()) {
        jar = new JarFile(root);
        LOGGER.log(Level.FINE, "opened: {0} {1}", new Object[]{root.getAbsolutePath(), System.currentTimeMillis()}); //NOI18N
        return jar;
      }
    } catch (ZipException ex) {
      dumpFDs();
      LOGGER.log(Level.INFO, ex.getMessage(), ex);
    } catch (IOException ex) {
      LOGGER.log(Level.INFO, ex.getMessage(), ex);
    }
    LOGGER.log(Level.WARNING, "cannot open {0}", root.getAbsolutePath()); // NOI18N
  }
  return jar;
}

代码示例来源:origin: org.apache.ant/ant

/**
 * Sets the central directory part of extra fields.
 *
 * @param b boolean
 */
public void setCentralDirectoryExtra(final byte[] b) {
  try {
    final ZipExtraField[] central = ExtraFieldUtils.parse(b, false,
        ExtraFieldUtils.UnparseableExtraField.READ);
    mergeExtraFields(central, false);
  } catch (final ZipException e) {
    throw new RuntimeException(e.getMessage(), e); //NOSONAR
  }
}

代码示例来源:origin: alibaba/mdrill

/**
 * Sets the central directory part of extra fields.
 */
public void setCentralDirectoryExtra(byte[] b) {
  try {
    ZipExtraField[] central =
      ExtraFieldUtils.parse(b, false,
                 ExtraFieldUtils.UnparseableExtraField.READ);
    mergeExtraFields(central, false);
  } catch (ZipException e) {
    throw new RuntimeException(e.getMessage(), e);
  }
}

代码示例来源:origin: org.apache.commons/commons-compress

/**
 * Sets the central directory part of extra fields.
 * @param b an array of bytes to be parsed into extra fields
 */
public void setCentralDirectoryExtra(final byte[] b) {
  try {
    final ZipExtraField[] central =
      ExtraFieldUtils.parse(b, false,
                 ExtraFieldUtils.UnparseableExtraField.READ);
    mergeExtraFields(central, false);
  } catch (final ZipException e) {
    throw new RuntimeException(e.getMessage(), e); //NOSONAR
  }
}

代码示例来源:origin: org.apache.poi/poi-ooxml

ZipArchiveEntry getNextEntry() throws IOException {
  if (!(in instanceof ZipArchiveInputStream)) {
    throw new IllegalStateException("getNextEntry() is only allowed for stream based zip processing.");
  }
  try {
    entry = ((ZipArchiveInputStream) in).getNextZipEntry();
    return entry;
  } catch (ZipException ze) {
    if (ze.getMessage().startsWith("Unexpected record signature")) {
      throw new NotOfficeXmlFileException(
          "No valid entries or contents found, this is not a valid OOXML (Office Open XML) file", ze);
    }
    throw ze;
  }
}

代码示例来源:origin: org.apache.ant/ant

if (ex.getMessage().contains("duplicate")) {

代码示例来源:origin: GlowstoneMC/Glowstone

new GZIPInputStream(new ByteArrayInputStream(data), 2048)));
} catch (ZipException e) {
  if (e.getMessage().equals("Not in GZIP format")) {
    GlowServer.logger.info("Incorrect region version, switching to zlib...");
    file.seek((sectorNumber * SECTOR_BYTES) + Integer.BYTES);

代码示例来源:origin: org.apache.commons/commons-compress

/**
 * Parses the given bytes as extra field data and consumes any
 * unparseable data as an {@link UnparseableExtraFieldData}
 * instance.
 * @param extra an array of bytes to be parsed into extra fields
 * @throws RuntimeException if the bytes cannot be parsed
 * @throws RuntimeException on error
 */
@Override
public void setExtra(final byte[] extra) throws RuntimeException {
  try {
    final ZipExtraField[] local =
      ExtraFieldUtils.parse(extra, true,
                 ExtraFieldUtils.UnparseableExtraField.READ);
    mergeExtraFields(local, true);
  } catch (final ZipException e) {
    // actually this is not possible as of Commons Compress 1.1
    throw new RuntimeException("Error parsing extra fields for entry: " //NOSONAR
                  + getName() + " - " + e.getMessage(), e);
  }
}

代码示例来源:origin: org.apache.ant/ant

/**
 * Parses the given bytes as extra field data and consumes any
 * unparseable data as an {@link UnparseableExtraFieldData}
 * instance.
 *
 * @param extra an array of bytes to be parsed into extra fields
 * @throws RuntimeException if the bytes cannot be parsed
 * @throws RuntimeException on error
 * @since 1.1
 */
@Override
public void setExtra(final byte[] extra) throws RuntimeException {
  try {
    final ZipExtraField[] local = ExtraFieldUtils.parse(extra, true,
        ExtraFieldUtils.UnparseableExtraField.READ);
    mergeExtraFields(local, true);
  } catch (final ZipException e) {
    // actually this is not be possible as of Ant 1.8.1
    throw new RuntimeException("Error parsing extra fields for entry: " //NOSONAR
                  + getName() + " - " + e.getMessage(), e);
  }
}

代码示例来源:origin: alibaba/mdrill

/**
 * Parses the given bytes as extra field data and consumes any
 * unparseable data as an {@link UnparseableExtraFieldData}
 * instance.
 * @param extra an array of bytes to be parsed into extra fields
 * @throws RuntimeException if the bytes cannot be parsed
 * @since 1.1
 * @throws RuntimeException on error
 */
@Override
public void setExtra(byte[] extra) throws RuntimeException {
  try {
    ZipExtraField[] local =
      ExtraFieldUtils.parse(extra, true,
                 ExtraFieldUtils.UnparseableExtraField.READ);
    mergeExtraFields(local, true);
  } catch (ZipException e) {
    // actually this is not be possible as of Ant 1.8.1
    throw new RuntimeException("Error parsing extra fields for entry: "
                  + getName() + " - " + e.getMessage(), e);
  }
}

代码示例来源:origin: deathmarine/Luyten

if (!ze.getMessage().contains("duplicate")) {
  throw ze;

代码示例来源:origin: drewnoakes/metadata-extractor

inflateStream.close();
} catch(java.util.zip.ZipException zex) {
  directory.addError(String.format("Exception decompressing PNG iCCP chunk : %s", zex.getMessage()));
  metadata.addDirectory(directory);
  textBytes = null;
  PngDirectory directory = new PngDirectory(PngChunkType.zTXt);
  directory.addError(String.format("Exception decompressing PNG zTXt chunk with keyword \"%s\": %s", keyword, zex.getMessage()));
  metadata.addDirectory(directory);
    textBytes = null;
    PngDirectory directory = new PngDirectory(PngChunkType.iTXt);
    directory.addError(String.format("Exception decompressing PNG iTXt chunk with keyword \"%s\": %s", keyword, zex.getMessage()));
    metadata.addDirectory(directory);

代码示例来源:origin: PrivacyApps/document-viewer

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;
  }
}

代码示例来源:origin: de.julielab/julielab-java-utilities

public static BufferedInputStream getInputStreamFromUri(URI uri) throws IOException {
  try {
    String uriStr = uri.toString().toLowerCase();
    return new BufferedInputStream(uriStr.endsWith(".gz") || uriStr.endsWith(".gzip") ?
        new GZIPInputStream(uri.toURL().openStream()) :
        uri.toURL().openStream());
  } catch (ZipException e) {
    log.error("URI {} target could not be uncompressed: {}", uri, e.getMessage());
    throw e;
  }
}

代码示例来源:origin: jolira/onejar-maven-plugin

private void addToZip(JarOutputStream out, ZipEntry entry, InputStream in) throws IOException {
  try{
    out.putNextEntry(entry);
    IOUtils.copy(in, out);
    out.closeEntry();
  }catch(ZipException e){
    if (e.getMessage().startsWith("duplicate entry")){
      // A Jar with the same name was already added. Let's add this one using a modified name:
      final ZipEntry alternativeEntry = new ZipEntry(entry.getName() + "-DUPLICATE-FILENAME-" + alternativeEntryCounter.incrementAndGet() + ".jar");
      addToZip(out, alternativeEntry, in);
    }else{
      throw e;
    }
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

ZipArchiveEntry getNextEntry() throws IOException {
  if (!(in instanceof ZipArchiveInputStream)) {
    throw new IllegalStateException("getNextEntry() is only allowed for stream based zip processing.");
  }
  try {
    entry = ((ZipArchiveInputStream) in).getNextZipEntry();
    return entry;
  } catch (ZipException ze) {
    if (ze.getMessage().startsWith("Unexpected record signature")) {
      throw new NotOfficeXmlFileException(
          "No valid entries or contents found, this is not a valid OOXML (Office Open XML) file", ze);
    }
    throw ze;
  }
}

代码示例来源:origin: org.xbib/archive

/**
 * Sets the central directory part of extra fields.
 */
public void setCentralDirectoryExtra(byte[] b) {
  try {
    ZipExtraField[] central =
        ExtraFieldUtils.parse(b, false,
            ExtraFieldUtils.UnparseableExtraField.READ);
    mergeExtraFields(central, false);
  } catch (ZipException e) {
    throw new RuntimeException(e.getMessage(), e);
  }
}

代码示例来源:origin: KostyaSha/yet-another-docker-plugin

/**
 * Sets the central directory part of extra fields.
 * @param b an array of bytes to be parsed into extra fields
 */
public void setCentralDirectoryExtra(final byte[] b) {
  try {
    final ZipExtraField[] central =
      ExtraFieldUtils.parse(b, false,
                 ExtraFieldUtils.UnparseableExtraField.READ);
    mergeExtraFields(central, false);
  } catch (final ZipException e) {
    throw new RuntimeException(e.getMessage(), e); //NOSONAR
  }
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

/**
 * Sets the central directory part of extra fields.
 * @param b an array of bytes to be parsed into extra fields
 */
public void setCentralDirectoryExtra(final byte[] b) {
  try {
    final ZipExtraField[] central =
      ExtraFieldUtils.parse(b, false,
                 ExtraFieldUtils.UnparseableExtraField.READ);
    mergeExtraFields(central, false);
  } catch (final ZipException e) {
    throw new RuntimeException(e.getMessage(), e); //NOSONAR
  }
}

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com