nus-yam/ex-repair huggingface dataset:
Buggy code:
public class EJBComponentDescriptionTestCase { private static class TestBean { public void someMethod ( ) { } } @ Test public void testNoTxAttrs ( ) throws Exception { final EJBComponentConfiguration configuration = mock ( EJBComponentConfiguration . class ) ; when ( configuration . getTransactionManagementType ( ) ) . thenReturn ( BEAN ) ; final EEModuleDescription moduleDescription = new EEModuleDescription ( "TestApp" , "TestModule" ) ; final ServiceName duServiceName = Services . deploymentUnitName ( "Dummy<seq2seq4repair_space>Deployment<seq2seq4repair_space>Unit" ) ; <START_BUG> final EjbJarDescription ejbJarDescription = new EjbJarDescription ( moduleDescription ) ; <END_BUG> final EJBComponentDescription description = new EJBComponentDescription ( "Test" , "TestBean" , ejbJarDescription , duServiceName ) { @ Override public MethodIntf getMethodIntf ( String viewClassName ) { return MethodIntf . LOCAL ; } @ Override protected void addCurrentInvocationContextFactory ( ViewDescription view ) { } } ; Class < ? > viewClass = EJBComponentDescriptionTestCase . TestBean . class ; Method viewMethod = EJBComponentDescriptionTestCase . TestBean . class . getMethod ( "someMethod" ) ; Method componentMethod = null ; } }

Fix:
final EjbJarDescription ejbJarDescription = new EjbJarDescription ( moduleDescription , false ) ;
Buggy code:
public class Parser { private static String NL = System . getProperty ( "line.separator" ) ; protected InfModel model ; public Parser ( InputStream input ) throws InvalidModelException { } public Parser ( String filename ) throws InvalidModelException { } public Parser ( Model model ) throws InvalidModelException { } public void init ( InputStream input ) throws InvalidModelException { } public void init ( Model model ) throws InvalidModelException { } public static InfModel createInfModel ( ) throws InvalidModelException { } public static InfModel createInfModel ( Model data ) throws InvalidModelException { } public static void setCommonPrefixes ( Model model ) { } public static Model parse ( String filename ) { } public ResultSetRewindable query ( String queryString ) { } public static String getDefaultPrefixes ( ) { } public static String createPrefix ( String name , String URI ) { } public void printStatements ( Resource s , Property p , Resource o ) { } public static String toString ( Model model ) { String result = "" ; for ( StmtIterator i = model . listStatements ( ) ; i . hasNext ( ) ; ) { Statement stmt = i . nextStatement ( ) ; <START_BUG> result += PrintUtil . print ( stmt ) ; <END_BUG> } return result ; } public InfModel getModel ( ) { } public static boolean isValid ( InfModel model ) { } public static boolean isValid ( Model model ) { } public static String getValidationReport ( Model model ) { } public static String getValidationReport ( InfModel model ) { } public boolean isValid ( ) { } public String getValidationReport ( ) { } }

Fix:
result += ( PrintUtil . print ( stmt ) ) + ( Parser . NL ) ;
Buggy code:
public class Files extends AbstractSelectorContainer implements Cloneable , ResourceCollection { private static final Iterator EMPTY_ITERATOR = Collections . EMPTY_SET . iterator ( ) ; private PatternSet defaultPatterns = new PatternSet ( ) ; private Vector additionalPatterns = new Vector ( ) ; private Vector selectors = new Vector ( ) ; private boolean useDefaultExcludes = true ; private boolean caseSensitive = true ; private boolean followSymlinks = true ; private DirectoryScanner ds = null ; public Files ( ) { } protected Files ( Files f ) { } public void setRefid ( Reference r ) throws BuildException { } public synchronized PatternSet createPatternSet ( ) { } public synchronized NameEntry createInclude ( ) { } public synchronized NameEntry createIncludesFile ( ) { } public synchronized NameEntry createExclude ( ) { } public synchronized NameEntry createExcludesFile ( ) { } public synchronized void setIncludes ( String includes ) { } public synchronized void appendIncludes ( String [ ] includes ) { } public synchronized void setExcludes ( String excludes ) { } public synchronized void appendExcludes ( String [ ] excludes ) { } public synchronized void setIncludesfile ( File incl ) throws BuildException { } public synchronized void setExcludesfile ( File excl ) throws BuildException { } public synchronized void setDefaultexcludes ( boolean useDefaultExcludes ) { } public synchronized boolean getDefaultexcludes ( ) { } public synchronized void setCaseSensitive ( boolean caseSensitive ) { } public synchronized boolean isCaseSensitive ( ) { } public synchronized void setFollowSymlinks ( boolean followSymlinks ) { } public synchronized boolean isFollowSymlinks ( ) { } public synchronized Iterator iterator ( ) { if ( isReference ( ) ) { return getRef ( ) . iterator ( ) ; } ensureDirectoryScannerSetup ( ) ; ds . scan ( ) ; int fct = ds . getIncludedFilesCount ( ) ; int dct = ds . getIncludedDirsCount ( ) ; if ( ( fct + dct ) == 0 ) { return Files . EMPTY_ITERATOR ; } <START_BUG> FileResourceIterator result = new FileResourceIterator ( ) ; <END_BUG> if ( fct > 0 ) { result . addFiles ( ds . getIncludedFiles ( ) ) ; } if ( dct > 0 ) { result . addFiles ( ds . getIncludedDirectories ( ) ) ; } return result ; } public synchronized int size ( ) { } public synchronized boolean hasPatterns ( ) { } public synchronized void appendSelector ( FileSelector selector ) { } public String toString ( ) { } public synchronized Object clone ( ) { } public String [ ] mergeIncludes ( Project p ) { } public String [ ] mergeExcludes ( Project p ) { } public synchronized PatternSet mergePatterns ( Project p ) { } public boolean isFilesystemOnly ( ) { } protected Files getRef ( ) { } private synchronized void ensureDirectoryScannerSetup ( ) { } private boolean hasPatterns ( PatternSet ps ) { } }

Fix:
FileResourceIterator result = new FileResourceIterator ( getProject ( ) ) ;
Buggy code:
public class DiagonalMatrix extends AbstractRealMatrix implements Serializable { private static final long serialVersionUID = 20121229L ; private final double [ ] data ; public DiagonalMatrix ( final int dimension ) throws NotStrictlyPositiveException { } public DiagonalMatrix ( final double [ ] d ) { } public DiagonalMatrix ( final double [ ] d , final boolean copyArray ) throws NullArgumentException { } @ Override public RealMatrix createMatrix ( final int rowDimension , final int columnDimension ) throws DimensionMismatchException , NotStrictlyPositiveException { } @ Override <START_BUG> public DiagonalMatrix copy ( ) { <END_BUG> return new DiagonalMatrix ( data ) ; } public DiagonalMatrix add ( final DiagonalMatrix m ) throws MatrixDimensionMismatchException { } public DiagonalMatrix subtract ( final DiagonalMatrix m ) throws MatrixDimensionMismatchException { } public DiagonalMatrix multiply ( final DiagonalMatrix m ) throws DimensionMismatchException { } public RealMatrix multiply ( final RealMatrix m ) throws DimensionMismatchException { } @ Override public double [ ] [ ] getData ( ) { } public double [ ] getDataRef ( ) { } @ Override public double getEntry ( final int row , final int column ) throws OutOfRangeException { } @ Override public void setEntry ( final int row , final int column , final double value ) throws NumberIsTooLargeException , OutOfRangeException { } @ Override public void addToEntry ( final int row , final int column , final double increment ) throws NumberIsTooLargeException , OutOfRangeException { } @ Override public void multiplyEntry ( final int row , final int column , final double factor ) throws OutOfRangeException { } @ Override public int getRowDimension ( ) { } @ Override public int getColumnDimension ( ) { } @ Override public double [ ] operate ( final double [ ] v ) throws DimensionMismatchException { } @ Override public double [ ] preMultiply ( final double [ ] v ) throws DimensionMismatchException { } private void ensureZero ( final double value ) throws NumberIsTooLargeException { } }

Fix:
public RealMatrix copy ( ) {
Buggy code:
public class CXFCorePlugin extends AbstractUIPlugin { public static final String PLUGIN_ID = "org.eclipse.jst.ws.cxf.core" ; public static final String CXF_VERSION_2_0 = "2.0" ; public static final String CXF_VERSION_2_1 = "2.1" ; private static CXFCorePlugin plugin ; private Java2WSPersistentContext java2WSContext ; private WSDL2JavaPersistentContext wsdl2JavaContext ; private Version currentRuntimeVersion ; public CXFCorePlugin ( ) { } public void start ( BundleContext context ) throws Exception { } public void stop ( BundleContext context ) throws Exception { } public static CXFCorePlugin getDefault ( ) { } public Java2WSPersistentContext getJava2WSContext ( ) { } public WSDL2JavaPersistentContext getWSDL2JavaContext ( ) { } public Version getCurrentRuntimeVersion ( ) { } public void setCurrentRuntimeVersion ( Version version ) { } public static void logMessage ( int severity , String message ) { } public static void log ( IStatus status ) { } public static void log ( Throwable exception ) { <START_BUG> CXFCorePlugin . log ( new Status ( IStatus . ERROR , CXFCorePlugin . PLUGIN_ID , exception . getLocalizedMessage ( ) , exception ) ) ; <END_BUG> } }

Fix:
CXFCorePlugin . log ( new Status ( IStatus . ERROR , CXFCorePlugin . PLUGIN_ID , exception . toString ( ) , exception ) ) ;
Buggy code:
public class SavedRequest implements Serializable { private static final String SESSION_KEY = SavedRequest . class . getName ( ) ; private final byte [ ] data ; private final int dataLength ; private final HttpString method ; private final String requestUri ; public SavedRequest ( byte [ ] data , int dataLength , HttpString method , String requestUri ) { } public static void trySaveRequest ( final HttpServerExchange exchange ) { int maxSize = exchange . getConnection ( ) . getUndertowOptions ( ) . get ( MAX_BUFFERED_REQUEST_SIZE , 16384 ) ; if ( maxSize > 0 ) { if ( ! ( exchange . isRequestComplete ( ) ) ) { final long requestContentLength = exchange . getRequestContentLength ( ) ; if ( requestContentLength > maxSize ) { REQUEST_LOGGER . debugf ( "Request<seq2seq4repair_space>to<seq2seq4repair_space>%s<seq2seq4repair_space>was<seq2seq4repair_space>to<seq2seq4repair_space>large<seq2seq4repair_space>to<seq2seq4repair_space>save" , exchange . getRequestURI ( ) ) ; return ; } byte [ ] buffer = new byte [ maxSize ] ; int read = 0 ; int res = 0 ; InputStream in = exchange . getInputStream ( ) ; try { <START_BUG> while ( ( res = in . read ( buffer ) ) > 0 ) { <END_BUG> read += res ; if ( read == maxSize ) { REQUEST_LOGGER . debugf ( "Request<seq2seq4repair_space>to<seq2seq4repair_space>%s<seq2seq4repair_space>was<seq2seq4repair_space>to<seq2seq4repair_space>large<seq2seq4repair_space>to<seq2seq4repair_space>save" , exchange . getRequestURI ( ) ) ; return ; } } SavedRequest request = new SavedRequest ( buffer , read , exchange . getRequestMethod ( ) , exchange . getRequestURI ( ) ) ; final ServletRequestContext sc = exchange . getAttachment ( ATTACHMENT_KEY ) ; HttpSessionImpl session = sc . getCurrentServetContext ( ) . getSession ( exchange , true ) ; Session underlyingSession ; if ( ( System . getSecurityManager ( ) ) == null ) { underlyingSession = session . getSession ( ) ; } else { underlyingSession = AccessController . doPrivileged ( new HttpSessionImpl . UnwrapSessionAction ( session ) ) ; } underlyingSession . setAttribute ( SavedRequest . SESSION_KEY , request ) ; } catch ( IOException e ) { REQUEST_IO_LOGGER . ioException ( e ) ; } } } } public static void tryRestoreRequest ( final HttpServerExchange exchange , HttpSession session ) { } }

Fix:
while ( ( res = in . read ( buffer , read , ( ( buffer . length ) - read ) ) ) > 0 ) {
Buggy code:
public class AVLTreeTest { @ Test public void testInsert ( ) { } @ Test public void testDelete1 ( ) { } @ Test public void testNavigation ( ) { } @ Test public void testSearch ( ) { } @ Test public void testRepetition ( ) { } private AVLTree < Integer > buildTree ( int [ ] array ) { } private int value ( AVLTree < Integer > . Node node ) { <START_BUG> return ( ( Integer ) ( node . getElement ( ) ) ) . intValue ( ) ; <END_BUG> } private void checkOrder ( AVLTree < Integer > tree ) { } }

Fix:
return node . getElement ( ) . intValue ( ) ;
Buggy code:
public class ResolveExpressionOnHostHandler implements OperationStepHandler , DescriptionProvider { public static final String OPERATION_NAME = "resolve-expression-on-domain" ; public static final ResolveExpressionOnHostHandler INSTANCE = new ResolveExpressionOnHostHandler ( ) ; private ResolveExpressionOnHostHandler ( ) { } @ Override public void execute ( OperationContext context , ModelNode operation ) throws OperationFailedException { EXPRESSION . validateOperation ( operation ) ; <START_BUG> context . completeStep ( NOOP_ROLLBACK_HANDLER ) ; <END_BUG> } @ Override public ModelNode getModelDescription ( Locale locale ) { } }

Fix:
context . stepCompleted ( ) ;
Buggy code:
public class StartExamples { public static void main ( String [ ] args ) { Server server = new Server ( ) ; SelectChannelConnector connector = new SelectChannelConnector ( ) ; connector . setPort ( 8080 ) ; server . setConnectors ( new Connector [ ] { connector } ) ; WebAppContext web = new WebAppContext ( ) ; <START_BUG> web . setContextPath ( "//org.apache.wicket-auth-roles-examples" ) ; <END_BUG> web . setWar ( "src//main//webapp" ) ; server . addHandler ( web ) ; try { server . start ( ) ; server . join ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; System . exit ( 100 ) ; } } StartExamples ( ) { } }

Fix:
web . setContextPath ( "//wicket-auth-roles-examples" ) ;
Buggy code:
public class RegisterActivity extends OrmLiteActivity implements Serializable { @ Inject private UserService userService ; @ Inject private CommodityService commodityService ; @ Inject private StockService stockService ; @ Inject private OrderService orderService ; @ Inject private SmsSyncService smsSyncService ; @ Inject private CommodityActionService commodityActionService ; @ Inject private AlertsService alertsService ; @ InjectView ( R . id . textUsername ) private TextView textUsername ; @ InjectView ( R . id . textPassword ) private TextView textPassword ; @ InjectResource ( string . registration_successful_message ) private String registrationSuccessfulMessage ; @ Override protected void onCreate ( Bundle savedInstanceState ) { } private void validateAndRegister ( ) { } protected void doRegister ( final String username , final String password ) { } private class RegisterTask extends AsyncTask < Void , Void , Boolean > { private final String username ; private final String password ; private Exception failureCause ; private ProgressDialog dialog ; public RegisterTask ( String username , String password ) { } @ Override protected void onPreExecute ( ) { } @ Override protected Boolean doInBackground ( Void ... params ) { } @ Override protected void onPostExecute ( Boolean succeeded ) { <START_BUG> if ( ( ( dialog . isShowing ( ) ) && ( ( dialog . getOwnerActivity ( ) ) != null ) ) && ( ! ( dialog . getOwnerActivity ( ) . isFinishing ( ) ) ) ) { <END_BUG> dialog . dismiss ( ) ; } if ( succeeded ) { startActivity ( new android . content . Intent ( getApplicationContext ( ) , HomeActivity . class ) ) ; finish ( ) ; } String toastMessage = ( succeeded ) ? registrationSuccessfulMessage : failureCause . getMessage ( ) ; Toast . makeText ( getApplicationContext ( ) , toastMessage , LENGTH_SHORT ) . show ( ) ; Log . e ( "Registration" , ( toastMessage + "<seq2seq4repair_space>" ) ) ; } } }

Fix:
if ( dialog . isShowing ( ) ) {
Buggy code:
public interface Executor { public abstract RewriteRelation run ( Term cfg , boolean computeGraph ) throws KRunExecutionException { } public abstract SearchResults search ( Integer bound , Integer depth , SearchType searchType , Rule pattern , Term cfg , RuleCompilerSteps compilationInfo ) throws KRunExecutionException { } public abstract RewriteRelation step ( Term cfg , int steps , boolean computeGraph ) throws KRunExecutionException { } public static class Tool implements Transformation < Void , KRunResult > { private final KRunOptions options ; private final Provider < Term > initialConfiguration ; private final Context context ; private final Stopwatch sw ; private final KExceptionManager kem ; private final Executor executor ; private final TermLoader loader ; @ Inject Tool ( KRunOptions options , @ Main Provider < Term > initialConfiguration , Stopwatch sw , @ Main Context context , KExceptionManager kem , @ Main Executor executor , TermLoader loader ) { } public KRunResult run ( Void v , Attributes a ) { } public class SearchPattern { public final RuleCompilerSteps steps ; public final Rule patternRule ; public SearchPattern ( ASTNode pattern ) { } } public SearchResults search ( ) throws KRunExecutionException , ParseFailedException { } public KRunResult execute ( ) throws KRunExecutionException , ParseFailedException { KRunState result ; if ( ( options . depth ) != null ) { result = executor . step ( initialConfiguration . get ( ) , options . depth , false ) . getFinalState ( ) ; sw . printIntermediate ( "Bounded<seq2seq4repair_space>execution<seq2seq4repair_space>total" ) ; } else { <START_BUG> result = executor . run ( initialConfiguration . get ( ) , false ) . getFinalState ( ) ; <END_BUG> sw . printIntermediate ( "Normal<seq2seq4repair_space>execution<seq2seq4repair_space>total" ) ; } ASTNode pattern = pattern ( ) ; if ( ( pattern != null ) && ( ! ( options . search ( ) ) ) ) { Executor . Tool . SearchPattern searchPattern = new Executor . Tool . SearchPattern ( pattern ) ; Term res = result . getRawResult ( ) ; return executor . search ( 1 , 1 , FINAL , searchPattern . patternRule , res , searchPattern . steps ) ; } return result ; } public ASTNode pattern ( ) throws ParseFailedException { } @ Override public String getName ( ) { } } }

Fix:
result = executor . run ( initialConfiguration . get ( ) , falsem ) . getFinalState ( ) ;
Buggy code:
public class BattlePoints extends JavaPlugin { private static String prefix ; protected static BattlePoints instance ; protected static VaultChatBridge vcbridge ; protected static ColorTeamingBridge ctbridge ; private String championName ; private Objective objective ; private BPConfig config ; private BPWebServer webserver ; @ Override public void onEnable ( ) { } @ Override public void onDisable ( ) { } public static BattlePoints getInstance ( ) { } protected static File getConfigFolder ( ) { } public static File getPluginJarFile ( ) { } public File getWebstatsContentFolder ( ) { } public File getWebstatsLogFolder ( ) { } public void changePoints ( Player winner , Player loser ) { BPUserData winnerData = BPUserData . getData ( winner . getName ( ) ) ; BPUserData loserData = BPUserData . getData ( loser . getName ( ) ) ; int lastWinnerPoint = winnerData . point ; int lastLoserPoint = loserData . point ; int rate = config . getEloRating ( lastWinnerPoint , lastLoserPoint ) ; int winnerRate = rate + ( config . getWinOffsetPoint ( ) ) ; int loserRate = rate ; int newWinnerPoint = lastWinnerPoint + winnerRate ; int newLoserPoint = lastLoserPoint - loserRate ; if ( newWinnerPoint > 9999 ) { newWinnerPoint = 9999 ; } if ( newLoserPoint < 0 ) { newLoserPoint = 0 ; } setPoint ( winner . getName ( ) , newWinnerPoint ) ; addKill ( winner . getName ( ) , 1 ) ; setPoint ( loser . getName ( ) , newLoserPoint ) ; <START_BUG> addKill ( loser . getName ( ) , 1 ) ; <END_BUG> winnerData = BPUserData . getData ( winner . getName ( ) ) ; loserData = BPUserData . getData ( loser . getName ( ) ) ; String wColor = config . getColorFromPoint ( winnerData . point ) ; String lColor = config . getColorFromPoint ( loserData . point ) ; broadcastMessage ( "battleResult" , wColor , winner . getName ( ) , winnerData . point , winnerRate , lColor , loser . getName ( ) , loserData . point , loserRate ) ; } public void setPoint ( String name , int point ) { } public int addPoint ( String name , int point ) { } public int addKill ( String name , int amount ) { } public int addDeath ( String name , int amount ) { } public BPConfig getBPConfig ( ) { } protected String getChampionName ( ) { } protected void refreshChampionNameWith ( String name ) { } public void reloadDatas ( ) { } private void broadcastMessage ( String key , Object ... args ) { } private static Score getScore ( Objective objective , String playerName ) { } }

Fix:
addDeath ( loser . getName ( ) , 1 ) ;
Buggy code:
public class PGSqlWriter implements Writer { static Logger LOGGER = LoggerFactory . getLogger ( PGSqlWriter . class ) ; private String dbName ; private String dbUser ; private String dbPassword ; private String dbHost ; private String dbPort ; private Connection con = null ; private PreparedStatement insert_info ; private PreparedStatement insert_data ; private GpxFilter filter ; public PGSqlWriter ( GpxFilter filter , String dbName , String dbUser , String dbPassword , String dbHost , String dbPort ) { } @ Override public void init ( ) { } private void createTable ( ) { Statement create = null ; try { create = con . createStatement ( ) ; <START_BUG> create . addBatch ( "DROP<seq2seq4repair_space>TABLE<seq2seq4repair_space>IF<seq2seq4repair_space>EXISTS<seq2seq4repair_space>gpx_info;" ) ; <END_BUG> create . addBatch ( "CREATE<seq2seq4repair_space>TABLE<seq2seq4repair_space>gpx_info(\"gpx_id\"<seq2seq4repair_space>integer<seq2seq4repair_space>CONSTRAINT<seq2seq4repair_space>\"gpx_info_id\"<seq2seq4repair_space>PRIMARY<seq2seq4repair_space>KEY,\"tags\"<seq2seq4repair_space>text[],\"points\"<seq2seq4repair_space>integer,\"uid\"<seq2seq4repair_space>integer,\"user\"<seq2seq4repair_space>text,\"visibility\"<seq2seq4repair_space>text,\"description\"<seq2seq4repair_space>text);" ) ; create . addBatch ( "DROP<seq2seq4repair_space>TABLE<seq2seq4repair_space>IF<seq2seq4repair_space>EXISTS<seq2seq4repair_space>gpx_data;" ) ; create . addBatch ( "CREATE<seq2seq4repair_space>TABLE<seq2seq4repair_space>gpx_data(\"gpx_id\"<seq2seq4repair_space>integer<seq2seq4repair_space>references<seq2seq4repair_space>gpx_info(gpx_id),\"trk_id\"<seq2seq4repair_space>integer,\"trkseg_id\"<seq2seq4repair_space>integer,\"trkpt_id\"<seq2seq4repair_space>integer,\"timestamp\"<seq2seq4repair_space>text,geom<seq2seq4repair_space>geometry(PointZ,4326),PRIMARY<seq2seq4repair_space>KEY(gpx_id,<seq2seq4repair_space>trk_id,<seq2seq4repair_space>trkseg_id,<seq2seq4repair_space>trkpt_id));" ) ; create . addBatch ( "DROP<seq2seq4repair_space>INDEX<seq2seq4repair_space>IF<seq2seq4repair_space>EXISTS<seq2seq4repair_space>gpx_data_geom_index;" ) ; create . addBatch ( "CREATE<seq2seq4repair_space>INDEX<seq2seq4repair_space>gpx_data_geom_index<seq2seq4repair_space>ON<seq2seq4repair_space>gpx_data<seq2seq4repair_space>USING<seq2seq4repair_space>gist<seq2seq4repair_space>(geom);" ) ; create . executeBatch ( ) ; create . close ( ) ; } catch ( SQLException e ) { e . printStackTrace ( ) ; System . exit ( 1 ) ; } } private void connectToDatabase ( ) { } @ Override public void write ( Gpx gpx , String filename , GpxFile metadata ) { } private void writeGeometry ( Gpx gpx , int gpx_id ) { } private void writeMetadata ( GpxFile metadata ) { } @ Override public void close ( ) { } }

Fix:
create . addBatch ( "DROP<seq2seq4repair_space>TABLE<seq2seq4repair_space>IF<seq2seq4repair_space>EXISTS<seq2seq4repair_space>gpx_info<seq2seq4repair_space>cascade;" ) ;
Buggy code:
abstract class UnaryOp extends AbstractVal implements Val { private final Val _val ; private ClassMetaData _meta = null ; private Class _cast = null ; public UnaryOp ( Val val ) { } protected Val getVal ( ) { } public ClassMetaData getMetaData ( ) { } public void setMetaData ( ClassMetaData meta ) { } public boolean isVariable ( ) { } public Class getType ( ) { } public void setImplicitType ( Class type ) { } public void initialize ( Select sel , JDBCStore store , boolean nullTest ) { } public Joins getJoins ( ) { } public Object toDataStoreValue ( Object val , JDBCStore store ) { } public void select ( Select sel , JDBCStore store , Object [ ] params , boolean pks , JDBCFetchConfiguration fetch ) { } public void selectColumns ( Select sel , JDBCStore store , Object [ ] params , boolean pks , JDBCFetchConfiguration fetch ) { } public void groupBy ( Select sel , JDBCStore store , Object [ ] params , JDBCFetchConfiguration fetch ) { <START_BUG> sel . groupBy ( newSQLBuffer ( sel , store , params , fetch ) , false ) ; <END_BUG> } public void orderBy ( Select sel , JDBCStore store , Object [ ] params , boolean asc , JDBCFetchConfiguration fetch ) { } private SQLBuffer newSQLBuffer ( Select sel , JDBCStore store , Object [ ] params , JDBCFetchConfiguration fetch ) { } public Object load ( Result res , JDBCStore store , JDBCFetchConfiguration fetch ) throws SQLException { } public boolean hasVariable ( Variable var ) { } public void calculateValue ( Select sel , JDBCStore store , Object [ ] params , Val other , JDBCFetchConfiguration fetch ) { } public void clearParameters ( ) { } public int length ( ) { } public void appendTo ( SQLBuffer sql , int index , Select sel , JDBCStore store , Object [ ] params , JDBCFetchConfiguration fetch ) { } protected boolean isAggregate ( ) { } protected Class getType ( Class c ) { } protected abstract String getOperator ( ) { } }

Fix:
sel . groupBy ( newSQLBuffer ( sel , store , params , fetch ) ) ;
Buggy code:
public class BcelWorld extends World implements Repository { private ClassPathManager classPath ; private Repository delegate ; public BcelWorld ( ) { } public BcelWorld ( String cp ) { } private static List makeDefaultClasspath ( String cp ) { } private static List getPathEntries ( String s ) { } public BcelWorld ( List classPath , IMessageHandler handler , ICrossReferenceHandler xrefHandler ) { } public BcelWorld ( ClassPathManager cpm , IMessageHandler handler , ICrossReferenceHandler xrefHandler ) { } public BcelWorld ( ClassLoader loader , IMessageHandler handler , ICrossReferenceHandler xrefHandler ) { } public void addPath ( String name ) { } public Advice shadowMunger ( String str , int extraFlag ) { } private String [ ] parseIds ( String str ) { } public static Type makeBcelType ( UnresolvedType type ) { <START_BUG> return Type . getType ( type . getSignature ( ) ) ; <END_BUG> } static Type [ ] makeBcelTypes ( UnresolvedType [ ] types ) { } public static UnresolvedType fromBcel ( Type t ) { } static UnresolvedType [ ] fromBcel ( Type [ ] ts ) { } public ResolvedType resolve ( Type t ) { } protected ReferenceTypeDelegate resolveDelegate ( ReferenceType ty ) { } protected BcelObjectType makeBcelObjectType ( ReferenceType resolvedTypeX , JavaClass jc , boolean exposedToWeaver ) { } private JavaClass lookupJavaClass ( ClassPathManager classPath , String name ) { } public BcelObjectType addSourceObjectType ( JavaClass jc ) { } void deleteSourceObjectType ( UnresolvedType ty ) { } public static Member makeFieldJoinPointSignature ( LazyClassGen cg , FieldInstruction fi ) { } public Member makeJoinPointSignature ( LazyMethodGen mg ) { } public Member makeJoinPointSignatureFromMethod ( LazyMethodGen mg , MemberImpl . Kind kind ) { } public Member makeJoinPointSignatureForMethodInvocation ( LazyClassGen cg , InvokeInstruction ii ) { } public static Member makeMungerMethodSignature ( JavaClass javaClass , Method method ) { } private static final String [ ] ZERO_STRINGS = new String [ 0 ] ; public String toString ( ) { } public Advice createAdviceMunger ( AjAttribute . AdviceAttribute attribute , Pointcut pointcut , Member signature ) { } public ConcreteTypeMunger concreteTypeMunger ( ResolvedTypeMunger munger , ResolvedType aspectType ) { } public ConcreteTypeMunger makeCflowStackFieldAdder ( ResolvedMember cflowField ) { } public ConcreteTypeMunger makeCflowCounterFieldAdder ( ResolvedMember cflowField ) { } public ConcreteTypeMunger makePerClauseAspect ( ResolvedType aspect , PerClause . Kind kind ) { } public static BcelObjectType getBcelObjectType ( ResolvedType concreteAspect ) { } public void tidyUp ( ) { } public JavaClass findClass ( String className ) { } public JavaClass loadClass ( String className ) throws ClassNotFoundException { } public void storeClass ( JavaClass clazz ) { } public void removeClass ( JavaClass clazz ) { } public JavaClass loadClass ( Class clazz ) throws ClassNotFoundException { } public void clear ( ) { } }

Fix:
return Type . getType ( type . getErasureSignature ( ) ) ;
Buggy code:
public abstract class CommonDeployableContainer < T extends CommonContainerConfiguration > implements DeployableContainer < T > { private final Logger log = Logger . getLogger ( CommonDeployableContainer . class . getName ( ) ) ; private T containerConfig ; private ManagementClient managementClient ; @ Inject @ ContainerScoped private InstanceProducer < ArchiveDeployer > archiveDeployerInst ; @ Override public ProtocolDescription getDefaultProtocol ( ) { } @ Override public void setup ( T config ) { } @ Override public final void start ( ) throws LifecycleException { ModelControllerClient modelControllerClient = Factory . create ( containerConfig . getManagementAddress ( ) , containerConfig . getManagementPort ( ) , CommonDeployableContainer . getCallbackHandler ( ) ) ; <START_BUG> managementClient = new ManagementClient ( modelControllerClient , containerConfig . getManagementAddress ( ) . getHostAddress ( ) ) ; <END_BUG> archiveDeployerInst . set ( new ArchiveDeployer ( ServerDeploymentManager . Factory . create ( modelControllerClient ) ) ) ; try { startInternal ( ) ; } catch ( LifecycleException e ) { safeCloseClient ( ) ; throw e ; } } protected abstract void startInternal ( ) throws LifecycleException { } @ Override public final void stop ( ) throws LifecycleException { } protected abstract void stopInternal ( ) throws LifecycleException { } protected T getContainerConfiguration ( ) { } protected ManagementClient getManagementClient ( ) { } protected ModelControllerClient getModelControllerClient ( ) { } @ Override public ProtocolMetaData deploy ( Archive < ? > archive ) throws DeploymentException { } @ Override public void undeploy ( Archive < ? > archive ) throws DeploymentException { } @ Override public void deploy ( Descriptor descriptor ) throws DeploymentException { } @ Override public void undeploy ( Descriptor descriptor ) throws DeploymentException { } private void safeCloseClient ( ) { } }

Fix:
managementClient = new ManagementClient ( modelControllerClient , containerConfig . getManagementAddress ( ) . getHostAddress ( ) , containerConfig . getManagementPort ( ) ) ;
Buggy code:
public class BlueToothService extends Service { static final String LOGTAG = "BlueToothService" ; BlueToothService . WorkThread workThread = null ; static WakeLock powerWakeLock = null ; static final int timeoutQuitting = 1000 ; static synchronized void powerLock ( Context mContext ) { } static synchronized void powerUnlock ( ) { } public static void checkService ( Context context ) { } @ Override public void onCreate ( ) { } @ Override public void onDestroy ( ) { } boolean shouldBeRun ( ) { } @ Override public IBinder onBind ( Intent intent ) { } @ Override public int onStartCommand ( Intent intent , int flags , int startId ) { } void setupWatchDogTimer ( int timeMinutes ) { } class WorkThread extends Thread { int startId ; BluetoothListener listener = null ; WorkThread ( int aStartId ) { } @ Override public void run ( ) { } void quit ( int timeout ) { } boolean isRunning ( ) { <START_BUG> return ( listener . stRunning ) == ( BluetoothListener . stRunning ) ; <END_BUG> } } public static String WatchdogBluetoothListener = "com.kivSW.phonerecorderui.BluetoothReceiveService.WatchdogBluetoothListener" ; public static class BluetoothControlReceiver extends BroadcastReceiver { @ Override public void onReceive ( Context context , Intent intent ) { } } }

Fix:
return ( listener . status ) == ( BluetoothListener . stRunning ) ;
Buggy code:
public class HtmlProblemFinderTest extends WicketTestCase { public HtmlProblemFinderTest ( String name ) { } public void testProblemFinder ( ) { final MarkupParser parser = new MarkupParser ( "<img<seq2seq4repair_space>src=\"\"//>" ) ; <START_BUG> parser . appendMarkupFilter ( new HtmlProblemFinder ( HtmlProblemFinder . ERR_THROW_EXCEPTION ) , RelativePathPrefixHandler . class ) ; <END_BUG> try { parser . parse ( ) ; assertTrue ( "Should<seq2seq4repair_space>have<seq2seq4repair_space>thrown<seq2seq4repair_space>an<seq2seq4repair_space>exception" , false ) ; } catch ( Exception ex ) { } } }

Fix:
parser . add ( new HtmlProblemFinder ( HtmlProblemFinder . ERR_THROW_EXCEPTION ) , RelativePathPrefixHandler . class ) ;
Buggy code:
public class TestLockFactory extends LuceneTestCase { public void testCustomLockFactory ( ) throws IOException { } public void testRAMDirectoryNoLocking ( ) throws IOException { } public void testDefaultRAMDirectory ( ) throws IOException { } public void testDefaultFSDirectory ( ) throws IOException { } public void testFSDirectoryTwoCreates ( ) throws IOException { } public void testLockClassProperty ( ) throws IOException { } public void testDisableLocks ( ) throws IOException { } public void testFSDirectoryDifferentLockFactory ( ) throws IOException { } public void testStressLocks ( ) throws IOException { } public void testStressLocksNativeFSLockFactory ( ) throws IOException { } public void _testStressLocks ( LockFactory lockFactory , String indexDirName ) throws IOException { <START_BUG> FSDirectory fs1 = FSDirectory . getDirectory ( indexDirName , lockFactory ) ; <END_BUG> IndexWriter w = new IndexWriter ( fs1 , new WhitespaceAnalyzer ( ) , true ) ; addDoc ( w ) ; w . close ( ) ; TestLockFactory . WriterThread writer = new TestLockFactory . WriterThread ( 100 , fs1 ) ; TestLockFactory . SearcherThread searcher = new TestLockFactory . SearcherThread ( 100 , fs1 ) ; writer . start ( ) ; searcher . start ( ) ; while ( ( writer . isAlive ( ) ) || ( searcher . isAlive ( ) ) ) { try { Thread . sleep ( 1000 ) ; } catch ( InterruptedException e ) { } } assertTrue ( "IndexWriter<seq2seq4repair_space>hit<seq2seq4repair_space>unexpected<seq2seq4repair_space>exceptions" , ( ! ( writer . hitException ) ) ) ; assertTrue ( "IndexSearcher<seq2seq4repair_space>hit<seq2seq4repair_space>unexpected<seq2seq4repair_space>exceptions" , ( ! ( searcher . hitException ) ) ) ; rmDir ( indexDirName ) ; } public void testNativeFSLockFactory ( ) throws IOException { } public void testNativeFSLockFactoryPrefix ( ) throws IOException { } public void testDefaultFSLockFactoryPrefix ( ) throws IOException { } private class WriterThread extends Thread { private Directory dir ; private int numIteration ; public boolean hitException = false ; public WriterThread ( int numIteration , Directory dir ) { } public void run ( ) { } } private class SearcherThread extends Thread { private Directory dir ; private int numIteration ; public boolean hitException = false ; public SearcherThread ( int numIteration , Directory dir ) { } public void run ( ) { } } public class MockLockFactory extends LockFactory { public boolean lockPrefixSet ; public Hashtable locksCreated = new Hashtable ( ) ; public int makeLockCount = 0 ; public void setLockPrefix ( String lockPrefix ) { } public synchronized Lock makeLock ( String lockName ) { } public void clearLock ( String specificLockName ) { } public class MockLock extends Lock { public int lockAttempts ; public boolean obtain ( ) { } public void release ( ) { } public boolean isLocked ( ) { } } } private void addDoc ( IndexWriter writer ) throws IOException { } private void rmDir ( String dirName ) { } }

Fix:
FSDirectory fs1 = FSDirectory . getDirectory ( indexDirName , lockFactory , false ) ;
Buggy code:
public class NamespaceImpl extends ModelElementImpl implements Namespace { public Vector _ownedElement ; public NamespaceImpl ( ) { } public NamespaceImpl ( Name name ) { } public NamespaceImpl ( String nameStr ) { } public Vector getOwnedElement ( ) { } public void setOwnedElement ( Vector x ) throws PropertyVetoException { } public void addOwnedElement ( ElementOwnership x ) throws PropertyVetoException { } public void removeOwnedElement ( ElementOwnership x ) throws PropertyVetoException { } public void addPublicOwnedElement ( ModelElement x ) throws PropertyVetoException { } public void addPrivateOwnedElement ( ModelElement x ) throws PropertyVetoException { } public void addProtectedOwnedElement ( ModelElement x ) throws PropertyVetoException { } public void addUnspecOwnedElement ( ModelElement x ) throws PropertyVetoException { } public ElementOwnership elementOwnershipFor ( ModelElement me , VisibilityKind vk ) { Enumeration eoEnum = _ownedElement . elements ( ) ; while ( eoEnum . hasMoreElements ( ) ) { ElementOwnership eo = ( ( ElementOwnership ) ( eoEnum . nextElement ( ) ) ) ; <START_BUG> if ( ( ( eo . getModelElement ( ) ) == me ) && ( ( vk == null ) || ( vk == ( eo . getVisibility ( ) ) ) ) ) <END_BUG> return eo ; } return null ; } public boolean contains ( ModelElement me ) { } public boolean contains ( ModelElement me , VisibilityKind vk ) { } public boolean containsPublic ( ModelElement me ) { } }

Fix:
if ( ( ( eo . getModelElement ( ) ) == me ) && ( ( vk == null ) || ( vk . equals ( eo . getVisibility ( ) ) ) ) )
Buggy code:
public class NumberLiteral extends Expression { private String tokenValue = "0" ; NumberLiteral ( AST ast ) { } public int getNodeType ( ) { } ASTNode clone ( AST target ) { } public boolean subtreeMatch ( ASTMatcher matcher , Object other ) { } void accept0 ( ASTVisitor visitor ) { <START_BUG> boolean visitChildren = visitor . visit ( this ) ; <END_BUG> visitor . endVisit ( this ) ; } public String getToken ( ) { } public void setToken ( String token ) { } int memSize ( ) { } int treeSize ( ) { } }

Fix:
visitor . visit ( this ) ;
Buggy code:
public class ProjectService implements IProjectService { @ Resource ( name = "sessionFactory" ) private SessionFactory sessionFactory ; @ Resource ( name = "projectRepository" ) private IRepository < Project > projectRepository ; @ Resource ( name = "projectTypeRepository" ) private IRepository < ProjectType > projectTypeRepository ; @ Resource ( name = "countryRepository" ) private IRepository < Country > countryRepository ; @ Resource ( name = "rewardRepository" ) private IRepository < Reward > rewardRepository ; @ Resource ( name = "donationRepository" ) private IRepository < Donation > donationRepository ; @ Resource ( name = "userService" ) private IUserService userService ; public Integer save ( ProjectModel projectModel , String userName ) { } public ProjectModel get ( Integer projectId ) { } public List < Project > getUserProjects ( String userName ) { } public List < Project > getAll ( ) { } public void donateToProject ( DonationModel model , String userName ) { Donation donation = new Donation ( ) ; donation . setProject ( projectRepository . getById ( model . getProjectId ( ) ) ) ; donation . setUser ( userService . getUserByName ( userName ) ) ; donation . setAmount ( model . getAmount ( ) ) ; <START_BUG> if ( ( model . getRewardId ( ) ) >= 0 ) { <END_BUG> donation . setReward ( rewardRepository . getById ( model . getRewardId ( ) ) ) ; } donationRepository . add ( donation ) ; } public List < Project > getAllByCategory ( Integer categoryId ) { } }

Fix:
if ( ( ( model . getRewardId ( ) ) != null ) && ( ( model . getRewardId ( ) ) >= 0 ) ) {
Buggy code:
public class WorkingSetNewWizard extends Wizard implements IWorkingSetNewWizard { private WorkingSetTypePage workingSetTypePage ; private IWorkingSetPage workingSetEditPage ; private String editPageId ; private IWorkingSet workingSet ; private WorkingSetDescriptor [ ] descriptors ; public WorkingSetNewWizard ( WorkingSetDescriptor [ ] descriptors ) { } public void addPages ( ) { super . addPages ( ) ; IWizardPage page ; WorkingSetRegistry registry = WorkbenchPlugin . getDefault ( ) . getWorkingSetRegistry ( ) ; if ( ( descriptors . length ) > 1 ) { <START_BUG> page = workingSetTypePage = new WorkingSetTypePage ( ) ; <END_BUG> } else { editPageId = descriptors [ 0 ] . getId ( ) ; page = workingSetEditPage = registry . getWorkingSetPage ( editPageId ) ; } page . setWizard ( this ) ; addPage ( page ) ; setForcePreviousAndNextButtons ( ( ( descriptors . length ) > 1 ) ) ; } public boolean canFinish ( ) { } public IWizardPage getNextPage ( IWizardPage page ) { } public IWorkingSet getSelection ( ) { } public boolean performFinish ( ) { } }

Fix:
page = workingSetTypePage = new WorkingSetTypePage ( this . descriptors ) ;
Buggy code:
public class ShuntingYardParser { private String input ; private Tokenizer tokenizer ; private Stack < Operation > operationStack = new Stack < Operation > ( ) ; private List < Token > output = new ArrayList < Token > ( ) ; private OperationsCollection operations ; public ShuntingYardParser ( String input ) throws IOException { } public List < Token > parse ( ) { String prevToken = null ; String token ; while ( tokenizer . hasNext ( ) ) { token = tokenizer . next ( ) ; if ( token . equals ( "(" ) ) { operationStack . push ( operations . getOperation ( LEFT_PAREN ) ) ; } else if ( token . equals ( ")" ) ) { while ( ( ! ( operationStack . empty ( ) ) ) && ( ! ( operationStack . peek ( ) . getSign ( ) . equals ( "(" ) ) ) ) { output . add ( operationStack . pop ( ) ) ; } operationStack . pop ( ) ; } else if ( token . equals ( "," ) ) { while ( ( ! ( operationStack . empty ( ) ) ) && ( ! ( operationStack . peek ( ) . getSign ( ) . equals ( "(" ) ) ) ) { output . add ( operationStack . pop ( ) ) ; } } else if ( token . equals ( "-" ) ) { if ( ( ( operations . containsOperation ( prevToken ) ) && ( ! ( ")" . equals ( prevToken ) ) ) ) || ( prevToken == null ) ) { Operation operation = operations . getOperation ( MINUS_U ) ; <START_BUG> while ( ( ! ( operationStack . empty ( ) ) ) && ( ! ( ( operationStack . peek ( ) . getArgCount ( ) ) == 1 ) ) ) { <END_BUG> output . add ( operationStack . pop ( ) ) ; } operationStack . push ( operation ) ; } else { Operation operation = operations . getOperation ( SUB_B ) ; while ( ( ! ( operationStack . empty ( ) ) ) && ( ( operation . getPrecedence ( ) ) < ( operationStack . peek ( ) . getPrecedence ( ) ) ) ) { output . add ( operationStack . pop ( ) ) ; } operationStack . push ( operation ) ; } } else if ( operations . containsOperation ( token ) ) { Notation notation = operations . getNotation ( token ) ; Operation operation = operations . getOperation ( notation ) ; while ( ( ! ( operationStack . empty ( ) ) ) && ( ( operation . getPrecedence ( ) ) < ( operationStack . peek ( ) . getPrecedence ( ) ) ) ) { output . add ( operationStack . pop ( ) ) ; } operationStack . push ( operation ) ; } else { output . add ( new Numerical ( Double . parseDouble ( token ) ) ) ; } prevToken = token ; } while ( ! ( operationStack . isEmpty ( ) ) ) { output . add ( operationStack . pop ( ) ) ; } return output ; } private boolean matchingParenthesis ( ) { } private boolean isNumeric ( String input ) { } }

Fix:
while ( ( ! ( operationStack . empty ( ) ) ) && ( ! ( ( operationStack . peek ( ) . getArgCount ( ) ) <= 1 ) ) ) {
Buggy code:
abstract class StringFunction extends AbstractVal implements Val { final Val _val ; ClassMetaData _meta = null ; String _pre = null ; String _post = null ; public StringFunction ( Val val ) { } public ClassMetaData getMetaData ( ) { } public void setMetaData ( ClassMetaData meta ) { } public boolean isVariable ( ) { } public Class getType ( ) { } public void setImplicitType ( Class type ) { } public Joins getJoins ( ) { } public Object toDataStoreValue ( Object val , JDBCStore store ) { } public void select ( Select sel , JDBCStore store , Object [ ] params , boolean pks , JDBCFetchConfiguration fetch ) { } public void selectColumns ( Select sel , JDBCStore store , Object [ ] params , boolean pks , JDBCFetchConfiguration fetch ) { } public void groupBy ( Select sel , JDBCStore store , Object [ ] params , JDBCFetchConfiguration fetch ) { <START_BUG> sel . groupBy ( newSQLBuffer ( sel , store , params , fetch ) , false ) ; <END_BUG> } public void orderBy ( Select sel , JDBCStore store , Object [ ] params , boolean asc , JDBCFetchConfiguration fetch ) { } private SQLBuffer newSQLBuffer ( Select sel , JDBCStore store , Object [ ] params , JDBCFetchConfiguration fetch ) { } public Object load ( Result res , JDBCStore store , JDBCFetchConfiguration fetch ) throws SQLException { } public boolean hasVariable ( Variable var ) { } public void calculateValue ( Select sel , JDBCStore store , Object [ ] params , Val other , JDBCFetchConfiguration fetch ) { } public void clearParameters ( ) { } public int length ( ) { } public void appendTo ( SQLBuffer sql , int index , Select sel , JDBCStore store , Object [ ] params , JDBCFetchConfiguration fetch ) { } }

Fix:
sel . groupBy ( newSQLBuffer ( sel , store , params , fetch ) ) ;
Buggy code:
public class ProposalDevelopmentKRMSAuditRule extends KcTransactionalDocumentRuleBase implements DocumentAuditRule { private KrmsRulesExecutionService krmsRulesExecutionService ; @ Override public boolean processRunAuditBusinessRules ( Document document ) { boolean valid = true ; ProposalDevelopmentDocument pdDocument = ( ( ProposalDevelopmentDocument ) ( document ) ) ; <START_BUG> List < Map < String , String > > krmsErrors = getKrmsRulesExecutionService ( ) . processUnitKcValidations ( pdDocument . getLeadUnitNumber ( ) , pdDocument ) ; <END_BUG> for ( Map < String , String > error : krmsErrors ) { valid = false ; String areaName = error . get ( VALIDATIONS_ACTION_AREA_ATTRIBUTE ) ; String sectionName = error . get ( VALIDATIONS_ACTION_SECTION_ATTRIBUTE ) ; String errorParam = error . get ( VALIDATIONS_ACTION_MESSAGE_ATTRIBUTE ) ; String severity = ( error . get ( VALIDATIONS_ACTION_TYPE_CODE_ATTRIBUTE ) . equals ( "E" ) ) ? "Error" : "Warnings" ; String pageID = error . get ( VALIDATIONS_ACTION_NAVIGATE_TO_PAGE_ID_ATTRIBUTE ) ; String sectionId = error . get ( VALIDATIONS_ACTION_NAVIGATE_TO_SECTION_ID_ATTRIBUTE ) ; getAuditErrors ( areaName , sectionName , severity ) . add ( new AuditError ( pageID , GENERIC_ERROR , ( ( pageID + "." ) + sectionId ) , new String [ ] { errorParam } ) ) ; } return valid ; } private List < AuditError > getAuditErrors ( String areaName , String sectionName , String severity ) { } public KrmsRulesExecutionService getKrmsRulesExecutionService ( ) { } public void setKrmsRulesExecutionService ( KrmsRulesExecutionService krmsRulesExecutionService ) { } }

Fix:
List < Map < String , String > > krmsErrors = getKrmsRulesExecutionService ( ) . processUnitKcValidations ( pdDocument . getDevelopmentProposal ( ) . getAllUnitNumbers ( ) , pdDocument ) ;
Buggy code:
public class WeldJpaInjectionServices implements JpaInjectionServices { private final DeploymentUnit deploymentUnit ; private final ServiceRegistry serviceRegistry ; public WeldJpaInjectionServices ( DeploymentUnit deploymentUnit , ServiceRegistry serviceRegistry ) { } @ Override public EntityManager resolvePersistenceContext ( InjectionPoint injectionPoint ) { } @ Override public EntityManagerFactory resolvePersistenceUnit ( InjectionPoint injectionPoint ) { } @ Override public ResourceReferenceFactory < EntityManager > registerPersistenceContextInjectionPoint ( final InjectionPoint injectionPoint ) { } @ Override public ResourceReferenceFactory < EntityManagerFactory > registerPersistenceUnitInjectionPoint ( final InjectionPoint injectionPoint ) { <START_BUG> final PersistenceUnit context = injectionPoint . getAnnotated ( ) . getAnnotation ( PersistenceUnit . class ) ; <END_BUG> if ( context == null ) { throw MESSAGES . annotationNotFound ( PersistenceUnit . class , injectionPoint . getMember ( ) ) ; } final String scopedPuName = getScopedPUName ( deploymentUnit , context . unitName ( ) ) ; final ServiceName persistenceUnitServiceName = PersistenceUnitServiceImpl . getPUServiceName ( scopedPuName ) ; final ServiceController < ? > serviceController = serviceRegistry . getRequiredService ( persistenceUnitServiceName ) ; final PersistenceUnitServiceImpl persistenceUnitService = ( ( PersistenceUnitServiceImpl ) ( serviceController . getValue ( ) ) ) ; return new org . jboss . as . weld . util . ImmediateResourceReferenceFactory < EntityManagerFactory > ( persistenceUnitService . getEntityManagerFactory ( ) ) ; } @ Override public void cleanup ( ) { } private String getScopedPUName ( final DeploymentUnit deploymentUnit , final String persistenceUnitName ) { } }

Fix:
final PersistenceUnit context = getResourceAnnotated ( injectionPoint ) . getAnnotation ( PersistenceUnit . class ) ;