nus-yam/ex-repair huggingface dataset:
Buggy code:
public class ExpenditureFrag extends Fragment { private static final String TAG = ExpenditureFrag . class . getSimpleName ( ) ; private Spinner mSpinner ; private RadioGroup mRadioGroup ; private EditText ex_remarksTx ; private EditText ex_moneyTx ; private TextView ex_dateTx ; private DatePickerDialog datePickerDialog ; private boolean isUpdate = false ; private MyDBHelper dbHelper ; private Button submitBtn = null ; private int ex_in_type = 0 ; private String ex_type ; private String ex_remark ; private float ex_money = 0 ; private String ex_date ; private String ex_time ; private String rbData = "ÔçÉÏ" ; private String monthOfYearStr = "" ; private String dayOfMonthStr = "" ; @ Override public View onCreateView ( LayoutInflater inflater , ViewGroup container , Bundle savedInstanceState ) { } private void clearInput ( ) { } private boolean checkInput ( String remarks , String money , String date ) { <START_BUG> if ( ( ( "" . equals ( remarks ) ) || ( "" . equals ( money ) ) ) || ( "" . equals ( date ) ) ) { <END_BUG> Toast . makeText ( getActivity ( ) , "ÊäÈë²»ÄÜÎª¿Õ£¡" , LENGTH_SHORT ) . show ( ) ; return false ; } return true ; } private void insertData ( SQLiteDatabase db , ContentValues values ) { } @ Override public void onDestroy ( ) { } }

Fix:
if ( ( "" . equals ( money ) ) || ( "" . equals ( date ) ) ) {
Buggy code:
public class Trie { private TrieConfig trieConfig ; private State rootState ; private boolean failureStatesConstructed = false ; public Trie ( TrieConfig trieConfig ) { } public Trie ( ) { } public Trie caseInsensitive ( ) { } public Trie removeOverlaps ( ) { } public Trie onlyWholeWords ( ) { } public void addKeyword ( String keyword ) { } public Collection < Token > tokenize ( String text ) { } private Token createFragment ( Emit emit , String text , int lastCollectedPosition ) { } private Token createMatch ( Emit emit , String text ) { } @ SuppressWarnings ( "unchecked" ) public Collection < Emit > parseText ( String text ) { } private void removePartialMatches ( String searchText , List < Emit > collectedEmits ) { long size = searchText . length ( ) ; List < Emit > removeEmits = new ArrayList < Emit > ( ) ; for ( Emit emit : collectedEmits ) { <START_BUG> if ( ( ( ( emit . getStart ( ) ) == 0 ) || ( ! ( Character . isAlphabetic ( searchText . charAt ( ( ( emit . getStart ( ) ) - 1 ) ) ) ) ) ) && ( ( ( emit . getEnd ( ) ) == size ) || ( ! ( Character . isAlphabetic ( searchText . charAt ( ( ( emit . getEnd ( ) ) + 1 ) ) ) ) ) ) ) { <END_BUG> continue ; } removeEmits . add ( emit ) ; } for ( Emit removeEmit : removeEmits ) { collectedEmits . remove ( removeEmit ) ; } } private State getState ( State currentState , Character character ) { } private void checkForConstructedFailureStates ( ) { } private void constructFailureStates ( ) { } private void storeEmits ( int position , State currentState , List < Emit > collectedEmits ) { } }

Fix:
if ( ( ( ( emit . getStart ( ) ) == 0 ) || ( ! ( Character . isAlphabetic ( searchText . charAt ( ( ( emit . getStart ( ) ) - 1 ) ) ) ) ) ) && ( ( ( ( emit . getEnd ( ) ) + 1 ) == size ) || ( ! ( Character . isAlphabetic ( searchText . charAt ( ( ( emit . getEnd ( ) ) + 1 ) ) ) ) ) ) ) {
Buggy code:
public class Xkcd extends IndexedComic { @ Override protected String getFrontPageUrl ( ) { } public String getComicWebPageUrl ( ) { } @ Override protected int parseForLatestId ( BufferedReader reader ) throws ComicLatestException , IOException { } @ Override public String getStripUrlFromId ( int num ) { } @ Override protected int getIdFromStripUrl ( String url ) { } @ Override protected boolean htmlNeeded ( ) { } @ Override protected String parse ( String url , BufferedReader reader , Strip strip ) throws IOException { String str ; String final_str = null ; String final_title = null ; String final_title1 = null ; String final_itext = null ; while ( ( str = reader . readLine ( ) ) != null ) { int index1 = str . indexOf ( "<img<seq2seq4repair_space>src=\"http:////imgs.xkcd.com//comics" ) ; if ( index1 != ( - 1 ) ) { final_str = str ; final_itext = str ; } int index3 = str . indexOf ( "Permanent<seq2seq4repair_space>link<seq2seq4repair_space>to<seq2seq4repair_space>this<seq2seq4repair_space>comic" ) ; if ( index3 != ( - 1 ) ) { final_title = str ; } if ( ( str . indexOf ( "<title>" ) ) != ( - 1 ) ) { final_title1 = str ; } } final_str = final_str . replaceAll ( ".*src=\"" , "" ) ; final_str = final_str . replaceAll ( "\".*" , "" ) ; final_title = final_title . replaceAll ( ".*.com//" , "" ) ; final_title = final_title . replaceAll ( "//.*" , "" ) ; final_title1 = final_title1 . replaceAll ( ".*<title>" , "" ) ; final_title1 = final_title1 . replaceAll ( "xkcd:<seq2seq4repair_space>" , "" ) ; final_title1 = final_title1 . replaceAll ( "<//title>.*" , "" ) ; final_itext = final_itext . replaceAll ( ".*title=\"" , "" ) ; <START_BUG> final_itext = final_itext . replaceAll ( "\"<seq2seq4repair_space>alt.*" , "" ) ; <END_BUG> strip . setTitle ( ( ( ( "Xkcd:<seq2seq4repair_space>" + final_title1 ) + "<seq2seq4repair_space>:<seq2seq4repair_space>" ) + final_title ) ) ; strip . setText ( final_itext ) ; return final_str ; } }

Fix:
final_itext = final_itext . replaceAll ( "\".*" , "" ) ;
Buggy code:
public abstract class ValueSource implements Serializable { @ Deprecated public DocValues getValues ( IndexReader reader ) throws IOException { } public DocValues getValues ( Map context , IndexReader reader ) throws IOException { <START_BUG> return null ; <END_BUG> } public abstract boolean equals ( Object o ) { } public abstract int hashCode ( ) { } public abstract String description ( ) { } public String toString ( ) { } public void createWeight ( Map context , Searcher searcher ) throws IOException { } public static Map newContext ( ) { } }

Fix:
return getValues ( reader ) ;
Buggy code:
public class ViewResolverRegistry { private ContentNegotiatingViewResolver contentNegotiatingResolver ; private final List < ViewResolver > viewResolvers = new ArrayList < ViewResolver > ( 4 ) ; private Integer order ; private ContentNegotiationManager contentNegotiationManager ; private ApplicationContext applicationContext ; protected void setContentNegotiationManager ( ContentNegotiationManager contentNegotiationManager ) { } protected void setApplicationContext ( ApplicationContext applicationContext ) { } public boolean hasRegistrations ( ) { } public void enableContentNegotiation ( View ... defaultViews ) { } public void enableContentNegotiation ( boolean useNotAcceptableStatus , View ... defaultViews ) { } private void initContentNegotiatingViewResolver ( View [ ] defaultViews ) { } public UrlBasedViewResolverRegistration jsp ( ) { } public UrlBasedViewResolverRegistration jsp ( String prefix , String suffix ) { } public UrlBasedViewResolverRegistration tiles ( ) { } public UrlBasedViewResolverRegistration freeMarker ( ) { } public UrlBasedViewResolverRegistration velocity ( ) { } public UrlBasedViewResolverRegistration groovy ( ) { } public void beanName ( ) { } public void viewResolver ( ViewResolver viewResolver ) { } public void order ( int order ) { } protected boolean hasBeanOfType ( Class < ? > beanType ) { } protected int getOrder ( ) { <START_BUG> return this . order ; <END_BUG> } protected List < ViewResolver > getViewResolvers ( ) { } private static class TilesRegistration extends UrlBasedViewResolverRegistration { private TilesRegistration ( ) { } } private static class VelocityRegistration extends UrlBasedViewResolverRegistration { private VelocityRegistration ( ) { } } private static class FreeMarkerRegistration extends UrlBasedViewResolverRegistration { private FreeMarkerRegistration ( ) { } } private static class GroovyMarkupRegistration extends UrlBasedViewResolverRegistration { private GroovyMarkupRegistration ( ) { } } }

Fix:
return ( this . order ) != null ? this . order : Ordered . LOWEST_PRECEDENCE ;
Buggy code:
public class Question { public static void main ( String [ ] args ) { } public String reverseWords ( String s ) { if ( ( s == null ) || ( ( s . length ( ) ) == 0 ) ) { return "" ; } s = s . trim ( ) ; <START_BUG> String [ ] strArray = s . split ( "\\s" ) ; <END_BUG> StringBuilder sb = new StringBuilder ( ) ; for ( int i = ( strArray . length ) - 1 ; i >= 0 ; i -- ) { sb . append ( strArray [ i ] ) . append ( "<seq2seq4repair_space>" ) ; } return ( sb . length ( ) ) == 0 ? "" : sb . deleteCharAt ( ( ( sb . length ( ) ) - 1 ) ) . toString ( ) ; } }

Fix:
String [ ] strArray = s . split ( "\\s+" ) ;
Buggy code:
public class XADataSourceAddCompositeHandler extends ResourceCompositeOperationHandler implements OperationCommandWithDescription { private static final String XA_DATASOURCE_PROPERTIES = "xa-datasource-properties" ; private ArgumentWithValue xaProps ; public XADataSourceAddCompositeHandler ( CommandContext ctx , String nodeType ) { } @ Override protected Map < String , CommandArgument > loadArguments ( CommandContext ctx ) { } protected ModelNode buildRequestWithoutHeaders ( CommandContext ctx ) throws CommandFormatException { final ModelNode req = super . buildRequestWithoutHeaders ( ctx ) ; final ModelNode steps = req . get ( STEPS ) ; final String xaPropsStr = xaProps . getValue ( ctx . getParsedCommandLine ( ) ) ; if ( xaPropsStr != null ) { <START_BUG> final List < Property > propsList = xaProps . getValueConverter ( ) . fromString ( xaPropsStr ) . asPropertyList ( ) ; <END_BUG> for ( Property prop : propsList ) { final ModelNode address = this . buildOperationAddress ( ctx ) ; address . add ( XADataSourceAddCompositeHandler . XA_DATASOURCE_PROPERTIES , prop . getName ( ) ) ; final ModelNode addProp = new ModelNode ( ) ; addProp . get ( ADDRESS ) . set ( address ) ; addProp . get ( OPERATION ) . set ( ADD ) ; addProp . get ( VALUE ) . set ( prop . getValue ( ) ) ; steps . add ( addProp ) ; } } return req ; } @ Override public ModelNode getOperationDescription ( CommandContext ctx ) throws CommandLineException { } }

Fix:
final List < Property > propsList = xaProps . getValueConverter ( ) . fromString ( ctx , xaPropsStr ) . asPropertyList ( ) ;
Buggy code:
public class AddTeamCommand extends BaseCommand { public AddTeamCommand ( Main plugin ) { } @ Override public String getCommand ( ) { } @ Override public String getName ( ) { } @ Override public String getDescription ( ) { } @ Override public String [ ] getArguments ( ) { } @ Override public boolean execute ( CommandSender sender , ArrayList < String > args ) { if ( ! ( sender . hasPermission ( ( "bw." + ( this . getPermission ( ) ) ) ) ) ) { return false ; } Game game = this . getPlugin ( ) . getGameManager ( ) . getGame ( args . get ( 0 ) ) ; String name = args . get ( 1 ) ; String color = args . get ( 2 ) ; String maxPlayers = args . get ( 3 ) ; <START_BUG> TeamColor tColor = TeamColor . valueOf ( color ) ; <END_BUG> if ( game == null ) { sender . sendMessage ( ChatWriter . pluginMessage ( ( ( ChatColor . RED ) + ( Main . _l ( "errors.gamenotfound" , ImmutableMap . of ( "game" , args . get ( 0 ) . toString ( ) ) ) ) ) ) ) ; return false ; } int playerMax = Integer . parseInt ( maxPlayers ) ; if ( ( playerMax < 1 ) || ( playerMax > 24 ) ) { sender . sendMessage ( ChatWriter . pluginMessage ( ( ( ChatColor . RED ) + ( Main . _l ( "errors.playeramount" ) ) ) ) ) ; return false ; } if ( tColor == null ) { sender . sendMessage ( ChatWriter . pluginMessage ( ( ( ChatColor . RED ) + ( Main . _l ( "errors.teamcolornotallowed" ) ) ) ) ) ; return false ; } if ( ( ( name . length ( ) ) < 3 ) || ( ( name . length ( ) ) > 20 ) ) { sender . sendMessage ( ChatWriter . pluginMessage ( ( ( ChatColor . RED ) + ( Main . _l ( "errors.teamnamelength" ) ) ) ) ) ; return false ; } game . addTeam ( name , tColor , playerMax ) ; sender . sendMessage ( ChatWriter . pluginMessage ( ( ( ChatColor . GREEN ) + ( Main . _l ( "success.teamadded" , ImmutableMap . of ( "team" , name ) ) ) ) ) ) ; return true ; } @ Override public String getPermission ( ) { } }

Fix:
TeamColor tColor = TeamColor . valueOf ( color . toUpperCase ( ) ) ;
Buggy code:
@ SuppressWarnings ( { "JUnitTestMethodWithNoAssertions" , "ThrowableResultOfMethodCallIgnored" , "ErrorNotRethrown" } ) public class GuavaInmemoryCacheWrapperTest { private static final int THREAD_COUNT = 10 * ( Runtime . getRuntime ( ) . availableProcessors ( ) ) ; private static final int SLEEPING_THREAD_COUNT = 100 * ( Runtime . getRuntime ( ) . availableProcessors ( ) ) ; private static final int SECTION_COUNT = 50 ; private static final int KEY_PER_SECTION_COUNT = 50 ; private static final int TOTAL_KEY_COUNT = ( GuavaInmemoryCacheWrapperTest . SECTION_COUNT ) * ( GuavaInmemoryCacheWrapperTest . KEY_PER_SECTION_COUNT ) ; private static final long VALUE_LIFETIME_MILLIS = 350L ; private static final long VALUE_CHECK_INTERVAL_MILLIS = 250L ; private static final int VALUE_LENGTH = Ints . checkedCast ( BYTES_PER_KB ) ; @ Test public void testStoringOfValues ( ) throws Exception { } @ Test public void testOverridingOfValuesWithLifetime ( ) throws Exception { } @ Test public void testConcurrentStoringOfValues ( ) throws Exception { } private static void executeConcurrentStoringOfValues ( final Cache < String , byte [ ] > cache , final BlockingQueue < CachePath > cachePaths , final AtomicReference < AssertionError > assertionError , final AtomicReference < Throwable > unexpectedThrowable ) { } @ Test public void testConcurrentStoringOfValuesWithLifetime ( ) throws Exception { } private static void checkStoringOneValue ( Cache < String , byte [ ] > cache , CachePath cachePath ) { } private static void checkStoringOneValueWithLifetime ( Cache < String , byte [ ] > cache , CachePath cachePath ) { } private static BlockingQueue < CachePath > getCachePaths ( ) { <START_BUG> return CacheTestUtil . getCachePaths ( GuavaInmemoryCacheWrapperTest . KEY_PER_SECTION_COUNT , GuavaInmemoryCacheWrapperTest . KEY_PER_SECTION_COUNT , GuavaInmemoryCacheWrapperTest . TOTAL_KEY_COUNT ) ; <END_BUG> } }

Fix:
return CacheTestUtil . getCachePaths ( GuavaInmemoryCacheWrapperTest . SECTION_COUNT , GuavaInmemoryCacheWrapperTest . KEY_PER_SECTION_COUNT , GuavaInmemoryCacheWrapperTest . TOTAL_KEY_COUNT ) ;
Buggy code:
public class FragmentPage extends WicketExamplePage { private class MyFragment extends Fragment { public MyFragment ( String id , String markupId ) { } } public FragmentPage ( ) { } protected void explain ( ) { <START_BUG> String html = "<org.apache.wicket:fragment<seq2seq4repair_space>wicket:id=\"fragmentid\">...<//org.apache.wicket:fragment>" ; <END_BUG> String code = "private<seq2seq4repair_space>class<seq2seq4repair_space>MyFragment<seq2seq4repair_space>extends<seq2seq4repair_space>Fragment<seq2seq4repair_space>{\n<seq2seq4repair_space>...\n" + "add(new<seq2seq4repair_space>MyFragment(\"fragment\",<seq2seq4repair_space>\"fragmentid\"));" ; add ( new ExplainPanel ( html , code ) ) ; } }

Fix:
String html = "<wicket:fragment<seq2seq4repair_space>wicket:id=\"fragmentid\">...<//wicket:fragment>" ;
Buggy code:
public class StringToByteConverter extends AbstractConverter { private static final Resources REZ = ResourceManager . getPackageResources ( StringToByteConverter . class ) ; public StringToByteConverter ( ) { } <START_BUG> public Object convert ( final Object object , final Context context ) throws ConverterException { <END_BUG> try { return new Byte ( ( ( String ) ( object ) ) ) ; } catch ( final NumberFormatException nfe ) { final String message = StringToByteConverter . REZ . getString ( "convert.bad-byte.error" , object ) ; throw new ConverterException ( message , nfe ) ; } } }

Fix:
public Object convert ( final Object object , final Object context ) throws ConverterException {
Buggy code:
public class PayloadHelper { private byte [ ] payloadField = new byte [ ] { 1 } ; private byte [ ] payloadMultiField1 = new byte [ ] { 2 } ; private byte [ ] payloadMultiField2 = new byte [ ] { 4 } ; public static final String NO_PAYLOAD_FIELD = "noPayloadField" ; public static final String MULTI_FIELD = "multiField" ; public static final String FIELD = "field" ; public IndexReader reader ; public final class PayloadAnalyzer extends Analyzer { public PayloadAnalyzer ( ) { } @ Override public TokenStreamComponents createComponents ( String fieldName ) { } } public final class PayloadFilter extends TokenFilter { private final String fieldName ; private int numSeen = 0 ; private final PayloadAttribute payloadAtt ; public PayloadFilter ( TokenStream input , String fieldName ) { } @ Override public boolean incrementToken ( ) throws IOException { } @ Override public void reset ( ) throws IOException { } } public IndexSearcher setUp ( Random random , Similarity similarity , int numDocs ) throws IOException { Directory directory = new org . apache . lucene . store . MockDirectoryWrapper ( random , new RAMDirectory ( ) ) ; PayloadHelper . PayloadAnalyzer analyzer = new PayloadHelper . PayloadAnalyzer ( ) ; IndexWriter writer = new IndexWriter ( directory , new org . apache . lucene . index . IndexWriterConfig ( TEST_VERSION_CURRENT , analyzer ) . setSimilarity ( similarity ) ) ; for ( int i = 0 ; i < numDocs ; i ++ ) { Document doc = new Document ( ) ; doc . add ( new org . apache . lucene . document . TextField ( PayloadHelper . FIELD , English . intToEnglish ( i ) , Store . YES ) ) ; doc . add ( new org . apache . lucene . document . TextField ( PayloadHelper . MULTI_FIELD , ( ( ( English . intToEnglish ( i ) ) + "<seq2seq4repair_space>" ) + ( English . intToEnglish ( i ) ) ) , Store . YES ) ) ; doc . add ( new org . apache . lucene . document . TextField ( PayloadHelper . NO_PAYLOAD_FIELD , English . intToEnglish ( i ) , Store . YES ) ) ; writer . addDocument ( doc ) ; } reader = DirectoryReader . open ( writer , true ) ; <START_BUG> writer . close ( ) ; <END_BUG> IndexSearcher searcher = LuceneTestCase . newSearcher ( reader ) ; searcher . setSimilarity ( similarity ) ; return searcher ; } public void tearDown ( ) throws Exception { } }

Fix:
writer . shutdown ( ) ;
Buggy code:
public class PerObject extends PerClause { private boolean isThis ; private Pointcut entry ; public PerObject ( Pointcut entry , boolean isThis ) { } <START_BUG> public FuzzyBoolean fastMatch ( ResolvedTypeX type ) { <END_BUG> return FuzzyBoolean . MAYBE ; } public FuzzyBoolean match ( Shadow shadow ) { } public void resolveBindings ( IScope scope , Bindings bindings ) { } private Var getVar ( Shadow shadow ) { } public Test findResidue ( Shadow shadow , ExposedState state ) { } public PerClause concretize ( ResolvedTypeX inAspect ) { } public void write ( DataOutputStream s ) throws IOException { } public static PerClause readPerClause ( DataInputStream s , ISourceContext context ) throws IOException { } public Kind getKind ( ) { } public String toString ( ) { } }

Fix:
public FuzzyBoolean fastMatch ( FastMatchInfo type ) {
Buggy code:
public class AnimoResultOneStepTraverser extends ResultTraverser { public AnimoResultOneStepTraverser ( ) { } @ Override protected void process ( GraphHandler handler , PFlow pf , Statement s , Statement parent , QCAVector rr , int level , boolean isOne , int pos , boolean isLast ) throws IOException { } protected boolean result ( GraphHandler handler , PFlow pf , QCAVector rr , int level , boolean isOne ) throws IOException { Relationship r = rr . getClosest ( ) ; PFlow pflow = new PFlow ( pf ) ; <START_BUG> Iterator < QCAVector > in = _ . execute ( pflow , new QCAVector ( r , rr ) , null , false ) ; <END_BUG> iterate ( handler , pflow , null , rr , in , level , isOne ) ; return true ; } }

Fix:
Iterator < QCAVector > in = _ . execute ( pflow , rr . question ( r ) , null , false ) ;
Buggy code:
public class WildcardBinding extends ReferenceBinding { ReferenceBinding genericType ; int rank ; public TypeBinding bound ; public TypeBinding [ ] otherBounds ; char [ ] genericSignature ; public int boundKind ; ReferenceBinding superclass ; ReferenceBinding [ ] superInterfaces ; TypeVariableBinding typeVariable ; LookupEnvironment environment ; public WildcardBinding ( ReferenceBinding genericType , int rank , TypeBinding bound , TypeBinding [ ] otherBounds , int boundKind , LookupEnvironment environment ) { } public int kind ( ) { } public boolean boundCheck ( TypeBinding argumentType ) { } public boolean canBeInstantiated ( ) { } public void collectSubstitutes ( Scope scope , TypeBinding actualType , Map substitutes , int constraint ) { } public char [ ] computeUniqueKey ( boolean isLeaf ) { } public String debugName ( ) { } public TypeBinding erasure ( ) { } public char [ ] genericTypeSignature ( ) { } public int hashCode ( ) { } void initialize ( ReferenceBinding someGenericType , TypeBinding someBound , TypeBinding [ ] someOtherBounds ) { } public boolean isSuperclassOf ( ReferenceBinding otherType ) { } public boolean isIntersectionType ( ) { } public boolean isUnboundWildcard ( ) { } public boolean isWildcard ( ) { } public char [ ] readableName ( ) { } ReferenceBinding resolve ( ) { } public char [ ] shortReadableName ( ) { } public char [ ] signature ( ) { } public char [ ] sourceName ( ) { } public ReferenceBinding superclass ( ) { } public ReferenceBinding [ ] superInterfaces ( ) { } public ReferenceBinding [ ] superInterfaces2 ( ) { } public void swapUnresolved ( UnresolvedReferenceBinding unresolvedType , ReferenceBinding resolvedType , LookupEnvironment env ) { boolean affected = false ; if ( ( this . genericType ) == unresolvedType ) { this . genericType = resolvedType ; affected = true ; } else if ( ( this . bound ) == unresolvedType ) { <START_BUG> this . bound = env . convertToRawType ( resolvedType ) ; <END_BUG> affected = true ; } if ( affected ) initialize ( this . genericType , this . bound , this . otherBounds ) ; } public String toString ( ) { } public TypeVariableBinding typeVariable ( ) { } }

Fix:
this . bound = env . convertUnresolvedBinaryToRawType ( resolvedType ) ;
Buggy code:
public class ColorAttrDriver { public static void main ( String [ ] args ) { ColorAttr testColor ; <START_BUG> testColor = new ColorAttr ( "red" ) ; <END_BUG> System . out . println ( testColor . toString ( ) ) ; } No newline ; at end ; of file ; }

Fix:
testColor = new ColorAttr ( "Color" , "red" ) ;
Buggy code:
public class ArgumentWriter { protected final byte [ ] openingCurlyBracket = new byte [ ] { '{' } ; protected final byte [ ] closingCurlyBracket = new byte [ ] { '}' } ; protected final byte [ ] newline = new byte [ ] { '\r' , '\n' } ; protected OutputStream output ; protected IMAPProtocol protocol ; static boolean nested = false ; public ArgumentWriter ( IMAPProtocol protocol ) { } public ArgumentWriter ( OutputStream output ) { } public void write ( Arguments args ) throws Exception { } protected void writeString ( byte [ ] data ) throws Exception { } protected void writeBytes ( byte [ ] data ) throws Exception { output . write ( openingCurlyBracket ) ; output . write ( Integer . toString ( data . length ) . getBytes ( "ISO-8859-1" ) ) ; output . write ( closingCurlyBracket ) ; output . write ( newline ) ; output . flush ( ) ; for ( ; ; ) { <START_BUG> IMAPResponse r = protocol . getResponse ( null ) ; <END_BUG> if ( r . isCONTINUATION ( ) ) break ; } output . write ( data ) ; } protected void writeAtom ( Atom atom ) throws Exception { } }

Fix:
IMAPResponse r = protocol . getResponse ( ) ;
Buggy code:
public class IncomeFrag extends Fragment { private static final String TAG = IncomeFrag . class . getSimpleName ( ) ; private Spinner mSpinner ; private EditText in_remarkTx ; private EditText in_moneyTx ; private TextView in_dateTx ; private DatePickerDialog datePickerDialog ; private boolean isUpdate = false ; private MyDBHelper dbHelper ; private Button submitBtn2 = null ; private int ex_in_type = 1 ; private String in_type ; private String in_remark ; private float in_money ; private String in_date ; private String in_time = "ÂÔ" ; private String monthOfYearStr = "" ; private String dayOfMonthStr = "" ; @ Override public View onCreateView ( LayoutInflater inflater , ViewGroup container , Bundle savedInstanceState ) { } private void clearInput ( ) { } private boolean checkInput ( String remarks , String money , String date ) { <START_BUG> if ( ( ( "" . equals ( remarks ) ) || ( "" . equals ( money ) ) ) || ( "" . equals ( date ) ) ) { <END_BUG> Toast . makeText ( getActivity ( ) , "ÊäÈë²»ÄÜÎª¿Õ£¡" , LENGTH_SHORT ) . show ( ) ; return false ; } return true ; } private void insertData ( SQLiteDatabase db , ContentValues values ) { } }

Fix:
if ( ( "" . equals ( money ) ) || ( "" . equals ( date ) ) ) {
Buggy code:
public class ZephyrBHConnectedListener extends ConnectListenerImpl { ZephyrBHDeviceAdapter deviceAdapter ; private GeneralPacketInfo gpInfo = new GeneralPacketInfo ( ) ; private ECGPacketInfo ecgInfoPacket = new ECGPacketInfo ( ) ; private BreathingPacketInfo breathingInfoPacket = new BreathingPacketInfo ( ) ; private RtoRPacketInfo rToRInfoPacket = new RtoRPacketInfo ( ) ; private AccelerometerPacketInfo accInfoPacket = new AccelerometerPacketInfo ( ) ; private PacketTypeRequest rqPacketType = new PacketTypeRequest ( ) ; private Map < String , String > config ; private ZephyrProtocol protocol ; private String devId ; ZephyrBHDevice device ; public ZephyrBHConnectedListener ( ZephyrBHDeviceAdapter deviceAdapter , String devId , Map < String , String > config ) { } @ Override public void Connected ( ConnectedEvent < BTClient > eventArgs ) { } private void processPacketGeneral ( byte [ ] dataArray ) { } private void processPacketEcg ( byte [ ] dataArray ) { } private void processPacketBreath ( byte [ ] dataArray ) { } private void processPacketRtor ( byte [ ] dataArray ) { Observation tmpObs ; int [ ] samples ; long timestamp = TimeConverter . timeToEpoch ( rToRInfoPacket . GetTSYear ( dataArray ) , rToRInfoPacket . GetTSMonth ( dataArray ) , rToRInfoPacket . GetTSDay ( dataArray ) , rToRInfoPacket . GetMsofDay ( dataArray ) ) ; samples = rToRInfoPacket . GetRtoRSamples ( dataArray ) ; String [ ] strSamples = new String [ samples . length ] ; for ( int i = 0 ; i < ( samples . length ) ; i ++ ) { <START_BUG> strSamples [ i ] = Integer . toString ( samples [ i ] ) ; <END_BUG> } tmpObs = new Observation ( ZephyrBHConstants . SENSOR_R_TO_R , strSamples ) ; tmpObs . setPhenomenonTime ( timestamp ) ; tmpObs . setDuration ( SAMPLES_R_TO_R_DURATION ) ; deviceAdapter . receivedMeasurement ( tmpObs , device ) ; } private void processPacketAccel ( byte [ ] dataArray ) { } public void parseCommand ( String command ) { } }

Fix:
strSamples [ i ] = Short . toString ( ( ( short ) ( samples [ i ] ) ) ) ;
Buggy code:
public class LocationService extends Service { static final int MSG_REGISTER_CLIENT = 1 ; private HashMap < String , String > maps = null ; private Stack < String > pendingPositions ; private String usernameForGetTask = null ; static final int MSG_UNREGISTER_CLIENT = 2 ; static final int MSG_SET_VALUE = 3 ; private final Handler handler = new Handler ( ) ; Messenger mClients ; Timer timer ; Integer value ; final Messenger mMessenger = new Messenger ( new LocationService . IncomingHandler ( ) ) ; private String username = null ; private double latitude_to_send = 0 ; private double longitude_to_send = 0 ; private Bundle mex_attachment_bundle ; private boolean sending_flag = false ; private boolean alreadyAcquiringPosition = false ; private LocationService . sendMyPositionTask sendTask = null ; public void callAsynchronousTask ( ) { final Handler handler = new Handler ( ) ; Timer timer = new Timer ( ) ; TimerTask doAsynchronousTask = new TimerTask ( ) { @ Override public void run ( ) { handler . post ( new Runnable ( ) { public void run ( ) { try { Log . println ( DEBUG , "Service.GetPosition-Task" , "Get<seq2seq4repair_space>Data<seq2seq4repair_space>Async<seq2seq4repair_space>started" ) ; if ( ( mClients ) == null ) { Log . println ( DEBUG , "Service.GetPosition-Task" , "No<seq2seq4repair_space>clients<seq2seq4repair_space>alive" ) ; return ; } if ( ( usernameForGetTask ) == null ) { Log . println ( DEBUG , "Service.GetPosition-Task" , "No<seq2seq4repair_space>user<seq2seq4repair_space>is<seq2seq4repair_space>set<seq2seq4repair_space>to<seq2seq4repair_space>getting<seq2seq4repair_space>data<seq2seq4repair_space>from<seq2seq4repair_space>server" ) ; return ; } LocationService . getPositionsTask performBackgroundTask = new LocationService . getPositionsTask ( ) ; performBackgroundTask . execute ( "http:////robsite.altervista.org//mobile//getAllPositions.php" ) ; } catch ( Exception e ) { Log . println ( DEBUG , "Service.GetPosition-Task" , "Error<seq2seq4repair_space>Async<seq2seq4repair_space>Get" ) ; } } } ) ; } } ; <START_BUG> timer . schedule ( doAsynchronousTask , 0 , 120000 ) ; <END_BUG> } public void sendPosinAsyncMode ( ) { } class IncomingHandler extends Handler { @ Override public void handleMessage ( Message msg ) { } } @ Override public void onCreate ( ) { } @ Override public void onDestroy ( ) { } private class getPositionsTask extends AsyncTask < String , Void , Integer > { @ Override protected Integer doInBackground ( String ... params ) { } @ Override protected void onPostExecute ( Integer integer ) { } } private class sendMyPositionTask extends AsyncTask < String , Void , Integer > { @ Override protected void onPreExecute ( ) { } @ Override protected void onPostExecute ( Integer integer ) { } @ Override protected Integer doInBackground ( String ... params ) { } } @ Override public IBinder onBind ( Intent intent ) { } @ Override public boolean onUnbind ( Intent intent ) { } }

Fix:
timer . schedule ( doAsynchronousTask , 0 , 60000 ) ;
Buggy code:
public class PlacesService { private static final String TAG = "PlacesService" ; public static final int TYPE_PLACE = 0 ; public static final int KEYWORD_PLACE = 1 ; private String API_KEY ; public PlacesService ( String apikey ) { } public void setApiKey ( String apikey ) { } public ArrayList < Place > findPlaces ( double latitude , double longitude , String placeSpacification , int type ) { } private String makeUrl ( double latitude , double longitude , String place , int type ) { StringBuilder urlString = new StringBuilder ( "https:////maps.googleapis.com//maps//api//place//search//json?" ) ; if ( type == ( this . TYPE_PLACE ) ) { if ( place . equals ( "" ) ) { urlString . append ( "&location=" ) ; urlString . append ( Double . toString ( latitude ) ) ; urlString . append ( "," ) ; urlString . append ( Double . toString ( longitude ) ) ; urlString . append ( "&radius=2000" ) ; urlString . append ( ( "&key=" + ( API_KEY ) ) ) ; } else { urlString . append ( "&location=" ) ; urlString . append ( Double . toString ( latitude ) ) ; urlString . append ( "," ) ; urlString . append ( Double . toString ( longitude ) ) ; urlString . append ( "&radius=2000" ) ; urlString . append ( ( "&types=" + place ) ) ; urlString . append ( ( "&key=" + ( API_KEY ) ) ) ; } } else if ( type == ( this . KEYWORD_PLACE ) ) { if ( place . equals ( "" ) ) { Log . e ( PlacesService . TAG , "cannot<seq2seq4repair_space>be<seq2seq4repair_space>empty" ) ; } else { urlString . append ( "&location=" ) ; urlString . append ( Double . toString ( latitude ) ) ; urlString . append ( "," ) ; urlString . append ( Double . toString ( longitude ) ) ; urlString . append ( "&radius=2000" ) ; <START_BUG> urlString . append ( ( "&name=" + place ) ) ; <END_BUG> urlString . append ( ( "&key=" + ( API_KEY ) ) ) ; } } return urlString . toString ( ) ; } protected String getJSON ( String url ) { } private String getUrlContents ( String theUrl ) { } No newline ; at end ; of file ; }

Fix:
urlString . append ( ( "&keyword=" + place ) ) ;
Buggy code:
public class Snippet129 { public static void main ( String [ ] args ) { Display display = new Display ( ) ; Color red = display . getSystemColor ( COLOR_RED ) ; Color blue = display . getSystemColor ( COLOR_BLUE ) ; Color white = display . getSystemColor ( COLOR_WHITE ) ; Color gray = display . getSystemColor ( COLOR_GRAY ) ; Shell shell = new Shell ( display ) ; shell . setLayout ( new FillLayout ( ) ) ; <START_BUG> Table table = new Table ( shell , SWT . BORDER ) ; <END_BUG> table . setBackground ( gray ) ; TableColumn column1 = new TableColumn ( table , SWT . NONE ) ; TableColumn column2 = new TableColumn ( table , SWT . NONE ) ; TableColumn column3 = new TableColumn ( table , SWT . NONE ) ; TableItem item = new TableItem ( table , SWT . NONE ) ; item . setText ( new String [ ] { "entire" , "row" , "red<seq2seq4repair_space>foreground" } ) ; item . setForeground ( red ) ; item = new TableItem ( table , SWT . NONE ) ; item . setText ( new String [ ] { "entire" , "row" , "red<seq2seq4repair_space>background" } ) ; item . setBackground ( red ) ; item = new TableItem ( table , SWT . NONE ) ; item . setText ( new String [ ] { "entire" , "row" , "white<seq2seq4repair_space>fore//red<seq2seq4repair_space>back" } ) ; item . setForeground ( white ) ; item . setBackground ( red ) ; item = new TableItem ( table , SWT . NONE ) ; item . setText ( new String [ ] { "normal" , "blue<seq2seq4repair_space>foreground" , "red<seq2seq4repair_space>foreground" } ) ; item . setForeground ( 1 , blue ) ; item . setForeground ( 2 , red ) ; item = new TableItem ( table , SWT . NONE ) ; item . setText ( new String [ ] { "normal" , "blue<seq2seq4repair_space>background" , "red<seq2seq4repair_space>background" } ) ; item . setBackground ( 1 , blue ) ; item . setBackground ( 2 , red ) ; item = new TableItem ( table , SWT . NONE ) ; item . setText ( new String [ ] { "white<seq2seq4repair_space>fore//blue<seq2seq4repair_space>back" , "normal" , "white<seq2seq4repair_space>fore//red<seq2seq4repair_space>back" } ) ; item . setForeground ( 0 , white ) ; item . setBackground ( 0 , blue ) ; item . setForeground ( 2 , white ) ; item . setBackground ( 2 , red ) ; column1 . pack ( ) ; column2 . pack ( ) ; column3 . pack ( ) ; shell . pack ( ) ; shell . open ( ) ; while ( ! ( shell . isDisposed ( ) ) ) { if ( ! ( display . readAndDispatch ( ) ) ) display . sleep ( ) ; } display . dispose ( ) ; } }

Fix:
Table table = new Table ( shell , ( ( SWT . BORDER ) | ( SWT . FULL_SELECTION ) ) ) ;
Buggy code:
public class WeaverMessageHandler implements IMessageHandler { private IMessageHandler sink ; private CompilationResult currentlyWeaving ; private Compiler compiler ; public WeaverMessageHandler ( IMessageHandler handler , Compiler compiler ) { } public void setCurrentResult ( CompilationResult result ) { } public boolean handleMessage ( IMessage message ) throws AbortException { if ( ! ( ( message . isError ( ) ) || ( message . isWarning ( ) ) ) ) return sink . handleMessage ( message ) ; ISourceLocation sLoc = message . getSourceLocation ( ) ; CompilationResult problemSource = currentlyWeaving ; if ( problemSource == null ) { if ( sLoc instanceof EclipseSourceLocation ) { problemSource = ( ( EclipseSourceLocation ) ( sLoc ) ) . getCompilationResult ( ) ; } if ( problemSource == null ) { return sink . handleMessage ( message ) ; } } int startPos = getStartPos ( sLoc , problemSource ) ; int endPos = getEndPos ( sLoc , problemSource ) ; int severity = ( message . isError ( ) ) ? ProblemSeverities . Error : ProblemSeverities . Warning ; char [ ] filename = problemSource . fileName ; boolean usedBinarySourceFileName = false ; if ( problemSource . isFromBinarySource ( ) ) { if ( sLoc != null ) { filename = sLoc . getSourceFile ( ) . getPath ( ) . toCharArray ( ) ; usedBinarySourceFileName = true ; } } ReferenceContext referenceContext = findReferenceContextFor ( problemSource ) ; <START_BUG> IProblem problem = compiler . problemReporter . createProblem ( filename , IProblem . Unclassified , new String [ 0 ] , new String [ ] { message . getMessage ( ) } , severity , startPos , endPos , ( sLoc != null ? sLoc . getLine ( ) : 1 ) , referenceContext , problemSource ) ; <END_BUG> IProblem [ ] seeAlso = buildSeeAlsoProblems ( message . getExtraSourceLocations ( ) , problemSource , usedBinarySourceFileName ) ; problem . setSeeAlsoProblems ( seeAlso ) ; if ( ( message . getDetails ( ) ) != null ) { problem . setSupplementaryMessageInfo ( message . getDetails ( ) ) ; } compiler . problemReporter . record ( problem , problemSource , referenceContext ) ; return true ; } public boolean isIgnoring ( Kind kind ) { } private int getStartPos ( ISourceLocation sLoc , CompilationResult result ) { } private int getEndPos ( ISourceLocation sLoc , CompilationResult result ) { } private ReferenceContext findReferenceContextFor ( CompilationResult result ) { } private IProblem [ ] buildSeeAlsoProblems ( List sourceLocations , CompilationResult problemSource , boolean usedBinarySourceFileName ) { } }

Fix:
IProblem problem = compiler . problemReporter . createProblem ( filename , IProblem . Unclassified , new String [ 0 ] , new String [ ] { message . getMessage ( ) } , severity , startPos , endPos , ( sLoc != null ? sLoc . getLine ( ) : 0 ) , referenceContext , problemSource ) ;
Buggy code:
public class GuiTest { @ Test public void TestFrame ( ) { try { <START_BUG> Model model = new Model ( ) ; <END_BUG> ChessFrame chessFrame = new ChessFrame ( ) ; LoginView loginView = new LoginView ( chessFrame ) ; LoadingView connectView = new LoadingView ( chessFrame ) ; GameView gameView = new GameView ( chessFrame ) ; AboutView aboutView = new AboutView ( chessFrame ) ; new controller . LoginController ( model , loginView ) ; new controller . AboutController ( model , aboutView ) ; new controller . GameWindowController ( model , gameView ) ; new controller . ConnectionController ( model , connectView ) ; } catch ( ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e ) { e . printStackTrace ( ) ; } } }

Fix:
Model model = new Model ( "localhost" , 8000 ) ;
Buggy code:
public class Mkdir extends Task { private String dirName ; public void execute ( ) throws BuildException { File dir = project . resolveFile ( dirName ) ; if ( ! ( dir . exists ( ) ) ) { boolean result = dir . mkdirs ( ) ; if ( result == false ) { String msg = ( ( "Directory<seq2seq4repair_space>" + ( dirName ) ) + "<seq2seq4repair_space>creation<seq2seq4repair_space>was<seq2seq4repair_space>not<seq2seq4repair_space>" ) + "succesful<seq2seq4repair_space>for<seq2seq4repair_space>an<seq2seq4repair_space>unknown<seq2seq4repair_space>reason" ; throw new BuildException ( msg ) ; } <START_BUG> project . log ( ( "Created<seq2seq4repair_space>dir:<seq2seq4repair_space>" + ( dir . getAbsolutePath ( ) ) ) ) ; <END_BUG> } } public void setDir ( String dirName ) { } }

Fix:
log ( ( "Created<seq2seq4repair_space>dir:<seq2seq4repair_space>" + ( dir . getAbsolutePath ( ) ) ) ) ;
Buggy code:
public class ExampleView extends ViewPart { public static final String ID = "fr.inria.soctrace.framesoc.tutorials.tool.ExampleView" ; private Text txtTrace ; private Text txtEntity ; private QueryEntity queryEntity ; private ListViewer listViewer ; private ISelectionListener listener = new ISelectionListener ( ) { public void selectionChanged ( IWorkbenchPart sourcepart , ISelection selection ) { } } ; @ Override public void createPartControl ( Composite parent ) { } private void updateView ( Trace trace ) { txtTrace . setText ( trace . getAlias ( ) ) ; List < String > input = new ArrayList < > ( ) ; TraceDBObject traceDB = null ; try { <START_BUG> traceDB = TraceDBObject . openNewIstance ( trace . getDbName ( ) ) ; <END_BUG> if ( queryEntity . equals ( TYPES ) ) { EventTypeQuery etq = new EventTypeQuery ( traceDB ) ; List < EventType > etl = etq . getList ( ) ; for ( EventType et : etl ) { input . add ( et . getName ( ) ) ; } } else if ( queryEntity . equals ( PRODUCERS ) ) { EventProducerQuery epq = new EventProducerQuery ( traceDB ) ; List < EventProducer > epl = epq . getList ( ) ; for ( EventProducer ep : epl ) { input . add ( ep . getName ( ) ) ; } } } catch ( SoCTraceException e ) { e . printStackTrace ( ) ; } finally { DBObject . finalClose ( traceDB ) ; } listViewer . setInput ( input ) ; } public void setInput ( ExampleToolInput exampleInput ) { } @ Override public void setFocus ( ) { } @ Override public void dispose ( ) { } }

Fix:
traceDB = TraceDBObject . openNewInstance ( trace . getDbName ( ) ) ;
Buggy code:
public class ColumnFamilyStoreTest extends CleanupHelper { static byte [ ] bytes1 ; static byte [ ] bytes2 ; @ Test public void testGetColumnWithWrongBF ( ) throws IOException , InterruptedException , ExecutionException { } @ Test public void testEmptyRow ( ) throws Exception { } @ Test public void testSkipStartKey ( ) throws IOException , InterruptedException , ExecutionException { } @ Test public void testIndexScan ( ) throws IOException { } @ Test public void testLargeScan ( ) throws IOException { } @ Test public void testIndexDeletions ( ) throws IOException { } @ Test public void testIndexUpdate ( ) throws IOException { } @ Test public void testIndexCreate ( ) throws IOException , InterruptedException , ExecutionException , ConfigurationException { Table table = Table . open ( "Keyspace1" ) ; RowMutation rm ; rm = new RowMutation ( "Keyspace1" , ByteBufferUtil . bytes ( "k1" ) ) ; rm . add ( new QueryPath ( "Indexed2" , null , ByteBufferUtil . bytes ( "birthdate" ) ) , ByteBufferUtil . bytes ( 1L ) , 1 ) ; rm . apply ( ) ; ColumnFamilyStore cfs = table . getColumnFamilyStore ( "Indexed2" ) ; ColumnDefinition old = cfs . metadata . getColumn_metadata ( ) . get ( ByteBufferUtil . bytes ( "birthdate" ) ) ; <START_BUG> ColumnDefinition cd = new ColumnDefinition ( old . name , old . validator . getClass ( ) . getName ( ) , IndexType . KEYS , "birthdate_index" ) ; <END_BUG> Future < ? > future = cfs . addIndex ( cd ) ; future . get ( ) ; assert ( cfs . getIndexedColumnFamilyStore ( cd . name ) . getSSTables ( ) . size ( ) ) > 0 ; queryBirthdate ( table ) ; ColumnFamilyStore indexedCfs = cfs . getIndexedColumnFamilyStore ( ByteBufferUtil . bytes ( "birthdate" ) ) ; cfs . removeIndex ( ByteBufferUtil . bytes ( "birthdate" ) ) ; assert ! ( indexedCfs . isIndexBuilt ( ) ) ; future = cfs . addIndex ( cd ) ; future . get ( ) ; queryBirthdate ( table ) ; } private void queryBirthdate ( Table table ) throws CharacterCodingException { } @ Test public void testDeleteSuperRowSticksAfterFlush ( ) throws Throwable { } private static void assertRowAndColCount ( int rowCount , int colCount , ByteBuffer sc , boolean isDeleted , Collection < Row > rows ) { } private static String str ( ColumnFamily cf ) { } private static void putColsSuper ( ColumnFamilyStore cfs , DecoratedKey key , ByteBuffer scfName , Column ... cols ) throws Throwable { } private static void putColsStandard ( ColumnFamilyStore cfs , DecoratedKey key , Column ... cols ) throws Throwable { } @ Test public void testDeleteStandardRowSticksAfterFlush ( ) throws Throwable { } private ColumnFamilyStore insertKey1Key2 ( ) throws IOException , InterruptedException , ExecutionException { } @ Test public void testBackupAfterFlush ( ) throws Throwable { } }

Fix:
ColumnDefinition cd = new ColumnDefinition ( old . name , old . getValidator ( ) . getClass ( ) . getName ( ) , IndexType . KEYS , "birthdate_index" ) ;
Buggy code:
public class LoggerAction extends Action { Logger logger = Logger . getLogger ( LoggerAction . class ) ; public void begin ( ExecutionContext ec , String name , Attributes attributes ) { inError = false ; LoggerRepository repository = ( ( LoggerRepository ) ( ec . getObject ( 0 ) ) ) ; String loggerName = attributes . getValue ( NAME_ATTRIBUTE ) ; if ( Option . isEmpty ( loggerName ) ) { inError = true ; String line = ( ( ",<seq2seq4repair_space>around<seq2seq4repair_space>line<seq2seq4repair_space>" + ( getLineNumber ( ec ) ) ) + "<seq2seq4repair_space>column<seq2seq4repair_space>" ) + ( getColumnNumber ( ec ) ) ; String errorMsg = ( "No<seq2seq4repair_space>'name'<seq2seq4repair_space>attribute<seq2seq4repair_space>in<seq2seq4repair_space>element<seq2seq4repair_space>" + name ) + line ; logger . warn ( errorMsg ) ; <START_BUG> ec . addError ( new org . apache . joran . ErrorItem ( errorMsg , ec . getLocator ( ) ) ) ; <END_BUG> return ; } logger . debug ( ( ( "Logger<seq2seq4repair_space>name<seq2seq4repair_space>is<seq2seq4repair_space>[" + loggerName ) + "]." ) ) ; Logger l ; String className = attributes . getValue ( CLASS_ATTRIBUTE ) ; if ( Option . isEmpty ( className ) ) { logger . debug ( "Retreiving<seq2seq4repair_space>an<seq2seq4repair_space>instance<seq2seq4repair_space>of<seq2seq4repair_space>org.apache.log4j.Logger." ) ; l = repository . getLogger ( loggerName ) ; } else { logger . debug ( ( ( "Desired<seq2seq4repair_space>logger<seq2seq4repair_space>sub-class:<seq2seq4repair_space>[" + className ) + ']' ) ) ; try { Class clazz = Loader . loadClass ( className ) ; Method getInstanceMethod = clazz . getMethod ( "getLogger" , ONE_STRING_PARAM ) ; l = ( ( Logger ) ( getInstanceMethod . invoke ( null , new Object [ ] { loggerName } ) ) ) ; } catch ( Exception oops ) { logger . error ( ( ( "Could<seq2seq4repair_space>not<seq2seq4repair_space>retrieve<seq2seq4repair_space>category<seq2seq4repair_space>[" + loggerName ) + "].<seq2seq4repair_space>Reported<seq2seq4repair_space>error<seq2seq4repair_space>follows." ) , oops ) ; return ; } } boolean additivity = OptionConverter . toBoolean ( attributes . getValue ( ADDITIVITY_ATTRIBUTE ) , true ) ; logger . debug ( ( ( ( ( "Setting<seq2seq4repair_space>[" + ( l . getName ( ) ) ) + "]<seq2seq4repair_space>additivity<seq2seq4repair_space>to<seq2seq4repair_space>[" ) + additivity ) + "]." ) ) ; l . setAdditivity ( additivity ) ; logger . debug ( ( ( "Pushing<seq2seq4repair_space>logger<seq2seq4repair_space>named<seq2seq4repair_space>[" + loggerName ) + "]." ) ) ; ec . pushObject ( l ) ; } public void end ( ExecutionContext ec , String e ) { } public void finish ( ExecutionContext ec ) { } }

Fix:
ec . addError ( new ErrorItem ( errorMsg ) ) ;
Buggy code:
public class ActionAddNote extends UMLChangeAction { protected static final int DISTANCE = 80 ; public static ActionAddNote SINGLETON = new ActionAddNote ( ) ; public ActionAddNote ( ) { } public void actionPerformed ( ActionEvent ae ) { } public boolean shouldBeEnabled ( ) { ProjectBrowser pb = ProjectBrowser . TheInstance ; Object target = pb . getDetailsTarget ( ) ; <START_BUG> return ( super . shouldBeEnabled ( ) ) && ( ( target instanceof MClassifier ) || ( target instanceof MStateVertex ) ) ; <END_BUG> } }

Fix:
return ( ( super . shouldBeEnabled ( ) ) && ( target instanceof MModelElement ) ) && ( ( pb . getActiveDiagram ( ) . presentationFor ( target ) ) instanceof FigNode ) ;
Buggy code:
public class RTFTransfer extends ByteArrayTransfer { private static RTFTransfer _instance = new RTFTransfer ( ) ; private static final String TEXT_RTF = "text//rtf" ; private static final int TEXT_RTF_ID = registerType ( RTFTransfer . TEXT_RTF ) ; private static final String TEXT_RTF2 = "TEXT//RTF" ; private static final int TEXT_RTF2_ID = registerType ( RTFTransfer . TEXT_RTF2 ) ; private static final String APPLICATION_RTF = "application//rtf" ; private static final int APPLICATION_RTF_ID = registerType ( RTFTransfer . APPLICATION_RTF ) ; private RTFTransfer ( ) { } public static RTFTransfer getInstance ( ) { } public void javaToNative ( Object object , TransferData transferData ) { transferData . result = 0 ; if ( ( ! ( checkRTF ( object ) ) ) || ( ! ( isSupportedType ( transferData ) ) ) ) { DND . error ( ERROR_INVALID_DATA ) ; } String string = ( ( String ) ( object ) ) ; byte [ ] buffer = Converter . wcsToMbcs ( null , string , true ) ; int pValue = OS . g_malloc ( buffer . length ) ; if ( pValue == 0 ) return ; OS . memmove ( pValue , buffer , buffer . length ) ; <START_BUG> transferData . length = buffer . length ; <END_BUG> transferData . format = 8 ; transferData . pValue = pValue ; transferData . result = 1 ; } public Object nativeToJava ( TransferData transferData ) { } protected int [ ] getTypeIds ( ) { } protected String [ ] getTypeNames ( ) { } boolean checkRTF ( Object object ) { } protected boolean validate ( Object object ) { } }

Fix:
transferData . length = ( buffer . length ) - 1 ;