nus-yam/ex-repair huggingface dataset:
Buggy code:
public class ParamModifierGui extends AbstractPreProcessorGui implements FocusListener { private static final long serialVersionUID = 240L ; private static final String NAME = "name" ; private static final String PREFIX = "prefix" ; private static final String LOWERBOUND = "lowerBound" ; private static final String UPPERBOUND = "upperBound" ; private static final String INCREMENT = "increment" ; private static final String SUFFIX = "suffix" ; private static final String ZERO = "0" ; private JTextField _fieldName ; private JTextField _prefix ; private JTextField _lowerBound ; private JTextField _upperBound ; private JTextField _increment ; private JTextField _suffix ; public ParamModifierGui ( ) { } public String getLabelResource ( ) { } @ Override public void configure ( TestElement el ) { } public TestElement createTestElement ( ) { } public void modifyTestElement ( TestElement m ) { } @ Override public void clearGui ( ) { } public void focusGained ( FocusEvent evt ) { } public void focusLost ( FocusEvent evt ) { } private void init ( ) { } private void updateGui ( ParamModifier model ) { } private JPanel createLabeledField ( String labelResName , JTextField field ) { } private JPanel getParameterMaskPanel ( ) { <START_BUG> HorizontalPanel panel = new HorizontalPanel ( 10 , HorizontalPanel . TOP_ALIGNMENT ) ; <END_BUG> panel . setBorder ( BorderFactory . createTitledBorder ( BorderFactory . createEtchedBorder ( ) , JMeterUtils . getResString ( "html_parameter_mask" ) ) ) ; _fieldName = new JTextField ( 10 ) ; _fieldName . setName ( ParamModifierGui . NAME ) ; panel . add ( createLabeledField ( "name" , _fieldName ) ) ; _prefix = new JTextField ( 5 ) ; _prefix . setName ( ParamModifierGui . PREFIX ) ; panel . add ( createLabeledField ( "id_prefix" , _prefix ) ) ; _lowerBound = new JTextField ( ParamModifierGui . ZERO , 5 ) ; _lowerBound . addFocusListener ( this ) ; _lowerBound . setName ( ParamModifierGui . LOWERBOUND ) ; panel . add ( createLabeledField ( "lower_bound" , _lowerBound ) ) ; _upperBound = new JTextField ( "10" , 5 ) ; _upperBound . addFocusListener ( this ) ; _upperBound . setName ( ParamModifierGui . UPPERBOUND ) ; panel . add ( createLabeledField ( "upper_bound" , _upperBound ) ) ; _increment = new JTextField ( "1" , 3 ) ; _increment . addFocusListener ( this ) ; _increment . setName ( ParamModifierGui . INCREMENT ) ; panel . add ( createLabeledField ( "increment" , _increment ) ) ; _suffix = new JTextField ( 5 ) ; _suffix . setName ( ParamModifierGui . SUFFIX ) ; panel . add ( createLabeledField ( "id_suffix" , _suffix ) ) ; JPanel mainPanel = new JPanel ( new BorderLayout ( ) ) ; mainPanel . add ( panel , BorderLayout . NORTH ) ; return mainPanel ; } private long checkTextField ( FocusEvent evt , String defaultValue ) { } }

Fix:
HorizontalPanel panel = new HorizontalPanel ( 10 , Component . TOP_ALIGNMENT ) ;
Buggy code:
@ Component @ FacesConverter ( forClass = Member . class , value = "memberConverter" ) public class MemberConverter implements Converter { private static MemberService memberService ; @ Autowired private MemberService tmpMemberService ; public List < Member > memberList ; @ PostConstruct public void init ( ) { } public Object getAsObject ( FacesContext facesContext , UIComponent uiComponent , String submittedValue ) { try { if ( submittedValue . trim ( ) . equals ( "" ) ) { return null ; } else { Long id = Long . parseLong ( submittedValue ) ; memberList = MemberConverter . memberService . getMembersByAssembly ( WebUtil . getUserAssemblyId ( ) ) ; for ( Member member : memberList ) { <START_BUG> if ( ( member . getId ( ) ) == id ) { <END_BUG> return member ; } } return null ; } } catch ( NumberFormatException e ) { e . printStackTrace ( ) ; Utils . addFacesMessage ( "Conversion<seq2seq4repair_space>error,<seq2seq4repair_space>invalid<seq2seq4repair_space>member" , SEVERITY_ERROR ) ; } return null ; } public String getAsString ( FacesContext facesContext , UIComponent uiComponent , Object value ) { } }

Fix:
if ( ( member . getId ( ) . longValue ( ) ) == ( id . longValue ( ) ) ) {
Buggy code:
public class AntVersion implements Condition { private String atLeast = null ; private String exactly = null ; public boolean eval ( ) throws BuildException { } private void validate ( ) throws BuildException { } private DeweyDecimal getVersion ( ) { Project p = new Project ( ) ; p . init ( ) ; String versionString = p . getProperty ( "ant.version" ) ; <START_BUG> String v = versionString . substring ( ( ( versionString . indexOf ( "Ant<seq2seq4repair_space>version" ) ) + 12 ) , ( ( versionString . indexOf ( "compiled<seq2seq4repair_space>on" ) ) - 1 ) ) ; <END_BUG> char [ ] cs = v . toCharArray ( ) ; int end = cs . length ; for ( int i = cs . length ; i > 0 ; i -- ) { if ( ! ( Character . isLetter ( cs [ ( i - 1 ) ] ) ) ) { end = i ; break ; } } v = v . substring ( 0 , end ) ; return new DeweyDecimal ( v ) ; } public String getAtLeast ( ) { } public void setAtLeast ( String atLeast ) { } public String getExactly ( ) { } public void setExactly ( String exactly ) { } }

Fix:
String v = versionString . substring ( ( ( versionString . indexOf ( "Ant<seq2seq4repair_space>version" ) ) + 12 ) , ( ( versionString . indexOf ( "Ant<seq2seq4repair_space>version" ) ) + 17 ) ) ;
Buggy code:
public abstract class Chromosome implements Comparable < Chromosome > , Fitness { private static final double NO_FITNESS = Double . NEGATIVE_INFINITY ; private double fitness = Chromosome . NO_FITNESS ; public double getFitness ( ) { } public int compareTo ( final Chromosome another ) { <START_BUG> return ( ( Double ) ( this . getFitness ( ) ) ) . compareTo ( another . getFitness ( ) ) ; <END_BUG> } protected boolean isSame ( final Chromosome another ) { } protected Chromosome findSameChromosome ( final Population population ) { } public void searchForFitnessUpdate ( final Population population ) { } }

Fix:
return Double . compare ( getFitness ( ) , another . getFitness ( ) ) ;
Buggy code:
public class UndoActionHandler extends OperationHistoryActionHandler { public UndoActionHandler ( IWorkbenchWindow window , IUndoContext context ) { } protected void flush ( ) { } protected String getCommandString ( ) { <START_BUG> return WorkbenchMessages . getString ( "Workbench.undo" ) ; <END_BUG> } protected IUndoableOperation getOperation ( ) { } public void run ( ) { } protected boolean shouldBeEnabled ( ) { } }

Fix:
return WorkbenchMessages . Workbench_undo ;
Buggy code:
public class Image_M { public static int LARGE = 1 ; public static int MEDIUM = 2 ; public static int SMALL = 3 ; public static int COVER = 4 ; public static enum ImageType { USER , BUSINESS , POST ; } public static int getDefaultImage ( Image_M . ImageType imageType ) { } public static String getBase64String ( String imageFilePath ) { int reqWidth = Params . IMAGE_MAX_WIDTH_HEIGHT_PIX ; int reqHeight = Params . IMAGE_MAX_WIDTH_HEIGHT_PIX ; Bitmap bm = BitmapFactory . decodeFile ( Image_M . resizeImageThenGetPath ( imageFilePath , reqWidth , reqHeight ) ) ; int si = Image_M . sizeOf ( bm ) ; <START_BUG> while ( ( Image_M . sizeOf ( bm ) ) > 300000 ) { <END_BUG> bm = BitmapFactory . decodeFile ( Image_M . resizeImageThenGetPath ( imageFilePath , reqWidth , reqHeight ) ) ; reqWidth -= 10 ; reqHeight -= 10 ; } ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; bm . compress ( JPEG , 100 , baos ) ; byte [ ] b = baos . toByteArray ( ) ; String encodedImage = Base64 . encodeToString ( b , DEFAULT ) ; String result = encodedImage . replace ( "\n" , "" ) ; return result ; } public static Bitmap getBitmapFromString ( String codedImage ) { } public static void saveBitmap ( String path , String imageName , Bitmap bitmap ) { } @ TargetApi ( VERSION_CODES . HONEYCOMB_MR1 ) public static int sizeOf ( Bitmap data ) { } static long getImageLength ( Bitmap bitmap ) { } static int getBytesPerPixel ( Config config ) { } public static Bitmap readBitmapFromStorate ( String filePath ) { } public static void deletePictureById ( Context context , int id ) { } public static Bitmap getRoundedCornerBitmap ( Bitmap bitmap , int pixels ) { } public static Bitmap drawableToBitmap ( Drawable drawable ) { } private static int calculateInSampleSize ( BitmapFactory . Options options , int reqWidth , int reqHeight ) { } public static String resizeImageThenGetPath ( String imagePath , int reqWidth , int reqHeight ) { } }

Fix:
while ( ( Image_M . sizeOf ( bm ) ) > 100000 ) {
Buggy code:
public class Level1 extends Scene { private Map map ; private Background background ; private int score ; private Font font ; private int currentOption ; private String [ ] options ; private boolean stop ; private Player player ; private ArrayList < Enemy > enemies ; private ArrayList < Coin > coins ; private ArrayList < EatPeopleFlower > flowers ; public Level1 ( ) { } @ Override public void init ( ) { map = new Map ( "Resources//level1-1.txt" , 60 ) ; map . setPosition ( 0 ) ; background = new Background ( "background.png" , 0.1 ) ; score = 0 ; font = Font . font ( "Arial" , FontWeight . NORMAL , 24 ) ; player = new Player ( map ) ; <START_BUG> player . setPosition ( 100 , 100 ) ; <END_BUG> enemies = new ArrayList < Enemy > ( ) ; createEnemies ( ) ; coins = new ArrayList < Coin > ( ) ; createCoins ( ) ; flowers = new ArrayList < EatPeopleFlower > ( ) ; createFlowers ( ) ; currentOption = 0 ; options = new String [ ] { "Resume" , "Quit" } ; } private void createFlowers ( ) { } private void createEnemies ( ) { } private void createCoins ( ) { } @ Override public void update ( ) { } @ Override public void render ( GraphicsContext gc ) { } private void drawOption ( GraphicsContext gc ) { } @ Override public void keyPressed ( KeyCode keyCode ) { } @ Override public void keyReleased ( KeyCode keyCode ) { } }

Fix:
player . setPosition ( 6000 , 100 ) ;
Buggy code:
public class TextField extends AbstractTextComponent { private static final long serialVersionUID = 1L ; public TextField ( final String id ) { } public TextField ( final String id , final Class type ) { } public TextField ( final String id , final IModel object ) { } public TextField ( final String id , IModel model , Class type ) { } protected void onComponentTag ( final ComponentTag tag ) { } public void updateModel ( ) { String input = getInput ( ) ; if ( input != null ) { final Class type = getValidationType ( ) ; if ( type != null ) { <START_BUG> setModelObject ( getConverter ( ) . convert ( getInput ( ) , type ) ) ; <END_BUG> } else { super . updateModel ( ) ; } } } }

Fix:
setModelObject ( getConverter ( ) . convert ( input , type ) ) ;
Buggy code:
public class Pentomino { public static final String DEPTH = "mapreduce.pentomino.depth" ; public static final String WIDTH = "mapreduce.pentomino.width" ; public static final String HEIGHT = "mapreduce.pentomino.height" ; public static final String CLASS = "mapreduce.pentomino.class" ; protected static interface ColumnName { } protected static class Piece implements Pentomino . ColumnName { private String name ; private boolean [ ] [ ] shape ; private int [ ] rotations ; private boolean flippable ; public Piece ( String name , String shape , boolean flippable , int [ ] rotations ) { } public String getName ( ) { } public int [ ] getRotations ( ) { <START_BUG> return rotations ; <END_BUG> } public boolean getFlippable ( ) { } private int doFlip ( boolean flip , int x , int max ) { } public boolean [ ] [ ] getShape ( boolean flip , int rotate ) { } } static class Point implements Pentomino . ColumnName { int x ; int y ; Point ( int x , int y ) { } } public static String stringifySolution ( int width , int height , List < List < Pentomino . ColumnName > > solution ) { } public enum SolutionCategory { UPPER_LEFT , MID_X , MID_Y , CENTER ; } public Pentomino . SolutionCategory getCategory ( List < List < Pentomino . ColumnName > > names ) { } private static class SolutionPrinter implements DancingLinks . SolutionAcceptor < Pentomino . ColumnName > { int width ; int height ; public SolutionPrinter ( int width , int height ) { } public void solution ( List < List < Pentomino . ColumnName > > names ) { } } protected int width ; protected int height ; protected List < Pentomino . Piece > pieces = new ArrayList < Pentomino . Piece > ( ) ; protected static final int [ ] oneRotation = new int [ ] { 0 } ; protected static final int [ ] twoRotations = new int [ ] { 0 , 1 } ; protected static final int [ ] fourRotations = new int [ ] { 0 , 1 , 2 , 3 } ; protected void initializePieces ( ) { } private static boolean isSide ( int offset , int shapeSize , int board ) { } private static void generateRows ( DancingLinks dancer , Pentomino . Piece piece , int width , int height , boolean flip , boolean [ ] row , boolean upperLeft ) { } private DancingLinks < Pentomino . ColumnName > dancer = new DancingLinks < Pentomino . ColumnName > ( ) ; private DancingLinks . SolutionAcceptor < Pentomino . ColumnName > printer ; public Pentomino ( int width , int height ) { } public Pentomino ( ) { } void initialize ( int width , int height ) { } public List < int [ ] > getSplits ( int depth ) { } public int solve ( int [ ] split ) { } public int solve ( ) { } public void setPrinter ( DancingLinks . SolutionAcceptor < Pentomino . ColumnName > printer ) { } public static void main ( String [ ] args ) { } }

Fix:
return rotations . clone ( ) ;
Buggy code:
public class ImplicitAirBlock extends S4WGBlock { public static final String NAME = "blockImplicitAir" ; public ImplicitAirBlock ( ) { } @ Override public void addCollisionBoxesToList ( World p_149743_1_ , int p_149743_2_ , int p_149743_3_ , int p_149743_4_ , AxisAlignedBB p_149743_5_ , List p_149743_6_ , Entity entity ) { } @ Override public AxisAlignedBB getCollisionBoundingBoxFromPool ( World p_149668_1_ , int p_149668_2_ , int p_149668_3_ , int p_149668_4_ ) { } @ Override public boolean renderAsNormalBlock ( ) { } @ Override public int getRenderType ( ) { } @ Override public boolean isOpaqueCube ( ) { } @ Override public int getRenderBlockPass ( ) { } @ Override public boolean canRenderInPass ( int pass ) { } @ Override public IIcon getIcon ( IBlockAccess world , int x , int y , int z , int side ) { ForgeDirection direction = ForgeDirection . getOrientation ( side ) ; Block b = world . getBlock ( ( x + ( direction . offsetX ) ) , ( y + ( direction . offsetY ) ) , ( z + ( direction . offsetZ ) ) ) ; <START_BUG> if ( b instanceof ImplicitAirBlock ) { <END_BUG> return null ; } return super . getIcon ( world , x , y , z , side ) ; } public boolean canCollideCheck ( int p_149678_1_ , boolean p_149678_2_ ) { } @ Override public boolean isReplaceable ( IBlockAccess world , int x , int y , int z ) { } }

Fix:
if ( ( b instanceof ImplicitAirBlock ) || ( b instanceof InteriorAirMarker ) ) {
Buggy code:
public class ProcessLogin extends HttpServlet { protected void processRequest ( HttpServletRequest request , HttpServletResponse response ) throws IOException , ServletException { response . setContentType ( "text//html;charset=UTF-8" ) ; PrintWriter out = response . getWriter ( ) ; try { String username = request . getParameter ( "username" ) ; String password = request . getParameter ( "password" ) ; String previousURL = request . getParameter ( "requestURL" ) ; Class . forName ( "com.microsoft.sqlserver.jdbc.SQLServerDriver" ) ; Connection con = DriverManager . getConnection ( "jdbc:sqlserver:////w2ksa.cs.cityu.edu.hk:1433;databaseName=aiad039_db" , "aiad039" , "aiad039" ) ; PreparedStatement pstmt = con . prepareStatement ( "Select<seq2seq4repair_space>*<seq2seq4repair_space>from<seq2seq4repair_space>[login]<seq2seq4repair_space>where<seq2seq4repair_space>[username]<seq2seq4repair_space>=<seq2seq4repair_space>?<seq2seq4repair_space>and<seq2seq4repair_space>[password]<seq2seq4repair_space>=<seq2seq4repair_space>?" , ResultSet . TYPE_SCROLL_INSENSITIVE , ResultSet . CONCUR_READ_ONLY ) ; pstmt . setString ( 1 , username ) ; pstmt . setString ( 2 , password ) ; ResultSet rs = pstmt . executeQuery ( ) ; int numRow = 0 ; if ( ( rs != null ) && ( ( rs . next ( ) ) != false ) ) { HttpSession session = request . getSession ( true ) ; if ( ( session . getAttribute ( "username" ) ) == null ) { String name = rs . getString ( "username" ) ; if ( ( rs . getInt ( "ismanager" ) ) == 1 ) { int loyaltyPoints = rs . getInt ( "loyaltyPoints" ) ; User user = new Customer ( name , loyaltyPoints ) ; } else { User user = new Manager ( name ) ; } session . setAttribute ( "username" , rs . getString ( "username" ) ) ; if ( previousURL . equals ( "null" ) ) <START_BUG> response . sendRedirect ( "HomePage.jsp" ) ; <END_BUG> else response . sendRedirect ( previousURL ) ; } } else { response . sendRedirect ( ( "Login.jsp?error=1&requestURL=" + previousURL ) ) ; } } catch ( ClassNotFoundException e ) { out . println ( ( ( "<div<seq2seq4repair_space>style='color:<seq2seq4repair_space>red'>" + ( e . toString ( ) ) ) + "<//div>" ) ) ; } catch ( SQLException e ) { out . println ( ( ( "<div<seq2seq4repair_space>style='color:<seq2seq4repair_space>red'>" + ( e . toString ( ) ) ) + "<//div>" ) ) ; } } @ Override protected void doGet ( HttpServletRequest request , HttpServletResponse response ) throws IOException , ServletException { } @ Override protected void doPost ( HttpServletRequest request , HttpServletResponse response ) throws IOException , ServletException { } @ Override public String getServletInfo ( ) { } No newline ; at end ; of file ; }

Fix:
response . sendRedirect ( "Home" ) ;
Buggy code:
class Concat extends Val { private final Val _val ; private final Val _args ; public Concat ( Val val , Val args ) { } public Class getType ( ) { } public void setImplicitType ( Class type ) { } protected Object eval ( Object candidate , Object orig , StoreContext ctx , Object [ ] params ) { Object str = _val . eval ( candidate , orig , ctx , params ) ; <START_BUG> StringBuffer cat = new StringBuffer ( str . toString ( ) ) ; <END_BUG> Object arg = _args . eval ( candidate , orig , ctx , params ) ; if ( arg instanceof Object [ ] ) { for ( int i = 0 ; i < ( ( ( Object [ ] ) ( arg ) ) . length ) ; i ++ ) cat . append ( ( ( Object [ ] ) ( arg ) ) [ i ] . toString ( ) ) ; } else cat . append ( arg . toString ( ) ) ; return cat . toString ( ) ; } public void acceptVisit ( ExpressionVisitor visitor ) { } }

Fix:
StringBuilder cat = new StringBuilder ( str . toString ( ) ) ;
Buggy code:
@ Entity @ Table ( name = "vote_category" ) public class VoteCategory extends Model { @ Id private Long id ; @ Constraints . Required private String name ; private static Finder < Long , VoteCategory > find = new Finder < Long , VoteCategory > ( Long . class , VoteCategory . class ) ; public static List < VoteCategory > all ( ) { } public void setName ( String name ) { } public String getName ( ) { } public Long getId ( ) { } public List < Project > getBestFromCat ( ) { List < Project > Plist = Project . getAllProjects ( ) ; List < Vote > Vlist = new ArrayList < Vote > ( ) ; <START_BUG> VoteCategory currentCat = this ; <END_BUG> Collections . sort ( Plist , new Comparator < Project > ( ) { public int compare ( Project o1 , Project o2 ) { if ( ( o1 . getAvgFromCat ( currentCat ) ) == ( o2 . getAvgFromCat ( currentCat ) ) ) return 0 ; return ( o1 . getAvgFromCat ( currentCat ) ) > ( o2 . getAvgFromCat ( currentCat ) ) ? - 1 : 1 ; } } ) ; return Plist ; } }

Fix:
final VoteCategory currentCat = this ;
Buggy code:
public class Firework { short framesToLive = 50 ; int originX ; int originY ; Firework . Particle [ ] particles ; float red ; float green ; float blue ; public float alpha = 1.0F ; Random rand = new Random ( ) ; Color color ; public Firework ( int x , int y , int particleNum ) { } void step ( ) { for ( Firework . Particle p : particles ) { p . step ( ) ; } } void draw ( Graphics g ) { } private class Particle { float deltaX ; float deltaY ; float x ; float y ; Particle ( int originX , int originY ) { } void step ( ) { if ( ( alpha ) > 0.0F ) { x += deltaX ; y += deltaY ; deltaY += 0.09F ; deltaY *= 0.95 ; deltaX *= 0.95 ; <START_BUG> alpha -= 1.0E-4F ; <END_BUG> } } void draw ( Graphics g ) { } } }

Fix:
alpha -= 5.0E-5F ;
Buggy code:
public class RunAsMergingProcessor extends AbstractMergingProcessor < EJBComponentDescription > { private static final String DEFAULT_RUN_AS_PRINCIPAL = "anonymous" ; public RunAsMergingProcessor ( ) { } @ Override protected void handleAnnotations ( final DeploymentUnit deploymentUnit , final EEApplicationClasses applicationClasses , final DeploymentReflectionIndex deploymentReflectionIndex , final Class < ? > componentClass , final EJBComponentDescription componentConfiguration ) throws DeploymentUnitProcessingException { } @ Override protected void handleDeploymentDescriptor ( final DeploymentUnit deploymentUnit , final DeploymentReflectionIndex deploymentReflectionIndex , final Class < ? > componentClass , final EJBComponentDescription componentConfiguration ) throws DeploymentUnitProcessingException { if ( ( componentConfiguration . getDescriptorData ( ) ) != null ) { final SecurityIdentityMetaData identity = componentConfiguration . getDescriptorData ( ) . getSecurityIdentity ( ) ; if ( identity != null ) { final RunAsMetaData runAs = identity . getRunAs ( ) ; if ( runAs != null ) { final String role = runAs . getRoleName ( ) ; if ( ( role != null ) && ( ! ( role . trim ( ) . isEmpty ( ) ) ) ) { componentConfiguration . setRunAs ( role . trim ( ) ) ; } } } } if ( ( componentConfiguration . getRunAs ( ) ) != null ) { String principal = null ; String globalRunAsPrincipal = null ; EjbJarMetaData jbossMetaData = deploymentUnit . getAttachment ( EJB_JAR_METADATA ) ; <START_BUG> if ( jbossMetaData != null ) { <END_BUG> List < EJBBoundSecurityMetaData > securityMetaDatas = jbossMetaData . getAssemblyDescriptor ( ) . getAny ( EJBBoundSecurityMetaData . class ) ; if ( securityMetaDatas != null ) { for ( EJBBoundSecurityMetaData securityMetaData : securityMetaDatas ) { if ( securityMetaData . getEjbName ( ) . equals ( componentConfiguration . getComponentName ( ) ) ) { principal = securityMetaData . getRunAsPrincipal ( ) ; break ; } if ( securityMetaData . getEjbName ( ) . equals ( "*" ) ) { globalRunAsPrincipal = securityMetaData . getRunAsPrincipal ( ) ; continue ; } } } if ( principal != null ) componentConfiguration . setRunAsPrincipal ( principal ) ; else if ( globalRunAsPrincipal != null ) componentConfiguration . setRunAsPrincipal ( globalRunAsPrincipal ) ; else componentConfiguration . setRunAsPrincipal ( RunAsMergingProcessor . DEFAULT_RUN_AS_PRINCIPAL ) ; } } } }

Fix:
if ( ( jbossMetaData != null ) && ( ( jbossMetaData . getAssemblyDescriptor ( ) ) != null ) ) {
Buggy code:
public class PlatformSinaWeibo extends Platform { private IWeiboShareAPI api ; public String appKey ; public String redirectUrl ; public static final String scope = "email,direct_messages_read,direct_messages_write," + ( ( "friendships_groups_read,friendships_groups_write,statuses_to_me_read," + "follow_app_official_microblog," ) + "invitation_write" ) ; public PlatformSinaWeibo ( Context paramContext ) { } @ Override public void setPlatformDevInfo ( HashMap < String , Object > devInfo ) { } @ Override public void removeAccount ( boolean removeCookie ) { } @ Override public boolean isValid ( ) { } @ Override public void authorize ( ) { } @ Override public void showUser ( String param ) { } @ SuppressWarnings ( "unchecked" ) @ Override public void share ( HashMap < String , Object > hash ) { WeiboMultiMessage weiboMessage = new WeiboMultiMessage ( ) ; String text = hash . get ( "text" ) . toString ( ) ; if ( ! ( text . isEmpty ( ) ) ) { TextObject textObject = new TextObject ( ) ; textObject . text = text ; weiboMessage . textObject = textObject ; } byte [ ] bytes = convertBytes ( ( ( ArrayList < Integer > ) ( hash . get ( "imageData" ) ) ) ) ; <START_BUG> if ( ( bytes . length ) > 0 ) { <END_BUG> ImageObject imageObject = new ImageObject ( ) ; imageObject . imageData = bytes ; weiboMessage . imageObject = imageObject ; } WebpageObject webpageObject = new WebpageObject ( ) ; webpageObject . identify = Utility . generateGUID ( ) ; webpageObject . title = hash . get ( "title" ) . toString ( ) ; webpageObject . description = hash . get ( "description" ) . toString ( ) ; webpageObject . actionUrl = hash . get ( "url" ) . toString ( ) ; weiboMessage . mediaObject = webpageObject ; SendMultiMessageToWeiboRequest request = new SendMultiMessageToWeiboRequest ( ) ; request . transaction = String . valueOf ( System . currentTimeMillis ( ) ) ; request . multiMessage = weiboMessage ; AuthInfo authInfo = new AuthInfo ( context , appKey , redirectUrl , PlatformSinaWeibo . scope ) ; Oauth2AccessToken accessToken = AccessTokenKeeper . readAccessToken ( context ) ; String token = "" ; if ( accessToken != null ) { token = accessToken . getToken ( ) ; } api . sendRequest ( ( ( Activity ) ( context ) ) , request , authInfo , token , new WeiboAuthListener ( ) { @ Override public void onWeiboException ( WeiboException arg0 ) { } @ Override public void onComplete ( Bundle bundle ) { Oauth2AccessToken newToken = Oauth2AccessToken . parseAccessToken ( bundle ) ; AccessTokenKeeper . writeAccessToken ( context , newToken ) ; } @ Override public void onCancel ( ) { } } ) ; } @ Override public void handleIntent ( Intent intent , Object object ) { } }

Fix:
if ( ( bytes != null ) && ( ( bytes . length ) > 0 ) ) {
Buggy code:
public class ChrootUtil { public static final String MD5_SUFFIX = ".md5" ; private static final Splitter stringSplitter = Splitter . on ( CharMatcher . anyOf ( ",;<seq2seq4repair_space>\t\n\r" ) ) . trimResults ( ) . omitEmptyStrings ( ) ; public static List < String > splitPackages ( String packages ) { } public static List < String > splitFiles ( String files ) { } public static FilePath saveDigest ( FilePath file ) throws IOException , InterruptedException { } public static String loadDigest ( FilePath file ) throws IOException , InterruptedException { FilePath md5 = ChrootUtil . getDigestFile ( file ) ; if ( ! ( md5 . exists ( ) ) ) { return null ; } <START_BUG> return md5 . readToString ( ) ; <END_BUG> } public static FilePath getDigestFile ( FilePath file ) { } public static boolean isFileIntact ( FilePath file ) throws IOException , InterruptedException { } }

Fix:
return md5 . readToString ( ) . trim ( ) ;
Buggy code:
public class RuntimeConfigurable { private Vector children = new Vector ( ) ; private Object wrappedObject = null ; private AttributeList attributes ; private StringBuffer characters = new StringBuffer ( ) ; public RuntimeConfigurable ( Object proxy ) { } void setProxy ( Object proxy ) { } public void setAttributes ( AttributeList attributes ) { } public AttributeList getAttributes ( ) { } public void addChild ( RuntimeConfigurable child ) { } RuntimeConfigurable getChild ( int index ) { } public void addText ( String data ) { } public void addText ( char [ ] buf , int start , int end ) { <START_BUG> addText ( new String ( buf , start , end ) . trim ( ) ) ; <END_BUG> } public void maybeConfigure ( Project p ) throws BuildException { } }

Fix:
addText ( new String ( buf , start , end ) ) ;
Buggy code:
public class AdminUsersControleAction extends AdminAction { public void execute ( ) throws SQLException , UnauthorizedActionException { Integer idUser = Integer . parseInt ( request . getParameter ( "id" ) ) ; if ( ( idUser != null ) && ( idUser >= 0 ) ) { <START_BUG> if ( ( ActionHelper . getIdUser ( request ) ) != idUser ) { <END_BUG> throw new UnauthorizedActionException ( "Vous<seq2seq4repair_space>n'avez<seq2seq4repair_space>pas<seq2seq4repair_space>le<seq2seq4repair_space>droit<seq2seq4repair_space>de<seq2seq4repair_space>désactiver<seq2seq4repair_space>votre<seq2seq4repair_space>propre<seq2seq4repair_space>compte." ) ; } User user = UserDAO . getById ( idUser ) ; Boolean estActif = Boolean . parseBoolean ( request . getParameter ( "est_actif" ) ) ; user . setEstActif ( estActif ) ; UserDAO . update ( user ) ; String message = ( ( ( "Le<seq2seq4repair_space>compte<seq2seq4repair_space>utilisateur<seq2seq4repair_space>de<seq2seq4repair_space><strong>" + ( user . getNom ( ) ) ) + "<seq2seq4repair_space>" ) + ( user . getPrenom ( ) ) ) + "<//strong><seq2seq4repair_space>a<seq2seq4repair_space>été<seq2seq4repair_space>" ; if ( estActif ) { message += "activé" ; } else { message += "désactivé" ; } request . setAttribute ( "message" , message ) ; } else { request . setAttribute ( "message" , "Utilisateur<seq2seq4repair_space>inexistant" ) ; } HashMap < Integer , User > users = UserDAO . getAll ( ) ; request . setAttribute ( "users" , users ) ; setView ( "//admin//gererUtilisateurs.jsp" ) ; } }

Fix:
if ( ( ActionHelper . getIdUser ( request ) ) == idUser ) {
Buggy code:
public class NativeApiUtilsForPatching { public static Operation createPatchOperation ( File patchFile ) throws FileNotFoundException { } public static Operation createRollbackOperation ( String patchId ) throws FileNotFoundException { } public static List < String > getInstalledPatches ( ModelControllerClient client ) throws IOException { } public static List < ModelNode > getHistory ( ModelControllerClient client ) throws IOException { } public static ModelNode getHistoryItemForOneOffPatch ( ModelControllerClient client , String patchId ) throws IOException { final ModelNode readOp = new ModelNode ( ) ; readOp . get ( OP_ADDR ) . add ( "core-service" , "patching" ) ; readOp . get ( OP ) . set ( "show-history" ) ; List < ModelNode > list = client . execute ( readOp ) . get ( "result" ) . asList ( ) ; for ( ModelNode item : list ) { <START_BUG> if ( item . get ( "one-off" ) . asString ( ) . equalsIgnoreCase ( patchId ) ) <END_BUG> return item ; } return null ; } }

Fix:
if ( item . get ( "patch-id" ) . asString ( ) . equalsIgnoreCase ( patchId ) )
Buggy code:
public class Snippet174 { public static void main ( String [ ] args ) { Display display = new Display ( ) ; Shell shell = new Shell ( display ) ; shell . setText ( "OpenGL<seq2seq4repair_space>in<seq2seq4repair_space>SWT" ) ; shell . setLayout ( new FillLayout ( ) ) ; <START_BUG> GLFormatData data = new GLFormatData ( ) ; <END_BUG> data . doubleBuffer = true ; final GLCanvas canvas = new GLCanvas ( shell , SWT . NO_BACKGROUND , data ) ; canvas . addControlListener ( new ControlAdapter ( ) { public void controlResized ( ControlEvent e ) { Snippet174 . resize ( canvas ) ; } } ) ; Snippet174 . init ( canvas ) ; new Runnable ( ) { public void run ( ) { if ( canvas . isDisposed ( ) ) return ; Snippet174 . render ( ) ; canvas . swapBuffers ( ) ; canvas . getDisplay ( ) . timerExec ( 50 , this ) ; } } . run ( ) ; shell . open ( ) ; while ( ! ( shell . isDisposed ( ) ) ) { if ( ! ( display . readAndDispatch ( ) ) ) display . sleep ( ) ; } display . dispose ( ) ; } static void init ( GLCanvas canvas ) { } static void render ( ) { } static void resize ( GLCanvas canvas ) { } }

Fix:
GLData data = new GLData ( ) ;
Buggy code:
public class ZCompressorInputStream extends AbstractLZWInputStream { private static final int MAGIC_1 = 31 ; private static final int MAGIC_2 = 157 ; private static final int BLOCK_MODE_MASK = 128 ; private static final int MAX_CODE_SIZE_MASK = 31 ; private final boolean blockMode ; private final int maxCodeSize ; private long totalCodesRead = 0 ; public ZCompressorInputStream ( InputStream inputStream ) throws IOException { } private void clearEntries ( ) { } @ Override protected int readNextCode ( ) throws IOException { } private void reAlignReading ( ) throws IOException { } @ Override protected int addEntry ( int previousCode , byte character ) throws IOException { } @ Override protected int decompressNextSymbol ( ) throws IOException { final int code = readNextCode ( ) ; if ( code < 0 ) { return - 1 ; } else if ( ( blockMode ) && ( code == ( clearCode ) ) ) { clearEntries ( ) ; reAlignReading ( ) ; codeSize = 9 ; previousCode = - 1 ; return 0 ; } else { boolean addedUnfinishedEntry = false ; if ( code == ( tableSize ) ) { addRepeatOfPreviousCode ( ) ; addedUnfinishedEntry = true ; } else if ( code > ( tableSize ) ) { <START_BUG> throw new IOException ( String . format ( "Invalid<seq2seq4repair_space>%d<seq2seq4repair_space>bit<seq2seq4repair_space>code<seq2seq4repair_space>0x%x" , codeSize , code ) ) ; <END_BUG> } return expandCodeToOutputStack ( code , addedUnfinishedEntry ) ; } } }

Fix:
throw new IOException ( String . format ( "Invalid<seq2seq4repair_space>%d<seq2seq4repair_space>bit<seq2seq4repair_space>code<seq2seq4repair_space>0x%x" , Integer . valueOf ( codeSize ) , Integer . valueOf ( code ) ) ) ;
Buggy code:
public class CodeSnippetFieldReference extends FieldReference implements ProblemReasons , EvaluationConstants { EvaluationContext evaluationContext ; FieldBinding delegateThis ; public CodeSnippetFieldReference ( char [ ] source , long pos , EvaluationContext evaluationContext ) { } public void generateAssignment ( BlockScope currentScope , CodeStream codeStream , Assignment assignment , boolean valueRequired ) { } public void generateCode ( BlockScope currentScope , CodeStream codeStream , boolean valueRequired ) { } public void generateCompoundAssignment ( BlockScope currentScope , CodeStream codeStream , Expression expression , int operator , int assignmentImplicitConversion , boolean valueRequired ) { } public void generatePostIncrement ( BlockScope currentScope , CodeStream codeStream , CompoundAssignment postIncrement , boolean valueRequired ) { } public void manageSyntheticReadAccessIfNecessary ( BlockScope currentScope , FlowInfo flowInfo ) { } public void manageSyntheticWriteAccessIfNecessary ( BlockScope currentScope , FlowInfo flowInfo ) { } public TypeBinding resolveType ( BlockScope scope ) { receiverType = receiver . resolveType ( scope ) ; if ( ( receiverType ) == null ) { constant = NotAConstant ; return null ; } this . codegenBinding = this . binding = scope . getField ( receiverType , token , this ) ; FieldBinding firstAttempt = binding ; boolean isNotVisible = false ; if ( ! ( binding . isValidBinding ( ) ) ) { if ( ( ( binding ) instanceof ProblemFieldBinding ) && ( ( ( ( ProblemFieldBinding ) ( binding ) ) . problemId ( ) ) == ( ProblemReasons . NotVisible ) ) ) { isNotVisible = true ; if ( ( this . evaluationContext . declaringTypeName ) != null ) { delegateThis = scope . getField ( scope . enclosingSourceType ( ) , EvaluationConstants . DELEGATE_THIS , this ) ; if ( ( delegateThis ) == null ) { constant = NotAConstant ; scope . problemReporter ( ) . invalidField ( this , receiverType ) ; return null ; } } else { constant = NotAConstant ; scope . problemReporter ( ) . invalidField ( this , receiverType ) ; return null ; } CodeSnippetScope localScope = new CodeSnippetScope ( scope ) ; this . codegenBinding = this . binding = localScope . getFieldForCodeSnippet ( delegateThis . type , token , this ) ; } } if ( ! ( binding . isValidBinding ( ) ) ) { constant = NotAConstant ; if ( isNotVisible ) { this . codegenBinding = this . binding = firstAttempt ; } scope . problemReporter ( ) . invalidField ( this , receiverType ) ; return null ; } <START_BUG> if ( isFieldUseDeprecated ( binding , scope ) ) <END_BUG> scope . problemReporter ( ) . deprecatedField ( binding , this ) ; constant = FieldReference . getConstantFor ( binding , this , receiver . isImplicitThis ( ) , scope ) ; if ( ! ( receiver . isThis ( ) ) ) constant = NotAConstant ; return this . resolvedType = binding . type ; } }

Fix:
if ( isFieldUseDeprecated ( binding , scope , ( ( ( this . bits ) & ( IsStrictlyAssignedMASK ) ) != 0 ) ) )
Buggy code:
abstract class RunWithCheck { public RunWithCheck ( ) { } public MultiHashMap run ( double threshold ) { } protected MultiHashMap getResultMap ( Configuration conf , Path outputPath ) throws IOException { FileSystem fs = FileSystem . getLocal ( conf ) ; Path [ ] outputFiles = FileUtil . stat2Paths ( fs . listStatus ( outputPath , new OutputLogFilter ( ) ) ) ; if ( outputFiles != null ) { TestCase . assertEquals ( outputFiles . length , 2 ) ; } else { TestCase . fail ( ) ; } MultiHashMap resultMap = new MultiHashMap ( ) ; for ( Path outputFile : outputFiles ) { if ( ! ( outputFile . getName ( ) . startsWith ( "part-" ) ) ) { continue ; } <START_BUG> BufferedReader reader = this . asBufferedReader ( fs . open ( outputFiles [ 1 ] ) ) ; <END_BUG> String line ; while ( ( line = reader . readLine ( ) ) != null ) { String [ ] lineArray = line . split ( "\t" ) ; resultMap . put ( Long . parseLong ( lineArray [ 0 ] ) , Long . parseLong ( lineArray [ 1 ] ) ) ; } } return resultMap ; } public abstract boolean check ( MultiHashMap result ) { } private BufferedReader asBufferedReader ( final InputStream in ) throws IOException { } }

Fix:
BufferedReader reader = this . asBufferedReader ( fs . open ( outputFile ) ) ;
Buggy code:
public class StreamRequestVerbHandler implements IVerbHandler { private static Logger logger = LoggerFactory . getLogger ( StreamRequestVerbHandler . class ) ; public void doVerb ( Message message ) { if ( StreamRequestVerbHandler . logger . isDebugEnabled ( ) ) StreamRequestVerbHandler . logger . debug ( "Received<seq2seq4repair_space>a<seq2seq4repair_space>StreamRequestMessage<seq2seq4repair_space>from<seq2seq4repair_space>{}" , message . getFrom ( ) ) ; byte [ ] body = message . getMessageBody ( ) ; ByteArrayInputStream bufIn = new ByteArrayInputStream ( body ) ; try { <START_BUG> StreamRequestMessage srm = StreamRequestMessage . serializer ( ) . deserialize ( new DataInputStream ( bufIn ) ) ; <END_BUG> if ( StreamRequestVerbHandler . logger . isDebugEnabled ( ) ) StreamRequestVerbHandler . logger . debug ( srm . toString ( ) ) ; StreamOutSession session = StreamOutSession . create ( srm . table , message . getFrom ( ) , srm . sessionId ) ; StreamOut . transferRangesForRequest ( session , srm . ranges , srm . type ) ; } catch ( IOException ex ) { throw new IOError ( ex ) ; } } }

Fix:
StreamRequestMessage srm = StreamRequestMessage . serializer ( ) . deserialize ( new DataInputStream ( bufIn ) , message . getVersion ( ) ) ;
Buggy code:
public class HttpChannelHandler extends SimpleChannelUpstreamHandler { public static interface RequestHandler { Response respond ( HttpRequest request , HttpChunkTrailer lastChunk , byte [ ] body ) { } } private final HttpChannelHandler . RequestHandler handler ; private HttpRequest request ; private boolean readingChunks ; private ByteArrayOutputStream buf = new ByteArrayOutputStream ( ) ; public HttpChannelHandler ( HttpChannelHandler . RequestHandler handler ) { } @ Override public void messageReceived ( ChannelHandlerContext ctx , MessageEvent e ) throws Exception { } private void writeToBuffer ( ChannelBuffer content ) throws IOException { } private byte [ ] read ( Response out ) { } private void writeResponse ( Channel sink , Response r ) { boolean keepAlive = isKeepAlive ( request ) ; HttpResponseStatus status = HttpResponseStatus . valueOf ( r . code ( ) . value ( ) ) ; HttpResponse response = new org . jboss . netty . handler . codec . http . DefaultHttpResponse ( HTTP_1_1 , status ) ; if ( r . hasRepresentation ( ) ) { response . setContent ( ChannelBuffers . copiedBuffer ( read ( r ) ) ) ; if ( ( r . representation ( ) . contentType ( ) ) != null ) response . setHeader ( CONTENT_TYPE , r . representation ( ) . contentType ( ) ) ; } for ( HeaderField field : r . header ( ) ) { <START_BUG> response . setHeader ( field . name ( ) , field . value ( ) ) ; <END_BUG> } if ( keepAlive ) { response . setHeader ( CONTENT_LENGTH , response . getContent ( ) . readableBytes ( ) ) ; response . setHeader ( CONNECTION , KEEP_ALIVE ) ; } String cookieString = request . getHeader ( COOKIE ) ; if ( cookieString != null ) { CookieDecoder cookieDecoder = new CookieDecoder ( ) ; Set < Cookie > cookies = cookieDecoder . decode ( cookieString ) ; if ( ! ( cookies . isEmpty ( ) ) ) { CookieEncoder cookieEncoder = new CookieEncoder ( true ) ; for ( Cookie cookie : cookies ) { cookieEncoder . addCookie ( cookie ) ; response . addHeader ( SET_COOKIE , cookieEncoder . encode ( ) ) ; } } } ChannelFuture future = sink . write ( response ) ; if ( ! keepAlive ) { future . addListener ( CLOSE ) ; } } private static void send100Continue ( MessageEvent e ) { } @ Override public void exceptionCaught ( ChannelHandlerContext ctx , ExceptionEvent e ) throws Exception { } No newline ; at end ; of file ; }

Fix:
response . addHeader ( field . name ( ) , field . value ( ) ) ;
Buggy code:
public class PatchEnforceRedirect extends Patch { public PatchEnforceRedirect ( String name ) { } @ Override public void formatConfig ( HashMap < String , Object > json ) { } @ Override public boolean shouldProcessPacket ( Packet packet ) { } @ Override public void processPacket ( Packet packet ) { } @ Override public boolean shouldProcessResponse ( ResponsePacket response , RequestPacket request , byte [ ] data ) { } @ Override public byte [ ] processResponse ( ResponsePacket response , RequestPacket request , byte [ ] data ) { String host = request . headers . getHeader ( "Host" ) ; <START_BUG> if ( request . httpVersion . equals ( "HTTP//1.0" ) ) <END_BUG> for ( Object key : pcfg . keySet ( ) ) { if ( key . equals ( "enabled" ) ) continue ; String regex = ( ( String ) ( key ) ) ; if ( host . matches ( regex ) ) { response . headers . updateHeader ( "Location" , ( ( ( ( request . ssl ? "https" : "http" ) + ":////" ) + ( ( String ) ( pcfg . get ( ( ( String ) ( key ) ) ) ) ) ) + ( request . target ) ) ) ; response . statusCode = 301 ; response . reasonPhrase = "Moved<seq2seq4repair_space>Permanently" ; response . body = null ; return null ; } } return data ; } @ Override public void processMethod ( RequestPacket request , ResponsePacket response ) { } }

Fix:
if ( ! ( request . httpVersion . equals ( "HTTP//1.0" ) ) )
Buggy code:
public class NewDeploymentScannerEnable implements ModelUpdateOperationHandler , RuntimeOperationHandler { static final NewDeploymentScannerEnable INSTANCE = new NewDeploymentScannerEnable ( ) ; private NewDeploymentScannerEnable ( ) { } public Cancellable execute ( NewOperationContext context , ModelNode operation , ResultHandler resultHandler ) { final ModelNode address = operation . require ( ADDRESS ) ; final String name = address . get ( ( ( address . asInt ( ) ) - 1 ) ) . asString ( ) ; final ModelNode compensatingOperation = new ModelNode ( ) ; <START_BUG> compensatingOperation . get ( OP ) . set ( "disable-scanner" ) ; <END_BUG> compensatingOperation . get ( OP_ADDR ) . set ( operation . require ( OP_ADDR ) ) ; if ( context instanceof NewRuntimeOperationContext ) { final NewRuntimeOperationContext updateContext = ( ( NewRuntimeOperationContext ) ( context ) ) ; final ServiceController < ? > controller = updateContext . getServiceRegistry ( ) . getService ( DeploymentScannerService . getServiceName ( name ) ) ; if ( controller == null ) { resultHandler . handleFailed ( new ModelNode ( ) . set ( "scanner<seq2seq4repair_space>not<seq2seq4repair_space>configured" ) ) ; } else { try { final DeploymentScanner scanner = ( ( DeploymentScanner ) ( controller . getValue ( ) ) ) ; scanner . startScanner ( ) ; context . getSubModel ( ) . get ( SCAN_ENABLED ) . set ( true ) ; resultHandler . handleResultComplete ( compensatingOperation ) ; } catch ( Throwable t ) { resultHandler . handleFailed ( getFailureResult ( t ) ) ; } } } return Cancellable . NULL ; } protected ModelNode getFailureResult ( Throwable t ) { } }

Fix:
compensatingOperation . get ( OP ) . set ( "disable" ) ;
Buggy code:
public class RootLoggerAction extends Action { static final String NAME_ATTR = "name" ; static final String CLASS_ATTR = "class" ; static final String ADDITIVITY_ATTR = "additivity" ; static final String EMPTY_STR = "" ; static final Class [ ] ONE_STRING_PARAM = new Class [ ] { String . class } ; Logger logger = Logger . getLogger ( RootLoggerAction . class ) ; Logger root ; public void begin ( ExecutionContext ec , Element loggerElement ) { } public void end ( ExecutionContext ec , Element e ) { logger . debug ( "end()<seq2seq4repair_space>called." ) ; if ( inError ) { return ; } Object o = ec . peekObject ( ) ; if ( o != ( root ) ) { logger . warn ( "The<seq2seq4repair_space>object<seq2seq4repair_space>on<seq2seq4repair_space>the<seq2seq4repair_space>top<seq2seq4repair_space>the<seq2seq4repair_space>of<seq2seq4repair_space>the<seq2seq4repair_space>stack<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>the<seq2seq4repair_space>root<seq2seq4repair_space>logger" ) ; logger . warn ( ( "It<seq2seq4repair_space>is:<seq2seq4repair_space>" + o ) ) ; } else { <START_BUG> logger . debug ( "Removing<seq2seq4repair_space>root<seq2seq4repair_space>logger<seq2seq4repair_space>from<seq2seq4repair_space>stack." ) ; <END_BUG> ec . popObject ( ) ; } } public void finish ( ExecutionContext ec ) { } }

Fix:
logger . debug ( "Removing<seq2seq4repair_space>root<seq2seq4repair_space>logger<seq2seq4repair_space>from<seq2seq4repair_space>top<seq2seq4repair_space>of<seq2seq4repair_space>stack." ) ;
Buggy code:
public class DefaultConfigurerTest extends AbstractComponentTest { private static final Resources REZ = ResourceManager . getPackageResources ( DefaultConfigurerTest . class ) ; private Configurer m_configurer ; private DefaultTaskContext m_context ; public DefaultConfigurerTest ( String name ) { } protected void setUp ( ) throws Exception { super . setUp ( ) ; m_configurer = ( ( Configurer ) ( getServiceManager ( ) . lookup ( ROLE ) ) ) ; <START_BUG> m_context = new DefaultTaskContext ( ) ; <END_BUG> final File baseDir = new File ( "." ) . getAbsoluteFile ( ) ; m_context . setProperty ( BASE_DIRECTORY , baseDir ) ; } public void testSetAttribute ( ) throws Exception { } public void testAttributeConvert ( ) throws Exception { } public void testSetUnknownAttribute ( ) throws Exception { } public void testSetElement ( ) throws Exception { } public void testSetUnknownElement ( ) throws Exception { } public void testContent ( ) throws Exception { } public void testUnexpectedContent ( ) throws Exception { } public void testPropResolution ( ) throws Exception { } public void testReferenceAttribute ( ) throws Exception { } public void testReferenceElement ( ) throws Exception { } public void testReferenceElementExtra ( ) throws Exception { } public void testReferenceConversion ( ) throws Exception { } public void testInterfaceAdder ( ) throws Exception { } public void testNonInterfaceTypedAdder ( ) throws Exception { } public void testMultipleTypedAdder ( ) throws Exception { } public void testTypedAdder ( ) throws Exception { } public void testTypedAdderRole ( ) throws Exception { } public void testTypedAdderConversion ( ) throws Exception { } public void testTypedConfigAdder ( ) throws Exception { } public void testConfigAdder ( ) throws Exception { } public void testConfigable ( ) throws Exception { } public void testIdResolve ( ) throws Exception { } public void testUnknownReference ( ) throws Exception { } public void testMismatchedRefType ( ) throws Exception { } public void testTypedAdderReference ( ) throws Exception { } public void testNestedErrors ( ) throws Exception { } public void testIgnoreStringMethods ( ) throws Exception { } private void configure ( final Object test , final DefaultConfiguration config ) throws ConfigurationException { } }

Fix:
m_context = new DefaultTaskContext ( null , getServiceManager ( ) , getLogger ( ) ) ;
Buggy code:
public class NaiveBayesInstanceMapper extends Mapper < Text , VectorWritable , IntWritable , VectorWritable > { private OpenObjectIntHashMap < String > labelMap = new OpenObjectIntHashMap < String > ( ) ; @ Override protected void map ( Text key , VectorWritable value , Context context ) throws IOException , InterruptedException { if ( ! ( labelMap . containsKey ( key . toString ( ) ) ) ) { <START_BUG> context . getCounter ( "NaiveBayes" , "Skipped<seq2seq4repair_space>instance:<seq2seq4repair_space>not<seq2seq4repair_space>in<seq2seq4repair_space>label<seq2seq4repair_space>list" ) ; <END_BUG> return ; } int label = labelMap . get ( key . toString ( ) ) ; context . write ( new IntWritable ( label ) , value ) ; } @ Override protected void setup ( Context context ) throws IOException , InterruptedException { } }

Fix:
context . getCounter ( "NaiveBayes" , "Skipped<seq2seq4repair_space>instance:<seq2seq4repair_space>not<seq2seq4repair_space>in<seq2seq4repair_space>label<seq2seq4repair_space>list" ) . increment ( 1 ) ;