[NETBEANS-3985] : Addressed code review comments
diff --git a/apisupport/apisupport.installer.maven/src/org/netbeans/modules/apisupport/installer/maven/actions/BuildInstallersAction.java b/apisupport/apisupport.installer.maven/src/org/netbeans/modules/apisupport/installer/maven/actions/BuildInstallersAction.java
index d9b4f6e..0773a5e 100644
--- a/apisupport/apisupport.installer.maven/src/org/netbeans/modules/apisupport/installer/maven/actions/BuildInstallersAction.java
+++ b/apisupport/apisupport.installer.maven/src/org/netbeans/modules/apisupport/installer/maven/actions/BuildInstallersAction.java
@@ -149,7 +149,6 @@
// licenseFile = null;
//}
}
- //boolean usePack200 = prefs.getBoolean(SuiteInstallerProjectProperties.USE_PACK200_COMPRESSION, false);
//${harness.dir}/etc/applicationIcon.icns
appIconIcnsFile = new File(InstalledFileLocator.getDefault().locate(
@@ -322,9 +321,6 @@
"generated-installers-location-forward-slashes",
new File(suiteLocation, "dist").getAbsolutePath().replace("\\", "/"));
*/
- //pack200 is not supported from jdk 14 onwards
- /*props.put(
- "pack200.enabled", "" + usePack200);*/
/*
if(appIcon!=null) {
diff --git a/apisupport/apisupport.installer/nbproject/org-netbeans-modules-apisupport-installer.sig b/apisupport/apisupport.installer/nbproject/org-netbeans-modules-apisupport-installer.sig
index fb46c1e..e785b1a 100644
--- a/apisupport/apisupport.installer/nbproject/org-netbeans-modules-apisupport-installer.sig
+++ b/apisupport/apisupport.installer/nbproject/org-netbeans-modules-apisupport-installer.sig
@@ -624,7 +624,6 @@
fld public final static java.lang.String LICENSE_TYPE_CUSTOM = "custom"
fld public final static java.lang.String LICENSE_TYPE_FILE = "file"
fld public final static java.lang.String LICENSE_TYPE_NO = "no"
-#fld public final static java.lang.String USE_PACK200_COMPRESSION = "pack200-enabled"
meth public static java.util.prefs.Preferences prefs(org.netbeans.api.project.Project)
meth public void store() throws java.io.IOException
supr java.lang.Object
diff --git a/apisupport/apisupport.installer/src/org/netbeans/modules/apisupport/installer/actions/BuildInstallersAction.java b/apisupport/apisupport.installer/src/org/netbeans/modules/apisupport/installer/actions/BuildInstallersAction.java
index 57bc41f..c5265e6 100644
--- a/apisupport/apisupport.installer/src/org/netbeans/modules/apisupport/installer/actions/BuildInstallersAction.java
+++ b/apisupport/apisupport.installer/src/org/netbeans/modules/apisupport/installer/actions/BuildInstallersAction.java
@@ -105,7 +105,6 @@
// licenseFile = null;
//}
}
- //boolean usePack200 = prefs.getBoolean(SuiteInstallerProjectProperties.USE_PACK200_COMPRESSION, false);
try {
FileObject propertiesFile = prj.getProjectDirectory().getFileObject(AntProjectHelper.PROJECT_PROPERTIES_PATH);
@@ -314,9 +313,6 @@
"generated-installers-location-forward-slashes",
new File(suiteLocation, "dist").getAbsolutePath().replace("\\", "/"));
*/
- //pack200 is not supported from jdk 14 onwards
- /*props.put(
- "pack200.enabled", "" + usePack200);*/
if(appIcon!=null) {
File appIconFile = new File(appIcon);
diff --git a/apisupport/apisupport.installer/src/org/netbeans/modules/apisupport/installer/ui/InstallerPanel.java b/apisupport/apisupport.installer/src/org/netbeans/modules/apisupport/installer/ui/InstallerPanel.java
index 968a387..ceddd40 100644
--- a/apisupport/apisupport.installer/src/org/netbeans/modules/apisupport/installer/ui/InstallerPanel.java
+++ b/apisupport/apisupport.installer/src/org/netbeans/modules/apisupport/installer/ui/InstallerPanel.java
@@ -38,8 +38,6 @@
jCheckBox2.setModel(installerProps.linuxModel);
jCheckBox3.setModel(installerProps.macModel);
jCheckBox4.setModel(installerProps.solarisModel);
- //pack200 is not supported from jdk 14 onwards
- //jCheckBox5.setModel(installerProps.pack200Model);
licenseComboBox.setModel(installerProps.licenseModel);
}
diff --git a/apisupport/apisupport.installer/src/org/netbeans/modules/apisupport/installer/ui/SuiteInstallerProjectProperties.java b/apisupport/apisupport.installer/src/org/netbeans/modules/apisupport/installer/ui/SuiteInstallerProjectProperties.java
index 0967703..828729c 100644
--- a/apisupport/apisupport.installer/src/org/netbeans/modules/apisupport/installer/ui/SuiteInstallerProjectProperties.java
+++ b/apisupport/apisupport.installer/src/org/netbeans/modules/apisupport/installer/ui/SuiteInstallerProjectProperties.java
@@ -44,7 +44,6 @@
public static final String GENERATE_FOR_LINUX = "os-linux";
public static final String GENERATE_FOR_SOLARIS = "os-solaris";
public static final String GENERATE_FOR_MAC = "os-macosx";
- //public static final String USE_PACK200_COMPRESSION = "pack200-enabled";
public static final String LICENSE_TYPE = "license-type";
public static final String LICENSE_TYPE_NO = "no";
@@ -57,8 +56,6 @@
final JToggleButton.ToggleButtonModel linuxModel;
final JToggleButton.ToggleButtonModel solarisModel;
final JToggleButton.ToggleButtonModel macModel;
- //pack200 is not supported from jdk 14 onwards
- //final JToggleButton.ToggleButtonModel pack200Model;
final LicenseComboBoxModel licenseModel;
public SuiteInstallerProjectProperties(Project suiteProject) {
@@ -72,9 +69,6 @@
solarisModel.setSelected(prefs.getBoolean(GENERATE_FOR_SOLARIS, Utilities.getOperatingSystem() == Utilities.OS_SOLARIS));
macModel = new JToggleButton.ToggleButtonModel();
macModel.setSelected(prefs.getBoolean(GENERATE_FOR_MAC, Utilities.isMac()));
- //pack200 is not supported from jdk 14 onwards
- //pack200Model = new JToggleButton.ToggleButtonModel();
- //pack200Model.setSelected(prefs.getBoolean(USE_PACK200_COMPRESSION, false));
// license model:
ResourceBundle rb = NbBundle.getBundle(SuiteInstallerProjectProperties.class);
@@ -128,8 +122,6 @@
prefs.putBoolean(GENERATE_FOR_LINUX, linuxModel.isSelected());
prefs.putBoolean(GENERATE_FOR_SOLARIS, solarisModel.isSelected());
prefs.putBoolean(GENERATE_FOR_MAC, macModel.isSelected());
- //pack200 is not supported from jdk 14 onwards
- //prefs.putBoolean(USE_PACK200_COMPRESSION, pack200Model.isSelected());
String licenseName = (String) licenseModel.getSelectedItem();
if (licenseName != null) {
int index = licenseModel.getNames().indexOf(licenseName);
diff --git a/harness/libs.nbi.ant/stub/build.properties b/harness/libs.nbi.ant/stub/build.properties
index 7f50edf..f57f444 100644
--- a/harness/libs.nbi.ant/stub/build.properties
+++ b/harness/libs.nbi.ant/stub/build.properties
@@ -16,7 +16,6 @@
# under the License.
output.dir=${basedir}/build
jarsigner.enabled=false
-#pack200.enabled={pack200.enabled}
core.module.name=nbi
ext.module.name=ext
diff --git a/harness/libs.nbi.ant/stub/template.xml b/harness/libs.nbi.ant/stub/template.xml
index bbcd112..ec39c97 100644
--- a/harness/libs.nbi.ant/stub/template.xml
+++ b/harness/libs.nbi.ant/stub/template.xml
@@ -137,7 +137,6 @@
<replacefilter token="{product-platforms}" value="${generate.installer.for.platforms}"/>
<replacefilter token="{generator-jdk-location-forward-slashes}" value="${generator-jdk-location-forward-slashes}"/>
<replacefilter token="{generated-installers-location-forward-slashes}" value="${suite.dist.directory}"/>
- <!--<replacefilter token="{pack200.enabled}" value="${pack200.enabled}"/>-->
<replacefilter token="{generated-installers-prefix}" value="${installers.file.prefix}"/>
<replacefilter token="{product-uid}" value="${product-uid}"/>
</replace>
diff --git a/harness/libs.nbi.ant/stub/tmpl.properties b/harness/libs.nbi.ant/stub/tmpl.properties
index 015ea8d..aee69ff 100644
--- a/harness/libs.nbi.ant/stub/tmpl.properties
+++ b/harness/libs.nbi.ant/stub/tmpl.properties
@@ -27,6 +27,5 @@
generate.installer.for.platforms=windows linux macosx
generator-jdk-location-forward-slashes=C:/Program Files/Java/jdk1.5.0_16
-#pack200.enabled=false
suite.nbi.product.uid=myapp
diff --git a/nbbuild/antsrc/org/netbeans/nbbuild/MakeNBM.java b/nbbuild/antsrc/org/netbeans/nbbuild/MakeNBM.java
index d40c586..f8524e3 100644
--- a/nbbuild/antsrc/org/netbeans/nbbuild/MakeNBM.java
+++ b/nbbuild/antsrc/org/netbeans/nbbuild/MakeNBM.java
@@ -307,8 +307,8 @@
private Path updaterJar;
private FileSet executablesSet;
private ZipFileSet extraNBMFiles;
- //private boolean usePack200;
- //private String pack200excludes;
+ private boolean usePack200;
+ private String pack200excludes;
private boolean alwaysCreateNBM;
/** Try to find and create localized info.xml files */
@@ -334,14 +334,14 @@
public void setFile(File file) {
this.file = file;
}
- //Commented below code, as pack200 is not supported from jdk 14 onwards
- /*public void setUsePack200(boolean usePack200) {
+
+ public void setUsePack200(boolean usePack200) {
this.usePack200 = usePack200;
}
public void setPack200Excludes(String pack200excludes) {
this.pack200excludes = pack200excludes;
- }*/
+ }
public void setAlwaysCreateNBM(boolean alwaysCreateNBM) {
this.alwaysCreateNBM = alwaysCreateNBM;
@@ -674,8 +674,7 @@
List <String> moduleFiles = new ArrayList <>();
fs.setDir( productDir );
String [] filesForPackaging = null;
- //Commented below code, as pack200 is not supported from jdk 14 onwards
- /*if(usePack200 && pack200excludes!=null && !pack200excludes.equals("")) {
+ if(usePack200 && pack200excludes!=null && !pack200excludes.equals("")) {
FileSet pack200Files = new FileSet();
pack200Files.setDir(productDir);
pack200Files.setExcludes(pack200excludes);
@@ -686,12 +685,11 @@
DirectoryScanner ds = pack200Files.getDirectoryScanner();
ds.scan();
filesForPackaging = ds.getIncludedFiles();
- }*/
+ }
List<File> packedFiles = new ArrayList<>();
for (int i = 0; i < files.length; i++) {
- //Commented below code, as pack200 is not supported from jdk 14 onwards
- /*if (usePack200) {
+ if (usePack200) {
File sourceFile = new File(productDir, files[i]);
if (sourceFile.isFile() && sourceFile.getName().endsWith(".jar")) {
@@ -732,7 +730,7 @@
}
}
}
- }*/
+ }
fs.createInclude().setName(files[i]);
moduleFiles.add(files[i]);
diff --git a/nbbuild/installer/infra/build/init.sh b/nbbuild/installer/infra/build/init.sh
index 4f1f531..235f23f 100644
--- a/nbbuild/installer/infra/build/init.sh
+++ b/nbbuild/installer/infra/build/init.sh
@@ -58,7 +58,6 @@
echo jarsigner.keystore="${JARSIGNER_KEYSTORE}"
echo jarsigner.alias="${JARSIGNER_ALIAS}"
echo jarsigner.storepass="${JARSIGNER_STOREPASS}"
-#echo pack200.enabled="${USE_PACK200}"
echo nbi.cache.dir="${CACHE_DIR}"
echo nb.binary.name="${BINARY_NAME}"
echo nb.version="${NB_VER_NUMBER}"
diff --git a/nbbuild/templates/common.xml b/nbbuild/templates/common.xml
index 677f13c..828bab1 100644
--- a/nbbuild/templates/common.xml
+++ b/nbbuild/templates/common.xml
@@ -447,8 +447,8 @@
<mkdir dir="${build.dir}"/>
<property name="nbm.target.cluster" value=""/> <!-- fallback -->
<property name="license.file.override" value="${license.file}"/>
- <!--<property name="use.pack200" value="false"/>-->
- <!--<property name="pack200.excludes" value=""/>-->
+ <property name="use.pack200" value="false"/>
+ <property name="pack200.excludes" value=""/>
<property name="nbm.locales" value="${locales}"/>
<makenbm file="${build.dir}/${nbm}"
productdir="${cluster}"
@@ -458,6 +458,8 @@
needsrestart="${nbm.needs.restart}"
global="${nbm.is.global}"
preferredupdate="${nbm.is.preferredupdate}"
+ usepack200="${use.pack200}"
+ pack200excludes="${pack200.excludes}"
alwayscreatenbm="${nbm.always.create}"
targetcluster="${nbm.target.cluster}"
releasedate="${nbm.release.date}"
diff --git a/nbi/engine/src/org/netbeans/installer/utils/FileUtils.java b/nbi/engine/src/org/netbeans/installer/utils/FileUtils.java
index 4505d29..4b1b116 100644
--- a/nbi/engine/src/org/netbeans/installer/utils/FileUtils.java
+++ b/nbi/engine/src/org/netbeans/installer/utils/FileUtils.java
@@ -51,10 +51,6 @@
import java.util.Set;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
-//commented below 3 lines, bacause pack200 is not supported from jdk 14 onwards
-//import java.util.jar.JarOutputStream;
-//import java.util.jar.Pack200;
-//import java.util.jar.Pack200.Unpacker;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.zip.CRC32;
@@ -79,9 +75,7 @@
public final class FileUtils {
/////////////////////////////////////////////////////////////////////////////////
// Static
- //commented below line, bacause pack200 is not supported from jdk 14 onwards
- //private final static Unpacker unpacker = Pack200.newUnpacker();
-
+
// file/stream read/write ///////////////////////////////////////////////////////
public static String readFile(
final File file, String charset) throws IOException {
@@ -1171,145 +1165,6 @@
}
}
- // pack200/unpack200 ////////////////////////////////////////////////////////////
- //commented below method, bacause pack200 is not supported from jdk 14 onwards
- /*public static File pack(
- final File source) throws IOException {
- final File target = new File(source.getParentFile(),
- source.getName() + PACK_GZ_SUFFIX);
- if(SystemUtils.isWindows() && source.getAbsolutePath().length() > 255) {*/
- /*
- * WORKAROUND for two issues (and 6612389 in BugTrack):
- * http://www.netbeans.org/issues/show_bug.cgi?id=96548
- * http://www.netbeans.org/issues/show_bug.cgi?id=97984
- * The issue is that unpack200/pack200 doesn`t support long path names
- * Copy source to tmp dir, unpack it there and copy to target.
- */
- /*
-
- File tmpSource = null;
- File tmpTarget = null;
- try {
- tmpSource = File.createTempFile(source.getName(), ".jar");
- copyFile(source, tmpSource);
- tmpTarget = pack(tmpSource);
- deleteFile(tmpSource);
- tmpSource = null;
- copyFile(tmpTarget,target);
- deleteFile(tmpTarget);
- tmpTarget = null;
- } finally {
- if(tmpSource!=null) {
- deleteFile(tmpSource);
- }
- if(tmpTarget!=null) {
- deleteFile(tmpTarget);
- }
- }
- } else {
- ExecutionResults er = SystemUtils.executeCommand(
- SystemUtils.getPacker().getAbsolutePath(),
- target.getAbsolutePath(),
- source.getAbsolutePath());
- if( er.getErrorCode() != 0) {
- throw new IOException(ResourceUtils.getString(FileUtils.class,
- ERROR_PACK200_FAILED_KEY,
- er.getErrorCode(), er.getStdOut(),er.getStdErr()));
- }
- }
-
- return target;
- }*/
- //commented below method, bacause pack200 is not supported from jdk 14 onwards
- /*public static File unpack(
- final File source) throws IOException {
- final String name = source.getName();
- final File target = new File(source.getParentFile(),
- name.substring(0, name.length() - PACK_GZ_SUFFIX.length()));
-
- if(SystemUtils.isWindows() && source.getAbsolutePath().length() > 255) {*/
- /*
- * WORKAROUND for two issues (and 6612389 in BugTrack):
- * http://www.netbeans.org/issues/show_bug.cgi?id=96548
- * http://www.netbeans.org/issues/show_bug.cgi?id=97984
- * The issue is that unpack200/pack200 doesn`t support long path names
- * Copy source to tmp dir, unpack it there and copy to target.
- */
- /*
- File tmpSource = null;
- File tmpTarget = null;
- try {
- tmpSource = File.createTempFile(target.getName(),
- ".tmp" + PACK_GZ_SUFFIX);
- copyFile(source, tmpSource);
- tmpTarget = unpack(tmpSource);
- deleteFile(tmpSource);
- tmpSource = null;
- copyFile(tmpTarget,target);
- deleteFile(tmpTarget);
- tmpTarget = null;
- } finally {
- if(tmpSource!=null) {
- deleteFile(tmpSource);
- }
- if(tmpTarget!=null) {
- deleteFile(tmpTarget);
- }
- }
- } else if((System.getProperty("os.name").equals("AIX") &&
- System.getProperty("java.version").startsWith("1.6")) ||
- Boolean.getBoolean(USE_INTERNAL_UNPACK200_PROPERTY)) {
- //workaround the bug when unpack200 command from Java6 on AIX corrupts the jar
- //by using inverting zip magic numbers
- unpack200Internal(source, target);
- } else {
- ExecutionResults er = SystemUtils.executeCommand(
- SystemUtils.getUnpacker().getAbsolutePath(),
- source.getAbsolutePath(),
- target.getAbsolutePath());
- int errorCode = er.getErrorCode();
- if (errorCode != 0) {
- if(errorCode == -1073741801 || errorCode == -1073741502) {
- // Workaround for the issue in lvprcsrv.exe process
- // http://www.netbeans.org/issues/show_bug.cgi?id=117334
- // http://www.netbeans.org/issues/show_bug.cgi?id=165319
- LogManager.log("\n\n");
- LogManager.log("Attention!");
- LogManager.log("You have run into the Issue 117334");
- LogManager.log("http://www.netbeans.org/issues/show_bug.cgi?id=117334");
- LogManager.log("This is the result of error in process lvprcsrv.exe (Logitech QuickCam)");
- LogManager.log("You should turn it off if you have had any issues during installations");
- LogManager.log("\n\n");
- } else {
- throw new IOException(ResourceUtils.getString(FileUtils.class,
- ERROR_UNPACK200_FAILED_KEY,
- errorCode, er.getStdOut(),er.getStdErr()));
- }
- }
- }
- return target;
- }*/
-
- //commented below method, bacause pack200 is not supported from jdk 14 onwards
- /*private static void unpack200Internal (File source, File target) throws IOException {
- InputStream is = null;
- JarOutputStream os = null;
- try {
- //Unpacker has memory leaks so use with care
- LogManager.log("unpacking " + source);
- is = new GZIPInputStream(new FileInputStream(source));
- os = new JarOutputStream(new FileOutputStream(target));
- unpacker.unpack(is, os);
- } finally {
- if(is!=null) {
- is.close();
- }
- if(os!=null) {
- os.close();
- }
- }
- }*/
-
// miscellaneous ////////////////////////////////////////////////////////////////
public static FilesList mkdirs(
final File file) throws IOException {
@@ -1833,24 +1688,6 @@
}
}
- //commented below code, bacause pack200 is not supported from jdk 14 onwards
- /*if (listEntry.isPackedJarFile()) {
- final File packed = listEntry.getFile();;
- final File unpacked = unpack(packed);
-
- deleteFile(packed);
-
- listEntry = new FileEntry(
- unpacked,
- listEntry.getSize(),
- listEntry.getMd5(),
- listEntry.isJarFile(),
- false,
- listEntry.isSignedJarFile(),
- listEntry.getLastModified(),
- listEntry.getPermissions());
- }*/
-
listEntryFile.setLastModified(listEntry.getLastModified());
SystemUtils.setPermissions(
@@ -2090,11 +1927,4 @@
public static final String MESSAGE_DELETE_DIR =
ResourceUtils.getString(FileUtils.class,
"FU.message.delete.dir");//NOI18N
- //commented below lines, bacause pack200 is not supported from jdk 14 onwards
- /*public static final String ERROR_PACK200_FAILED_KEY =
- "FU.error.pack200.failed";//NOI18N
- public static final String ERROR_UNPACK200_FAILED_KEY =
- "FU.error.unpack200.failed";//NOI18N
- public static final String USE_INTERNAL_UNPACK200_PROPERTY =
- "nbi.use.internal.unpack200";//NOI18N*/
}
diff --git a/nbi/engine/src/org/netbeans/installer/utils/SystemUtils.java b/nbi/engine/src/org/netbeans/installer/utils/SystemUtils.java
index e9d119f..22c1f74 100644
--- a/nbi/engine/src/org/netbeans/installer/utils/SystemUtils.java
+++ b/nbi/engine/src/org/netbeans/installer/utils/SystemUtils.java
@@ -134,23 +134,6 @@
osArch.equals("ppc64");
}
- //commented below 2 methods, as pack200 not supported from jdk14 onwards
-// public static File getPacker() {
-// if (isWindows()) {
-// return new File(getCurrentJavaHome(), "bin/pack200.exe");
-// } else {
-// return new File(getCurrentJavaHome(), "bin/pack200");
-// }
-// }
-//
-// public static File getUnpacker() {
-// if (isWindows()) {
-// return new File(getCurrentJavaHome(), "bin/unpack200.exe");
-// } else {
-// return new File(getCurrentJavaHome(), "bin/unpack200");
-// }
-// }
-
public static String getLineSeparator() {
return LINE_SEPARATOR;
}
diff --git a/nbi/infra/build/.ant-lib/src/org/netbeans/installer/infra/build/ant/Package.java b/nbi/infra/build/.ant-lib/src/org/netbeans/installer/infra/build/ant/Package.java
index aa2f2d3..25b3b23 100644
--- a/nbi/infra/build/.ant-lib/src/org/netbeans/installer/infra/build/ant/Package.java
+++ b/nbi/infra/build/.ant-lib/src/org/netbeans/installer/infra/build/ant/Package.java
@@ -218,110 +218,6 @@
browse(child, output, offset);
} else {
- //commented below code, bacause pack200 is not supported from jdk 14 onwards
- /*
- // if pack200.enabled property is set to false then disable packing
- // otherwise do repacking
- boolean packedProp = false;
- final String pack200Enabled = getProject().getProperty("pack200.enabled"); //NOI18N
- boolean usePacking = ! "false".equals(pack200Enabled); //NOI18N
-
- boolean mirrorFileExist = false;
- File mirrorFile = null;
- if (child.getName().endsWith(".jar.pack.gz")) {
- mirrorFile = new File(child.getParentFile(), child.getName().substring(0, child.getName().length() - (".pack.gz".length())));
- } else if (child.getName().endsWith(".jar")) {
- mirrorFile = new File(child + ".pack.gz");
- }
-
- if (mirrorFile != null && mirrorFile.exists()) {
- log(" mirror packing files exists, skipping repacking : " + mirrorFile);
- mirrorFileExist = true;
- usePacking = false;
- }
-
- // if the source file comes in already packed, we need to unpack it
- // first and then process normally
- if (!mirrorFileExist && child.getName().endsWith(".jar.pack.gz")) { // NOI18N
- if(usePacking) {
- log(" it is a packed jar - unpacking"); // NOI18N
- File unpacked = new File(child.getPath().substring(
- 0,
- child.getPath().length() - 8));
- File temp = null;
-
- if (unpacked.exists()) {
- temp = File.createTempFile(
- "xxx", // NOI18N
- null,
- child.getParentFile());
- temp.delete();
- unpacked.renameTo(temp);
- }
-
- if (Utils.unpack(child, unpacked)) {
- child.delete();
- if (temp != null) {
- temp.delete();
- }
- child = unpacked.getAbsoluteFile();
-
- log(" successfully unpacked - processing " + // NOI18N
- "file: " + getShortPath(child,offset)); // NOI18N
- } else {
- unpacked.delete();
- if (temp != null) {
- temp.renameTo(unpacked);
- }
- }
- } else {
- packedProp = true;
- }
- }
- entry = new FileEntry(child, name);
- if(packedProp) {
- entry.setJarFile(true);
- entry.setPackedJarFile(true);
- }
-
- if(usePacking && entry.isJarFile() && !entry.isSignedJarFile()) {
- File backup = new File(child.getPath() + ".bak"); // NOI18N
- File packed = new File(child.getPath() + ".pack.gz"); // NOI18N
-
- // if the packed form of this jar already exists, we need to
- // clean it up
- if (packed.exists()) {
- log(" packed jar already exists - " + // NOI18N
- "deleting it"); // NOI18N
- packed.delete();
- toSkip.add(packed);
- }
-
- Utils.copy(child, backup);
-
- if (Utils.pack(child, packed) &&
- Utils.unpack(packed, child) &&
- Utils.verifyJad(child) &&
- Utils.verify(child)) {
- name = packed.getPath().
- substring(offset + 1).replace('\\', '/'); // NOMAGI
-
- entry = new FileEntry(child, name);
- entry.setJarFile(true);
- entry.setPackedJarFile(true);
- entry.setSignedJarFile(false);
-
- child.delete();
- backup.delete();
-
- child = packed;
- } else {
- Utils.copy(backup, child);
-
- packed.delete();
- backup.delete();
- }
- }*/
entry = new FileEntry(child, name);
log(" archiving file: " + name); // NOI18N
jarEntry = new JarEntry(name);
diff --git a/nbi/infra/build/.ant-lib/src/org/netbeans/installer/infra/build/ant/utils/Utils.java b/nbi/infra/build/.ant-lib/src/org/netbeans/installer/infra/build/ant/utils/Utils.java
index 82b146b..042be6d 100644
--- a/nbi/infra/build/.ant-lib/src/org/netbeans/installer/infra/build/ant/utils/Utils.java
+++ b/nbi/infra/build/.ant-lib/src/org/netbeans/installer/infra/build/ant/utils/Utils.java
@@ -41,11 +41,6 @@
import java.util.Stack;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
-//commented below code, bacause pack200 is not supported from jdk 14 onwards
-//import java.util.jar.JarOutputStream;
-//import java.util.jar.Pack200;
-//import java.util.jar.Pack200.Packer;
-//import java.util.jar.Pack200.Unpacker;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.zip.GZIPInputStream;
@@ -62,9 +57,6 @@
public final class Utils {
/////////////////////////////////////////////////////////////////////////////////
// Static
- //commented below code, bacause pack200 is not supported from jdk 14 onwards
- /*private final static Packer packer = Pack200.newPacker();
- private final static Unpacker unpacker = Pack200.newUnpacker();*/
/**
* The current ant project. Some of its methods will get called in process of
* the executions of some of the utility procedures. Thus the ant tasks using the
@@ -74,9 +66,6 @@
private static byte[] buffer = new byte[102400];
private static Project project = null;
- //commented below code, bacause pack200 is not supported from jdk 14 onwards
- /*private static boolean useInternalPacker = false;
- private static boolean useInternalUnpacker = false;*/
private static boolean tarInitialized = false;
@@ -94,18 +83,6 @@
*/
public static void setProject(final Project project) {
Utils.project = project;
- //commented below code, bacause pack200 is not supported from jdk 14 onwards
- /*useInternalPacker = "true".equals(project.getProperty("use.internal.packer"));
- useInternalUnpacker = "true".equals(project.getProperty("use.internal.unpacker"));
- xmx = ARG_PREFIX + XMX_ARG + project.getProperty("pack200.xmx");
- permSize = ARG_PREFIX + PERM_SIZE_ARG + project.getProperty("pack200.perm.size");
- maxPermSize = ARG_PREFIX + MAX_PERM_SIZE_ARG + project.getProperty("pack200.max.perm.size");
- String output = "use.internal.packer? " + useInternalPacker;
- if (project != null) {
- project.log(" " + output);
- } else {
- System.out.println(output);
- }*/
}
/**
@@ -203,141 +180,6 @@
}
/**
- * Packs the given jar archive using the pack200 utility.
- *
- * @param source Jar archive to pack.
- * @param target File which should become the packed jar archive.
- * @return The target file, i.e. the packed jar archive.
- * @throws java.io.IOException if an I/O error occurs.
- */
- //commented below code, bacause pack200 is not supported from jdk 14 onwards
- /*public static boolean pack(
- final File source,
- final File target) throws IOException {
- return useInternalPacker ? packInternally(source,target) : packExternally(source,target);
- }
-
- private static boolean packExternally(
- final File source,
- final File target) throws IOException {
- boolean result;
-
-
- String output = "Calling pack200(" + getPackerExecutable() + ") on " + source + " to " + target;
- if (project != null) {
- project.log(" " + output);
- } else {
- System.out.println(output);
- }
-
- Results results = run(
- getPackerExecutable(),
- xmx,
- permSize,
- maxPermSize,
- target.getAbsolutePath(),
- source.getAbsolutePath());
-
- if (results.getExitcode() == 0) {
- result = true;
- } else {
- System.out.println(results.getStdout());
- System.out.println(results.getStderr());
- System.out.println(results.getExitcode());
- result = false;
- }
-
- if (result == true) {
- target.setLastModified(source.lastModified());
- }
-
- return result;
- }
- @SuppressWarnings("CallToThreadDumpStack")
- public static boolean packInternally(final File source,
- final File target) throws IOException {
- try {
- JarFile jarFile = new JarFile(source);
- FileOutputStream outputStream = new FileOutputStream(target);
-
-
- String output = "Packing jarFile: " + jarFile + " to " + target;
- if (project != null) {
- project.log(" " + output);
- } else {
- System.out.println(output);
- }
-
- //packer.pack(jarFile, outputStream);
-
- jarFile.close();
- outputStream.close();
- target.setLastModified(source.lastModified());
- } catch (IOException exc) {
- exc.printStackTrace();
- return false;
- }
- return true;
- }
- /**
- * Unpacks the given packed jar archive using the unpack200 utility.
- *
- * @param source Jar archive to unpack.
- * @param target File to which the unpacked archive should be saved.
- * @return The target file, i.e. the unpacked jar archive.
- * @throws java.io.IOException if an I/O errors occurs.
- */
-
- /* public static boolean unpack(
- final File source,
- final File target) throws IOException {
- return useInternalUnpacker ? unpackInternally(source,target) : unpackExternally(source,target);
- }
-
- private static boolean unpackExternally(
- final File source,
- final File target) throws IOException {
- boolean result;
-
-
- Results results = run(
- getUnPackerExecutable(),
- xmx,
- permSize,
- maxPermSize,
- source.getAbsolutePath(),
- target.getAbsolutePath());
-
- if (results.getExitcode() == 0) {
- result = true;
- } else {
- System.out.println(results.getStdout());
- System.out.println(results.getStderr());
- System.out.println(results.getExitcode());
- result = false;
- }
-
- if (result == true) {
- target.setLastModified(source.lastModified());
- }
-
- return result;
- }
- @SuppressWarnings("CallToThreadDumpStack")
- public static boolean unpackInternally(final File source,
- final File target) throws IOException {
- try {
- JarOutputStream os = new JarOutputStream(new FileOutputStream(target));
- //unpacker.unpack(source, os);
- os.close();
- target.setLastModified(source.lastModified());
- } catch (IOException exc) {
- exc.printStackTrace();
- return false;
- }
- return true;
- }*/
- /**
* Verifies that the jar archive is correct. This method tries to access all
* jar archive entries and to load all the classes.
*
@@ -1101,13 +943,6 @@
return handleProcess(process);
}
- //commented below code, bacause pack200 is not supported from jdk 14 onwards
- /*public static String getPackerExecutable() {
- return getExecutable(PACKER_EXECUTABLE_PROPERTY, PACKER_EXECUTABLE);
- }
- public static String getUnPackerExecutable() {
- return getExecutable(UNPACKER_EXECUTABLE_PROPERTY, UNPACKER_EXECUTABLE);
- }*/
public static String getLsExecutable() {
final String value = project.getProperty(LS_EXECUTABLE_PROPERTY);
return (value == null || value.equals("")) ? findLsExecutable() : value;
@@ -1470,12 +1305,6 @@
private static final String VERIFICATION_JAVA_EXECUTABLE =
JAVA_HOME_VALUE + File.separator + ((IS_WINDOWS) ? JAVA_EXE : JAVA);
- //commented below code, bacause pack200 is not supported from jdk 14 onwards
- /*private static final String PACKER_EXECUTABLE = JAVA_HOME_VALUE +
- ((IS_WINDOWS) ? "\\bin\\pack200.exe" : "/bin/pack200");//NOI18N
- private static final String UNPACKER_EXECUTABLE = JAVA_HOME_VALUE +
- ((IS_WINDOWS) ? "\\bin\\unpack200.exe" : "/bin/unpack200");//NOI18N
- */
private static final String NATIVE_UNZIP_EXECUTABLE =
(IS_WINDOWS) ? "unzip.exe" : "unzip"; //NOI18N
private static final String NATIVE_TAR_EXECUTABLE =
@@ -1485,11 +1314,6 @@
private static final String NATIVE_GNUTAR_EXECUTABLE =
(IS_WINDOWS) ? "gnutar.exe" : "gnutar"; //NOI18N
- //commented below code, bacause pack200 is not supported from jdk 14 onwards
- /*public static final String PACKER_EXECUTABLE_PROPERTY =
- "pack200.executable";
- public static final String UNPACKER_EXECUTABLE_PROPERTY =
- "unpack200.executable";*/
public static final String TAR_EXECUTABLE_PROPERTY =
"tar.executable";
public static final String UNZIP_EXECUTABLE_PROPERTY =