- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中java.util.zip.ZipException.getMessage()
方法的一些代码示例,展示了ZipException.getMessage()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipException.getMessage()
方法的具体详情如下:
包路径:java.util.zip.ZipException
类名称: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
}
}
我想知道使用 GetMessage 与 GetMessages 逐一获取消息的开销是多少?我应该始终使用 GetMessages(32) 吗?它比 GetMessage() 有什么优势吗? 最佳答案
我想知道使用 GetMessage 与 GetMessages 逐一获取消息的开销是多少?我应该始终使用 GetMessages(32) 吗?它比 GetMessage() 有什么优势吗? 最佳答案
Like in this picture 我知道它们都可以正常工作,但我只是想知道它们之间有何不同? PS:我是初学者。 最佳答案 A LogEvent可以同时包含消息和异常。如果您使用第一种形式:
我观察到这两种说法都是有效的。与第二个语句相比,第一个语句中记录的额外内容是什么? 最佳答案 第一个还记录原始异常(和堆栈跟踪),第二个仅记录消息。 因此,第一个语句中记录的“额外内容”是原始异常。这
我的问题是:用 getMessage 或 toString 或两者都记录更好吗?考虑到开源引发的错误。看到评论中的问题,但没有得到答案。也许我错过了什么?不要介意记录其中之一的小性能影响,但除非有充分
当针对返回 null 的 NullPointerException 引发时,我在 exception.getMessage() 方法中遇到问题。 如何覆盖基本 Exception.getMessage
如何让 MyException 和 MyRuntimeException 使用相同的自定义 getMessage() 实现? 由于 Java 没有多重继承,我不知道该怎么做。目前我在两个类中都有重复的
public class TestException extends Exception { public TestException() { super("Test
我有一个串行设备,可以传输多种类型的消息作为应答。每个消息头代表消息类型。每种消息类型都有其一组字段。我永远不知道我会收到哪种消息类型。 在我的代码中,每种消息类型都代表类。借助 getMessage
这个问题已经有答案了: Can the HWND from CreateWindow/CreateDialog be GetMessage'd from another thread? (7 个回答)
多年来,我在各种不同的程序中使用了以下功能。它一直没有错误。直到现在,我第一次尝试让它针对 64 位代码工作。 我尝试逐行执行代码...首先我执行 something_done = TRUE; 这行(
如果 GetMessage(...) 失败,消息是否不会从消息队列中删除?我问是因为当我有以下循环时,我最终会进入一个无限循环,试图一遍又一遍地处理相同的消息: while( GetMessage(
我有一个应用程序,第二个线程在循环中调用 GetMessage()。在某些时候,第一个线程意识到用户想要退出应用程序并通知第二个线程它应该终止。由于第二个线程卡在 GetMessage() 上,因此程
我有这些类(class): public class NegativeNumberException extends Exception{ NegativeNumberExceptio
当我在 php 中捕获异常并尝试输出一些详细信息时,getMessage() 总是不返回任何内容。如果我执行 var_dump(),我会看到我想要显示的消息。我做错了什么?
嗨,我有下面的伪代码抛出这样的异常 throw new MyException("Bad thing happened","com.stuff.errorCode"); 其中 MyException
我需要更改方法 getMessage() 的返回消息, 例如,我有一个 ArithmeticException,当我写时: try{c=a/0;} catch(ArithmeticException
我试图捕获异常然后将其显示在 JTextArea 中,但我得到了 null... 这里是: } catch (Exception rwe) { // System.
使用 BitmapFactory.decodeStream 函数,我得到了以下异常 02-22 13:24:34.129: W/System.err(7927): java.io.FileNotFou
我有以下代码 SendApp,点击按钮[X]时,执行以下代码 HWND pHWndReceiveApp = FindWindowA(NULL, "ReceiveApp"); if (NULL
我是一名优秀的程序员,十分优秀!