harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From odea...@apache.org
Subject svn commit: r588601 - in /harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util: jar/ zip/
Date Fri, 26 Oct 2007 11:10:28 GMT
Author: odeakin
Date: Fri Oct 26 04:10:26 2007
New Revision: 588601

URL: http://svn.apache.org/viewvc?rev=588601&view=rev
Log:
Let JUnit deal with unexpected Exceptions rather than catching them ourselves.

Modified:
    harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/jar/JarEntryTest.java
    harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/jar/JarFileTest.java
    harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/jar/JarInputStreamTest.java
    harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/jar/JarOutputStreamTest.java
    harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/zip/InflaterTest.java
    harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/zip/ZipFileTest.java
    harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/zip/ZipOutputStreamTest.java

Modified: harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/jar/JarEntryTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/jar/JarEntryTest.java?rev=588601&r1=588600&r2=588601&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/jar/JarEntryTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/jar/JarEntryTest.java
Fri Oct 26 04:10:26 2007
@@ -96,30 +96,20 @@
     /**
      * @tests java.util.jar.JarEntry#getAttributes()
      */
-    public void test_getAttributes() {
+    public void test_getAttributes() throws Exception {
         JarFile attrJar = null;
         File file = null;
-        try {
-            Support_Resources.copyFile(resources, null, attJarName);
-            file = new File(resources, attJarName);
-            attrJar = new JarFile(file);
-        } catch (Exception e) {
-            assertTrue(file + " does not exist", file.exists());
-            fail("Exception opening file: " + e.toString());
-        }
-        try {
-            jarEntry = attrJar.getJarEntry(attEntryName);
-            assertNotNull("Should have Manifest attributes", jarEntry.getAttributes());
-        } catch (Exception e) {
-            fail("Exception during 2nd test: " + e.toString());
-        }
-        try {
-            jarEntry = attrJar.getJarEntry(attEntryName2);
-            assertNull("Shouldn't have any Manifest attributes", jarEntry.getAttributes());
-            attrJar.close();
-        } catch (Exception e) {
-            fail("Exception during 1st test: " + e.toString());
-        }
+
+        Support_Resources.copyFile(resources, null, attJarName);
+        file = new File(resources, attJarName);
+        attrJar = new JarFile(file);
+
+        jarEntry = attrJar.getJarEntry(attEntryName);
+        assertNotNull("Should have Manifest attributes", jarEntry.getAttributes());
+
+        jarEntry = attrJar.getJarEntry(attEntryName2);
+        assertNull("Shouldn't have any Manifest attributes", jarEntry.getAttributes());
+        attrJar.close();
     }
 
     /**

Modified: harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/jar/JarFileTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/jar/JarFileTest.java?rev=588601&r1=588600&r2=588601&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/jar/JarFileTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/jar/JarFileTest.java
Fri Oct 26 04:10:26 2007
@@ -131,16 +131,12 @@
 	/**
 	 * @tests java.util.jar.JarFile#getJarEntry(java.lang.String)
 	 */
-	public void test_getJarEntryLjava_lang_String() {
-		try {
-			Support_Resources.copyFile(resources, null, jarName);
-			JarFile jarFile = new JarFile(new File(resources, jarName));
-			assertEquals("Error in returned entry", 311, jarFile.getEntry(entryName)
-					.getSize());
-			jarFile.close();
-		} catch (Exception e) {
-			fail("Exception during test: " + e.toString());
-		}
+	public void test_getJarEntryLjava_lang_String() throws Exception {
+		Support_Resources.copyFile(resources, null, jarName);
+		JarFile jarFile = new JarFile(new File(resources, jarName));
+		assertEquals("Error in returned entry", 311, jarFile.getEntry(entryName)
+				.getSize());
+		jarFile.close();
 
 		// tests for signed jars
 		// test all signed jars in the /Testres/Internal/SignedJars directory
@@ -187,7 +183,7 @@
 			try {
 				File file = Support_Resources.getExternalLocalFile(jarDirUrl
 						+ "/" + jarName);
-				JarFile jarFile = new JarFile(file, true);
+				jarFile = new JarFile(file, true);
 				boolean foundCerts = false;
 				Enumeration<JarEntry> e = jarFile.entries();
 				while (e.hasMoreElements()) {
@@ -214,72 +210,58 @@
 	/**
 	 * @tests java.util.jar.JarFile#getManifest()
 	 */
-	public void test_getManifest() {
+	public void test_getManifest() throws Exception {
 		// Test for method java.util.jar.Manifest
 		// java.util.jar.JarFile.getManifest()
-		try {
-			Support_Resources.copyFile(resources, null, jarName);
-			JarFile jarFile = new JarFile(new File(resources, jarName));
-			assertNotNull("Error--Manifest not returned",
-					jarFile.getManifest());
-			jarFile.close();
-		} catch (Exception e) {
-			fail("Exception during 1st test: " + e.toString());
-		}
-		try {
-			Support_Resources.copyFile(resources, null, jarName2);
-			JarFile jarFile = new JarFile(new File(resources, jarName2));
-			assertNull("Error--should have returned null", jarFile
-					.getManifest());
-			jarFile.close();
-		} catch (Exception e) {
-			fail("Exception during 2nd test: " + e.toString());
-		}
+		Support_Resources.copyFile(resources, null, jarName);
+		JarFile jarFile = new JarFile(new File(resources, jarName));
+		assertNotNull("Error--Manifest not returned",
+				jarFile.getManifest());
+		jarFile.close();
+
+		Support_Resources.copyFile(resources, null, jarName2);
+                jarFile = new JarFile(new File(resources, jarName2));
+		assertNull("Error--should have returned null", jarFile
+				.getManifest());
+		jarFile.close();
+
+		// jarName3 was created using the following test
+		Support_Resources.copyFile(resources, null, jarName3);
+		jarFile = new JarFile(new File(resources, jarName3));
+		assertNotNull("Should find manifest without verifying", jarFile
+				.getManifest());
+		jarFile.close();
+
+		// this is used to create jarName3 used in the previous test
+		Manifest manifest = new Manifest();
+		Attributes attributes = manifest.getMainAttributes();
+		attributes.put(new Attributes.Name("Manifest-Version"), "1.0");
+		ByteArrayOutputStream manOut = new ByteArrayOutputStream();
+		manifest.write(manOut);
+		byte[] manBytes = manOut.toByteArray();
+		File file = new File(Support_PlatformFile.getNewPlatformFile(
+				"hyts_manifest1", ".jar"));
+		JarOutputStream jarOut = new JarOutputStream(new FileOutputStream(
+				file.getAbsolutePath()));
+		ZipEntry entry = new ZipEntry("META-INF/");
+		entry.setSize(0);
+		jarOut.putNextEntry(entry);
+		entry = new ZipEntry(JarFile.MANIFEST_NAME);
+		entry.setSize(manBytes.length);
+		jarOut.putNextEntry(entry);
+		jarOut.write(manBytes);
+		entry = new ZipEntry("myfile");
+		entry.setSize(1);
+		jarOut.putNextEntry(entry);
+		jarOut.write(65);
+		jarOut.close();
+		JarFile jar = new JarFile(file.getAbsolutePath(), false);
+		assertNotNull("Should find manifest without verifying", jar
+				.getManifest());
+		jar.close();
+		file.delete();
 
-		try {
-			// jarName3 was created using the following test
-			Support_Resources.copyFile(resources, null, jarName3);
-			JarFile jarFile = new JarFile(new File(resources, jarName3));
-			assertNotNull("Should find manifest without verifying", jarFile
-					.getManifest());
-			jarFile.close();
-		} catch (Exception e) {
-			fail("Exception during 3rd test: " + e.toString());
-		}
-
-		try {
-			// this is used to create jarName3 used in the previous test
-			Manifest manifest = new Manifest();
-			Attributes attributes = manifest.getMainAttributes();
-			attributes.put(new Attributes.Name("Manifest-Version"), "1.0");
-			ByteArrayOutputStream manOut = new ByteArrayOutputStream();
-			manifest.write(manOut);
-			byte[] manBytes = manOut.toByteArray();
-			File file = new File(Support_PlatformFile.getNewPlatformFile(
-					"hyts_manifest1", ".jar"));
-			JarOutputStream jarOut = new JarOutputStream(new FileOutputStream(
-					file.getAbsolutePath()));
-			ZipEntry entry = new ZipEntry("META-INF/");
-			entry.setSize(0);
-			jarOut.putNextEntry(entry);
-			entry = new ZipEntry(JarFile.MANIFEST_NAME);
-			entry.setSize(manBytes.length);
-			jarOut.putNextEntry(entry);
-			jarOut.write(manBytes);
-			entry = new ZipEntry("myfile");
-			entry.setSize(1);
-			jarOut.putNextEntry(entry);
-			jarOut.write(65);
-			jarOut.close();
-			JarFile jar = new JarFile(file.getAbsolutePath(), false);
-			assertNotNull("Should find manifest without verifying", jar
-					.getManifest());
-			jar.close();
-			file.delete();
-		} catch (IOException e) {
-			fail("IOException 3");
-		}
-		try {
+                try {
 			Support_Resources.copyFile(resources, null, jarName2);
 			JarFile jF = new JarFile(new File(resources, jarName2));
 			jF.close();
@@ -287,8 +269,6 @@
 		        fail("FAILED: expected IllegalStateException" ); 
 		} catch (IllegalStateException ise) {
 			//expected;
-		} catch (Exception e) {
-			fail("Exception during 4th test: " + e.toString());
 		}
 	}
 
@@ -325,46 +305,33 @@
 	/**
 	 * @tests java.util.jar.JarFile#getInputStream(java.util.zip.ZipEntry)
 	 */
-	public void test_getInputStreamLjava_util_jar_JarEntry_subtest0() {
+	public void test_getInputStreamLjava_util_jar_JarEntry_subtest0() throws Exception {
 		File signedFile = null;
-		try {
-			Support_Resources.copyFile(resources, null, jarName4);
-			signedFile = new File(resources, jarName4);
-		} catch (Exception e) {
-			fail("Failed to create local file 2: " + e);
-		}
+		Support_Resources.copyFile(resources, null, jarName4);
+		signedFile = new File(resources, jarName4);
 
-		try {
-			JarFile jar = new JarFile(signedFile);
-			JarEntry entry = new JarEntry(entryName3);
-			InputStream in = jar.getInputStream(entry);
-			in.read();
-		} catch (Exception e) {
-			fail("Exception during test 3: " + e);
-		}
-
-		try {
-			JarFile jar = new JarFile(signedFile);
-			JarEntry entry = new JarEntry(entryName3);
-			InputStream in = jar.getInputStream(entry);
-			in.read(new byte[1077]);
-			assertNull("found certificates", entry.getCertificates());
-		} catch (Exception e) {
-			fail("Exception during test 4: " + e);
-		}
+		JarFile jar = new JarFile(signedFile);
+		JarEntry entry = new JarEntry(entryName3);
+		InputStream in = jar.getInputStream(entry);
+		in.read();
+
+                jar = new JarFile(signedFile);
+		entry = new JarEntry(entryName3);
+		in = jar.getInputStream(entry);
+		in.read(new byte[1077]);
+		assertNull("found certificates", entry.getCertificates());
 
 		boolean exception = false;
 		try {
-			JarFile jar = new JarFile(signedFile);
-			JarEntry entry = new JarEntry(entryName3);
+			jar = new JarFile(signedFile);
+			entry = new JarEntry(entryName3);
 			entry.setSize(1076);
-			InputStream in = jar.getInputStream(entry);
+			in = jar.getInputStream(entry);
 			in.read(new byte[2048]);
 		} catch (SecurityException e) {
 			exception = true;
-		} catch (Exception e) {
-			fail("Exception during test 5: " + e);
 		}
+
 		assertTrue("Failed to throw SecurityException", exception);
 	}
 

Modified: harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/jar/JarInputStreamTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/jar/JarInputStreamTest.java?rev=588601&r1=588600&r2=588601&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/jar/JarInputStreamTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/jar/JarInputStreamTest.java
Fri Oct 26 04:10:26 2007
@@ -53,55 +53,38 @@
 	/**
 	 * @tests java.util.jar.JarInputStream#JarInputStream(java.io.InputStream)
 	 */
-	public void test_ConstructorLjava_io_InputStream() {
+	public void test_ConstructorLjava_io_InputStream() throws Exception {
 		// Test for method java.util.jar.JarInputStream(java.io.InputStream)
-		try {
-			InputStream is = new URL(jarName).openConnection()
-					.getInputStream();
-			boolean hasCorrectEntry = false;
-			JarInputStream jis = new JarInputStream(is);
-			assertNotNull("The jar input stream should have a manifest", jis
-					.getManifest());
-			JarEntry je = jis.getNextJarEntry();
-			while (je != null) {
-				if (je.getName().equals(entryName)) {
-                    hasCorrectEntry = true;
+		InputStream is = new URL(jarName).openConnection().getInputStream();
+		boolean hasCorrectEntry = false;
+		JarInputStream jis = new JarInputStream(is);
+		assertNotNull("The jar input stream should have a manifest", jis.getManifest());
+		JarEntry je = jis.getNextJarEntry();
+		while (je != null) {
+                    if (je.getName().equals(entryName)) {
+                        hasCorrectEntry = true;
+                    }
+                    je = jis.getNextJarEntry();
                 }
-				je = jis.getNextJarEntry();
-			}
-			assertTrue(
-					"The jar input stream does not contain the correct entries",
-					hasCorrectEntry);
-		} catch (Exception e) {
-			fail("Exception during test: " + e.toString());
-		}
-
+		assertTrue("The jar input stream does not contain the correct entries",	hasCorrectEntry);
 	}
 
 	/**
 	 * @tests java.util.jar.JarInputStream#getManifest()
 	 */
-	public void test_getManifest() {
+	public void test_getManifest() throws Exception {
 		// Test for method java.util.jar.Manifest
 		// java.util.jar.JarInputStream.getManifest()
-		try {
-			Manifest m;
-
-			InputStream is = new URL(jarName2).openConnection()
-					.getInputStream();
-			JarInputStream jis = new JarInputStream(is);
-			m = jis.getManifest();
-			assertNull("The jar input stream should not have a manifest",
-					m);
-
-			is = new URL(jarName).openConnection().getInputStream();
-			jis = new JarInputStream(is);
-			m = jis.getManifest();
-			assertNotNull("The jar input stream should have a manifest", m);
-		} catch (Exception e) {
-			fail("Exception during test: " + e.toString());
-		}
+		Manifest m;
+		InputStream is = new URL(jarName2).openConnection().getInputStream();
+		JarInputStream jis = new JarInputStream(is);
+		m = jis.getManifest();
+		assertNull("The jar input stream should not have a manifest", m);
 
+		is = new URL(jarName).openConnection().getInputStream();
+		jis = new JarInputStream(is);
+		m = jis.getManifest();
+		assertNotNull("The jar input stream should have a manifest", m);
 	}
 
 	/**

Modified: harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/jar/JarOutputStreamTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/jar/JarOutputStreamTest.java?rev=588601&r1=588600&r2=588601&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/jar/JarOutputStreamTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/jar/JarOutputStreamTest.java
Fri Oct 26 04:10:26 2007
@@ -33,7 +33,7 @@
 	/**
 	 * @tests java.util.jar.JarOutputStream#putNextEntry(java.util.zip.ZipEntry)
 	 */
-	public void test_putNextEntryLjava_util_zip_ZipEntry() {
+	public void test_putNextEntryLjava_util_zip_ZipEntry() throws Exception {
 		// testClass file`s actual extension is .class, since having .class
 		// extension files in source dir causes
 		// problems on eclipse, the extension is changed into .ser or it can be
@@ -60,47 +60,36 @@
 			File outputJar = null;
 			JarOutputStream jout = null;
 
-			try {
-				// open the output jarfile
-				outputJar = File.createTempFile("hyts_", ".jar");
-				jout = new JarOutputStream(new FileOutputStream(outputJar),
-						newman);
-				jout.putNextEntry(new JarEntry(entryName));
-			} catch (Exception e) {
-				fail("Error creating JarOutputStream: " + e);
-			}
+			// open the output jarfile
+			outputJar = File.createTempFile("hyts_", ".jar");
+			jout = new JarOutputStream(new FileOutputStream(outputJar),
+					newman);
+			jout.putNextEntry(new JarEntry(entryName));
+
 			File resources = Support_Resources.createTempFolder();
-			try {
-				// read in the class file, and output it to the jar
-				Support_Resources.copyFile(resources, null, testClass);
-				URL jarURL = new URL((new File(resources, testClass)).toURL()
-						.toString());
-				InputStream jis = jarURL.openStream();
-
-				byte[] bytes = new byte[1024];
-				int len;
-				while ((len = jis.read(bytes)) != -1) {
-                    jout.write(bytes, 0, len);
-                }
-
-				jout.flush();
-				jout.close();
-				jis.close();
-			} catch (Exception e) {
-				fail("Error writing JAR file for testing: " + e);
-			}
+
+                        // read in the class file, and output it to the jar
+			Support_Resources.copyFile(resources, null, testClass);
+			URL jarURL = new URL((new File(resources, testClass)).toURL()
+					.toString());
+			InputStream jis = jarURL.openStream();
+			byte[] bytes = new byte[1024];
+			int len;
+			while ((len = jis.read(bytes)) != -1) {
+                            jout.write(bytes, 0, len);
+                        }
+			jout.flush();
+			jout.close();
+			jis.close();
+
 			String res = null;
 			// set up the VM parameters
 			String[] args = new String[2];
 			args[0] = "-jar";
 			args[1] = outputJar.getAbsolutePath();
 
-			try {
-				// execute the JAR and read the result
-				res = Support_Exec.execJava(args, null, true);
-			} catch (Exception e) {
-				fail("Exception executing test JAR: " + e);
-			}
+			// execute the JAR and read the result
+			res = Support_Exec.execJava(args, null, true);
 
 			assertTrue("Error executing JAR test on: " + element
 					+ ". Result returned was incorrect.", res

Modified: harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/zip/InflaterTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/zip/InflaterTest.java?rev=588601&r1=588600&r2=588601&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/zip/InflaterTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/zip/InflaterTest.java
Fri Oct 26 04:10:26 2007
@@ -366,15 +366,9 @@
 	 */
 	public void test_Constructor() {
 		// test method of java.util.zip.inflater.Inflater()
-		try {
-			Inflater inflate = new Inflater();
-			assertNotNull("failed to create the instance of inflater",
-					inflate);
-
-		} catch (Exception e) {
-
-			assertTrue("Inflate () constructor threw an exception", true);
-		}
+		Inflater inflate = new Inflater();
+		assertNotNull("failed to create the instance of inflater",
+				inflate);
 	}
 
 	/**

Modified: harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/zip/ZipFileTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/zip/ZipFileTest.java?rev=588601&r1=588600&r2=588601&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/zip/ZipFileTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/zip/ZipFileTest.java
Fri Oct 26 04:10:26 2007
@@ -121,7 +121,7 @@
 	/**
 	 * @tests java.util.zip.ZipFile#entries()
 	 */
-	public void test_entries() {
+	public void test_entries() throws Exception {
 		// Test for method java.util.Enumeration java.util.zip.ZipFile.entries()
 		Enumeration<? extends ZipEntry> enumer = zfile.entries();
 		int c = 0;
@@ -131,20 +131,16 @@
 		}
 		assertTrue("Incorrect number of entries returned: " + c, c == 6);
 
+		Enumeration<? extends ZipEntry> enumeration = zfile.entries();
+		zfile.close();
+		zfile = null;
+		boolean pass = false;
 		try {
-			Enumeration<? extends ZipEntry> enumeration = zfile.entries();
-			zfile.close();
-			zfile = null;
-			boolean pass = false;
-			try {
-				enumeration.hasMoreElements();
-			} catch (IllegalStateException e) {
-				pass = true;
-			}
-			assertTrue("did not detect closed jar file", pass);
-		} catch (Exception e) {
-			fail("Exception during entries test: " + e.toString());
+			enumeration.hasMoreElements();
+		} catch (IllegalStateException e) {
+			pass = true;
 		}
+		assertTrue("did not detect closed jar file", pass);
 	}
 
 	/**

Modified: harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/zip/ZipOutputStreamTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/zip/ZipOutputStreamTest.java?rev=588601&r1=588600&r2=588601&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/zip/ZipOutputStreamTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/zip/ZipOutputStreamTest.java
Fri Oct 26 04:10:26 2007
@@ -126,11 +126,8 @@
     public void test_setCommentLjava_lang_String() {
         // There is no way to get the comment back, so no way to determine if
         // the comment is set correct
-        try {
-            zos.setComment("test setComment");
-        } catch (Exception e) {
-            fail("Trying to set comment failed");
-        }
+        zos.setComment("test setComment");
+
         try {
             zos.setComment(new String(new byte[0xFFFF + 1]));
             fail("Comment over 0xFFFF in length should throw exception");



Mime
View raw message