Kenney Westerhof wrote: > Wasn't the line ending stuff fixed in plexus-archiver a long time ago?
Running the attached test case (which might well be added to the plexus-archiver, whenever it should be fixed) demonstrates: No. Where is the plexus archivers issue tracker so that I can file an issue or attach my test? Regards, Jochen
package org.codehaus.plexus.archiver.jar; import java.io.BufferedReader; import java.io.File; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Enumeration; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import junit.framework.TestCase; /** Tests, whether it is possible to create invalid jar * files by using invalid MANIFEST values. */ public class BlanksTest extends TestCase { public void testLineFeeds() throws Exception { Manifest manifest = new Manifest(); final String entryName = BlanksTest.class.getName(); manifest.addConfiguredAttribute( new Manifest.Attribute( entryName, "xyz\r\nzyx" ) ); JarArchiver jarArchiver = new JarArchiver(); jarArchiver.addConfiguredManifest( manifest ); File tmpFile = File.createTempFile( entryName, null ); tmpFile.deleteOnExit(); jarArchiver.setDestFile( tmpFile ); jarArchiver.createArchive(); ZipFile zipFile = new ZipFile( tmpFile ); final String match = entryName + ": "; for ( Enumeration en = zipFile.entries(); en.hasMoreElements(); ) { ZipEntry entry = (ZipEntry) en.nextElement(); if ( "META-INF/MANIFEST.MF".equals( entry.getName() ) ) { InputStream istream = zipFile.getInputStream( entry ); try { InputStreamReader isr = new InputStreamReader( istream, "UTF-8" ); try { BufferedReader br = new BufferedReader( isr ); try { boolean found = false; for (;;) { String line = br.readLine(); if (line == null) { break; } if (line.startsWith( match )) { found = true; String value = line.substring( match.length() ).trim(); assertTrue("xyz zyx".equals(value) || "xyz zyx".equals(value)); } } assertTrue(found); br.close(); br = null; } finally { if (br != null) { try { br.close(); } catch (Throwable t) { /* Ignore me */ } } } isr.close(); isr = null; } finally { if (isr != null) { try { isr.close(); } catch (Throwable t) { /* Ignore me */ } } } istream.close(); istream = null; } finally { if (istream != null) { try { istream.close(); } catch (Throwable t) { /* Ignore me */ } } } } } } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]