|
|
@ -182,18 +182,11 @@ public abstract class JGitTestUtil { |
|
|
|
URL url = cl().getResource(CLASSPATH_TO_RESOURCES + name); |
|
|
|
URL url = cl().getResource(CLASSPATH_TO_RESOURCES + name); |
|
|
|
if (url == null) |
|
|
|
if (url == null) |
|
|
|
throw new FileNotFoundException(name); |
|
|
|
throw new FileNotFoundException(name); |
|
|
|
InputStream in = url.openStream(); |
|
|
|
try (InputStream in = url.openStream(); |
|
|
|
try { |
|
|
|
FileOutputStream out = new FileOutputStream(dest)) { |
|
|
|
FileOutputStream out = new FileOutputStream(dest); |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
byte[] buf = new byte[4096]; |
|
|
|
byte[] buf = new byte[4096]; |
|
|
|
for (int n; (n = in.read(buf)) > 0;) |
|
|
|
for (int n; (n = in.read(buf)) > 0;) |
|
|
|
out.write(buf, 0, n); |
|
|
|
out.write(buf, 0, n); |
|
|
|
} finally { |
|
|
|
|
|
|
|
out.close(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} finally { |
|
|
|
|
|
|
|
in.close(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -252,11 +245,9 @@ public abstract class JGitTestUtil { |
|
|
|
public static void write(final File f, final String body) |
|
|
|
public static void write(final File f, final String body) |
|
|
|
throws IOException { |
|
|
|
throws IOException { |
|
|
|
FileUtils.mkdirs(f.getParentFile(), true); |
|
|
|
FileUtils.mkdirs(f.getParentFile(), true); |
|
|
|
Writer w = new OutputStreamWriter(new FileOutputStream(f), UTF_8); |
|
|
|
try (Writer w = new OutputStreamWriter(new FileOutputStream(f), |
|
|
|
try { |
|
|
|
UTF_8)) { |
|
|
|
w.write(body); |
|
|
|
w.write(body); |
|
|
|
} finally { |
|
|
|
|
|
|
|
w.close(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|