Skip to content

Commit

Permalink
Log ignored IO exceptions (#932)
Browse files Browse the repository at this point in the history
  • Loading branch information
Goooler authored Aug 8, 2024
1 parent e652f1a commit da4c57b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ class ShadowCopyAction implements CopyAction {
} catch(Throwable t) {
try {
resource.close()
} catch (IOException ignored) {
// Ignored
} catch (IOException e) {
log.warn("Could not close resource $resource", e)
}
throw UncheckedException.throwAsUncheckedException(t)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

package com.github.jengelman.gradle.plugins.shadow.transformers

import groovy.util.logging.Slf4j
import org.apache.tools.zip.ZipEntry
import org.apache.tools.zip.ZipOutputStream
import org.codehaus.plexus.util.IOUtil
Expand All @@ -36,6 +37,7 @@ import static java.util.jar.JarFile.MANIFEST_NAME
* Modified from {@link ManifestResourceTransformer}.
* @author Chris Rankin
*/
@Slf4j
class ManifestAppenderTransformer implements Transformer {
private static final byte[] EOL = "\r\n".getBytes(UTF_8)
private static final byte[] SEPARATOR = ": ".getBytes(UTF_8)
Expand All @@ -62,7 +64,8 @@ class ManifestAppenderTransformer implements Transformer {
manifestContents = IOUtil.toByteArray(context.is)
try {
context.is
} catch (IOException ignored) {
} catch (IOException e) {
log.warn("Failed to read MANIFEST.MF", e)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

package com.github.jengelman.gradle.plugins.shadow.transformers

import groovy.util.logging.Slf4j
import org.apache.tools.zip.ZipEntry
import org.apache.tools.zip.ZipOutputStream
import org.gradle.api.file.FileTreeElement
Expand All @@ -39,6 +40,7 @@ import java.util.jar.Manifest
* @author Jason van Zyl
* @author John Engelman
*/
@Slf4j
class ManifestResourceTransformer implements Transformer {

// Configuration
Expand Down Expand Up @@ -73,7 +75,8 @@ class ManifestResourceTransformer implements Transformer {
manifestDiscovered = true
try {
context.is
} catch (IOException ignored) {
} catch (IOException e) {
log.warn("Failed to read MANIFEST.MF", e)
}
}
}
Expand Down

0 comments on commit da4c57b

Please sign in to comment.