nus-yam/ex-repair huggingface dataset:
Buggy code:
public class DeferredElementDefinitionImpl extends ElementDefinitionImpl implements DeferredNode { static final long serialVersionUID = 6703238199538041591L ; protected transient int fNodeIndex ; DeferredElementDefinitionImpl ( DeferredDocumentImpl ownerDocument , int nodeIndex ) { } public int getNodeIndex ( ) { } protected void synchronizeData ( ) { } protected void synchronizeChildren ( ) { syncChildren ( false ) ; DeferredDocumentImpl ownerDocument = ( ( DeferredDocumentImpl ) ( this . ownerDocument ) ) ; <START_BUG> attributes = new NamedNodeMapImpl ( ownerDocument , null ) ; <END_BUG> for ( int nodeIndex = ownerDocument . getLastChild ( fNodeIndex ) ; nodeIndex != ( - 1 ) ; nodeIndex = ownerDocument . getPrevSibling ( nodeIndex ) ) { Node attr = ownerDocument . getNodeObject ( nodeIndex ) ; attributes . setNamedItem ( attr ) ; } } }

Fix:
attributes = new NamedNodeMapImpl ( ownerDocument ) ;
Buggy code:
public class PageInstanceMapper extends AbstractMapper { public PageInstanceMapper ( ) { } public IRequestHandler mapRequest ( Request request ) { } public Url mapHandler ( IRequestHandler requestHandler ) { PageComponentInfo info = null ; if ( requestHandler instanceof RenderPageRequestHandler ) { IRequestablePage page = ( ( RenderPageRequestHandler ) ( requestHandler ) ) . getPage ( ) ; PageInfo i = new PageInfo ( page ) ; info = new PageComponentInfo ( i , null ) ; } else if ( requestHandler instanceof ListenerInterfaceRequestHandler ) { ListenerInterfaceRequestHandler handler = ( ( ListenerInterfaceRequestHandler ) ( requestHandler ) ) ; IRequestablePage page = handler . getPage ( ) ; <START_BUG> String componentPath = handler . getComponent ( ) . getPath ( ) ; <END_BUG> RequestListenerInterface listenerInterface = handler . getListenerInterface ( ) ; PageInfo pageInfo = new PageInfo ( page ) ; ComponentInfo componentInfo = new ComponentInfo ( page . getRenderCount ( ) , requestListenerInterfaceToString ( listenerInterface ) , componentPath , handler . getBehaviorIndex ( ) ) ; info = new PageComponentInfo ( pageInfo , componentInfo ) ; } if ( info != null ) { Url url = new Url ( ) ; url . getSegments ( ) . add ( getContext ( ) . getNamespace ( ) ) ; url . getSegments ( ) . add ( getContext ( ) . getPageIdentifier ( ) ) ; encodePageComponentInfo ( url , info ) ; return url ; } else { return null ; } } public int getCompatibilityScore ( Request request ) { } }

Fix:
String componentPath = handler . getComponent ( ) . getPageRelativePath ( ) ;
Buggy code:
public class ModuleContextProcessor implements DeploymentUnitProcessor { public void deploy ( DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext . getDeploymentUnit ( ) ; if ( isEarDeployment ( deploymentUnit ) ) { return ; } final ServiceTarget serviceTarget = phaseContext . getServiceTarget ( ) ; final ServiceName moduleContextServiceName = ContextServiceNameBuilder . module ( deploymentUnit ) ; final RootContextService contextService = new RootContextService ( ) ; serviceTarget . addService ( moduleContextServiceName , contextService ) . install ( ) ; final BinderService < String > moduleNameBinder = new BinderService < String > ( "ModuleName" , Values . immediateValue ( getModuleName ( deploymentUnit ) ) ) ; serviceTarget . addService ( moduleContextServiceName . append ( "ModuleName" ) , moduleNameBinder ) . addDependency ( moduleContextServiceName , Context . class , moduleNameBinder . getContextInjector ( ) ) . install ( ) ; <START_BUG> final ContextService envContextService = new ContextService ( JndiName . of ( "env" ) ) ; <END_BUG> serviceTarget . addService ( moduleContextServiceName . append ( "env" ) , envContextService ) . addDependency ( moduleContextServiceName , Context . class , envContextService . getParentContextInjector ( ) ) . install ( ) ; phaseContext . getDeploymentUnit ( ) . putAttachment ( MODULE_CONTEXT_CONFIG , new NamingContextConfig ( moduleContextServiceName ) ) ; } private String getModuleName ( final DeploymentUnit deploymentUnit ) { } public void undeploy ( DeploymentUnit context ) { } }

Fix:
final ContextService envContextService = new ContextService ( "env" ) ;
Buggy code:
public class TestMultipleCategoryLists extends FacetTestCase { private static final CategoryPath [ ] CATEGORIES = new CategoryPath [ ] { new CategoryPath ( "Author" , "Mark<seq2seq4repair_space>Twain" ) , new CategoryPath ( "Author" , "Stephen<seq2seq4repair_space>King" ) , new CategoryPath ( "Author" , "Kurt<seq2seq4repair_space>Vonnegut" ) , new CategoryPath ( "Band" , "Rock<seq2seq4repair_space>&<seq2seq4repair_space>Pop" , "The<seq2seq4repair_space>Beatles" ) , new CategoryPath ( "Band" , "Punk" , "The<seq2seq4repair_space>Ramones" ) , new CategoryPath ( "Band" , "Rock<seq2seq4repair_space>&<seq2seq4repair_space>Pop" , "U2" ) , new CategoryPath ( "Band" , "Rock<seq2seq4repair_space>&<seq2seq4repair_space>Pop" , "REM" ) , new CategoryPath ( "Band" , "Rock<seq2seq4repair_space>&<seq2seq4repair_space>Pop" , "Dave<seq2seq4repair_space>Matthews<seq2seq4repair_space>Band" ) , new CategoryPath ( "Composer" , "Bach" ) } ; @ Test public void testDefault ( ) throws Exception { } @ Test public void testCustom ( ) throws Exception { } @ Test public void testTwoCustomsSameField ( ) throws Exception { } private void assertOrdinalsExist ( String field , IndexReader ir ) throws IOException { for ( AtomicReaderContext context : ir . leaves ( ) ) { AtomicReader r = context . reader ( ) ; <START_BUG> if ( ( r . docValues ( field ) ) != null ) { <END_BUG> return ; } } fail ( ( "no<seq2seq4repair_space>ordinals<seq2seq4repair_space>found<seq2seq4repair_space>for<seq2seq4repair_space>" + field ) ) ; } @ Test public void testDifferentFieldsAndText ( ) throws Exception { } @ Test public void testSomeSameSomeDifferent ( ) throws Exception { } private void assertCorrectResults ( FacetsCollector facetsCollector ) throws IOException { } private FacetsCollector performSearch ( FacetIndexingParams iParams , TaxonomyReader tr , IndexReader ir , IndexSearcher searcher ) throws IOException { } private void seedIndex ( RandomIndexWriter iw , TaxonomyWriter tw , FacetIndexingParams iParams ) throws IOException { } private static void checkResult ( FacetResultNode sub , String label , double value ) { } }

Fix:
if ( ( r . getBinaryDocValues ( field ) ) != null ) {
Buggy code:
public class ToolBar extends Composite { ToolItem lastFocus ; ToolItem [ ] tabItemList ; ImageList imageList ; public ToolBar ( Composite parent , int style ) { } static int checkStyle ( int style ) { } protected void checkSubclass ( ) { } void createHandle ( int index ) { } public Point computeSize ( int wHint , int hHint , boolean changed ) { } Widget computeTabGroup ( ) { } Widget [ ] computeTabList ( ) { } int eventHandle ( ) { } int enterExitHandle ( ) { } void fixChildren ( Shell newShell , Shell oldShell , Decorations newDecorations , Decorations oldDecorations , Menu [ ] menus ) { } boolean forceFocus ( int focusHandle ) { } public ToolItem getItem ( int index ) { } public ToolItem getItem ( Point point ) { } public int getItemCount ( ) { } public ToolItem [ ] getItems ( ) { } ToolItem [ ] _getItems ( ) { } public int getRowCount ( ) { } ToolItem [ ] _getTabItemList ( ) { } int gtk_key_press_event ( int widget , int eventPtr ) { if ( ! ( hasFocus ( ) ) ) return 0 ; int result = super . gtk_key_press_event ( widget , eventPtr ) ; if ( result != 0 ) return result ; ToolItem [ ] items = getItems ( ) ; int length = items . length ; int index = 0 ; while ( index < length ) { if ( items [ index ] . hasFocus ( ) ) break ; index ++ ; } GdkEventKey gdkEvent = new GdkEventKey ( ) ; OS . memmove ( gdkEvent , eventPtr , sizeof ) ; boolean next = false ; switch ( gdkEvent . keyval ) { case OS . GDK_Up : case OS . GDK_Left : next = false ; break ; case OS . GDK_Down : { if ( ( 0 <= index ) && ( index < length ) ) { ToolItem item = items [ index ] ; if ( ( ( item . style ) & ( SWT . DROP_DOWN ) ) != 0 ) { Event event = new Event ( ) ; event . detail = SWT . ARROW ; int topHandle = item . topHandle ( ) ; event . x = OS . GTK_WIDGET_X ( topHandle ) ; event . y = ( OS . GTK_WIDGET_Y ( topHandle ) ) + ( OS . GTK_WIDGET_HEIGHT ( topHandle ) ) ; if ( ( ( style ) & ( SWT . MIRRORED ) ) != 0 ) event . x = ( ( getClientWidth ( ) ) - ( OS . GTK_WIDGET_WIDTH ( topHandle ) ) ) - ( event . x ) ; <START_BUG> item . postEvent ( Selection , event ) ; <END_BUG> return result ; } } } case OS . GDK_Right : next = true ; break ; default : return result ; } if ( ( ( style ) & ( SWT . MIRRORED ) ) != 0 ) next = ! next ; int start = index ; int offset = ( next ) ? 1 : - 1 ; while ( ( index = ( ( index + offset ) + length ) % length ) != start ) { ToolItem item = items [ index ] ; if ( item . setFocus ( ) ) return result ; } return result ; } boolean hasFocus ( ) { } public int indexOf ( ToolItem item ) { } boolean mnemonicHit ( char key ) { } boolean mnemonicMatch ( char key ) { } void relayout ( ) { } void releaseChildren ( boolean destroy ) { } void releaseWidget ( ) { } void removeControl ( Control control ) { } int setBounds ( int x , int y , int width , int height , boolean move , boolean resize ) { } void setFontDescription ( int font ) { } void setForegroundColor ( GdkColor color ) { } void setTabItemList ( ToolItem [ ] tabList ) { } public void setToolTipText ( String string ) { } }

Fix:
item . sendSelectionEvent ( Selection , event , false ) ;
Buggy code:
public class Filters { private static final BigDecimal ZERO_BIGDECIMAL = new BigDecimal ( 0.0 ) ; private static final BigInteger ZERO_BIGINTEGER = new BigInteger ( "0" ) ; private static final int OP_ADD = 0 ; private static final int OP_SUBTRACT = 1 ; private static final int OP_MULTIPLY = 2 ; private static final int OP_DIVIDE = 3 ; private static final int OP_MOD = 4 ; private static final Localizer _loc = Localizer . forPackage ( Filters . class ) ; public static Class wrap ( Class c ) { } public static Class unwrap ( Class c ) { } public static Class promote ( Class c1 , Class c2 ) { } private static boolean isNonstandardType ( Class c ) { } public static boolean canConvert ( Class c1 , Class c2 , boolean strict ) { c1 = Filters . wrap ( c1 ) ; c2 = Filters . wrap ( c2 ) ; if ( c2 . isAssignableFrom ( c1 ) ) return true ; boolean c1Number = Number . class . isAssignableFrom ( c1 ) ; boolean c2Number = Number . class . isAssignableFrom ( c2 ) ; if ( c1Number && c2Number ) return true ; if ( ( c1Number && ( ( c2 == ( Character . class ) ) || ( ( ! strict ) && ( c2 == ( String . class ) ) ) ) ) || ( c2Number && ( ( c1 == ( Character . class ) ) || ( ( ! strict ) && ( c1 == ( String . class ) ) ) ) ) ) return true ; if ( ( c1 == ( String . class ) ) && ( c2 == ( Character . class ) ) ) return true ; if ( c2 == ( String . class ) ) <START_BUG> return true ; <END_BUG> return false ; } public static Object convert ( Object o , Class type ) { } public static Object add ( Object o1 , Class c1 , Object o2 , Class c2 ) { } public static Object subtract ( Object o1 , Class c1 , Object o2 , Class c2 ) { } public static Object multiply ( Object o1 , Class c1 , Object o2 , Class c2 ) { } public static Object divide ( Object o1 , Class c1 , Object o2 , Class c2 ) { } public static Object mod ( Object o1 , Class c1 , Object o2 , Class c2 ) { } private static Object op ( Object o1 , Class c1 , Object o2 , Class c2 , int op ) { } private static Object op ( int n1 , int n2 , int op ) { } private static Object op ( float n1 , float n2 , int op ) { } private static Object op ( double n1 , double n2 , int op ) { } private static Object op ( long n1 , long n2 , int op ) { } private static Object op ( BigDecimal n1 , BigDecimal n2 , int op ) { } private static Object op ( BigInteger n1 , BigInteger n2 , int op ) { } public static List parseDeclaration ( String dec , char split , String decType ) { } public static List splitExpressions ( String str , char split , int expected ) { } public static List addAccessPathMetaDatas ( List metas , ClassMetaData [ ] path ) { } public static AggregateListener hintToAggregateListener ( Object hint , ClassLoader loader ) { } public static AggregateListener [ ] hintToAggregateListeners ( Object hint , ClassLoader loader ) { } public static FilterListener hintToFilterListener ( Object hint , ClassLoader loader ) { } public static FilterListener [ ] hintToFilterListeners ( Object hint , ClassLoader loader ) { } public static Object hintToGetter ( Object target , String hintKey ) { } public static void hintToSetter ( Object target , String hintKey , Object value ) { } }

Fix:
return ! strict ;
Buggy code:
class ClasspathMultiDirectory extends ClasspathDirectory { String sourcePath ; NameEnvironment nameEnvironment ; ClasspathMultiDirectory ( String sourcePath , String binaryPath ) { } void cleanup ( ) { } public boolean equals ( Object o ) { if ( ( this ) == o ) return true ; if ( ! ( o instanceof ClasspathMultiDirectory ) ) return false ; ClasspathMultiDirectory md = ( ( ClasspathMultiDirectory ) ( o ) ) ; <START_BUG> return ( binaryPath . equals ( md . binaryPath ) ) && ( sourcePath . equals ( md . sourcePath ) ) ; <END_BUG> } NameEnvironmentAnswer findClass ( char [ ] className , char [ ] [ ] packageName ) { } public String toString ( ) { } }

Fix:
return ( binaryPath . equalsIgnoreCase ( md . binaryPath ) ) && ( sourcePath . equalsIgnoreCase ( md . sourcePath ) ) ;
Buggy code:
public class BSPTree < S extends Space > { private SubHyperplane < S > cut ; private BSPTree < S > plus ; private BSPTree < S > minus ; private BSPTree < S > parent ; private Object attribute ; public BSPTree ( ) { } public BSPTree ( final Object attribute ) { } public BSPTree ( final SubHyperplane < S > cut , final BSPTree < S > plus , final BSPTree < S > minus , final Object attribute ) { } public boolean insertCut ( final Hyperplane < S > hyperplane ) { } public BSPTree < S > copySelf ( ) { } public SubHyperplane < S > getCut ( ) { } public BSPTree < S > getPlus ( ) { } public BSPTree < S > getMinus ( ) { } public BSPTree < S > getParent ( ) { } public void setAttribute ( final Object attribute ) { } public Object getAttribute ( ) { } public void visit ( final BSPTreeVisitor < S > visitor ) { } private SubHyperplane < S > fitToCell ( final SubHyperplane < S > sub ) { SubHyperplane < S > s = sub ; <START_BUG> for ( BSPTree < S > tree = this ; ( tree . parent ) != null ; tree = tree . parent ) { <END_BUG> if ( tree == ( tree . parent . plus ) ) { s = s . split ( tree . parent . cut . getHyperplane ( ) ) . getPlus ( ) ; } else { s = s . split ( tree . parent . cut . getHyperplane ( ) ) . getMinus ( ) ; } } return s ; } @ Deprecated public BSPTree < S > getCell ( final Vector < S > point ) { } public BSPTree < S > getCell ( final Point < S > point , final double tolerance ) { } public List < BSPTree < S > > getCloseCuts ( final Point < S > point , final double maxOffset ) { } private void recurseCloseCuts ( final Point < S > point , final double maxOffset , final List < BSPTree < S > > close ) { } private void condense ( ) { } public BSPTree < S > merge ( final BSPTree < S > tree , final BSPTree . LeafMerger < S > leafMerger ) { } private BSPTree < S > merge ( final BSPTree < S > tree , final BSPTree . LeafMerger < S > leafMerger , final BSPTree < S > parentTree , final boolean isPlusChild ) { } public interface LeafMerger < S extends Space > { BSPTree < S > merge ( BSPTree < S > leaf , BSPTree < S > tree , BSPTree < S > parentTree , boolean isPlusChild , boolean leafFromInstance ) { } } public BSPTree < S > split ( final SubHyperplane < S > sub ) { } public void insertInTree ( final BSPTree < S > parentTree , final boolean isPlusChild ) { } public BSPTree < S > pruneAroundConvexCell ( final Object cellAttribute , final Object otherLeafsAttributes , final Object internalAttributes ) { } private void chopOffMinus ( final Hyperplane < S > hyperplane ) { } private void chopOffPlus ( final Hyperplane < S > hyperplane ) { } }

Fix:
for ( BSPTree < S > tree = this ; ( ( tree . parent ) != null ) && ( s != null ) ; tree = tree . parent ) {
Buggy code:
public class RichTextDatabase extends ForwardingDatabase { private static final LoadingCache < String , String > PUBLISHABLES = CacheBuilder . newBuilder ( ) . maximumSize ( 10000 ) . build ( new CacheLoader < String , String > ( ) { @ Override public String load ( String value ) { } } ) ; public < T > T clean ( T object ) { if ( object == null ) { return null ; } State state = State . getInstance ( object ) ; ObjectType type = state . getType ( ) ; if ( type != null ) { for ( ObjectField field : type . getFields ( ) ) { if ( field . as ( ToolUi . class ) . isRichText ( ) ) { String fieldName = field . getInternalName ( ) ; <START_BUG> Object value = state . get ( fieldName ) ; <END_BUG> if ( value instanceof String ) { state . put ( fieldName , RichTextDatabase . PUBLISHABLES . getUnchecked ( ( ( String ) ( value ) ) ) ) ; } } } } return object ; } @ Override public < T > List < T > readAll ( Query < T > query ) { } @ Override public < T > T readFirst ( Query < T > query ) { } @ Override public < T > Iterable < T > readIterable ( Query < T > query , int fetchSize ) { } private class FilteringIterable < E > implements Iterable < E > { private final Iterable < E > delegate ; public FilteringIterable ( Iterable < E > delegate ) { } @ Override public Iterator < E > iterator ( ) { } } private class FilteringIterator < E > implements Closeable , Iterator < E > { private final Iterator < E > delegate ; public FilteringIterator ( Iterator < E > delegate ) { } @ Override public void close ( ) throws IOException { } @ Override public boolean hasNext ( ) { } @ Override public E next ( ) { } @ Override public void remove ( ) { } } @ Override public < T > PaginatedResult < T > readPartial ( Query < T > query , long offset , int limit ) { } @ Deprecated @ Override public < T > List < T > readList ( Query < T > query ) { } }

Fix:
Object value = state . getRawValue ( fieldName ) ;
Buggy code:
class EESubsystemXmlPersister implements XMLStreamConstants , XMLElementWriter < SubsystemMarshallingContext > { public static final EESubsystemXmlPersister INSTANCE = new EESubsystemXmlPersister ( ) ; private EESubsystemXmlPersister ( ) { } @ Override public void writeContent ( XMLExtendedStreamWriter writer , SubsystemMarshallingContext context ) throws XMLStreamException { <START_BUG> context . startSubsystemElement ( EE_3_0 . getUriString ( ) , false ) ; <END_BUG> ModelNode eeSubSystem = context . getModelNode ( ) ; GlobalModulesDefinition . INSTANCE . marshallAsElement ( eeSubSystem , writer ) ; EAR_SUBDEPLOYMENTS_ISOLATED . marshallAsElement ( eeSubSystem , writer ) ; SPEC_DESCRIPTOR_PROPERTY_REPLACEMENT . marshallAsElement ( eeSubSystem , writer ) ; JBOSS_DESCRIPTOR_PROPERTY_REPLACEMENT . marshallAsElement ( eeSubSystem , writer ) ; ANNOTATION_PROPERTY_REPLACEMENT . marshallAsElement ( eeSubSystem , writer ) ; writeConcurrentElement ( writer , eeSubSystem ) ; writeDefaultBindingsElement ( writer , eeSubSystem ) ; writer . writeEndElement ( ) ; } private void writeConcurrentElement ( XMLExtendedStreamWriter writer , ModelNode eeSubSystem ) throws XMLStreamException { } private void writeContextServices ( final XMLExtendedStreamWriter writer , final ModelNode subModel ) throws XMLStreamException { } private void writeManagedThreadFactories ( final XMLExtendedStreamWriter writer , final ModelNode subModel ) throws XMLStreamException { } private void writeManagedExecutorServices ( final XMLExtendedStreamWriter writer , final ModelNode subModel ) throws XMLStreamException { } private void writeManagedScheduledExecutorServices ( final XMLExtendedStreamWriter writer , final ModelNode subModel ) throws XMLStreamException { } private void writeDefaultBindingsElement ( XMLExtendedStreamWriter writer , ModelNode eeSubSystem ) throws XMLStreamException { } }

Fix:
context . startSubsystemElement ( EE_2_0 . getUriString ( ) , false ) ;
Buggy code:
public class TypeParameterPattern extends JavaSearchPattern { protected boolean findDeclarations ; protected boolean findReferences ; protected char [ ] name ; protected ITypeParameter typeParameter ; protected char [ ] declaringMemberName ; protected char [ ] methodDeclaringClassName ; protected char [ ] [ ] methodArgumentTypes ; public TypeParameterPattern ( boolean findDeclarations , boolean findReferences , ITypeParameter typeParameter , int matchRule ) { } public void findIndexMatches ( Index index , IndexQueryRequestor requestor , SearchParticipant participant , IJavaSearchScope scope , IProgressMonitor progressMonitor ) { } protected StringBuffer print ( StringBuffer output ) { if ( this . findDeclarations ) { output . append ( ( this . findReferences ? "TypeParamCombinedPattern:<seq2seq4repair_space>" : "TypeParamDeclarationPattern:<seq2seq4repair_space>" ) ) ; } else { output . append ( "TypeParamReferencePattern:<seq2seq4repair_space>" ) ; } <START_BUG> output . append ( typeParameter . toString ( ) ) ; <END_BUG> return super . print ( output ) ; } }

Fix:
output . append ( this . typeParameter . toString ( ) ) ;
Buggy code:
@ WebServlet ( "//Notes" ) public class NotesServlet extends HttpServlet { private static final long serialVersionUID = 1L ; private static SimpleDateFormat sdf = new SimpleDateFormat ( "h:mm<seq2seq4repair_space>a<seq2seq4repair_space>EEE<seq2seq4repair_space>MMM<seq2seq4repair_space>d,<seq2seq4repair_space>yyyy" ) ; public NotesServlet ( ) { } protected void doGet ( HttpServletRequest request , HttpServletResponse response ) throws IOException , ServletException { try { if ( ( BannerWebHelper . setupLoginBanner ( request , response , true , "Notes" ) ) == true ) return ; if ( ( request . getParameter ( "seen" ) ) != null ) { NoteMessage n = NoteMessage . getById ( Integer . parseInt ( request . getParameter ( "note_id" ) ) ) ; n . view ( ) ; request . setAttribute ( "noteContents" , n . getContents ( ) ) ; request . setAttribute ( "sender" , n . getSender ( ) . getUsername ( ) ) ; request . setAttribute ( "sentDate" , NotesServlet . sdf . format ( n . getSentDate ( ) ) ) ; request . setAttribute ( "subject" , n . getSubject ( ) ) ; <START_BUG> request . setAttribute ( "senderId" , n . getSender ( ) ) ; <END_BUG> } RequestDispatcher rd = request . getRequestDispatcher ( "//WEB-INF//notes.jsp" ) ; Account account = ( ( Account ) ( request . getSession ( ) . getAttribute ( "loggedInAccount" ) ) ) ; request . setAttribute ( "notesHTML" , createNotesHTML ( account ) ) ; rd . forward ( request , response ) ; } catch ( SQLException e1 ) { e1 . printStackTrace ( ) ; } } protected void doPost ( HttpServletRequest request , HttpServletResponse response ) throws IOException , ServletException { } private String createNotesHTML ( Account account ) throws SQLException { } }

Fix:
request . setAttribute ( "senderId" , n . getSender ( ) . getId ( ) ) ;
Buggy code:
public class PrimeFactorGenerator { private final Long value ; private SortedSet < Long > list ; public PrimeFactorGenerator ( Long value ) { } public static boolean isPrime ( Long num ) { for ( int i = 2 ; i <= ( Math . sqrt ( num ) ) ; i ++ ) { if ( ( num % i ) == 0 ) { return false ; } } <START_BUG> return true ; <END_BUG> } public SortedSet < Long > getPrimeFactors ( ) { } private void addToListIfPrime ( Long i ) { } private boolean isPrimeFactor ( Long i ) { } public Long getLargestPrimeFactor ( ) { } }

Fix:
return num != 1 ;
Buggy code:
public interface SocialPlayDB { public Long getCurrentId ( ) { } <START_BUG> public Long insertAccountRecord ( IdentityType iType , String verification , String userName , String identity , boolean activated ) ; <END_BUG> public Long getAccountIdFromHash ( String accountCode ) { } public ActivationRecord getActivationRecord ( long accountId ) { } public boolean updateActivationRecord ( long accountId , ActivationRecord activationRecord ) { } public boolean invite ( long invitorAccount , long inviteeAccount ) { } public boolean keepLive ( long accountId ) { } No newline ; at end ; of file ; }

Fix:
public Long insertAccountRecord ( IdentityType iType , String userName , String identity , boolean activated ) ;
Buggy code:
public class GoElement2DependentElement implements TreeModelPrereqs { public String toString ( ) { <START_BUG> return Localizer . localize ( "Tree" , "Element->Dependent<seq2seq4repair_space>Element" ) ; <END_BUG> } public Object getRoot ( ) { } public void setRoot ( Object r ) { } public Object getChild ( Object parent , int index ) { } public int getChildCount ( Object parent ) { } public int getIndexOfChild ( Object parent , Object child ) { } public boolean isLeaf ( Object node ) { } public void valueForPathChanged ( TreePath path , Object newValue ) { } public void addTreeModelListener ( TreeModelListener l ) { } public void removeTreeModelListener ( TreeModelListener l ) { } public Vector getPrereqs ( ) { } public Vector getProvidedTypes ( ) { } }

Fix:
return Localizer . localize ( "Tree" , "misc.element.dependent-element" ) ;
Buggy code:
public class MemoryManagementTesting extends Activity { @ Override protected void onCreate ( Bundle savedInstanceState ) { super . onCreate ( savedInstanceState ) ; <START_BUG> setContentView ( main ) ; <END_BUG> } }

Fix:
setContentView ( activity_sample ) ;
Buggy code:
@ RunWith ( SpringJUnit4ClassRunner . class ) @ ContextConfiguration ( classes = SlangCompilerSpringConfig . class ) public class CompileOperationTest { @ Rule public ExpectedException exception = ExpectedException . none ( ) ; @ Autowired private SlangCompiler compiler ; @ Test public void testCompileOperationBasic ( ) throws Exception { } @ Test public void wrongOperationName ( ) throws Exception { } @ Test public void testCompileOperationWithData ( ) throws Exception { } @ Test public void testPreCompileOperationBasic ( ) throws Exception { URL resource = getClass ( ) . getResource ( "//operation.yaml" ) ; List < Executable > preCompiledOperations = compiler . preCompile ( SlangSource . fromFile ( resource . toURI ( ) ) ) ; Executable operation = Lambda . selectFirst ( preCompiledOperations , Lambda . having ( Lambda . on ( Executable . class ) . getName ( ) , equalTo ( "check_Weather" ) ) ) ; Assert . assertNotNull ( "preCompiledMetaData<seq2seq4repair_space>is<seq2seq4repair_space>null" , operation ) ; Assert . assertEquals ( "Operation<seq2seq4repair_space>name<seq2seq4repair_space>is<seq2seq4repair_space>wrong" , "check_Weather" , operation . getName ( ) ) ; Assert . assertEquals ( "Operation<seq2seq4repair_space>namespace<seq2seq4repair_space>is<seq2seq4repair_space>wrong" , "user.ops" , operation . getNamespace ( ) ) ; Assert . assertEquals ( "There<seq2seq4repair_space>is<seq2seq4repair_space>a<seq2seq4repair_space>different<seq2seq4repair_space>number<seq2seq4repair_space>of<seq2seq4repair_space>operation<seq2seq4repair_space>inputs<seq2seq4repair_space>than<seq2seq4repair_space>expected" , 1 , operation . getInputs ( ) . size ( ) ) ; <START_BUG> Assert . assertEquals ( "There<seq2seq4repair_space>is<seq2seq4repair_space>a<seq2seq4repair_space>different<seq2seq4repair_space>number<seq2seq4repair_space>of<seq2seq4repair_space>operation<seq2seq4repair_space>outputs<seq2seq4repair_space>than<seq2seq4repair_space>expected" , 1 , operation . getOutputs ( ) . size ( ) ) ; <END_BUG> Assert . assertEquals ( "There<seq2seq4repair_space>is<seq2seq4repair_space>a<seq2seq4repair_space>different<seq2seq4repair_space>number<seq2seq4repair_space>of<seq2seq4repair_space>operation<seq2seq4repair_space>results<seq2seq4repair_space>than<seq2seq4repair_space>expected" , 1 , operation . getResults ( ) . size ( ) ) ; Map < String , SlangFileType > dependencies = operation . getDependencies ( ) ; Assert . assertEquals ( "There<seq2seq4repair_space>is<seq2seq4repair_space>a<seq2seq4repair_space>different<seq2seq4repair_space>number<seq2seq4repair_space>of<seq2seq4repair_space>operation<seq2seq4repair_space>dependencies<seq2seq4repair_space>than<seq2seq4repair_space>expected" , 0 , dependencies . size ( ) ) ; } No newline ; at end ; of file ; }

Fix:
Assert . assertEquals ( "There<seq2seq4repair_space>is<seq2seq4repair_space>a<seq2seq4repair_space>different<seq2seq4repair_space>number<seq2seq4repair_space>of<seq2seq4repair_space>operation<seq2seq4repair_space>outputs<seq2seq4repair_space>than<seq2seq4repair_space>expected" , 2 , operation . getOutputs ( ) . size ( ) ) ;
Buggy code:
public class PropertyPageContributorManager extends ObjectContributorManager { private static PropertyPageContributorManager sharedInstance = null ; private static final Comparator comparer = new Comparator ( ) { private Collator collator = Collator . getInstance ( ) ; public int compare ( Object arg0 , Object arg1 ) { } } ; public PropertyPageContributorManager ( ) { } public boolean contribute ( PropertyPageManager manager , IAdaptable object ) { } public static PropertyPageContributorManager getManager ( ) { } public boolean hasContributorsFor ( Object object ) { } private void loadContributors ( ) { PropertyPagesRegistryReader reader = new PropertyPagesRegistryReader ( this ) ; <START_BUG> reader . registerPropertyPages ( Platform . getPluginRegistry ( ) ) ; <END_BUG> } }

Fix:
reader . registerPropertyPages ( Platform . getExtensionRegistry ( ) ) ;
Buggy code:
public class CollisionTester { public static boolean isColliding ( Circle c1 , Circle c2 ) { } public static boolean isColliding ( Rectangle r1 , Rectangle r2 ) { } public static boolean isColliding ( Circle c , Rectangle r ) { } public static boolean collisionDirection ( Body b1 , Body b2 ) { Rectangle rectA = ( ( Rectangle ) ( b1 ) ) ; Rectangle rectB = ( ( Rectangle ) ( b2 ) ) ; double halfWidthA = ( rectA . getWidth ( ) ) // 2.0 ; <START_BUG> double halfHeightA = ( rectA . getWidth ( ) ) // 2.0 ; <END_BUG> double halfWidthB = ( rectB . getWidth ( ) ) // 2.0 ; double halfHeightB = ( rectB . getHeight ( ) ) // 2.0 ; double centerAX = rectA . getPositionX ( ) ; double centerAY = rectA . getPositionY ( ) ; double centerBX = rectB . getPositionX ( ) ; double centerBY = rectB . getPositionY ( ) ; double distanceX = centerAX - centerBX ; double distanceY = centerAY - centerBY ; double minDistanceX = halfWidthA + halfWidthB ; double minDistanceY = halfHeightA + halfHeightB ; double depthX = ( distanceX > 0 ) ? minDistanceX - distanceX : ( - minDistanceX ) - distanceX ; double depthY = ( distanceY > 0 ) ? minDistanceY - distanceY : ( - minDistanceY ) - distanceY ; return ( Math . abs ( depthY ) ) < ( Math . abs ( depthX ) ) ; } }

Fix:
double halfHeightA = ( rectA . getHeight ( ) ) // 2.0 ;
Buggy code:
public class Find extends Task < ClientContext > { public Find ( ClientContext ctx ) { } @ Override public boolean activate ( ) { } @ Override public void execute ( ) { boolean attacking = false ; NoobCrabs . status = "Finding<seq2seq4repair_space>crab..." ; final Npc nearestRock = npcs . select ( ) . id ( Rocks ) . within ( location . area ( ) ) . nearest ( ) . poll ( ) ; if ( ( players . local ( ) . tile ( ) . distanceTo ( nearestRock ) ) > 1 ) { movement . step ( nearestRock ) ; Condition . wait ( new Callable < Boolean > ( ) { @ Override public Boolean call ( ) throws Exception { <START_BUG> return ( players . local ( ) . tile ( ) . distanceTo ( movement . destination ( ) ) ) < 10 ; <END_BUG> } } ) ; } else if ( ( players . local ( ) . tile ( ) . distanceTo ( nearestRock ) ) <= 1 ) { attacking = Condition . wait ( new Callable < Boolean > ( ) { @ Override public Boolean call ( ) throws Exception { return ( players . local ( ) . inCombat ( ) ) || ( nearestRock . inCombat ( ) ) ; } } , 200 , 10 ) ; } if ( attacking ) switch ( new Random ( ) . nextInt ( 6 ) ) { case 0 : NoobCrabs . status = "Calling<seq2seq4repair_space>crab<seq2seq4repair_space>a<seq2seq4repair_space>punk." ; break ; case 1 : NoobCrabs . status = "Ruining<seq2seq4repair_space>crab's<seq2seq4repair_space>day." ; break ; case 2 : NoobCrabs . status = "Insulting<seq2seq4repair_space>crab's<seq2seq4repair_space>mom." ; break ; case 3 : NoobCrabs . status = "Fucking<seq2seq4repair_space>up<seq2seq4repair_space>crab." ; break ; case 4 : NoobCrabs . status = "Mugging<seq2seq4repair_space>crab." ; break ; case 5 : NoobCrabs . status = "Breaking<seq2seq4repair_space>crab's<seq2seq4repair_space>legs." ; break ; } } }

Fix:
return ( players . local ( ) . tile ( ) . distanceTo ( movement . destination ( ) ) ) < 4 ;
Buggy code:
public class Snippet225 { public static void main ( String [ ] args ) { Display display = new Display ( ) ; Shell shell = new Shell ( display ) ; Image image = null ; final ToolTip tip = new ToolTip ( shell , ( ( SWT . BALLOON ) | ( SWT . ICON_INFORMATION ) ) ) ; tip . setMessage ( "Here<seq2seq4repair_space>is<seq2seq4repair_space>a<seq2seq4repair_space>message<seq2seq4repair_space>for<seq2seq4repair_space>the<seq2seq4repair_space>user.<seq2seq4repair_space>When<seq2seq4repair_space>the<seq2seq4repair_space>message<seq2seq4repair_space>is<seq2seq4repair_space>too<seq2seq4repair_space>long<seq2seq4repair_space>it<seq2seq4repair_space>wraps.<seq2seq4repair_space>I<seq2seq4repair_space>should<seq2seq4repair_space>say<seq2seq4repair_space>something<seq2seq4repair_space>cool<seq2seq4repair_space>but<seq2seq4repair_space>nothing<seq2seq4repair_space>comes<seq2seq4repair_space>to<seq2seq4repair_space>my<seq2seq4repair_space>mind." ) ; Tray tray = display . getSystemTray ( ) ; if ( tray != null ) { TrayItem item = new TrayItem ( tray , SWT . NONE ) ; <START_BUG> image = new Image ( display , Snippet225 . class . getResourceAsStream ( "eclipse.png" ) ) ; <END_BUG> item . setImage ( image ) ; tip . setText ( "Notification<seq2seq4repair_space>from<seq2seq4repair_space>a<seq2seq4repair_space>tray<seq2seq4repair_space>item" ) ; item . setToolTip ( tip ) ; } else { tip . setText ( "Notification<seq2seq4repair_space>from<seq2seq4repair_space>anywhere" ) ; tip . setLocation ( 400 , 400 ) ; } Button button = new Button ( shell , SWT . PUSH ) ; button . setText ( "Press<seq2seq4repair_space>for<seq2seq4repair_space>balloon<seq2seq4repair_space>tip" ) ; button . addListener ( Selection , new Listener ( ) { public void handleEvent ( Event event ) { tip . setVisible ( true ) ; } } ) ; button . pack ( ) ; shell . setBounds ( 50 , 50 , 300 , 200 ) ; shell . open ( ) ; while ( ! ( shell . isDisposed ( ) ) ) { if ( ! ( display . readAndDispatch ( ) ) ) display . sleep ( ) ; } if ( image != null ) image . dispose ( ) ; display . dispose ( ) ; } }

Fix:
image = display . getSystemImage ( ICON_INFORMATION ) ;
Buggy code:
public abstract class AbstractModel < E extends AbstractModel < E > > extends AbstractModelElement < E > { private static final long serialVersionUID = 66064050420378211L ; private transient final Set < AbstractModelElement < ? > > elements = Collections . newSetFromMap ( new IdentityHashMap < AbstractModelElement < ? > , Boolean > ( ) ) ; protected AbstractModel ( ) { } protected final void addElement ( AbstractModelElement < ? > element ) { if ( ! ( elements . add ( element ) ) ) { <START_BUG> throw new IllegalArgumentException ( ( "Domain<seq2seq4repair_space>already<seq2seq4repair_space>contains<seq2seq4repair_space>element<seq2seq4repair_space>" + element ) ) ; <END_BUG> } } protected final boolean removeElement ( AbstractModelElement < ? > element ) { } private static final FieldSetter elementsSetter = FieldSetter . get ( AbstractModel . class , "elements" ) ; private void readObject ( ObjectInputStream ois ) throws IOException , ClassNotFoundException { } protected void deserializeElement ( AbstractModelElement < ? > element ) throws InvalidObjectException { } private void writeObject ( ObjectOutputStream oos ) throws IOException { } }

Fix:
throw new IllegalArgumentException ( ( "Duplicate<seq2seq4repair_space>element<seq2seq4repair_space>" + element ) ) ;
Buggy code:
public class PageCrawler { private final String beginUrl ; private final Downloader downloader ; public PageCrawler ( final String beginUrl ) { } public PageCrawler ( final String beginUrl , final Downloader downloader ) { } private void craw ( final PageVisitor visitor , final Set < String > visitedUrls ) { if ( visitor == null ) { throw new NullPointerException ( "visitor<seq2seq4repair_space>cannot<seq2seq4repair_space>be<seq2seq4repair_space>null" ) ; } if ( ! ( visitedUrls . contains ( beginUrl ) ) ) { visitedUrls . add ( beginUrl ) ; Page page = new Page ( beginUrl , downloader ) ; visitor . visit ( page ) ; List < String > links = page . getLinks ( ) ; for ( String link : links ) { if ( visitor . followUrl ( link ) ) { <START_BUG> new PageCrawler ( link , downloader ) . craw ( visitor ) ; <END_BUG> } } } } public void craw ( final PageVisitor visitor ) { } }

Fix:
new PageCrawler ( link , downloader ) . craw ( visitor , visitedUrls ) ;
Buggy code:
public class CatalogServiceFinder extends ModelFinder < CatalogService > { public CatalogServiceFinder ( DBClientWrapper client ) { } public List < CatalogService > findByCatalogCategory ( URI catalogCategoryId ) { } public Map < URI , Set < String > > findPermissions ( StorageOSUser user , URI tenantId ) { } public Map < URI , Set < String > > findPermissions ( StorageOSUser user , URI tenantId , Set < String > filterBy ) { } public List < CatalogService > findByExecutionWindow ( URI executionWindowId ) { List < CatalogService > results = Lists . newArrayList ( ) ; <START_BUG> List < NamedElement > catalogServiceIds = client . findBy ( CatalogService . class , DEFAULT_EXECUTION_WINDOW_ID , executionWindowId ) ; <END_BUG> if ( catalogServiceIds != null ) { results . addAll ( findByIds ( toURIs ( catalogServiceIds ) ) ) ; } SortedIndexUtils . sort ( results ) ; return results ; } }

Fix:
List < NamedElement > catalogServiceIds = client . findByAlternateId ( CatalogService . class , DEFAULT_EXECUTION_WINDOW_ID , ( ( executionWindowId . toString ( ) ) + ":ExecutionWindow" ) ) ;
Buggy code:
public class JdbcConfigurableDefaultRoleRealm extends JdbcRealm { protected Set < String > getRoleNamesForUser ( Connection conn , String username ) throws SQLException { final Set < String > roleNames = super . getRoleNamesForUser ( conn , username ) ; final Roles . ROLE defaultRole = Config . getInstance ( ) . getDefaultRole ( ) ; <START_BUG> if ( ( ( roleNames . size ( ) ) == 0 ) && ( defaultRole != ( ROLE . NONE ) ) ) { <END_BUG> roleNames . add ( defaultRole . name ( ) . toLowerCase ( ) ) ; } return roleNames ; } }

Fix:
if ( ( ( roleNames . size ( ) ) == 0 ) && ( defaultRole != null ) ) {
Buggy code:
public class QV { PrismAPI prism ; String modelFileName ; String propertiesFileName ; String modelAsString ; String fileName ; private RQVResult [ ] RQVResultsArray ; public QV ( ) { } public RQVResult [ ] runQV ( Object ... parameters ) { } private String realiseProbabilisticModel ( Object ... parameters ) { <START_BUG> StringBuilder model = new StringBuilder ( ) ; <END_BUG> return model . toString ( ) ; } }

Fix:
StringBuilder model = new StringBuilder ( ( ( modelAsString ) + "\n\n////Variables\n" ) ) ;
Buggy code:
public class RecyclerViewAdapter implements ViewAdapter { private final RecyclerView mRecyclerView ; public RecyclerViewAdapter ( RecyclerView recyclerView ) { } @ Override public Context getContext ( ) { } @ Override public int getWidth ( ) { } @ Override public int getChildCount ( ) { } @ Override public void getLocationOnScreen ( int [ ] locations ) { } @ Override public View getChildAt ( int index ) { } @ Override public int getChildPosition ( View child ) { <START_BUG> return mRecyclerView . getChildPosition ( child ) ; <END_BUG> } @ Override public void requestDisallowInterceptTouchEvent ( boolean disallowIntercept ) { } @ Override public void onTouchEvent ( MotionEvent e ) { } @ Override public OnScrollListener makeScrollListener ( final AbsListView . OnScrollListener l ) { } }

Fix:
return mRecyclerView . getChildAdapterPosition ( child ) ;
Buggy code:
public final class LibraryApplication extends WicketExampleApplication { public LibraryApplication ( ) { } protected void init ( ) { <START_BUG> getExceptionSettings ( ) . setThrowExceptionOnMissingResource ( false ) ; <END_BUG> getRequestCycleSettings ( ) . setRenderStrategy ( REDIRECT_TO_RENDER ) ; IAuthorizationStrategy authorizationStrategy = new SimplePageAuthorizationStrategy ( AuthenticatedWebPage . class , SignIn . class ) { protected boolean isAuthorized ( ) { return ( ( LibrarySession ) ( wicket . Session . get ( ) ) ) . isSignedIn ( ) ; } } ; getSecuritySettings ( ) . setAuthorizationStrategy ( authorizationStrategy ) ; } public ISessionFactory getSessionFactory ( ) { } public Class getHomePage ( ) { } }

Fix:
getResourceSettings ( ) . setThrowExceptionOnMissingResource ( false ) ;
Buggy code:
public class BasicRenderer extends DefaultLabelRenderer { private String key ; public BasicRenderer ( String key ) { } public Component getTableCellRendererComponent ( JTable table , Object value , boolean isSelected , boolean hasFocus , int row , int column ) { if ( value == null ) { setText ( "" ) ; return this ; } String str = null ; try { str = ( ( String ) ( ( ( org . columba . mail . gui . table . model . MessageNode ) ( value ) ) . getHeader ( ) . get ( key ) ) ) ; } catch ( ClassCastException ex ) { System . out . println ( ( "headertablecommonrenderer:<seq2seq4repair_space>" + ( ex . getMessage ( ) ) ) ) ; <START_BUG> str = new String ( ) ; <END_BUG> } setText ( str ) ; return super . getTableCellRendererComponent ( table , value , isSelected , hasFocus , row , column ) ; } }

Fix:
str = "" ;
Buggy code:
public final class Classes { public static String name ( final Class c ) { } public static Class relativeClass ( final Class scope , final String path ) throws ClassNotFoundException { } public static Class resolveClass ( final String className ) { <START_BUG> if ( Application . isAttached ( ) ) { <END_BUG> return Application . get ( ) . getApplicationSettings ( ) . getClassResolver ( ) . resolveClass ( className ) ; } try { return Class . forName ( className ) ; } catch ( ClassNotFoundException e ) { e . printStackTrace ( ) ; return null ; } } public static String simpleName ( final Class c ) { } private Classes ( ) { } }

Fix:
if ( Application . exists ( ) ) {
Buggy code:
public class MemberValuePair extends ASTNode { public char [ ] name ; public Expression value ; public MethodBinding binding ; public MemberValuePair ( char [ ] token , int sourceStart , int sourceEnd , Expression value ) { } public StringBuffer print ( int indent , StringBuffer output ) { output . append ( name ) . append ( "<seq2seq4repair_space>=<seq2seq4repair_space>" ) ; <START_BUG> value . print ( indent , output ) ; <END_BUG> return output ; } public void resolveTypeExpecting ( BlockScope scope , TypeBinding requiredType ) { } public void traverse ( ASTVisitor visitor , BlockScope scope ) { } public void traverse ( ASTVisitor visitor , CompilationUnitScope scope ) { } }

Fix:
value . print ( 0 , output ) ;
Buggy code:
final class PNGFileFormat extends FileFormat { static final int SIGNATURE_LENGTH = 8 ; PngDecodingDataStream decodingStream ; PngIhdrChunk headerChunk ; PngPlteChunk paletteChunk ; ImageData imageData ; byte [ ] data ; byte [ ] alphaPalette ; void readSignature ( ) throws IOException { } ImageData [ ] loadFromByteStream ( ) { } void readNextChunk ( PngChunkReader chunkReader ) { } void unloadIntoByteStream ( ImageData p1 ) { <START_BUG> SWT . error ( ERROR_NOT_IMPLEMENTED ) ; <END_BUG> } boolean isFileFormat ( LEDataInputStream stream ) { } byte [ ] validateBitDepth ( byte [ ] data ) { } void setPixelData ( byte [ ] data , ImageData imageData ) { } void setImageDataValues ( byte [ ] data , ImageData imageData ) { } void readPixelData ( PngIdatChunk chunk , PngChunkReader chunkReader ) { } int getAlignedBytesPerRow ( ) { } int getBytesPerRow ( ) { } int getBytesPerPixel ( ) { } int getBytesPerRow ( int rowWidthInPixels ) { } void readInterlaceFrame ( int rowInterval , int columnInterval , int startRow , int startColumn , int frameCount ) { } void readInterlacedImage ( ) { } void fireInterlacedFrameEvent ( int frameCount ) { } void readNonInterlacedImage ( ) { } static void compress16BitDepthTo8BitDepth ( byte [ ] source , int sourceOffset , byte [ ] destination , int destinationOffset , int numberOfValues ) { } static int compress16BitDepthTo8BitDepth ( int value ) { } void filterRow ( byte [ ] row , byte [ ] previousRow , int filterType ) { } }

Fix:
SWT . error ( ERROR_UNSUPPORTED_FORMAT ) ;
Buggy code:
class XidTransactionRollbackTask extends XidTransactionManagementTask { XidTransactionRollbackTask ( final TransactionRequestHandler txRequestHandler , final EJBRemoteTransactionsRepository transactionsRepository , final MarshallerFactory marshallerFactory , final XidTransactionID xidTransactionID , final ChannelAssociation channelAssociation , final short invocationId ) { } @ Override protected void manageTransaction ( ) throws Throwable { <START_BUG> final Transaction transaction = this . transactionsRepository . removeTransaction ( this . xidTransactionID ) ; <END_BUG> if ( transaction == null ) { if ( EJB3_INVOCATION_LOGGER . isDebugEnabled ( ) ) { EJB3_INVOCATION_LOGGER . debug ( ( ( "Not<seq2seq4repair_space>rolling<seq2seq4repair_space>back<seq2seq4repair_space>transaction<seq2seq4repair_space>" + ( this . xidTransactionID ) ) + "<seq2seq4repair_space>as<seq2seq4repair_space>is<seq2seq4repair_space>was<seq2seq4repair_space>not<seq2seq4repair_space>found<seq2seq4repair_space>on<seq2seq4repair_space>the<seq2seq4repair_space>server" ) ) ; } return ; } this . resumeTransaction ( transaction ) ; final Xid xid = this . xidTransactionID . getXid ( ) ; try { SubordinateTransaction subordinateTransaction = SubordinationManager . getTransactionImporter ( ) . getImportedTransaction ( xid ) ; if ( subordinateTransaction == null ) { throw new XAException ( XAException . XAER_INVAL ) ; } if ( subordinateTransaction . activated ( ) ) { subordinateTransaction . doRollback ( ) ; SubordinationManager . getTransactionImporter ( ) . removeImportedTransaction ( xid ) ; } else { throw new XAException ( XAException . XA_RETRY ) ; } } catch ( XAException ex ) { if ( ( ex . errorCode ) != ( XAException . XA_RETRY ) ) { SubordinationManager . getTransactionImporter ( ) . removeImportedTransaction ( xid ) ; } throw ex ; } catch ( final HeuristicRollbackException ex ) { XAException xaException = new XAException ( XAException . XA_HEURRB ) ; xaException . initCause ( ex ) ; throw xaException ; } catch ( HeuristicCommitException ex ) { XAException xaException = new XAException ( XAException . XA_HEURCOM ) ; xaException . initCause ( ex ) ; throw xaException ; } catch ( HeuristicMixedException ex ) { XAException xaException = new XAException ( XAException . XA_HEURMIX ) ; xaException . initCause ( ex ) ; throw xaException ; } catch ( final IllegalStateException ex ) { SubordinationManager . getTransactionImporter ( ) . removeImportedTransaction ( xid ) ; XAException xaException = new XAException ( XAException . XAER_NOTA ) ; xaException . initCause ( ex ) ; throw xaException ; } catch ( SystemException ex ) { SubordinationManager . getTransactionImporter ( ) . removeImportedTransaction ( xid ) ; throw new XAException ( XAException . XAER_RMERR ) ; } finally { this . transactionsRepository . getTransactionManager ( ) . suspend ( ) ; } } }

Fix:
final Transaction transaction = this . transactionsRepository . getImportedTransaction ( this . xidTransactionID ) ;
Buggy code:
public class SocketMessenger implements BluetoothLinker . SocketHandler { private String mMessage ; private SocketMessenger . MessageListener mMessageListener ; public SocketMessenger ( String message , SocketMessenger . MessageListener messageListener ) { } @ Override public void manageConnectedSocket ( BluetoothSocket socket ) { } public static interface MessageListener { public void receiveMessage ( String message ) { } } private class ConnectedThread extends Thread { private final BluetoothSocket mmSocket ; private final InputStream mmInStream ; private final OutputStream mmOutStream ; public ConnectedThread ( BluetoothSocket socket ) { } public void run ( ) { byte [ ] buffer = new byte [ 1024 ] ; <START_BUG> int bytes ; <END_BUG> while ( true ) { try { bytes = mmInStream . read ( buffer ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; break ; } } String readMessage = new String ( buffer , 0 , bytes ) ; Log . d ( "bluetooth" , ( ( "Successfully<seq2seq4repair_space>read<seq2seq4repair_space>message<seq2seq4repair_space>\"" + readMessage ) + "\"" ) ) ; } public void write ( byte [ ] bytes ) { } public void cancel ( ) { } } }

Fix:
int bytes = 0 ;