nus-yam/ex-repair huggingface dataset:
Buggy code:
@ RunWith ( MockitoJUnitRunner . class ) public class SecureGraphUserRepositoryTest { @ Mock private OntologyRepository ontologyRepository ; @ Mock private Concept userConcept ; private AuthorizationRepository authorizationRepository ; private SecureGraphUserRepository secureGraphUserRepository ; @ Mock private UserListenerUtil userListenerUtil ; @ Before public void setup ( ) { InMemoryGraphConfiguration config = new InMemoryGraphConfiguration ( new HashMap ( ) ) ; authorizationRepository = new InMemoryAuthorizationRepository ( ) ; authorizationRepository . addAuthorizationToGraph ( SUPER_USER_VISIBILITY_STRING . toString ( ) ) ; when ( ontologyRepository . getOrCreateConcept ( ( ( Concept ) ( isNull ( ) ) ) , eq ( USER_CONCEPT_IRI ) , anyString ( ) , ( ( File ) ( anyObject ( ) ) ) ) ) . thenReturn ( userConcept ) ; when ( userConcept . getTitle ( ) ) . thenReturn ( USER_CONCEPT_IRI ) ; Configuration lumifyConfiguration = new HashMapConfigurationLoader ( new HashMap ( ) ) . createConfiguration ( ) ; <START_BUG> secureGraphUserRepository = new SecureGraphUserRepository ( lumifyConfiguration , authorizationRepository , InMemoryGraph . create ( config , new org . securegraph . id . UUIDIdGenerator ( config . getConfig ( ) ) , new org . securegraph . search . DefaultSearchIndex ( config . getConfig ( ) ) ) , ontologyRepository , userListenerUtil ) ; <END_BUG> } @ Test public void testAddUser ( ) { } }

Fix:
secureGraphUserRepository = new SecureGraphUserRepository ( lumifyConfiguration , authorizationRepository , InMemoryGraph . create ( config , new org . securegraph . id . UUIDIdGenerator ( config ) , new org . securegraph . search . DefaultSearchIndex ( config ) ) , ontologyRepository , userListenerUtil ) ;
Buggy code:
public class DecisionTreeTests { private DecisionTree tree ; private List < DataVector > testingData ; int dataSize = 20 ; int numOfAttr = 20 ; int numOfClass = 10 ; private double bootstrapRate = 2.0 // 3 ; @ Before public void setup ( ) { } @ Test public void testConstructor ( ) { } @ Test public void testClassify ( ) { <START_BUG> DataVector testRecord = Helper . setupTestingData ( 1 , 10 , 5 ) . get ( 0 ) ; <END_BUG> double result = tree . classify ( testRecord ) ; System . out . println ( ( "Test<seq2seq4repair_space>Result:<seq2seq4repair_space>" + result ) ) ; } @ Test public void printCreatedTree ( ) { } private int getNumOfAttrSample ( List < DataVector > data ) { } No newline ; at end ; of file ; }

Fix:
DataVector testRecord = Helper . setupTestingData ( 1 , numOfAttr , numOfClass ) . get ( 0 ) ;
Buggy code:
public class MergeRecyclerAdapter extends RecyclerView . Adapter { private final List < MergeRecyclerAdapter . LocalAdapter > adapters = new ArrayList < > ( ) ; private int mViewTypeIndex = 0 ; public class LocalAdapter { public final Map < Integer , Integer > mViewTypesMap = new HashMap < > ( ) ; public final Adapter mAdapter ; public int mLocalPosition = 0 ; public int mAdapterIndex = 0 ; public LocalAdapter ( RecyclerView . Adapter adapter ) { } @ Override public int hashCode ( ) { } @ Override public boolean equals ( Object o ) { } } public MergeRecyclerAdapter ( ) { } public void addAdapter ( RecyclerView . Adapter adapter ) { } public void addAdapter ( int index , RecyclerView . Adapter adapter ) { } public ImmutableList < ? extends RecyclerView . Adapter < ? > > getAdapters ( ) { } @ Override public int getItemCount ( ) { } public MergeRecyclerAdapter . LocalAdapter getAdapterOffsetForItem ( final int position ) { } @ Override public long getItemId ( int position ) { } @ Override public int getItemViewType ( int position ) { } @ Override public ViewHolder onCreateViewHolder ( ViewGroup viewGroup , int viewType ) { } @ SuppressWarnings ( "unchecked" ) @ Override public void onBindViewHolder ( RecyclerView . ViewHolder viewHolder , int position ) { } public Optional < Integer > getOffset ( RecyclerView . Adapter < ? > query ) { } private static class ForwardingDataSetObserver extends RecyclerView . AdapterDataObserver { private final Adapter owning ; private final WeakReference < MergeRecyclerAdapter > merge ; ForwardingDataSetObserver ( MergeRecyclerAdapter merge , RecyclerView . Adapter owning ) { } @ Override public void onChanged ( ) { } @ Override public void onItemRangeChanged ( int positionStart , int itemCount ) { } @ Override public void onItemRangeInserted ( int positionStart , int itemCount ) { } @ Override public void onItemRangeRemoved ( int positionStart , int itemCount ) { } @ SuppressWarnings ( "EqualsBetweenInconvertibleTypes" ) private int localToMergedIndex ( MergeRecyclerAdapter base , int index ) { int result = index ; for ( MergeRecyclerAdapter . LocalAdapter adapter : base . adapters ) { if ( adapter . equals ( owning ) ) { break ; } result += adapter . mAdapter . getItemCount ( ) ; } <START_BUG> return result ; <END_BUG> } private void withAdapter ( Action1 < MergeRecyclerAdapter > action ) { } } No newline ; at end ; of file ; }

Fix:
return result + index ;
Buggy code:
public class MetadataManagerTest { @ BeforeClass public void init ( ) { } @ Test public void testAttachCluster ( ) throws Exception { } @ Test public void testAttachConnector ( ) throws Exception { } @ Test public void testCreateCatalog ( ) throws Exception { } @ Test public void testCreateTable ( ) throws Exception { } @ Test public void testCreateConnector ( ) { } @ Test public void testAddExistingConnectorRef ( ) { } @ Test public void testAddNonExistingConnectorRef ( ) { } @ Test public void testSetConnectorStatus ( ) { } @ Test public void testGetConnectorRef ( ) { } @ Test public void testGetAttachedConnectors ( ) { } @ Test public void testCheckConnectorStatus ( ) { } @ Test ( dependsOnMethods = { "testCreateCatalog" } ) public void testGetCatalogs ( ) { String catalog = "catalogTest" ; HELPER . createTestCatalog ( catalog ) ; List < CatalogMetadata > catalogs = MANAGER . getCatalogs ( ) ; <START_BUG> int expectedNumber = 7 ; <END_BUG> assertTrue ( ( ( catalogs . size ( ) ) == expectedNumber ) , ( ( ( ( ( ( "Catalogs<seq2seq4repair_space>size<seq2seq4repair_space>is<seq2seq4repair_space>wrong." + ( System . lineSeparator ( ) ) ) + "Expected:<seq2seq4repair_space>" ) + expectedNumber ) + ( System . lineSeparator ( ) ) ) + "Found:<seq2seq4repair_space>" ) + ( catalogs . size ( ) ) ) ) ; } @ Test public void testGetTables ( ) { } @ Test public void testGetColumns ( ) { } @ Test public void testGetTablesByCatalogName ( ) { } @ Test public void testGetColumnByTable ( ) { } @ Test public void testGetConnectors ( ) { } @ Test public void testGetConnectorNames ( ) { } @ Test ( expectedExceptions = MetadataManagerException . class ) public void testShouldBeUniqueException ( ) { } @ Test ( expectedExceptions = MetadataManagerException . class ) public void testShouldExistException ( ) { } @ Test ( expectedExceptions = MetadataManagerException . class ) public void testCreateCatalogException ( ) { } @ Test ( expectedExceptions = MetadataManagerException . class ) public void testCreateTableException ( ) { } @ Test ( expectedExceptions = MetadataManagerException . class ) public void testCreateClusterException ( ) { } @ Test ( expectedExceptions = MetadataManagerException . class ) public void testCreateDataStoreException ( ) { } @ Test ( expectedExceptions = MetadataManagerException . class ) public void testCreateConnectorException ( ) { } }

Fix:
int expectedNumber = 1 ;
Buggy code:
public abstract class Activator implements Identifiable , ExceptionCallback , Runnable { private EventCaller caller ; private LocalEventManager localEventManager ; private ActivatorManager activatorManager ; private IdentificationManager identificationManager = IdentificationManager . getInstance ( ) ; private int exceptionCount = 0 ; @ SuppressWarnings ( "FieldCanBeLocal" ) private final int exceptionLimit = 100 ; private Context context ; public Activator ( Context context ) { } @ Override public void run ( ) { } public abstract void activatorStarts ( ) throws InterruptedException { } public final void exceptionThrown ( Exception e ) { ( exceptionCount ) ++ ; if ( ( exceptionCount ) < ( exceptionLimit ) ) { if ( ( terminated ( e ) ) && ( ( activatorManager ) != null ) ) { try { Thread . sleep ( 10 ) ; } catch ( InterruptedException e1 ) { <START_BUG> context . logger . getLogger ( ) . warn ( e ) ; <END_BUG> } activatorManager . restartActivator ( this ) ; } } } public abstract boolean terminated ( Exception e ) { } public void unregisterCaller ( ) { } public void fireEvent ( Event event ) throws MultipleEventsException , IllegalArgumentException { } public EventCaller getCaller ( ) { } void registerAllNeededDependencies ( LocalEventManager localEventManager , ActivatorManager activatorManager ) { } private void setLocalEventManager ( LocalEventManager localEventManager ) { } private void setActivatorManager ( ActivatorManager activatorManager ) { } public Context getContext ( ) { } public IdentificationManager getIdentificationManager ( ) { } }

Fix:
context . logger . getLogger ( ) . fatal ( e ) ;
Buggy code:
public class XMLNSDocumentScannerImpl extends XMLDocumentScannerImpl { protected boolean fBindNamespaces ; protected boolean fPerformValidation ; private XMLDTDValidatorFilter fDTDValidator ; private boolean fSawSpace ; public void setDTDValidator ( XMLDTDValidatorFilter dtd ) { } protected boolean scanStartElement ( ) throws IOException , XNIException { } protected void scanStartElementName ( ) throws IOException , XNIException { } protected boolean scanStartElementAfterName ( ) throws IOException , XNIException { } protected void scanAttribute ( XMLAttributesImpl attributes ) throws IOException , XNIException { } protected int scanEndElement ( ) throws IOException , XNIException { } public void reset ( XMLComponentManager componentManager ) throws XMLConfigurationException { } protected Dispatcher createContentDispatcher ( ) { } protected final class NSContentDispatcher extends ContentDispatcher { protected boolean scanRootElementHook ( ) throws IOException , XNIException { <START_BUG> if ( ( ( ( fExternalSubsetResolver ) != null ) && ( ! ( fSeenDoctypeDecl ) ) ) && ( ( fValidation ) || ( fLoadExternalDTD ) ) ) { <END_BUG> scanStartElementName ( ) ; resolveExternalSubsetAndRead ( ) ; reconfigurePipeline ( ) ; if ( scanStartElementAfterName ( ) ) { setScannerState ( SCANNER_STATE_TRAILING_MISC ) ; setDispatcher ( fTrailingMiscDispatcher ) ; return true ; } } else { reconfigurePipeline ( ) ; if ( scanStartElement ( ) ) { setScannerState ( SCANNER_STATE_TRAILING_MISC ) ; setDispatcher ( fTrailingMiscDispatcher ) ; return true ; } } return false ; } private void reconfigurePipeline ( ) { } } }

Fix:
if ( ( ( ( ( fExternalSubsetResolver ) != null ) && ( ! ( fSeenDoctypeDecl ) ) ) && ( ! ( fDisallowDoctype ) ) ) && ( ( fValidation ) || ( fLoadExternalDTD ) ) ) {
Buggy code:
public class CaseStatement extends Statement { public Expression constantExpression ; public CaseLabel targetLabel ; public boolean isEnumConstant ; public CaseStatement ( Expression constantExpression , int sourceEnd , int sourceStart ) { } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { } public StringBuffer printStatement ( int tab , StringBuffer output ) { } public void generateCode ( BlockScope currentScope , CodeStream codeStream ) { } public void resolve ( BlockScope scope ) { } public Constant resolveCase ( BlockScope scope , TypeBinding switchExpressionType , SwitchStatement switchStatement ) { scope . enclosingCase = this ; if ( ( constantExpression ) == null ) { if ( ( switchStatement . defaultCase ) != null ) scope . problemReporter ( ) . duplicateDefaultCase ( this ) ; switchStatement . defaultCase = this ; return Constant . NotAConstant ; } switchStatement . cases [ ( ( switchStatement . caseCount ) ++ ) ] = this ; if ( ( ( switchExpressionType != null ) && ( switchExpressionType . isEnum ( ) ) ) && ( ( constantExpression ) instanceof SingleNameReference ) ) { ( ( SingleNameReference ) ( constantExpression ) ) . setActualReceiverType ( ( ( ReferenceBinding ) ( switchExpressionType ) ) ) ; } TypeBinding caseType = constantExpression . resolveType ( scope ) ; if ( ( caseType == null ) || ( switchExpressionType == null ) ) return Constant . NotAConstant ; if ( ( constantExpression . isConstantValueOfTypeAssignableToType ( caseType , switchExpressionType ) ) || ( caseType . isCompatibleWith ( switchExpressionType ) ) ) { if ( caseType . isEnum ( ) ) { this . isEnumConstant = true ; if ( ( ( ( this . constantExpression . bits ) & ( ASTNode . ParenthesizedMASK ) ) > > ( ASTNode . ParenthesizedSHIFT ) ) != 0 ) { scope . problemReporter ( ) . enumConstantsCannotBeSurroundedByParenthesis ( this . constantExpression ) ; } if ( ( ( constantExpression ) instanceof NameReference ) && ( ( ( constantExpression . bits ) & ( ASTNode . RestrictiveFlagMASK ) ) == ( Binding . FIELD ) ) ) { NameReference reference = ( ( NameReference ) ( constantExpression ) ) ; FieldBinding field = reference . fieldBinding ( ) ; if ( ( ( field . modifiers ) & ( ClassFileConstants . AccEnum ) ) == 0 ) { scope . problemReporter ( ) . enumSwitchCannotTargetField ( reference , field ) ; } else if ( reference instanceof QualifiedNameReference ) { scope . problemReporter ( ) . cannotUseQualifiedEnumConstantInCaseLabel ( reference , field ) ; } <START_BUG> return IntConstant . fromValue ( field . original ( ) . id ) ; <END_BUG> } } else { return constantExpression . constant ; } } else if ( scope . isBoxingCompatibleWith ( caseType , switchExpressionType ) ) { constantExpression . computeConversion ( scope , caseType , switchExpressionType ) ; return constantExpression . constant ; } scope . problemReporter ( ) . typeMismatchError ( caseType , switchExpressionType , constantExpression ) ; return Constant . NotAConstant ; } public void traverse ( ASTVisitor visitor , BlockScope blockScope ) { } }

Fix:
return IntConstant . fromValue ( ( ( field . original ( ) . id ) + 1 ) ) ;
Buggy code:
public class SortElementsOperation extends JavaModelOperation { Comparator comparator ; int [ ] positions ; public SortElementsOperation ( IJavaElement [ ] elements , int [ ] positions , Comparator comparator ) { } protected int getMainAmountOfWork ( ) { } protected void executeOperation ( ) throws JavaModelException { } private String processElement ( ICompilationUnit unit , int [ ] positionsToMap , char [ ] source ) { CompilerOptions options = new CompilerOptions ( unit . getJavaProject ( ) . getOptions ( true ) ) ; SortElementBuilder builder = new SortElementBuilder ( source , positionsToMap , this . comparator , options ) ; <START_BUG> SourceElementParser parser = new SourceElementParser ( builder , ProblemFactory . getProblemFactory ( Locale . getDefault ( ) ) , options , true ) ; <END_BUG> if ( unit . exists ( ) ) { PackageFragment packageFragment = ( ( PackageFragment ) ( unit . getAncestor ( IJavaElement . PACKAGE_FRAGMENT ) ) ) ; char [ ] [ ] expectedPackageName = null ; if ( packageFragment != null ) { expectedPackageName = Util . toCharArrays ( packageFragment . names ) ; } parser . parseCompilationUnit ( new BasicCompilationUnit ( source , expectedPackageName , unit . getElementName ( ) , unit ) , false ) ; } else { parser . parseCompilationUnit ( new BasicCompilationUnit ( source , null , "" , unit . getJavaProject ( ) ) , false ) ; } return builder . getSource ( ) ; } public IJavaModelStatus verify ( ) { } }

Fix:
SourceElementParser parser = new SourceElementParser ( builder , ProblemFactory . getProblemFactory ( Locale . getDefault ( ) ) , options , true , true ) ;
Buggy code:
public class BookDerivative extends AbstractDerivative { protected String collection ; protected String book ; public BookDerivative ( String collection , String book , PrintStream report , Store store ) { } @ Override public void updateChecksum ( boolean force ) throws IOException { } @ Override public void check ( boolean checkBits ) throws IOException { List < String > errors = new ArrayList < > ( ) ; List < String > warnings = new ArrayList < > ( ) ; List < String > loadingErrors = new ArrayList < > ( ) ; BookCollection col = store . loadBookCollection ( collection , loadingErrors ) ; <START_BUG> Book b = ( col == null ) ? null : store . loadBook ( collection , book , loadingErrors ) ; <END_BUG> if ( b != null ) { store . check ( col , b , checkBits , errors , warnings ) ; } else { report . println ( ( ( ( ( "Failed<seq2seq4repair_space>to<seq2seq4repair_space>read<seq2seq4repair_space>book.<seq2seq4repair_space>[" + ( collection ) ) + ":" ) + ( book ) ) + "]" ) ) ; } if ( ! ( errors . isEmpty ( ) ) ) { reportError ( "Errors:<seq2seq4repair_space>" , errors ) ; } if ( ! ( warnings . isEmpty ( ) ) ) { reportError ( "Warnings:<seq2seq4repair_space>" , warnings ) ; } } public void generateAndWriteImageList ( boolean force ) throws IOException { } }

Fix:
Book b = ( col == null ) ? null : store . loadBook ( col , book , loadingErrors ) ;
Buggy code:
public class AddWatchpointActionDelegate extends ActionDelegate implements IObjectActionDelegate , IViewActionDelegate { private IWorkbenchPart fPart ; private ISelection fSelection ; private ToggleBreakpointAdapter fDefaultToggleTarget = new ToggleBreakpointAdapter ( ) ; @ Override public void init ( IViewPart view ) { } private void setView ( IViewPart view ) { } protected IWorkbenchPart getPart ( ) { } @ Override public void selectionChanged ( IAction action , ISelection selection ) { } @ Override public void setActivePart ( IAction action , IWorkbenchPart targetPart ) { } @ Override public void run ( IAction action ) { IToggleBreakpointsTarget toggleTarget = DebugUITools . getToggleBreakpointsTargetManager ( ) . getToggleBreakpointsTarget ( fPart , fSelection ) ; IToggleBreakpointsTargetCExtension cToggleTarget = null ; if ( toggleTarget instanceof IToggleBreakpointsTargetCExtension ) { cToggleTarget = ( ( IToggleBreakpointsTargetCExtension ) ( toggleTarget ) ) ; } else { cToggleTarget = fDefaultToggleTarget ; } try { cToggleTarget . createWatchpointsInteractive ( fPart , fSelection ) ; } catch ( CoreException e ) { <START_BUG> CDebugUIPlugin . errorDialog ( ActionMessages . getString ( "AddWatchpointActionDelegate1.0" ) , e ) ; <END_BUG> } } }

Fix:
CDebugUIPlugin . errorDialog ( ActionMessages . getString ( "AddWatchpointActionDelegate.0" ) , e ) ;
Buggy code:
public class ToolFactory { public static ICodeFormatter createCodeFormatter ( ) { } public static CodeFormatter createCodeFormatter ( Map options ) { } public static ICodeFormatter createDefaultCodeFormatter ( Map options ) { if ( options == null ) options = JavaCore . getOptions ( ) ; <START_BUG> return new org . eclipse . jdt . core . formatter . org . eclipse . jdt . internal . formatter . CodeFormatter ( options ) ; <END_BUG> } public static IClassFileDisassembler createDefaultClassFileDisassembler ( ) { } public static ClassFileBytesDisassembler createDefaultClassFileBytesDisassembler ( ) { } public static IClassFileReader createDefaultClassFileReader ( String fileName , int decodingFlag ) { } public static IClassFileReader createDefaultClassFileReader ( IClassFile classfile , int decodingFlag ) { } public static IClassFileReader createDefaultClassFileReader ( String zipFileName , String zipEntryName , int decodingFlag ) { } public static IScanner createScanner ( boolean tokenizeComments , boolean tokenizeWhiteSpace , boolean assertMode , boolean recordLineSeparator ) { } public static IScanner createScanner ( boolean tokenizeComments , boolean tokenizeWhiteSpace , boolean recordLineSeparator , String sourceLevel ) { } }

Fix:
return new org . eclipse . jdt . internal . formatter . old . CodeFormatter ( options ) ;
Buggy code:
public class SubsystemParserTestCase { @ Test public void testEmptySubsystem ( ) throws Exception { } @ Test public void testEmptyWithAttributesSubsystem ( ) throws Exception { } @ Test public void testSimpleSubsystem ( ) throws Exception { } @ Test public void testSimpleComment ( ) throws Exception { } @ Ignore ( "CDATA<seq2seq4repair_space>not<seq2seq4repair_space>reported<seq2seq4repair_space>propery.<seq2seq4repair_space>Look<seq2seq4repair_space>into<seq2seq4repair_space>if<seq2seq4repair_space>we<seq2seq4repair_space>start<seq2seq4repair_space>using<seq2seq4repair_space>that<seq2seq4repair_space>in<seq2seq4repair_space>our<seq2seq4repair_space>config<seq2seq4repair_space>files" ) @ Test public void testSimpleCData ( ) throws Exception { } @ Test public void testLoggingSubsystem ( ) throws Exception { } @ Test public void testTextAndCommentsSubsystem ( ) throws Exception { } @ Test public void testEjb3Subsystem ( ) throws Exception { } @ Test public void testSupplementDefault ( ) throws Exception { } @ Test public void testSupplementFull ( ) throws Exception { } @ Test public void testSupplementHa ( ) throws Exception { } @ Test public void testSupplementFullHa ( ) throws Exception { } @ Test public void testSimpleWithSeveralAttributeReplacements ( ) throws Exception { } private SubsystemParser testSubsystem ( String xml , String extensionModule ) throws Exception { } private SubsystemParser testSubsystem ( String xml , String extensionModule , String supplement , boolean compareWithOriginal ) throws Exception { } private String marshall ( SubsystemParser subsystemParser ) throws Exception { StringWriter stringWriter = new StringWriter ( ) ; <START_BUG> XMLOutputFactory factory = XMLOutputFactory . newFactory ( ) ; <END_BUG> FormattingXMLStreamWriter writer = new FormattingXMLStreamWriter ( factory . createXMLStreamWriter ( stringWriter ) ) ; try { Assert . assertNotNull ( subsystemParser . getSubsystem ( ) ) ; writer . writeStartDocument ( ) ; subsystemParser . getSubsystem ( ) . marshall ( writer ) ; writer . writeEndDocument ( ) ; } finally { writer . close ( ) ; } System . out . println ( stringWriter . getBuffer ( ) . toString ( ) ) ; return stringWriter . getBuffer ( ) . toString ( ) ; } private String trimOriginalXml ( URL url ) throws Exception { } protected String normalizeXML ( String xml ) throws Exception { } }

Fix:
XMLOutputFactory factory = XMLOutputFactory . newInstance ( ) ;
Buggy code:
public class Cuboid { Vector v1 ; Vector v2 = null ; String world = null ; public String getWorld ( ) { } public Cuboid ( ) { } public void setCuboid ( String line ) { } public void setCuboid ( Vector c1 , Vector c2 , String world ) { } public boolean isInside ( Location l ) { <START_BUG> return ( l . toVector ( ) . isInAABB ( Vector . getMinimum ( v1 , v2 ) . add ( new Vector ( ( - 1 ) , ( - 1 ) , ( - 1 ) ) ) , Vector . getMaximum ( v1 , v2 ) . add ( new Vector ( 1 , 1 , 1 ) ) ) ) && ( l . getWorld ( ) . getName ( ) . equals ( world ) ) ; <END_BUG> } public ArrayList < String > getChunks ( ) { } public Vector [ ] getCorners ( ) { } }

Fix:
return ( l . toVector ( ) . isInAABB ( Vector . getMinimum ( v1 , v2 ) , Vector . getMaximum ( v1 , v2 ) . add ( new Vector ( 1 , 1 , 1 ) ) ) ) && ( l . getWorld ( ) . getName ( ) . equals ( world ) ) ;
Buggy code:
@ RunWith ( Arquillian . class ) @ RunAsClient public class JaxrsAsyncTestCase { @ Deployment ( testable = false ) public static Archive < ? > deploy ( ) { } private static String performCall ( String urlPattern ) throws Exception { <START_BUG> return HttpRequest . get ( ( "http:////localhost:8080//jaxrsnoap//" + urlPattern ) , 5 , TimeUnit . SECONDS ) ; <END_BUG> } @ Test public void testJaxRsWithNoApplication ( ) throws Exception { } }

Fix:
return HttpRequest . get ( ( "http:////localhost:8080//jaxrsnoap//" + urlPattern ) , 10 , TimeUnit . SECONDS ) ;
Buggy code:
public class LogUtils { private static Level logLevel = Level . INFO ; private static Logger logger ; private static Plugin plugin ; public static void initLogUtils ( Plugin plugin ) { } public static void setLogLevel ( Level logLevel ) { } public static void sendLog ( String message ) { } public static void sendLog ( String message , boolean tags ) { } public static void sendLog ( Level level , String message ) { <START_BUG> LogUtils . sendLog ( level , message ) ; <END_BUG> } public static void sendLog ( final Level logLevel , final String message , boolean tags ) { } public static Level getLogLevel ( ) { } }

Fix:
LogUtils . sendLog ( level , message , true ) ;
Buggy code:
public class Frequency implements Serializable { private static final long serialVersionUID = - 3845586908418844111L ; private final TreeMap < Comparable < ? > , Long > freqTable ; public Frequency ( ) { } @ SuppressWarnings ( "unchecked" ) public Frequency ( Comparator < ? > comparator ) { } @ Override public String toString ( ) { NumberFormat nf = NumberFormat . getPercentInstance ( ) ; <START_BUG> StringBuffer outBuffer = new StringBuffer ( ) ; <END_BUG> outBuffer . append ( "Value<seq2seq4repair_space>\t<seq2seq4repair_space>Freq.<seq2seq4repair_space>\t<seq2seq4repair_space>Pct.<seq2seq4repair_space>\t<seq2seq4repair_space>Cum<seq2seq4repair_space>Pct.<seq2seq4repair_space>\n" ) ; Iterator < Comparable < ? > > iter = freqTable . keySet ( ) . iterator ( ) ; while ( iter . hasNext ( ) ) { Comparable < ? > value = iter . next ( ) ; outBuffer . append ( value ) ; outBuffer . append ( '\t' ) ; outBuffer . append ( getCount ( value ) ) ; outBuffer . append ( '\t' ) ; outBuffer . append ( nf . format ( getPct ( value ) ) ) ; outBuffer . append ( '\t' ) ; outBuffer . append ( nf . format ( getCumPct ( value ) ) ) ; outBuffer . append ( '\n' ) ; } return outBuffer . toString ( ) ; } public void addValue ( Comparable < ? > v ) { } public void addValue ( int v ) { } public void addValue ( long v ) { } public void addValue ( char v ) { } public void clear ( ) { } public Iterator < Comparable < ? > > valuesIterator ( ) { } public long getSumFreq ( ) { } public long getCount ( Comparable < ? > v ) { } public long getCount ( int v ) { } public long getCount ( long v ) { } public long getCount ( char v ) { } public double getPct ( Comparable < ? > v ) { } public double getPct ( int v ) { } public double getPct ( long v ) { } public double getPct ( char v ) { } public long getCumFreq ( Comparable < ? > v ) { } public long getCumFreq ( int v ) { } public long getCumFreq ( long v ) { } public long getCumFreq ( char v ) { } public double getCumPct ( Comparable < ? > v ) { } public double getCumPct ( int v ) { } public double getCumPct ( long v ) { } public double getCumPct ( char v ) { } private static class NaturalComparator < T extends Comparable < T > > implements Serializable , Comparator < Comparable < T > > { private static final long serialVersionUID = - 3852193713161395148L ; @ SuppressWarnings ( "unchecked" ) public int compare ( Comparable < T > o1 , Comparable < T > o2 ) { } } @ Override public int hashCode ( ) { } @ Override public boolean equals ( Object obj ) { } }

Fix:
StringBuilder outBuffer = new StringBuilder ( ) ;
Buggy code:
public class ManagementChannel extends ProtocolChannel { private final ManagementChannel . RequestReceiver requestReceiver = new ManagementChannel . RequestReceiver ( ) ; private final ManagementChannel . ResponseReceiver responseReceiver = new ManagementChannel . ResponseReceiver ( ) ; ManagementChannel ( String name , Channel channel ) { } public void setOperationHandler ( final ManagementOperationHandler handler ) { } @ Override protected void doHandle ( final Channel channel , final MessageInputStream message ) { } void executeRequest ( ManagementRequest < ? > request , ManagementResponseHandler < ? > responseHandler ) throws IOException { } void throwFormattedException ( Exception e ) throws IOException { } private class RequestReceiver { private volatile ManagementOperationHandler operationHandler ; private void handleRequest ( final ManagementRequestHeader header , final DataInput input ) throws IOException { } private ManagementRequestHandler getRequestHandler ( final ManagementRequestHeader header ) throws IOException { } private void writeResponseHeader ( final ManagementRequestHeader header , DataOutput output , Exception exception ) throws IOException { } private void setOperationHandler ( final ManagementOperationHandler operationHandler ) { } private String formatException ( Exception exception ) { } } private class ResponseReceiver { private final Map < Integer , ManagementResponseHandler < ? > > responseHandlers = Collections . synchronizedMap ( new HashMap < Integer , ManagementResponseHandler < ? > > ( ) ) ; private void registerResponseHandler ( final int requestId , final ManagementResponseHandler < ? > handler ) throws IOException { } private void handleResponse ( ManagementResponseHeader header , DataInput input ) throws IOException { ManagementResponseHandler < ? > responseHandler = responseHandlers . get ( header . getResponseId ( ) ) ; if ( responseHandler == null ) { throw new IOException ( ( "No<seq2seq4repair_space>response<seq2seq4repair_space>handler<seq2seq4repair_space>for<seq2seq4repair_space>request<seq2seq4repair_space>" + ( header . getResponseId ( ) ) ) ) ; } <START_BUG> responseHandler . setContext ( new ManagementResponseContext ( ManagementChannel . this , header ) ) ; <END_BUG> try { responseHandler . readResponse ( input ) ; expectHeader ( input , RESPONSE_END ) ; } catch ( Exception e ) { throwFormattedException ( e ) ; } } } }

Fix:
responseHandler . setContext ( new ManagementResponseContext ( header ) ) ;
Buggy code:
public class DefaultMachineCycleController < S extends Enum , P extends Payload > implements MachineCycleController { public DefaultMachineCycleController ( StateMachine < S , P > machine ) { } @ Override public boolean shouldProcess ( ) { } @ Override public boolean shouldYield ( ) { } @ Override public long getYieldTime ( ) { <START_BUG> return _yieldTime ; <END_BUG> } public void setYieldTime ( Long yieldTime ) { } private StateMachine < S , P > _machine ; private Long _yieldTime ; }

Fix:
return ( _yieldTime ) != null ? _yieldTime : 100L ;
Buggy code:
public class CommitWorkingCopyOperation extends JavaModelOperation { public CommitWorkingCopyOperation ( ICompilationUnit element , boolean force ) { } protected void executeOperation ( ) throws JavaModelException { } protected CompilationUnit getCompilationUnit ( ) { } protected ISchedulingRule getSchedulingRule ( ) { <START_BUG> return getElementToProcess ( ) . getParent ( ) . getResource ( ) ; <END_BUG> } public IJavaModelStatus verify ( ) { } }

Fix:
return getElementToProcess ( ) . getParent ( ) . getSchedulingRule ( ) ;
Buggy code:
public class SearchActivity extends BaseActivity { private static final String TAG = SearchActivity . class . getSimpleName ( ) ; private static final String KEY_SEARCH_INFOS = "search_infos" ; public static final String KEY_RESULT = "result" ; private OnClickListener mOnClickListener = new View . OnClickListener ( ) { @ Override public void onClick ( View view ) { } } ; private OnConfirmListener mConfirmListener = new WheelWindow . OnConfirmListener ( ) { @ Override public void onConfirm ( String result ) { } } ; @ InjectView ( id . titlebar_leftBtn ) ImageView mMenuBtn ; @ InjectView ( id . titlebar_title ) TextView mTitle ; @ InjectView ( id . search_area ) TextView mSearchArea ; @ InjectView ( id . search_input ) EditText mSearchInput ; @ InjectView ( id . search_clear ) ImageView mSearchClear ; @ InjectView ( id . search_confirm ) Button mSearchConfirm ; @ InjectView ( id . search_list ) ListView mSearchList ; private WheelWindow mWheelWindow ; private String [ ] mSearchInfos ; private boolean mIsFrom ; @ Override protected void onCreate ( Bundle savedInstanceState ) { } @ Override public boolean onKeyDown ( int keyCode , KeyEvent event ) { } private void handleIntent ( ) { } private void initView ( ) { } private void initData ( ) { } private void clearInput ( ) { } private void confirm ( ) { Intent intent = new Intent ( ) ; mSearchInfos [ 3 ] = mSearchInput . getText ( ) . toString ( ) ; <START_BUG> if ( mSearchInfos [ 2 ] . equals ( "请选择" ) ) { <END_BUG> mSearchInfos [ 2 ] = "" ; } intent . putExtra ( SearchActivity . KEY_RESULT , mSearchInfos ) ; setResult ( RESULT_OK , intent ) ; finish ( ) ; } private void showAreaPicker ( ) { } private void updateClearState ( ) { } public static void startSearchActivity ( Activity activity , int requestCode , String [ ] infos ) { } }

Fix:
if ( ( ( mSearchInfos [ 2 ] ) == null ) || ( mSearchInfos [ 2 ] . equals ( "请选择" ) ) ) {
Buggy code:
public class MPushClientTest { private String publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCghPCWCobG8nTD24juwSVataW7iViRxcTkey//B792VZEhuHjQvA3cAJgx2Lv8GnX8NIoShZtoCg3Cx6ecs+VEPD2fBcg2L4JK7xldGpOJ3ONEAyVsLOttXZtNXvyDZRijiErQALMTorcgi79M5uVX9//jMv2Ggb2XAeZhlLD28fHwIDAQAB" ; private String allocServer = "http:////allot.mangguoyisheng.com//" ; @ Test public void testStart ( ) throws Exception { <START_BUG> Client client = ClientConfig . build ( ) . setPublicKey ( publicKey ) . setAllotServer ( allocServer ) . setDeviceId ( "1111111111" ) . setOsName ( "Android" ) . setOsVersion ( "6.0" ) . setClientVersion ( "2.0" ) . setUserId ( "doctor43test" ) . setSessionStorageDir ( "D:\\" ) . setLogger ( new DefaultLogger ( ) ) . setLogEnabled ( true ) . setEnableHttpProxy ( false ) . create ( ) ; <END_BUG> client . start ( ) ; LockSupport . park ( ) ; } No newline ; at end ; of file ; }

Fix:
Client client = ClientConfig . build ( ) . setPublicKey ( publicKey ) . setAllotServer ( allocServer ) . setDeviceId ( "1111111111" ) . setOsName ( "Android" ) . setOsVersion ( "6.0" ) . setClientVersion ( "2.0" ) . setUserId ( "doctor43test" ) . setSessionStorageDir ( getClass ( ) . getResource ( "//" ) . getFile ( ) ) . setLogger ( new DefaultLogger ( ) ) . setLogEnabled ( true ) . setEnableHttpProxy ( false ) . create ( ) ;
Buggy code:
public final class UserInput implements FocusListener , KeyListener { public UserInput ( MapUser_Interface mui , String uName ) { } private MapUser_Interface MapUserAble_ ; private final String userName_ ; private Viewport currentView_ = new AvatarCreationView ( ) ; private final char nullChar = ( ( char ) ( 0 ) ) ; private void setView ( char c ) { boolean taken = false ; if ( ( currentView_ ) instanceof AvatarCreationView ) { if ( ( ( ( c == 'Z' ) || ( c == 'C' ) ) || ( c == 'X' ) ) || ( c == 'V' ) ) { currentView_ = new MapView ( ) ; } } if ( ( currentView_ ) instanceof MapView ) { if ( c == 'i' ) { currentView_ = new StatsView ( userName_ ) ; taken = true ; } } else if ( ( currentView_ ) instanceof StatsView ) { if ( c == 'i' ) { currentView_ = new MapView ( ) ; taken = true ; } } if ( ! taken ) { currentView_ . renderToDisplay ( MapUserAble_ . sendCommandToMap ( userName_ , c , ( ( Viewport . width_ ) // 2 ) , ( ( Viewport . height_ ) // 2 ) ) ) ; } else { <START_BUG> currentView_ . renderToDisplay ( MapUserAble_ . sendCommandToMap ( userName_ , nullChar ) ) ; <END_BUG> } } private void takeTurn ( KeyEvent e ) { } @ Override public void keyPressed ( KeyEvent e ) { } @ Override public void keyReleased ( KeyEvent e ) { } @ Override public void keyTyped ( KeyEvent e ) { } @ Override public void focusGained ( FocusEvent arg0 ) { } @ Override public void focusLost ( FocusEvent arg0 ) { } }

Fix:
currentView_ . renderToDisplay ( MapUserAble_ . sendCommandToMap ( userName_ , nullChar , ( ( Viewport . width_ ) // 2 ) , ( ( Viewport . height_ ) // 2 ) ) ) ;
Buggy code:
class MemoryManagerMXBeanAttributeHandler extends AbstractPlatformMBeanAttributeHandler { static final MemoryManagerMXBeanAttributeHandler INSTANCE = new MemoryManagerMXBeanAttributeHandler ( ) ; private MemoryManagerMXBeanAttributeHandler ( ) { } @ Override protected void executeReadAttribute ( OperationContext context , ModelNode operation ) throws OperationFailedException { final String mmName = PathAddress . pathAddress ( operation . require ( OP_ADDR ) ) . getLastElement ( ) . getValue ( ) ; final String name = operation . require ( NAME ) . asString ( ) ; MemoryManagerMXBean memoryManagerMXBean = null ; for ( MemoryManagerMXBean mbean : ManagementFactory . getMemoryManagerMXBeans ( ) ) { if ( mmName . equals ( PlatformMBeanUtil . escapeMBeanName ( mbean . getName ( ) ) ) ) { memoryManagerMXBean = mbean ; } } if ( memoryManagerMXBean == null ) { throw ROOT_LOGGER . unknownMemoryManager ( mmName ) ; } <START_BUG> if ( ( ( PlatformMBeanUtil . JVM_MAJOR_VERSION ) > 6 ) && ( OBJECT_NAME . getName ( ) . equals ( name ) ) ) { <END_BUG> final String objName = PlatformMBeanUtil . getObjectNameStringWithNameKey ( ManagementFactory . MEMORY_MANAGER_MXBEAN_DOMAIN_TYPE , mmName ) ; context . getResult ( ) . set ( objName ) ; } else if ( NAME . equals ( name ) ) { context . getResult ( ) . set ( PlatformMBeanUtil . escapeMBeanName ( memoryManagerMXBean . getName ( ) ) ) ; } else if ( VALID . getName ( ) . equals ( name ) ) { context . getResult ( ) . set ( memoryManagerMXBean . isValid ( ) ) ; } else if ( MEMORY_POOL_NAMES . equals ( name ) ) { final ModelNode result = context . getResult ( ) ; result . setEmptyList ( ) ; for ( String pool : memoryManagerMXBean . getMemoryPoolNames ( ) ) { result . add ( PlatformMBeanUtil . escapeMBeanName ( pool ) ) ; } } else if ( MEMORY_MANAGER_READ_ATTRIBUTES . contains ( name ) ) { throw ROOT_LOGGER . badReadAttributeImpl ( name ) ; } else { throw unknownAttribute ( operation ) ; } } @ Override protected void executeWriteAttribute ( OperationContext context , ModelNode operation ) throws OperationFailedException { } }

Fix:
if ( OBJECT_NAME . getName ( ) . equals ( name ) ) {
Buggy code:
public class TestUniqueTermCount extends LuceneTestCase { Directory dir ; IndexReader reader ; ArrayList < Integer > expected = new ArrayList < Integer > ( ) ; @ Override public void setUp ( ) throws Exception { } @ Override public void tearDown ( ) throws Exception { } public void test ( ) throws Exception { <START_BUG> NumericDocValues fooNorms = MultiSimpleDocValues . simpleNormValues ( reader , "foo" ) ; <END_BUG> assertNotNull ( fooNorms ) ; for ( int i = 0 ; i < ( reader . maxDoc ( ) ) ; i ++ ) { assertEquals ( expected . get ( i ) . longValue ( ) , fooNorms . get ( i ) ) ; } } private String addValue ( ) { } class TestSimilarity extends Similarity { @ Override public long computeNorm ( FieldInvertState state ) { } @ Override public SimWeight computeWeight ( float queryBoost , CollectionStatistics collectionStats , TermStatistics ... termStats ) { } @ Override public ExactSimScorer exactSimScorer ( SimWeight weight , AtomicReaderContext context ) throws IOException { } @ Override public SloppySimScorer sloppySimScorer ( SimWeight weight , AtomicReaderContext context ) throws IOException { } } }

Fix:
NumericDocValues fooNorms = MultiDocValues . getNormValues ( reader , "foo" ) ;
Buggy code:
public class CusIterator2ArrayList extends AbstractMessageTransformer { @ Override public Object transformMessage ( MuleMessage message , String outputEncoding ) throws TransformerException { ConsumerIterator ci = ( ( ConsumerIterator ) ( message . getPayload ( ) ) ) ; ArrayList tal = null ; ArrayList al = new ArrayList ( ) ; for ( ; ci . hasNext ( ) ; ) al . add ( ( ( Map ) ( ci . next ( ) ) ) ) ; if ( ( message . getInvocationProperty ( "defectCodeName" ) ) != null ) { if ( ( al . size ( ) ) > 0 ) message . setPayload ( al . get ( 0 ) ) ; else { HashMap hm = new HashMap ( ) ; hm . put ( "Id" , "00000000000000000000" ) ; message . setPayload ( hm ) ; } return message ; } String str = null ; if ( ( tal = message . getInvocationProperty ( "CusArrLst" ) ) == null ) { for ( int i = 0 ; i < ( al . size ( ) ) ; i ++ ) { Map m = null ; m = ( ( Map ) ( al . get ( i ) ) ) ; m . remove ( "type" ) ; for ( String n : ( ( String [ ] ) ( m . keySet ( ) . toArray ( new String [ 0 ] ) ) ) ) { if ( n . equals ( "Defect_Code__r" ) ) { m . put ( "DefectCodeName" , ( ( Map ) ( m . get ( "Defect_Code__r" ) ) ) . get ( "Name" ) ) ; m . remove ( "Defect_Code__r" ) ; continue ; } str = n . replace ( "__c" , "" ) . replace ( "_" , "" ) ; if ( ! ( n . equals ( str ) ) ) { m . put ( str , m . get ( n ) ) ; m . remove ( n ) ; } } } message . setInvocationProperty ( "CusArrLst" , al ) ; } else if ( ! ( al . isEmpty ( ) ) ) { Map m = ( ( Map ) ( al . get ( 0 ) ) ) ; Map mm = new HashMap ( ) ; Map ct = ( ( Map ) ( m . get ( "Contact" ) ) ) ; Map rpd = ( ( Map ) ( m . get ( "Respondent_Contact__r" ) ) ) ; ct . remove ( "Id" ) ; ct . remove ( "type" ) ; m . put ( "Claimant" , ct ) ; m . remove ( "Contact" ) ; m . remove ( "Respondent_Contact__r" ) ; m . put ( "Respondent" , mm ) ; <START_BUG> if ( ( red ) != null ) { <END_BUG> mm . put ( "Salutation" , rpd . get ( "Salutation" ) ) ; mm . put ( "FirstName" , rpd . get ( "FirstName" ) ) ; mm . put ( "LastName" , rpd . get ( "LastName" ) ) ; } for ( String n : ( ( String [ ] ) ( m . keySet ( ) . toArray ( new String [ 0 ] ) ) ) ) { if ( n . equals ( "Claimant" ) ) continue ; if ( n . startsWith ( "Licence_Number" ) ) { ct . put ( "LicenseNumber" , m . get ( n ) ) ; m . remove ( n ) ; continue ; } if ( n . startsWith ( "Respondent_" ) ) { str = n . replaceFirst ( "Respondent_" , "" ) . replace ( "Contact_" , "" ) . replace ( "__c" , "" ) . replace ( "_" , "" ) ; mm . put ( str , m . get ( n ) ) ; m . remove ( n ) ; } else { str = n . replaceFirst ( "__c" , "" ) . replace ( "BI_" , "" ) . replace ( "_" , "" ) . replace ( "InspectionTime2" , "ReinspectionTime" ) . replace ( "SiteDetails" , "SiteAddress" ) ; if ( ! ( n . equals ( str ) ) ) { m . put ( str , m . get ( n ) ) ; m . remove ( n ) ; } } } m . put ( "DisputeItems" , tal ) ; message . setPayload ( m ) ; } return message ; } }

Fix:
if ( rpd != null ) {
Buggy code:
public class MapActivity extends Activity implements OnMapReadyCallback { static final LatLng madison = new LatLng ( 43.073052 , ( - 89.40123 ) ) ; private Trip trip ; @ Override protected void onCreate ( Bundle savedInstanceState ) { } @ Override public void onMapReady ( GoogleMap map ) { map . setMapType ( MAP_TYPE_NORMAL ) ; map . setMyLocationEnabled ( true ) ; map . setTrafficEnabled ( true ) ; map . setIndoorEnabled ( true ) ; map . setBuildingsEnabled ( true ) ; map . getUiSettings ( ) . setZoomControlsEnabled ( true ) ; LatLng destination ; if ( ( trip . getGPSPoints ( ) . size ( ) ) >= 2 ) { <START_BUG> destination = new LatLng ( trip . getEndPoint ( ) . values [ 0 ] , trip . getEndPoint ( ) . values [ 0 ] ) ; <END_BUG> } else { destination = MapActivity . madison ; } CameraPosition position = CameraPosition . builder ( ) . target ( destination ) . zoom ( 15.0F ) . bearing ( 0.0F ) . tilt ( 0.0F ) . build ( ) ; map . moveCamera ( CameraUpdateFactory . newCameraPosition ( position ) ) ; plotRoute ( map ) ; } private void plotRoute ( GoogleMap map ) { } }

Fix:
destination = new LatLng ( trip . getEndPoint ( ) . values [ 0 ] , trip . getEndPoint ( ) . values [ 1 ] ) ;
Buggy code:
@ Deprecated public class LowMemoryTupleArrayList < A , B > implements Iterable < Map . Entry < A , B > > { private ArrayList < A > key = new ArrayList < A > ( ) ; private ArrayList < B > value = new ArrayList < B > ( ) ; public void put ( A a , B b ) { } public void clear ( ) { } public int size ( ) { } public Iterator < Map . Entry < A , B > > iterator ( boolean reverse ) { } public Iterator < Map . Entry < A , B > > reverseIterator ( ) { return new Iterator < Map . Entry < A , B > > ( ) { private int index = key . size ( ) ; @ Override public boolean hasNext ( ) { return ( index ) != 0 ; } @ Override public Map . Entry < A , B > next ( ) { <START_BUG> LowMemoryTupleArrayList . Tuple < A , B > result = new LowMemoryTupleArrayList . Tuple < A , B > ( key . get ( index ) , value . get ( index ) ) ; <END_BUG> -- ( index ) ; return result ; } public void remove ( ) { key . remove ( index ) ; value . remove ( index ) ; } } ; } public Iterator < Map . Entry < A , B > > iterator ( ) { } private static class Tuple < A , B > implements Map . Entry < A , B > { private A key ; private B value ; private Tuple ( A key , B value ) { } @ Override public A getKey ( ) { } @ Override public B getValue ( ) { } @ Override public B setValue ( B value ) { } } }

Fix:
LowMemoryTupleArrayList . Tuple < A , B > result = new LowMemoryTupleArrayList . Tuple < A , B > ( key . get ( ( ( index ) - 1 ) ) , value . get ( ( ( index ) - 1 ) ) ) ;
Buggy code:
public abstract class SourceRefElement extends JavaElement implements ISourceReference { public int occurrenceCount = 1 ; protected SourceRefElement ( JavaElement parent ) { } protected void closing ( Object info ) throws JavaModelException { } protected Object createElementInfo ( ) { } public void copy ( IJavaElement container , IJavaElement sibling , String rename , boolean force , IProgressMonitor monitor ) throws JavaModelException { } public void delete ( boolean force , IProgressMonitor monitor ) throws JavaModelException { } public boolean equals ( Object o ) { } public ASTNode findNode ( CompilationUnit ast ) { } protected void generateInfos ( Object info , HashMap newElements , IProgressMonitor pm ) throws JavaModelException { } public ICompilationUnit getCompilationUnit ( ) { <START_BUG> return ( ( JavaElement ) ( getParent ( ) ) ) . getCompilationUnit ( ) ; <END_BUG> } public IResource getCorrespondingResource ( ) throws JavaModelException { } public IJavaElement getHandleFromMemento ( String token , MementoTokenizer memento , WorkingCopyOwner workingCopyOwner ) { } protected void getHandleMemento ( StringBuffer buff ) { } public IJavaElement getHandleUpdatingCountFromMemento ( MementoTokenizer memento , WorkingCopyOwner owner ) { } public int getOccurrenceCount ( ) { } public IOpenable getOpenableParent ( ) { } public IPath getPath ( ) { } public IResource getResource ( ) { } public String getSource ( ) throws JavaModelException { } public ISourceRange getSourceRange ( ) throws JavaModelException { } public IResource getUnderlyingResource ( ) throws JavaModelException { } public boolean hasChildren ( ) throws JavaModelException { } public boolean isStructureKnown ( ) throws JavaModelException { } public void move ( IJavaElement container , IJavaElement sibling , String rename , boolean force , IProgressMonitor monitor ) throws JavaModelException { } public void rename ( String newName , boolean force , IProgressMonitor monitor ) throws JavaModelException { } protected void toStringName ( StringBuffer buffer ) { } }

Fix:
return ( ( ICompilationUnit ) ( getAncestor ( IJavaElement . COMPILATION_UNIT ) ) ) ;
Buggy code:
public class New implements Command { private static Set commands = new HashSet ( ) ; public New ( ) { } public Set getActionNames ( ) { } public void doAction ( ActionEvent e ) { ActionRouter . getInstance ( ) . actionPerformed ( new ActionEvent ( e . getSource ( ) , e . getID ( ) , CheckDirty . CHECK_DIRTY ) ) ; GuiPackage guiPackage = GuiPackage . getInstance ( ) ; if ( guiPackage . isDirty ( ) ) { if ( ( JOptionPane . showConfirmDialog ( GuiPackage . getInstance ( ) . getMainFrame ( ) , JMeterUtils . getResString ( "cancel_new_to_save" ) , JMeterUtils . getResString ( "Save?" ) , JOptionPane . YES_NO_OPTION , JOptionPane . QUESTION_MESSAGE ) ) == ( JOptionPane . YES_OPTION ) ) <START_BUG> ActionRouter . getInstance ( ) . actionPerformed ( new ActionEvent ( e . getSource ( ) , e . getID ( ) , CheckDirty . SAVE_ALL ) ) ; <END_BUG> } guiPackage . getTreeModel ( ) . clearTestPlan ( ) ; guiPackage . getTreeListener ( ) . getJTree ( ) . setSelectionRow ( 1 ) ; Save save = ( ( Save ) ( ActionRouter . getInstance ( ) . getAction ( "save" , "org.apache.jmeter.gui.action.Save" ) ) ) ; save . setTestPlanFile ( null ) ; ActionRouter . getInstance ( ) . actionPerformed ( new ActionEvent ( e . getSource ( ) , e . getID ( ) , CheckDirty . ADD_ALL ) ) ; } }

Fix:
ActionRouter . getInstance ( ) . doActionNow ( new ActionEvent ( e . getSource ( ) , e . getID ( ) , CheckDirty . SAVE_ALL ) ) ;