Source:
private static Manifest getSelfJarManifest() { try { final ProtectionDomain protectionDomain; try { protectionDomain = EmbulkVersion.class.getProtectionDomain(); } catch (SecurityException ex) { System.err.println("Embulk version unavailable due to ProtectionDomain inaccessible."); ex.printStackTrace(); return null; } final CodeSource codeSource = protectionDomain.getCodeSource(); if (codeSource == null) { System.err.println("Embulk version unavailable due to CodeSource unavailable."); return null; } final URL selfJarUrl = codeSource.getLocation(); if (selfJarUrl == null) { System.err.println("Embulk version unavailable due to the location of CodeSource unavailable."); return null; } else if (!selfJarUrl.getProtocol().equals("file")) { System.err.println("Embulk version unavailable as the location of CodeSource is not local."); return null; } final String selfJarPathString = selfJarUrl.getPath(); if (selfJarPathString == null) { System.err.println("Embulk version unavailable due to the path of CodeSource unavailable."); return null; } else if (selfJarPathString.isEmpty()) { System.err.println("Embulk version unavailable due to the path of CodeSource empty."); return null; } try (final JarFile selfJarFile = new JarFile(selfJarPathString)) { final Manifest selfJarManifest; try { return selfJarFile.getManifest(); } catch (IllegalStateException ex) { System.err.println("Embulk version unavailable due to the jar file closed unexpectedly."); ex.printStackTrace(); return null; } catch (IOException ex) { System.err.println("Embulk version unavailable due to failure to get the manifst in the jar file."); ex.printStackTrace(); return null; } } catch (SecurityException ex) { System.err.println("Embulk version unavailable due to the jar file inaccessible."); ex.printStackTrace(); return null; } catch (IOException ex) { System.err.println("Embulk version unavailable due to failure to access the jar file."); ex.printStackTrace(); return null; } } catch (Throwable ex) { System.err.println("Embulk version unavailable due to an unknown exception."); ex.printStackTrace(); return null; } }

Target:
private static Manifest getSelfJarManifest() { try { final ProtectionDomain protectionDomain; try { protectionDomain = EmbulkVersion.class.getProtectionDomain(); } catch (SecurityException ex) { System.err.println("Embulk version unavailable due to ProtectionDomain inaccessible."); ex.printStackTrace(); return null; } final CodeSource codeSource = protectionDomain.getCodeSource(); if (codeSource == null) { System.err.println("Embulk version unavailable due to CodeSource unavailable."); return null; } final URL selfJarUrl = codeSource.getLocation(); if (selfJarUrl == null) { System.err.println("Embulk version unavailable due to the location of CodeSource unavailable."); return null; } else if (!selfJarUrl.getProtocol().equals("file")) { System.err.println("Embulk version unavailable as the location of CodeSource is not local."); return null; } final String selfJarPathString = selfJarUrl.getPath(); if (selfJarPathString == null) { System.err.println("Embulk version unavailable due to the path of CodeSource unavailable."); return null; } else if (selfJarPathString.isEmpty()) { System.err.println("Embulk version unavailable due to the path of CodeSource empty."); return null; } try (final JarFile selfJarFile = new JarFile(selfJarPathString)) { try { return selfJarFile.getManifest(); } catch (IllegalStateException ex) { System.err.println("Embulk version unavailable due to the jar file closed unexpectedly."); ex.printStackTrace(); return null; } catch (IOException ex) { System.err.println("Embulk version unavailable due to failure to get the manifst in the jar file."); ex.printStackTrace(); return null; } } catch (SecurityException ex) { System.err.println("Embulk version unavailable due to the jar file inaccessible."); ex.printStackTrace(); return null; } catch (IOException ex) { System.err.println("Embulk version unavailable due to failure to access the jar file."); ex.printStackTrace(); return null; } } catch (Throwable ex) { System.err.println("Embulk version unavailable due to an unknown exception."); ex.printStackTrace(); return null; } }