Buggy code:
public class Jar extends Zip { private static final String INDEX_NAME = "META-INF//INDEX.LIST" ; private static final String MANIFEST_NAME = "META-INF//MANIFEST.MF" ; private Manifest configuredManifest ; private Manifest savedConfiguredManifest ; private Manifest filesetManifest ; private Manifest originalManifest ; private Jar . FilesetManifestConfig filesetManifestConfig ; private boolean mergeManifestsMain = true ; private Manifest manifest ; private String manifestEncoding ; private File manifestFile ; private boolean index = false ; private boolean createEmpty = false ; private Vector rootEntries ; private Path indexJars ; private ZipExtraField [ ] JAR_MARKER = new ZipExtraField [ ] { JarMarker . getInstance ( ) } ; protected String emptyBehavior = "create" ; public Jar ( ) { } public void setWhenempty ( WhenEmpty we ) { } public void setWhenmanifestonly ( WhenEmpty we ) { } public void setJarfile ( File jarFile ) { } public void setIndex ( boolean flag ) { } public void setManifestEncoding ( String manifestEncoding ) { } public void addConfiguredManifest ( Manifest newManifest ) throws ManifestException { } public void setManifest ( File manifestFile ) { } private Manifest getManifest ( File manifestFile ) { } private Manifest getManifestFromJar ( File jarFile ) throws IOException { } private Manifest getManifest ( Reader r ) { } public void setFilesetmanifest ( Jar . FilesetManifestConfig config ) { } public void addMetainf ( ZipFileSet fs ) { } public void addConfiguredIndexJars ( Path p ) { } protected void initZipOutputStream ( ZipOutputStream zOut ) throws IOException , BuildException { } private Manifest createManifest ( ) throws BuildException { } private void writeManifest ( ZipOutputStream zOut , Manifest manifest ) throws IOException { for ( Enumeration e = manifest . getWarnings ( ) ; e . hasMoreElements ( ) ; ) { log ( ( "Manifest<seq2seq4repair_space>warning:<seq2seq4repair_space>" + ( ( String ) ( e . nextElement ( ) ) ) ) , MSG_WARN ) ; } zipDir ( null , zOut , "META-INF//" , DEFAULT_DIR_MODE , JAR_MARKER ) ; ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; <START_BUG> OutputStreamWriter osw = new OutputStreamWriter ( baos , "UTF-8" ) ; <END_BUG> PrintWriter writer = new PrintWriter ( osw ) ; manifest . write ( writer ) ; writer . flush ( ) ; ByteArrayInputStream bais = new ByteArrayInputStream ( baos . toByteArray ( ) ) ; super . zipFile ( bais , zOut , Jar . MANIFEST_NAME , System . currentTimeMillis ( ) , null , DEFAULT_FILE_MODE ) ; super . initZipOutputStream ( zOut ) ; } protected void finalizeZipOutputStream ( ZipOutputStream zOut ) throws IOException , BuildException { } private void createIndexList ( ZipOutputStream zOut ) throws IOException { } protected void zipFile ( InputStream is , ZipOutputStream zOut , String vPath , long lastModified , File fromArchive , int mode ) throws IOException { } private void filesetManifest ( File file , InputStream is ) throws IOException { } protected ArchiveState getResourcesToAdd ( ResourceCollection [ ] rcs , File zipFile , boolean needsUpdate ) throws BuildException { } protected boolean createEmptyZip ( File zipFile ) throws BuildException { } protected void cleanUp ( ) { } public void reset ( ) { } public static class FilesetManifestConfig extends EnumeratedAttribute { public String [ ] getValues ( ) { } } protected final void writeIndexLikeList ( List dirs , List files , PrintWriter writer ) throws IOException { } protected static final String findJarName ( String fileName , String [ ] classpath ) { } protected static final void grabFilesAndDirs ( String file , List dirs , List files ) throws IOException { } }

Fix:
OutputStreamWriter osw = new OutputStreamWriter ( baos , Manifest . JAR_ENCODING ) ;