[Git][java-team/ivyplusplus][upstream] 2 commits: New upstream version 1.34
Emmanuel Bourg (@ebourg)
gitlab at salsa.debian.org
Tue Feb 15 11:45:24 GMT 2022
Emmanuel Bourg pushed to branch upstream at Debian Java Maintainers / ivyplusplus
Commits:
aec0a905 by Emmanuel Bourg at 2022-02-15T12:16:29+01:00
New upstream version 1.34
- - - - -
986ced25 by Emmanuel Bourg at 2022-02-15T12:16:50+01:00
New upstream version 1.38
- - - - -
16 changed files:
- build.xml
- buildScripts/ivy.xml
- buildScripts/ivysettings.xml
- src/com/zwitserloot/ivyplusplus/CachedUnjar.java
- src/com/zwitserloot/ivyplusplus/Compile.java
- src/com/zwitserloot/ivyplusplus/Version.java
- src/com/zwitserloot/ivyplusplus/createProject/CreateProject.java
- src/com/zwitserloot/ivyplusplus/ecj/CompilationUnitImpl.java
- src/com/zwitserloot/ivyplusplus/ecj/CompilerOptionsProvider.java
- src/com/zwitserloot/ivyplusplus/ecj/EcjAdapter.java
- src/com/zwitserloot/ivyplusplus/eclipse/BuildEclipseProject.java
- src/com/zwitserloot/ivyplusplus/eclipse/Srcdir.java
- src/com/zwitserloot/ivyplusplus/intellij/BuildIntellijProject.java
- src/com/zwitserloot/ivyplusplus/ssh/JarUnpacker.java
- src/com/zwitserloot/ivyplusplus/ssh/SshSubsystem.java
- src/com/zwitserloot/ivyplusplus/ssh/internal/SshUtil.java
Changes:
=====================================
build.xml
=====================================
@@ -20,9 +20,9 @@
THE SOFTWARE.
-->
<project name="com.zwitserloot.ivyplusplus" default="dist" xmlns:ivy="antlib:org.apache.ivy.ant">
- <property name="jre.version" value="1.7" />
+ <property name="jre.version" value="1.8" />
<property name="ivy.retrieve.pattern" value="lib/[conf]/[artifact].[ext]" />
- <property name="ivy.lib" value="ivy-2.4.0.jar" />
+ <property name="ivy.lib" value="ivy-2.5.0.jar" />
<property name="ivy.location" value="https://projectlombok.org/downloads/${ivy.lib}" />
<available file="lib/${ivy.lib}" property="ivy.available" />
@@ -160,7 +160,7 @@
</target>
<target name="config-ivy" depends="download-ivy">
- <taskdef classpath="lib/ivy-2.4.0.jar" resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" />
+ <taskdef classpath="lib/${ivy.lib}" resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" />
<ivy:configure file="buildScripts/ivysettings.xml" />
</target>
=====================================
buildScripts/ivy.xml
=====================================
@@ -9,14 +9,14 @@
<dependencies>
<dependency org="com.jcraft" name="jsch" rev="0.1.55" conf="build->default" />
<dependency org="org.projectlombok" name="jsch-ant-fixed" rev="0.1.42" conf="build" />
- <dependency org="org.apache.ant" name="ant" rev="1.10.5" conf="build->master; contrib->sources" />
- <dependency org="org.apache.ivy" name="ivy" rev="2.4.0" conf="build->master; contrib->sources" />
+ <dependency org="org.apache.ant" name="ant" rev="1.10.7" conf="build->master; contrib->sources" />
+ <dependency org="org.apache.ivy" name="ivy" rev="2.5.0" conf="build->master; contrib->sources" />
<dependency org="com.zwitserloot" name="cmdreader" rev="1.5" conf="build, runtime->default" />
<dependency org="com.googlecode.jarjar" name="jarjar" rev="1.3" conf="build->default" />
- <dependency org="org.bouncycastle" name="bcprov-jdk15on" rev="1.58" conf="build, pack->default" />
- <dependency org="org.bouncycastle" name="bcpg-jdk15on" rev="1.58" conf="build->default; pack->default; contrib->sources" />
- <dependency org="org.eclipse.tycho" name="org.eclipse.jdt.core" rev="3.13.50.v20171007-0855" conf="build, runtime->default" />
- <dependency org="com.hierynomus" name="sshj" rev="0.23.0" conf="build, pack->default" />
+ <dependency org="org.bouncycastle" name="bcprov-jdk15on" rev="1.65" conf="build, pack->default" />
+ <dependency org="org.bouncycastle" name="bcpg-jdk15on" rev="1.65" conf="build->default; pack->default; contrib->sources" />
+ <dependency org="org.eclipse.jdt" name="ecj" rev="3.21.0" conf="build, runtime->default" />
+ <dependency org="com.hierynomus" name="sshj" rev="0.27.0" conf="build, pack->default" />
<dependency org="org.slf4j" name="slf4j-simple" rev="1.7.25" conf="pack->default" />
</dependencies>
</ivy-module>
=====================================
buildScripts/ivysettings.xml
=====================================
@@ -4,7 +4,6 @@
<filesystem name="projectLocalRepo">
<ivy pattern="${ivy.settings.dir}/ivy-repo/[organisation]-[module]-[revision].xml" />
</filesystem>
- <ibiblio name="maven-repo2" m2compatible="true" root="https://repo2.maven.org/maven2" />
<ibiblio name="maven-repo2" m2compatible="true" root="https://repo1.maven.org/maven2" />
</chain>
</resolvers>
=====================================
src/com/zwitserloot/ivyplusplus/CachedUnjar.java
=====================================
@@ -181,18 +181,15 @@ public class CachedUnjar extends MatchingTask {
private static Set<CacheRecord> readCaches(File marker) throws IOException {
Set<CacheRecord> out = new LinkedHashSet<CacheRecord>();
- try {
+ try (
FileInputStream fis = new FileInputStream(marker);
- try {
- BufferedReader br = new BufferedReader(new InputStreamReader(fis, "UTF-8"));
- for (String line = br.readLine(); line != null; line = br.readLine()) {
- line = line.trim();
- if (line.startsWith("#")) continue;
- if (line.length() == 0) continue;
- out.add(CacheRecord.read(line));
- }
- } finally {
- fis.close();
+ BufferedReader br = new BufferedReader(new InputStreamReader(fis, "UTF-8"))
+ ) {
+ for (String line = br.readLine(); line != null; line = br.readLine()) {
+ line = line.trim();
+ if (line.startsWith("#")) continue;
+ if (line.length() == 0) continue;
+ out.add(CacheRecord.read(line));
}
} catch (FileNotFoundException e) {}
return out;
=====================================
src/com/zwitserloot/ivyplusplus/Compile.java
=====================================
@@ -32,6 +32,7 @@ import java.util.Map;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DynamicAttribute;
+import org.apache.tools.ant.Project;
import org.apache.tools.ant.RuntimeConfigurable;
import org.apache.tools.ant.UnknownElement;
import org.apache.tools.ant.taskdefs.Copy;
@@ -52,7 +53,7 @@ public class Compile extends MatchingTask implements DynamicAttribute {
private boolean ecj;
private boolean includeSystemBootclasspath;
private String copyExcludes;
- private boolean destdirSet;
+ private String destdirLoc;
public void setIncludeSystemBootclasspath(boolean includeSystemBootclasspath) {
this.includeSystemBootclasspath = includeSystemBootclasspath;
@@ -162,7 +163,7 @@ public class Compile extends MatchingTask implements DynamicAttribute {
matched |= setWithKey(javac, JAVAC_ATTR_MAP, name, value);
matched |= setWithKey(copy, COPY_ATTR_MAP, name, value);
if (!matched) throw new BuildException("Unknown property of compile task: " + name, getLocation());
- if ("destdir".equals(name)) destdirSet = true;
+ if ("destdir".equals(name)) destdirLoc = value;
}
public void setSrcdir(Path srcDir) {
@@ -208,11 +209,15 @@ public class Compile extends MatchingTask implements DynamicAttribute {
}
public void execute() {
- if (!destdirSet) throw new BuildException("mandatory property 'destdir' not set.");
+ if (destdirLoc == null) throw new BuildException("mandatory property 'destdir' not set.");
+ log(getLocation().toString() + "compiling to " + destdirLoc, Project.MSG_VERBOSE);
if (src == null) src = new Path(getProject());
Map<?, ?> attributeMap = javac.getWrapper().getAttributeMap();
+ boolean hasRelease = attributeMap.containsKey("release");
for (Map.Entry<String, String> e : JAVAC_DEFAULTS.entrySet()) {
- if (!attributeMap.containsKey(e.getKey())) javac.getWrapper().setAttribute(e.getKey(), e.getValue());
+ if (!(hasRelease && (e.getKey().equals("source") || e.getKey().equals("target"))) && !attributeMap.containsKey(e.getKey())) {
+ javac.getWrapper().setAttribute(e.getKey(), e.getValue());
+ }
}
attributeMap = copy.getWrapper().getAttributeMap();
for (Map.Entry<String, String> e : COPY_DEFAULTS.entrySet()) {
=====================================
src/com/zwitserloot/ivyplusplus/Version.java
=====================================
@@ -1,5 +1,5 @@
/**
- * Copyright © 2010-2019 Reinier Zwitserloot.
+ * Copyright © 2010-2020 Reinier Zwitserloot.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -23,7 +23,7 @@ package com.zwitserloot.ivyplusplus;
public class Version {
// ** CAREFUL ** - this class must always compile with 0 dependencies (it must not refer to any other sources or libraries).
- private static final String VERSION = "1.32";
+ private static final String VERSION = "1.38";
private Version() {
//Prevent instantiation
=====================================
src/com/zwitserloot/ivyplusplus/createProject/CreateProject.java
=====================================
@@ -1,5 +1,5 @@
/**
- * Copyright © 2011-2014 Reinier Zwitserloot.
+ * Copyright © 2011-2020 Reinier Zwitserloot.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -188,7 +188,8 @@ public class CreateProject {
System.out.println(java.util.Arrays.toString(Security.getProviders()));
System.out.println("Generating a new key pair. The generated key pair will be used by the <ivy:create-maven-artifact> task.");
System.out.print("What is the full name of the owner of this key: ");
- Scanner s = new Scanner(System.in);
+
+ @SuppressWarnings("resource") Scanner s = new Scanner(System.in);
String fullName = s.nextLine();
System.out.print("What is the email of the owner of this key: " );
String email = s.nextLine();
=====================================
src/com/zwitserloot/ivyplusplus/ecj/CompilationUnitImpl.java
=====================================
@@ -83,9 +83,10 @@ public class CompilationUnitImpl implements ICompilationUnit {
StringBuffer result = new StringBuffer();
- try {
- BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(sourceFile), this._sourceFile.getEncoding()));
-
+ try (
+ FileInputStream rawIn = new FileInputStream(sourceFile);
+ BufferedReader in = new BufferedReader(new InputStreamReader(rawIn, this._sourceFile.getEncoding()));
+ ) {
String str;
while ((str = in.readLine()) != null) {
result.append(str);
=====================================
src/com/zwitserloot/ivyplusplus/ecj/CompilerOptionsProvider.java
=====================================
@@ -158,6 +158,33 @@ public class CompilerOptionsProvider {
}
}
+ if (javac.getRelease() != null && !javac.getRelease().isEmpty()) {
+ String release = javac.getRelease();
+ if (release.equals("9")) {
+ result.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_9);
+ result.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_9);
+ result.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_9);
+ } else if (release.equals("10")) {
+ result.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_10);
+ result.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_10);
+ result.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_10);
+ } else if (release.equals("11")) {
+ result.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_11);
+ result.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_11);
+ result.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_11);
+ } else if (release.equals("12")) {
+ result.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_12);
+ result.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_12);
+ result.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_12);
+ } else if (release.equals("13")) {
+ result.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_13);
+ result.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_13);
+ result.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_13);
+ } else {
+ throw new BuildException("unknown java release: " + release);
+ }
+ }
+
if (javac.getDebug()) {
String debugLevel = javac.getDebugLevel();
=====================================
src/com/zwitserloot/ivyplusplus/ecj/EcjAdapter.java
=====================================
@@ -240,7 +240,7 @@ public class EcjAdapter implements CompilerAdapter {
return sourceFiles.toArray(new SourceFile[sourceFiles.size()]);
}
- @SuppressWarnings("unchecked") private Classpath[] createClasspaths() {
+ private Classpath[] createClasspaths() {
List<Classpath> classpathList = new ArrayList<Classpath>();
boolean includeSystem = includeSystemBootclasspath || javac.getBootclasspath() == null;
if (javac.getBootclasspath() != null) {
@@ -272,7 +272,7 @@ public class EcjAdapter implements CompilerAdapter {
return classpathList.toArray(new Classpath[0]);
}
- @SuppressWarnings("unchecked") private void createBootClasspath(List<Classpath> classpaths) {
+ private void createBootClasspath(List<Classpath> classpaths) {
// Step 1: get the boot class path as specified in the javac task
Path bootClasspath = javac.getBootclasspath();
@@ -325,13 +325,11 @@ public class EcjAdapter implements CompilerAdapter {
}
@Override public NameEnvironmentAnswer findType(char[] typeName, char[][] packageName, char[] moduleName) {
- NameEnvironmentAnswer answer = super.findType(typeName, packageName, moduleName);
- return answer;
+ return super.findType(typeName, packageName, moduleName);
}
@Override public NameEnvironmentAnswer findType(char[][] compoundName, char[] moduleName) {
- NameEnvironmentAnswer answer = super.findType(compoundName, moduleName);
- return answer;
+ return super.findType(compoundName, moduleName);
}
}
=====================================
src/com/zwitserloot/ivyplusplus/eclipse/BuildEclipseProject.java
=====================================
@@ -1,5 +1,5 @@
/**
- * Copyright © 2010-2019 Reinier Zwitserloot.
+ * Copyright © 2010-2020 Reinier Zwitserloot.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -59,6 +59,7 @@ public class BuildEclipseProject extends IvyPostResolveTask {
private List<Export> exports = new ArrayList<Export>();
private List<Lib> libs = new ArrayList<Lib>();
private String source = "1.8";
+ private String srcout = "bin";
private Settings settings;
private boolean pde = false;
@@ -70,6 +71,10 @@ public class BuildEclipseProject extends IvyPostResolveTask {
this.projectname = projectname;
}
+ public void setSrcout(String srcout) {
+ this.srcout = srcout;
+ }
+
public void setSource(String source) {
this.source = source;
}
@@ -311,6 +316,10 @@ public class BuildEclipseProject extends IvyPostResolveTask {
private static final Map<String, String> SOURCE_TO_CON;
static {
Map<String, String> map = new LinkedHashMap<String, String>();
+ map.put("17", "JavaSE-17");
+ map.put("16", "JavaSE-16");
+ map.put("15", "JavaSE-15");
+ map.put("14", "JavaSE-14");
map.put("13", "JavaSE-13");
map.put("12", "JavaSE-12");
map.put("11", "JavaSE-11");
@@ -340,9 +349,10 @@ public class BuildEclipseProject extends IvyPostResolveTask {
}
private String readProjName(File in, boolean error) throws IOException {
- FileInputStream fis = new FileInputStream(in);
- try {
+ try (
+ FileInputStream fis = new FileInputStream(in);
BufferedReader br = new BufferedReader(new InputStreamReader(fis, "UTF-8"));
+ ) {
List<String> stack = new ArrayList<String>();
while (true) {
String line = br.readLine();
@@ -376,8 +386,6 @@ public class BuildEclipseProject extends IvyPostResolveTask {
return warnAboutEclipseProjectReadFailure(error, in);
}
- } finally {
- fis.close();
}
}
@@ -423,7 +431,13 @@ public class BuildEclipseProject extends IvyPostResolveTask {
for (Srcdir dir : srcdirs) {
String path = todir.toURI().relativize(dir.getDir().toURI()).toString();
- elements.append("\t<classpathentry kind=\"src\" path=\"").append(path).append("\"");
+ elements.append("\t<classpathentry kind=\"src\" ");
+ if (!dir.getSrcout().isEmpty()) {
+ elements.append("output=\"");
+ elements.append(dir.getSrcout());
+ elements.append("\" ");
+ }
+ elements.append("path=\"").append(path).append("\"");
if (dir.isOptional()) {
elements.append(">\n\t\t<attributes>\n\t\t\t<attribute name=\"optional\" value=\"true\"/>\n\t\t</attributes>\n\t</classpathentry>\n");
} else {
@@ -443,12 +457,12 @@ public class BuildEclipseProject extends IvyPostResolveTask {
elements.append("\t<classpathentry kind=\"src\" path=\"/").append(pd.getName()).append("\" combineaccessrules=\"false\"/>\n");
}
- ModuleDescriptor md = null;
- if (getResolveId() != null) md = (ModuleDescriptor) getResolvedDescriptor(getResolveId());
- else md = (ModuleDescriptor) getResolvedDescriptor(getOrganisation(), getModule(), false);
+ ModuleDescriptor md = getResolveId() != null ?
+ (ModuleDescriptor) getResolvedDescriptor(getResolveId()) :
+ (ModuleDescriptor) getResolvedDescriptor(getOrganisation(), getModule(), false);
IvyNode[] deps = getIvyInstance().getResolveEngine().getDependencies(md, new ResolveOptions()
- .setConfs(confsWithSources.toArray(new String[0])).setResolveId(getResolveId()).setValidate(doValidate(getSettings())), null);
+ .setConfs(confsWithSources.toArray(new String[0])).setResolveId(getResolveId()).setValidate(doValidate(getSettings())), null);
List<ArtifactRevisionId> handledArtifacts = new ArrayList<ArtifactRevisionId>();
for (IvyNode dep : deps) {
if (dep.isCompletelyEvicted()) continue;
@@ -494,7 +508,7 @@ public class BuildEclipseProject extends IvyPostResolveTask {
}
elements.append("\t<classpathentry kind=\"con\" path=\"org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/")
.append(SOURCE_TO_CON.get(source)).append("\"/>\n");
- elements.append("\t<classpathentry kind=\"output\" path=\"bin\"/>\n");
+ elements.append("\t<classpathentry kind=\"output\" path=\"" + srcout + "\"/>\n");
elements.append("</classpath>\n");
try {
generateDotProject();
=====================================
src/com/zwitserloot/ivyplusplus/eclipse/Srcdir.java
=====================================
@@ -1,5 +1,5 @@
/**
- * Copyright © 2010 Reinier Zwitserloot.
+ * Copyright © 2010-2020 Reinier Zwitserloot.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -27,6 +27,7 @@ public class Srcdir {
private File dir;
private boolean optional = false;
private boolean test = false;
+ private String srcout = "";
public File getDir() {
return dir;
@@ -36,6 +37,14 @@ public class Srcdir {
this.dir = dir;
}
+ public String getSrcout() {
+ return srcout;
+ }
+
+ public void setSrcout(String srcout) {
+ this.srcout = srcout;
+ }
+
public boolean isOptional() {
return optional;
}
@@ -53,7 +62,9 @@ public class Srcdir {
}
@Override public String toString() {
- return "Srcdir [dir=" + dir + ", optional=" + optional + ", test=" + test + "]";
+ String out = "Srcdir [dir=" + dir + ", optional=" + optional + ", test=" + test;
+ if (!srcout.isEmpty()) out += ", srcout=" + srcout;
+ return out + "]";
}
@Override public int hashCode() {
@@ -62,6 +73,7 @@ public class Srcdir {
result = prime * result + ((dir == null) ? 0 : dir.hashCode());
result = prime * result + (optional ? 1231 : 1237);
result = prime * result + (test ? 1231 : 1237);
+ result = prime * result + srcout.hashCode();
return result;
}
@@ -75,6 +87,7 @@ public class Srcdir {
} else if (!dir.equals(other.dir)) return false;
if (optional != other.optional) return false;
if (test != other.test) return false;
+ if (!srcout.equals(other.srcout)) return false;
return true;
}
}
=====================================
src/com/zwitserloot/ivyplusplus/intellij/BuildIntellijProject.java
=====================================
@@ -1,5 +1,5 @@
/**
- * Copyright © 2010 Reinier Zwitserloot.
+ * Copyright © 2010-2020 Reinier Zwitserloot.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -122,9 +122,9 @@ public class BuildIntellijProject extends IvyPostResolveTask {
}
private void generateLibraryXml(File toDir) throws IOException {
- ModuleDescriptor md = null;
- if (getResolveId() != null) md = (ModuleDescriptor) getResolvedDescriptor(getResolveId());
- else md = (ModuleDescriptor) getResolvedDescriptor(getOrganisation(), getModule(), false);
+ ModuleDescriptor md = getResolveId() != null ?
+ (ModuleDescriptor) getResolvedDescriptor(getResolveId()) :
+ (ModuleDescriptor) getResolvedDescriptor(getOrganisation(), getModule(), false);
prepareAndCheck();
if (settings != null) settings.execute(todir, getLocation(), source);
@@ -134,11 +134,12 @@ public class BuildIntellijProject extends IvyPostResolveTask {
assert retrievePattern != null;
IvyNode[] deps = getIvyInstance().getResolveEngine().getDependencies(md, new ResolveOptions()
- .setConfs(confsWithSources.toArray(new String[0])).setResolveId(getResolveId()).setValidate(doValidate(getSettings())), null);
+ .setConfs(confsWithSources.toArray(new String[0])).setResolveId(getResolveId()).setValidate(doValidate(getSettings())), null);
List<ArtifactRevisionId> handledArtifacts = new ArrayList<ArtifactRevisionId>();
Map<Conf, StringBuilder> depLines = new HashMap<Conf, StringBuilder>();
Map<Conf, StringBuilder> sourceLines = new HashMap<Conf, StringBuilder>();
for (IvyNode dep : deps) {
+ if (dep.isCompletelyEvicted()) continue;
for (Conf conf : confs) {
for (Artifact artifact : dep.getArtifacts(conf.getName())) {
if (handledArtifacts.contains(artifact.getId())) continue;
=====================================
src/com/zwitserloot/ivyplusplus/ssh/JarUnpacker.java
=====================================
@@ -36,18 +36,13 @@ public class JarUnpacker {
public static void unpack(File tgtDir, String hashGuard) throws IOException {
String homeOfClass = findClasspathRoot(JarUnpacker.class);
- JarFile jf = new JarFile(homeOfClass);
-
String packHash = getPackHash();
+ if (packHash.equals(hashGuard)) return;
- if (packHash.equals(hashGuard)) {
- return;
- }
-
- new File(tgtDir, "HASH").delete();
- deleteAll(tgtDir, 0);
-
- try {
+ try (JarFile jf = new JarFile(homeOfClass)) {
+ new File(tgtDir, "HASH").delete();
+ deleteAll(tgtDir, 0);
+
Enumeration<JarEntry> en = jf.entries();
if (hashGuard != null) {
}
@@ -73,8 +68,6 @@ public class JarUnpacker {
transfer(in, out);
}
}
- } finally {
- jf.close();
}
File f = new File(tgtDir, "HASH");
=====================================
src/com/zwitserloot/ivyplusplus/ssh/SshSubsystem.java
=====================================
@@ -25,8 +25,9 @@ public class SshSubsystem {
}
private static String fetchHash(File f) throws IOException {
- InputStream in = new FileInputStream(f);
- return new BufferedReader(new InputStreamReader(in, "UTF-8")).readLine();
+ try (InputStream in = new FileInputStream(f)) {
+ return new BufferedReader(new InputStreamReader(in, "UTF-8")).readLine();
+ }
}
private static final class DummyInputStream extends InputStream {
=====================================
src/com/zwitserloot/ivyplusplus/ssh/internal/SshUtil.java
=====================================
@@ -36,10 +36,11 @@ class SshUtil {
static List<KnownHost> readKnownHosts(File f) throws IOException {
if (!f.exists()) return Collections.emptyList();
- InputStream raw = new FileInputStream(f);
- List<KnownHost> out = new ArrayList<>();
- try {
+ List<KnownHost> out = new ArrayList<KnownHost>();
+ try (
+ InputStream raw = new FileInputStream(f);
BufferedReader br = new BufferedReader(new InputStreamReader(raw, "UTF-8"));
+ ) {
for (String line = br.readLine(); line != null; line = br.readLine()) {
line = line.trim();
if (line.isEmpty() || line.startsWith("#")) continue;
@@ -52,8 +53,6 @@ class SshUtil {
kn.base64 = p[4];
out.add(kn);
}
- } finally {
- raw.close();
}
return out;
View it on GitLab: https://salsa.debian.org/java-team/ivyplusplus/-/compare/8152d7c02d1594b2966dbfe281e5c0b4bd321aa8...986ced25be1eb88a0e5088dcf0729f4aca913716
--
View it on GitLab: https://salsa.debian.org/java-team/ivyplusplus/-/compare/8152d7c02d1594b2966dbfe281e5c0b4bd321aa8...986ced25be1eb88a0e5088dcf0729f4aca913716
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20220215/f35a1154/attachment.htm>
More information about the pkg-java-commits
mailing list