Buggy code:
public final class FileTag extends TagImpl { public static final int NAMECONFLICT_UNDEFINED = 0 ; public static final int NAMECONFLICT_ERROR = 1 ; public static final int NAMECONFLICT_SKIP = 2 ; public static final int NAMECONFLICT_OVERWRITE = 3 ; public static final int NAMECONFLICT_MAKEUNIQUE = 4 ; private static final Key SET_ACL = KeyImpl . intern ( "setACL" ) ; private String action ; private String strDestination ; private Object output ; private Resource file ; private int mode = - 1 ; private String variable ; private String filefield ; private String charset = null ; private boolean addnewline = true ; private boolean fixnewline = true ; private String attributes ; private Resource source ; private int nameconflict = FileTag . NAMECONFLICT_UNDEFINED ; private String accept ; private String result = null ; private SecurityManager securityManager ; private String serverPassword = null ; private Object acl = null ; public void release ( ) { } public void setAction ( String action ) { } public void setDestination ( String destination ) { } public void setOutput ( Object output ) { } public void setFile ( String file ) { } public void setMode ( String mode ) throws PageException { } public static int toMode ( String mode ) throws PageException { } public void setVariable ( String variable ) { } public void setFilefield ( String filefield ) { } public void setCharset ( String charset ) { } public void setAcl ( String acl ) throws ApplicationException { } public void setAcl ( Object acl ) throws ApplicationException { } public void setStoreacl ( Object acl ) throws ApplicationException { } public void setServerpassword ( String serverPassword ) { } public void setAddnewline ( boolean addnewline ) { } public void setAttributes ( String attributes ) { } public void setSource ( String source ) { } public void setNameconflict ( String nameconflict ) throws ApplicationException { } public static int toNameconflict ( String nameconflict ) throws ApplicationException { } public void setAccept ( String accept ) { } public void setResult ( String result ) { } public int doStartTag ( ) throws PageException { } public int doEndTag ( ) { } private void actionMove ( ) throws PageException { } private static Resource toDestination ( PageContext pageContext , String path , Resource source ) { } private void actionCopy ( ) throws PageException { } private static void setACL ( Resource res , Object acl ) throws PageException { } private static Resource makeUnique ( Resource res ) { } private void actionDelete ( ) throws PageException { } private void actionRead ( ) throws PageException { } private void actionReadBinary ( ) throws PageException { } private void actionWrite ( ) throws PageException { } private void actionTouch ( ) throws PageException { } private void actionAppend ( ) throws PageException { if ( ( output ) == null ) throw new ApplicationException ( "attribute<seq2seq4repair_space>output<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>defined<seq2seq4repair_space>for<seq2seq4repair_space>tag<seq2seq4repair_space>file" ) ; checkFile ( true , false , true ) ; try { if ( ! ( file . exists ( ) ) ) file . createNewFile ( ) ; String content = Caster . toString ( output ) ; if ( fixnewline ) content = doFixNewLine ( content ) ; if ( addnewline ) <START_BUG> content += "\n" ; <END_BUG> IOUtil . write ( file , content , charset , true ) ; } catch ( UnsupportedEncodingException e ) { throw new ApplicationException ( ( ( "Unsupported<seq2seq4repair_space>Charset<seq2seq4repair_space>Definition<seq2seq4repair_space>[" + ( charset ) ) + "]" ) , e . getMessage ( ) ) ; } catch ( IOException e ) { throw new ApplicationException ( "can't<seq2seq4repair_space>write<seq2seq4repair_space>file" , e . getMessage ( ) ) ; } FileTag . setACL ( file , acl ) ; FileTag . setMode ( file , mode ) ; FileTag . setAttributes ( file , attributes ) ; } private String doFixNewLine ( String content ) { } private void actionInfo ( ) throws PageException { } private static String getFileAttribute ( Resource file ) { } public void actionUpload ( ) throws PageException { } public static Struct actionUpload ( PageContext pageContext , SecurityManager securityManager , String filefield , String strDestination , int nameconflict , String accept , int mode , String attributes , Object acl , String serverPassword ) throws PageException { } public void actionUploadAll ( ) throws PageException { } public static Array actionUploadAll ( PageContext pageContext , SecurityManager securityManager , String strDestination , int nameconflict , String accept , int mode , String attributes , Object acl , String serverPassword ) throws PageException { } private static synchronized Struct _actionUpload ( PageContext pageContext , SecurityManager securityManager , Item formItem , String strDestination , int nameconflict , String accept , int mode , String attributes , Object acl , String serverPassword ) throws PageException { } private static void checkContentType ( PageContext pageContext , String contentType , String accept ) throws PageException { } private static Item getFormItem ( PageContext pageContext , String filefield ) throws PageException { } private static Item [ ] getFormItems ( PageContext pageContext ) throws PageException { } private static String getFileExtension ( Resource file ) { } private static String getFileName ( Resource file ) { } private static String getParent ( Resource res ) { } private void checkFile ( boolean create , boolean canRead , boolean canWrite ) throws PageException { } private static void setAttributes ( Resource file , String attributes ) throws PageException { } private static void setMode ( Resource file , int mode ) throws ApplicationException { } public void setFixnewline ( boolean fixnewline ) { } No newline ; at end ; of file ; }

Fix:
content += SystemUtil . getOSSpecificLineSeparator ( ) ;