aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test-extensions/net/sourceforge/jnlp/util/FileTestUtils.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test-extensions/net/sourceforge/jnlp/util/FileTestUtils.java')
-rw-r--r--tests/test-extensions/net/sourceforge/jnlp/util/FileTestUtils.java16
1 files changed, 14 insertions, 2 deletions
diff --git a/tests/test-extensions/net/sourceforge/jnlp/util/FileTestUtils.java b/tests/test-extensions/net/sourceforge/jnlp/util/FileTestUtils.java
index 828d6a5..1ce4935 100644
--- a/tests/test-extensions/net/sourceforge/jnlp/util/FileTestUtils.java
+++ b/tests/test-extensions/net/sourceforge/jnlp/util/FileTestUtils.java
@@ -89,13 +89,25 @@ public class FileTestUtils {
}
/* Creates a jar in a temporary directory, with the given name & file contents */
+ static public void createJarWithoutManifestContents(File jarFile, File... fileContents) throws Exception{
+ createJarWithContents(jarFile, null, fileContents);
+ }
+
+ /* Creates a jar in a temporary directory, with the given name & file contents */
static public void createJarWithContents(File jarFile, Manifest manifestContents, File... fileContents)
throws Exception {
/* Manifest quite evilly ignores all attributes if we don't specify a version!
* Make sure it's set here. */
- manifestContents.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
+ if (manifestContents != null){
+ manifestContents.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
+ }
- JarOutputStream jarWriter = new JarOutputStream(new FileOutputStream(jarFile), manifestContents);
+ JarOutputStream jarWriter;
+ if (manifestContents == null){
+ jarWriter = new JarOutputStream(new FileOutputStream(jarFile));
+ } else {
+ jarWriter = new JarOutputStream(new FileOutputStream(jarFile), manifestContents);
+ }
for (File file : fileContents) {
jarWriter.putNextEntry(new JarEntry(file.getName()));
FileInputStream fileReader = new FileInputStream(file);