improve signing
diff --git a/plugins/org.eclipse.wtp.releng.tools/src/org/eclipse/wtp/releng/tools/UpdatePackPropertiesFile.java b/plugins/org.eclipse.wtp.releng.tools/src/org/eclipse/wtp/releng/tools/UpdatePackPropertiesFile.java
index 5b68ead..07f16ba 100644
--- a/plugins/org.eclipse.wtp.releng.tools/src/org/eclipse/wtp/releng/tools/UpdatePackPropertiesFile.java
+++ b/plugins/org.eclipse.wtp.releng.tools/src/org/eclipse/wtp/releng/tools/UpdatePackPropertiesFile.java
@@ -2,13 +2,9 @@
import java.io.File;
import java.io.FileInputStream;
-import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FilenameFilter;
import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream.GetField;
-import java.util.Arrays;
import java.util.Enumeration;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
@@ -17,7 +13,6 @@
import java.util.zip.ZipInputStream;
import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
@@ -33,11 +28,11 @@
}
}
-
+
private String archiveFilename;
private String packFileTemplate;
private FilenameFilter jarFileFilter = new JarFileFilter();
-
+
public void execute() throws BuildException {
boolean invalidProperties = false;
@@ -67,7 +62,7 @@
if (invalidProperties) {
throw new BuildException("The properties for this task are not valid. See log for more details");
}
-
+
// comma seperated list
String signedJarNames = null;
try {
@@ -76,7 +71,7 @@
catch (IOException e) {
throw new BuildException(e);
}
-
+
log(signedJarNames);
}
@@ -85,23 +80,23 @@
String result = "";
String tempdir = System.getProperty("java.io.tmpdir");
- if ( !(tempdir.endsWith("/") || tempdir.endsWith("\\")) )
- tempdir = tempdir + System.getProperty("file.separator");
+ if (!(tempdir.endsWith("/") || tempdir.endsWith("\\")))
+ tempdir = tempdir + System.getProperty("file.separator");
String zipfilename = getArchiveFilename();
-
+
String destinationdirectory = tempdir + "/tempzip/";
extractZipStream(destinationdirectory, zipfilename);
// we avoid short recursing since we know structure
File featureDestDir = new File(destinationdirectory + "eclipse/features/");
- String [] jars = featureDestDir.list(jarFileFilter);
+ String[] jars = featureDestDir.list(jarFileFilter);
File bundlesDestDir = new File(destinationdirectory + "eclipse/plugins/");
- String [] bundlejars = bundlesDestDir.list(jarFileFilter);
-
+ String[] bundlejars = bundlesDestDir.list(jarFileFilter);
+
result = checkIfJarsSigned(result, jars);
result = checkIfJarsSigned(result, bundlejars);
-
+
return result;
}
@@ -124,45 +119,41 @@
}
private void extractZipStream(String destinationdirectory, String zipfilename) throws IOException {
-
- byte[] buf = new byte[1024];
- ZipInputStream zipinputstream = null;
- ZipEntry zipentry;
- zipinputstream = new ZipInputStream(
- new FileInputStream(zipfilename));
- zipentry = zipinputstream.getNextEntry();
- while (zipentry != null)
- {
- //for each entry to be extracted
- String entryName = zipentry.getName();
- System.out.println("entryname "+entryName);
- int n;
- FileOutputStream fileoutputstream;
- File newFile = new File(entryName);
- String directory = newFile.getParent();
-
- if(directory == null)
- {
- if(newFile.isDirectory())
- break;
- }
-
- fileoutputstream = new FileOutputStream(
- destinationdirectory+entryName);
+ byte[] buf = new byte[1024];
+ ZipInputStream zipinputstream = null;
+ ZipEntry zipentry;
+ zipinputstream = new ZipInputStream(new FileInputStream(zipfilename));
- while ((n = zipinputstream.read(buf, 0, 1024)) > -1)
- fileoutputstream.write(buf, 0, n);
+ zipentry = zipinputstream.getNextEntry();
+ while (zipentry != null) {
+ // for each entry to be extracted
+ String entryName = zipentry.getName();
+ log("entryname: " + entryName);
+ int n;
+ FileOutputStream fileoutputstream;
+ File newFile = new File(entryName);
+
- fileoutputstream.close();
- zipinputstream.closeEntry();
- zipentry = zipinputstream.getNextEntry();
+ if (newFile.isDirectory()) {
+ newFile.mkdirs();
+ break;
+ }
- }//while
+ fileoutputstream = new FileOutputStream(destinationdirectory + entryName);
- zipinputstream.close();
+ while ((n = zipinputstream.read(buf, 0, 1024)) > -1)
+ fileoutputstream.write(buf, 0, n);
+
+ fileoutputstream.close();
+ zipinputstream.closeEntry();
+ zipentry = zipinputstream.getNextEntry();
+
+ }// while
+
+ zipinputstream.close();
}
-
+
public String getArchiveFilename() {
return archiveFilename;
}