From 61e4e2a0522197f84a172d7dd6e6067126b1c2b0 Mon Sep 17 00:00:00 2001 From: zzz Date: Fri, 3 Mar 2017 13:59:54 +0000 Subject: [PATCH] Util: Don't depend on DataHelper in FileUtil.copy(), causes Windows installer to fail because DataHelper is not in install.jar. tag i2p-0.9.29-win1 --- core/java/src/net/i2p/util/FileUtil.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/core/java/src/net/i2p/util/FileUtil.java b/core/java/src/net/i2p/util/FileUtil.java index 47aba6030..e1b6d0235 100644 --- a/core/java/src/net/i2p/util/FileUtil.java +++ b/core/java/src/net/i2p/util/FileUtil.java @@ -18,6 +18,11 @@ import java.util.jar.JarOutputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; +// WARNING +// Some methods called from install.jar (Windows installer utils) +// or InstallUpdate (i2pupdate.zip installer), +// where most external classes are not available, including DataHelper! +// Use caution when adding dependencies. import net.i2p.data.DataHelper; // Pack200 now loaded dynamically in unpack() below @@ -458,7 +463,14 @@ public class FileUtil { try { in = new FileInputStream(src); out = new FileOutputStream(dst); - DataHelper.copy(in, out); + // We do NOT use DataHelper.copy() because it's used in installer.jar + // which does not contain DataHelper + //DataHelper.copy(in, out); + int read; + byte buf[] = new byte[4096]; + while ((read = in.read(buf)) != -1) { + out.write(buf, 0, read); + } return true; } catch (IOException ioe) { if (!quiet)