Skip to content

Commit ef2902d

Browse files
committed
#20: Manifest#write blindly casts bytes to chars
This closes #20
1 parent d93fa7c commit ef2902d

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/main/java/org/codehaus/plexus/archiver/jar/Manifest.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -849,10 +849,8 @@ public void write( Writer writer )
849849
{
850850
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
851851
super.write( byteArrayOutputStream );
852-
for ( byte b : byteArrayOutputStream.toByteArray() )
853-
{
854-
writer.write( (char) b );
855-
}
852+
// We know that UTF-8 is the encoding of the JAR file specification
853+
writer.write( byteArrayOutputStream.toString( "UTF-8" ) );
856854
}
857855

858856
/**

0 commit comments

Comments
 (0)