nus-yam/ex-repair huggingface dataset:
Buggy code:
public class AlarmReceiver extends BroadcastReceiver { @ Override public void onReceive ( Context context , Intent intent ) { String notifKey = intent . getStringExtra ( "NOTIF_KEY" ) ; SharedStorage . initializeInstance ( context ) ; Log . i ( "AlarmReceiver" , "in<seq2seq4repair_space>Receiver" ) ; if ( notifKey == null ) { Log . i ( "AlarmReceiver" , "notifKey<seq2seq4repair_space>is<seq2seq4repair_space>null" ) ; } else { Log . i ( "AlarmReceiver" , notifKey ) ; Calendar rightNow = Calendar . getInstance ( ) ; Notification n = Storage . getInstance ( ) . getNotification ( notifKey ) ; boolean isInKeychain = false ; List < Notification > notifications = Storage . getInstance ( ) . getAllNotifications ( ) ; for ( Notification notif : notifications ) { if ( notif . getKey ( ) . equals ( n . getKey ( ) ) ) { isInKeychain = true ; break ; } } Lifestyle lifeContainer = Storage . getInstance ( ) . getLifestyle ( n . getLifestyleContainerKey ( ) ) ; Reminder reminderContainer = Storage . getInstance ( ) . getReminder ( n . getReminderContainerKey ( ) ) ; Action action = Storage . getInstance ( ) . getAction ( n . getActionKey ( ) ) ; if ( ( ( ( ( ( n . isEnabled ( ) ) && ( lifeContainer . isEnabled ( ) ) ) && ( reminderContainer . isEnabled ( ) ) ) && ( ! ( NOTIFICATION_FAILED_KEY . equals ( notifKey ) ) ) ) && ( ! ( ACTION_FAILED_KEY . equals ( action . getKey ( ) ) ) ) ) && isInKeychain ) { Log . i ( "AlarmReceiver" , "Valid<seq2seq4repair_space>notification" ) ; if ( ( ( rightNow . getTimeInMillis ( ) ) - 60000 ) <= ( n . getTime ( ) . getTimeInMillis ( ) ) ) n . sendNotification ( context ) ; n . makeNextNotificationTime ( context ) ; if ( ( Storage . getInstance ( ) . getOption ( OPTION_TEST_KEY4 ) . isEnabled ( ) ) && ( ( ! ( n . isRepeatDaysEnabled ( ) ) ) && ( ! ( n . isRepeatEveryBlankDaysEnabled ( ) ) ) ) ) { Storage . getInstance ( ) . deleteAbstractBaseEvent ( n ) ; if ( MainActivity . activityIsVisible ( ) ) { Intent mainIntent = new Intent ( context , MainActivity . class ) ; <START_BUG> mainIntent . addFlags ( FLAG_ACTIVITY_CLEAR_TASK ) ; <END_BUG> context . startActivity ( mainIntent ) ; } } } else { Log . i ( "AlarmReceiver" , "Invalid<seq2seq4repair_space>notification" ) ; if ( ! ( n . isEnabled ( ) ) ) { Log . i ( "AlarmReceiver" , "notification<seq2seq4repair_space>not<seq2seq4repair_space>Enabled" ) ; } if ( ! ( lifeContainer . isEnabled ( ) ) ) { Log . i ( "AlarmReceiver" , "lifestyle<seq2seq4repair_space>not<seq2seq4repair_space>Enabled" ) ; } if ( ! ( reminderContainer . isEnabled ( ) ) ) { Log . i ( "AlarmReceiver" , "reminder<seq2seq4repair_space>not<seq2seq4repair_space>Enabled" ) ; } if ( NOTIFICATION_FAILED_KEY . equals ( notifKey ) ) { Log . i ( "AlarmReceiver" , "Notification<seq2seq4repair_space>key<seq2seq4repair_space>is<seq2seq4repair_space>Failed" ) ; } if ( ACTION_FAILED_KEY . equals ( action . getKey ( ) ) ) { Log . i ( "AlarmReceiver" , "Action<seq2seq4repair_space>Key<seq2seq4repair_space>is<seq2seq4repair_space>Failed" ) ; } } } } No newline ; at end ; of file ; }

Fix:
mainIntent . addFlags ( FLAG_ACTIVITY_NEW_TASK ) ;
Buggy code:
public class SimplePageTest extends WicketTestCase { public SimplePageTest ( String name ) { } public void testRenderHomePage ( ) throws Exception { } public void testRenderHomePage_2 ( ) throws Exception { } public void testRenderHomePage_2a ( ) throws Exception { } public void testRenderHomePage_2b ( ) throws Exception { } public void testRenderHomePage_3 ( ) throws Exception { } public void testRenderHomePage_4 ( ) throws Exception { } public void testRenderHomePage_5 ( ) throws Exception { } public void testRenderHomePage_6 ( ) throws Exception { boolean hit = false ; try { executeTest ( SimplePage_6 . class , "SimplePageExpectedResult_6.html" ) ; <START_BUG> } catch ( MarkupException ex ) { <END_BUG> hit = true ; } assertTrue ( "Did<seq2seq4repair_space>expect<seq2seq4repair_space>a<seq2seq4repair_space>MarkupException" , hit ) ; } public void testRenderHomePage_7 ( ) throws Exception { } public void testRenderHomePage_8 ( ) throws Exception { } public void testRenderHomePage_9 ( ) throws Exception { } public void testRenderHomePage_10 ( ) throws Exception { } public void testRenderHomePage_11 ( ) throws Exception { } public void testRenderHomePage_12 ( ) throws Exception { } }

Fix:
} catch ( MarkupNotFoundException ex ) {
Buggy code:
public class StoreUnivariateImpl extends AbstractStoreUnivariate { DoubleArray eDA ; private int windowSize = Univariate . INIFINTE_WINDOW ; public StoreUnivariateImpl ( ) { } public double [ ] getValues ( ) { } public double getElement ( int index ) { } <START_BUG> public double getN ( ) { <END_BUG> return eDA . getNumElements ( ) ; } public synchronized void addValue ( double v ) { } public synchronized void clear ( ) { } public int getWindowSize ( ) { } public synchronized void setWindowSize ( int windowSize ) { } }

Fix:
public int getN ( ) {
Buggy code:
public class MinecraftVersion implements Serializable , Comparable < MinecraftVersion > { private static final long serialVersionUID = 1L ; private static final String VERSION_PATTERN = ".*\\(.*MC.\\s*([a-zA-z0-9\\-\\.]+)\\s*\\)" ; public static final MinecraftVersion BOUNTIFUL_UPDATE = new MinecraftVersion ( "1.8" ) ; public static final MinecraftVersion SKIN_UPDATE = new MinecraftVersion ( "1.7.8" ) ; public static final MinecraftVersion WORLD_UPDATE = new MinecraftVersion ( "1.7.2" ) ; public static final MinecraftVersion HORSE_UPDATE = new MinecraftVersion ( "1.6.1" ) ; public static final MinecraftVersion REDSTONE_UPDATE = new MinecraftVersion ( "1.5.0" ) ; public static final MinecraftVersion SCARY_UPDATE = new MinecraftVersion ( "1.4.2" ) ; private final int major ; private final int minor ; private final int build ; private final String development ; private final SnapshotVersion snapshot ; public MinecraftVersion ( Server server ) { } public MinecraftVersion ( String versionOnly ) { } private MinecraftVersion ( String versionOnly , boolean parseSnapshot ) { } public MinecraftVersion ( int major , int minor , int build ) { } public MinecraftVersion ( int major , int minor , int build , String development ) { } private int [ ] parseVersion ( String version ) { } public int getMajor ( ) { } public int getMinor ( ) { } public int getBuild ( ) { } public String getDevelopmentStage ( ) { } public SnapshotVersion getSnapshot ( ) { } public boolean isSnapshot ( ) { } public String getVersion ( ) { } @ Override public int compareTo ( MinecraftVersion o ) { } @ Override public boolean equals ( Object obj ) { } @ Override public int hashCode ( ) { } @ Override public String toString ( ) { } public static String extractVersion ( String text ) { } public static MinecraftVersion fromServerVersion ( String serverVersion ) { } private static MinecraftVersion currentVersion ; public static MinecraftVersion getCurrentVersion ( ) { if ( ( MinecraftVersion . currentVersion ) == null ) { <START_BUG> MinecraftVersion . currentVersion = new MinecraftVersion ( Bukkit . getVersion ( ) ) ; <END_BUG> } return MinecraftVersion . currentVersion ; } }

Fix:
MinecraftVersion . currentVersion = MinecraftVersion . fromServerVersion ( Bukkit . getVersion ( ) ) ;
Buggy code:
public class PlaypenControls extends RelativeLayout { public PlaypenControls ( Context c ) { } public PlaypenControls ( Context c , AttributeSet s ) { } public PlaypenControls ( Context c , AttributeSet s , int d ) { } public void showFor ( Deck d ) { View left = findViewById ( left_stub ) ; View right = findViewById ( right_stub ) ; View upDown = findViewById ( swipe_up_down ) ; <START_BUG> boolean hideSwipe = ( ! ( d . isProcessed ( ) ) ) || ( d . isLastStep ( ) ) ; <END_BUG> upDown . setVisibility ( ( hideSwipe ? View . GONE : View . VISIBLE ) ) ; if ( d . isSwipeable ( ) ) { if ( d . isOnOptionOne ( ) ) { int y = ( d . midYOfTex ( ) ) - ( ( right . getHeight ( ) ) // 2 ) ; right . setY ( y ) ; right . setVisibility ( VISIBLE ) ; left . setVisibility ( GONE ) ; } else { left . setVisibility ( VISIBLE ) ; right . setVisibility ( GONE ) ; } } else { left . setVisibility ( GONE ) ; right . setVisibility ( GONE ) ; } } public void hideLeftSwipe ( ) { } public void showLeftSwipe ( ) { } public void hideRightSwipe ( ) { } public void showRightSwipe ( ) { } public void hideLeftRightSwipes ( ) { } public void hideUpDownSwipe ( ) { } public void showUpDownSwipe ( ) { } }

Fix:
boolean hideSwipe = ( d . isOpen ( ) ) ? d . isProcessed ( ) ? d . isLastStep ( ) : true : false ;
Buggy code:
public class IntegerValidator extends AbstractValidator { public static final IntegerValidator INT = new IntegerValidator ( Integer . MIN_VALUE , Integer . MAX_VALUE ) ; public static final IntegerValidator POSITIVE_INT = new IntegerValidator ( 0 , Integer . MAX_VALUE ) ; public static final IntegerValidator LONG = new IntegerValidator ( Long . MIN_VALUE , Long . MAX_VALUE ) ; public static final IntegerValidator POSITIVE_LONG = new IntegerValidator ( 0 , Long . MAX_VALUE ) ; private final long min ; private final long max ; private IntegerValidator ( final long min , final long max ) { } public static final IntegerValidator range ( final long min , final long max ) { } public final void validate ( final FormComponent component ) { final String value = component . getRequestString ( ) ; if ( ( value != null ) && ( ! ( "" . equals ( value ) ) ) ) { boolean error = false ; try { final long longValue = Long . parseLong ( value ) ; if ( ( longValue < ( min ) ) || ( longValue > ( max ) ) ) { error = true ; } } catch ( NumberFormatException e ) { error = true ; } if ( error ) { final Map map = messageModel ( component , value ) ; map . put ( "min" , new Long ( min ) ) ; map . put ( "max" , new Long ( max ) ) ; <START_BUG> error ( component , resourceKey ( component ) , map , value ) ; <END_BUG> } } } public final long getMax ( ) { } public final long getMin ( ) { } public String toString ( ) { } }

Fix:
error ( component , resourceKey ( component ) , map ) ;
Buggy code:
public class DelayedJapanizeConvertTask extends BukkitRunnable { private static final String REGEX_URL = "https?:////[\\w//:%#\\$&\\?\\(\\)~\\.=\\+\\-]+" ; private String org ; private JapanizeType type ; private Channel channel ; private ChannelPlayer player ; private String format ; private String lineFormat ; private String result ; public DelayedJapanizeConvertTask ( String org , JapanizeType type , Channel channel , ChannelPlayer player , String japanizeFormat , String lineFormat ) { } @ Override public void run ( ) { } public boolean runSync ( ) { HashMap < String , String > keywordMap = new HashMap < String , String > ( ) ; ArrayList < String > keywords = new ArrayList < String > ( ) ; if ( LunaChat . getInstance ( ) . getLunaChatConfig ( ) . isJapanizeIgnorePlayerName ( ) ) { <START_BUG> for ( Player player : Bukkit . getOnlinePlayers ( ) ) { <END_BUG> keywords . add ( player . getName ( ) ) ; } } HashMap < String , String > dictionary = LunaChat . getInstance ( ) . getLunaChatAPI ( ) . getAllDictionary ( ) ; String deletedURL = Utility . stripColor ( org . replaceAll ( DelayedJapanizeConvertTask . REGEX_URL , "<seq2seq4repair_space>" ) ) ; int index = 0 ; String keywordLocked = deletedURL ; for ( String keyword : keywords ) { if ( keywordLocked . contains ( keyword ) ) { index ++ ; String key = ( "＜" + ( makeMultibytesDigit ( index ) ) ) + "＞" ; keywordLocked = keywordLocked . replace ( keyword , key ) ; keywordMap . put ( key , keyword ) ; } } for ( String dickey : dictionary . keySet ( ) ) { if ( keywordLocked . contains ( dickey ) ) { index ++ ; String key = ( "＜" + ( makeMultibytesDigit ( index ) ) ) + "＞" ; keywordLocked = keywordLocked . replace ( dickey , key ) ; keywordMap . put ( key , dictionary . get ( dickey ) ) ; } } String japanized = KanaConverter . conv ( keywordLocked ) ; if ( ( type ) == ( JapanizeType . GOOGLE_IME ) ) { japanized = IMEConverter . convByGoogleIME ( japanized ) ; } else if ( ( type ) == ( JapanizeType . SOCIAL_IME ) ) { japanized = IMEConverter . convBySocialIME ( japanized ) ; } for ( String key : keywordMap . keySet ( ) ) { japanized = japanized . replace ( key , keywordMap . get ( key ) ) ; } for ( Pattern pattern : LunaChat . getInstance ( ) . getLunaChatConfig ( ) . getNgwordCompiled ( ) ) { Matcher matcher = pattern . matcher ( japanized ) ; if ( matcher . find ( ) ) { japanized = matcher . replaceAll ( Utility . getAstariskString ( matcher . group ( 0 ) . length ( ) ) ) ; } } String channelName = ( ( channel ) == null ) ? "" : channel . getName ( ) ; LunaChatPostJapanizeEvent event = new LunaChatPostJapanizeEvent ( channelName , player , org , japanized ) ; Bukkit . getServer ( ) . getPluginManager ( ) . callEvent ( event ) ; if ( event . isCancelled ( ) ) { return false ; } japanized = event . getJapanized ( ) ; result = format . replace ( "%msg" , org ) ; result = result . replace ( "%japanize" , japanized ) ; return true ; } public String getResult ( ) { } private String makeMultibytesDigit ( int digit ) { } }

Fix:
for ( Player player : Utility . getOnlinePlayers ( ) ) {
Buggy code:
public class ErasmusListFragment extends Fragment implements StudentFragment { private final List < Erasmus > erasmusList = new ArrayList < > ( ) ; private final ErasmusAdapter adapter = new ErasmusAdapter ( erasmusList ) ; private RecyclerView recyclerView ; private SwipeRefreshLayout refreshLayout ; private Comparator < Student > comparator ; @ Override public View onCreateView ( LayoutInflater inflater , ViewGroup container , Bundle savedInstanceState ) { } @ Override public void sortBy ( Comparator < Student > comparator ) { this . comparator = comparator ; Collections . sort ( erasmusList , comparator ) ; <START_BUG> adapter . notifyDataSetChanged ( ) ; <END_BUG> } @ Override public void filter ( String text ) { } @ Override public void scrollToTop ( ) { } private final class ListUpdater extends AsyncTask < Void , Void , Void > { @ Override protected Void doInBackground ( Void ... params ) { } @ Override protected void onPostExecute ( Void result ) { } } }

Fix:
adapter . setModel ( erasmusList ) ;
Buggy code:
public abstract class AbstractDeploymentDescriptorBindingsProcessor implements DeploymentUnitProcessor { private static final Map < Class < ? > , Class < ? > > BOXED_TYPES ; @ Override public final void deploy ( DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext . getDeploymentUnit ( ) ; final DeploymentDescriptorEnvironment environment = deploymentUnit . getAttachment ( MODULE_DEPLOYMENT_DESCRIPTOR_ENVIRONMENT ) ; final EEApplicationClasses applicationClasses = deploymentUnit . getAttachment ( EE_APPLICATION_CLASSES_DESCRIPTION ) ; final Module module = deploymentUnit . getAttachment ( MODULE ) ; final DeploymentReflectionIndex deploymentReflectionIndex = deploymentUnit . getAttachment ( REFLECTION_INDEX ) ; final EEModuleDescription description = deploymentUnit . getAttachment ( EE_MODULE_DESCRIPTION ) ; <START_BUG> if ( description == null ) { <END_BUG> return ; } if ( environment != null ) { final List < BindingConfiguration > bindings = processDescriptorEntries ( deploymentUnit , environment , description , null , module . getClassLoader ( ) , deploymentReflectionIndex , applicationClasses ) ; description . getBindingConfigurations ( ) . addAll ( bindings ) ; } for ( final ComponentDescription componentDescription : description . getComponentDescriptions ( ) ) { if ( ( componentDescription . getDeploymentDescriptorEnvironment ( ) ) != null ) { final List < BindingConfiguration > bindings = processDescriptorEntries ( deploymentUnit , componentDescription . getDeploymentDescriptorEnvironment ( ) , componentDescription , componentDescription , module . getClassLoader ( ) , deploymentReflectionIndex , applicationClasses ) ; componentDescription . getBindingConfigurations ( ) . addAll ( bindings ) ; } } for ( final InterceptorEnvironment interceptorEnv : description . getInterceptorEnvironment ( ) . values ( ) ) { final List < BindingConfiguration > bindings = processDescriptorEntries ( deploymentUnit , interceptorEnv . getDeploymentDescriptorEnvironment ( ) , interceptorEnv , null , module . getClassLoader ( ) , deploymentReflectionIndex , applicationClasses ) ; interceptorEnv . getBindingConfigurations ( ) . addAll ( bindings ) ; } } protected abstract List < BindingConfiguration > processDescriptorEntries ( DeploymentUnit deploymentUnit , DeploymentDescriptorEnvironment environment , ResourceInjectionTarget resourceInjectionTarget , final ComponentDescription componentDescription , ClassLoader classLoader , DeploymentReflectionIndex deploymentReflectionIndex , final EEApplicationClasses applicationClasses ) throws DeploymentUnitProcessingException { } @ Override public void undeploy ( DeploymentUnit context ) { } protected Class < ? > processInjectionTargets ( final ResourceInjectionTarget resourceInjectionTarget , InjectionSource injectionSource , ClassLoader classLoader , DeploymentReflectionIndex deploymentReflectionIndex , ResourceInjectionMetaData entry , Class < ? > classType ) throws DeploymentUnitProcessingException { } }

Fix:
if ( ( module == null ) || ( description == null ) ) {
Buggy code:
public class Main { public static final String DEFAULT_BUILD_FILENAME = "build.xml" ; private int msgOutputLevel = Project . MSG_INFO ; private File buildFile ; private PrintStream out = System . out ; private PrintStream err = System . err ; private Vector targets = new Vector ( 5 ) ; private Properties definedProps = new Properties ( ) ; private Vector listeners = new Vector ( 5 ) ; private String loggerClassname = null ; private boolean emacsMode = false ; private boolean readyToRun = false ; private boolean projectHelp = false ; private static void printMessage ( Throwable t ) { } public static void start ( String [ ] args , Properties additionalUserProperties , ClassLoader coreLoader ) { } public static void main ( String [ ] args ) { } protected Main ( String [ ] args ) throws BuildException { } private File getParentFile ( File file ) { } private File findBuildFile ( String start , String suffix ) throws BuildException { } private void runBuild ( ClassLoader coreLoader ) throws BuildException { } protected void addBuildListeners ( Project project ) { } private BuildLogger createLogger ( ) { } private static void printUsage ( ) { } private static void printVersion ( ) throws BuildException { } private static String antVersion = null ; public static synchronized String getAntVersion ( ) throws BuildException { if ( ( Main . antVersion ) == null ) { try { Properties props = new Properties ( ) ; InputStream in = Main . class . getResourceAsStream ( "//org//apache//tools//ant//version.txt" ) ; props . load ( in ) ; in . close ( ) ; String lSep = System . getProperty ( "line.separator" ) ; StringBuffer msg = new StringBuffer ( ) ; <START_BUG> msg . append ( "Ant<seq2seq4repair_space>version<seq2seq4repair_space>" ) ; <END_BUG> msg . append ( props . getProperty ( "VERSION" ) ) ; msg . append ( "<seq2seq4repair_space>compiled<seq2seq4repair_space>on<seq2seq4repair_space>" ) ; msg . append ( props . getProperty ( "DATE" ) ) ; Main . antVersion = msg . toString ( ) ; } catch ( IOException ioe ) { throw new BuildException ( ( "Could<seq2seq4repair_space>not<seq2seq4repair_space>load<seq2seq4repair_space>the<seq2seq4repair_space>version<seq2seq4repair_space>information:" + ( ioe . getMessage ( ) ) ) ) ; } catch ( NullPointerException npe ) { throw new BuildException ( "Could<seq2seq4repair_space>not<seq2seq4repair_space>load<seq2seq4repair_space>the<seq2seq4repair_space>version<seq2seq4repair_space>information." ) ; } } return Main . antVersion ; } private static void printDescription ( Project project ) { } private static void printTargets ( Project project , boolean printSubTargets ) { } private static int findTargetPosition ( Vector names , String name ) { } private static void printTargets ( Vector names , Vector descriptions , String heading , int maxlen ) { } }

Fix:
msg . append ( "Apache<seq2seq4repair_space>Ant<seq2seq4repair_space>version<seq2seq4repair_space>" ) ;
Buggy code:
public class Tester { public static void main ( String [ ] args ) { Persistence . generateSchema ( "CA-2PU" , null ) ; EntityManagerFactory emf = Persistence . createEntityManagerFactory ( "CA-2PU" ) ; EntityManager em = emf . createEntityManager ( ) ; BjarkeFacade instance = new BjarkeFacade ( emf ) ; InfoEntity ent = new InfoEntity ( ) ; em . getTransaction ( ) . begin ( ) ; Phone ph = new Phone ( 12345 , "Test" ) ; <START_BUG> Address a = new Address ( "Test" , "Home" , em . find ( CityInfo . class , 2980 ) ) ; <END_BUG> Person nPerson = new Person ( "Brian" , "Torkal" , "t@t" , ph , a ) ; System . out . println ( ent . getPhone ( ) . toString ( ) ) ; instance . addPerson ( nPerson ) ; System . out . println ( instance . getPersons ( ) ) ; Person result = instance . getPerson ( 1 ) ; System . out . println ( result . getFirstName ( ) ) ; System . out . println ( result . getEmail ( ) ) ; } }

Fix:
Address a = new Address ( "Test" , "Home" , new CityInfo ( ) ) ;
Buggy code:
public class ClassLiteralAccess extends Expression { public TypeReference type ; public TypeBinding targetType ; FieldBinding syntheticField ; public ClassLiteralAccess ( int sourceEnd , TypeReference t ) { } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { SourceTypeBinding sourceType = currentScope . outerMostMethodScope ( ) . enclosingSourceType ( ) ; <START_BUG> if ( ( ! ( ( sourceType . isInterface ( ) ) || ( sourceType . isBaseType ( ) ) ) ) && ( ( currentScope . environment ( ) . options . sourceLevel ) <= ( ClassFileConstants . JDK1_5 ) ) ) { <END_BUG> syntheticField = sourceType . addSyntheticFieldForClassLiteral ( targetType , currentScope ) ; } return flowInfo ; } public void generateCode ( BlockScope currentScope , CodeStream codeStream , boolean valueRequired ) { } public StringBuffer printExpression ( int indent , StringBuffer output ) { } public TypeBinding resolveType ( BlockScope scope ) { } public void traverse ( ASTVisitor visitor , BlockScope blockScope ) { } }

Fix:
if ( ( ! ( ( sourceType . isInterface ( ) ) || ( sourceType . isBaseType ( ) ) ) ) && ( ( currentScope . compilerOptions ( ) . sourceLevel ) <= ( ClassFileConstants . JDK1_5 ) ) ) {
Buggy code:
public class SupplierBuilderTest { public static final int NUM_RANDOM_INPUTS = 100 * 1000 ; public static final Function < Integer , String > ADAPTER = Integer :: toHexString ; @ Rule public ExpectedException thrown = ExpectedException . none ( ) ; @ Test public void test_initThrownNullPointerException_whenArgumentIsNull ( ) throws Exception { } @ Test public void test_appendThrowsNullPointerException_whenArgumentIsNull ( ) throws Exception { } @ Test public void test_composedSupplierOutputEqualsExpectedSupplierOutput_onRandomisedInitialSupplierSuite ( ) throws Exception { for ( int i = 0 ; i < ( SupplierBuilderTest . NUM_RANDOM_INPUTS ) ; i ++ ) { <START_BUG> Supplier < Integer > start = ( ) -> ( RandomUtils . nextInt ( 0 , Integer . MAX_VALUE ) ) - ( RandomUtils . nextInt ( 0 , Integer . MIN_VALUE ) ) ; <END_BUG> Supplier < String > expected = ( ) -> SupplierBuilderTest . ADAPTER . apply ( start . get ( ) ) ; Supplier < String > actual = new SupplierBuilder ( start ) . append ( SupplierBuilderTest . ADAPTER ) . build ( ) ; assertEquals ( expected . get ( ) , actual . get ( ) ) ; } } @ Test public void test_getReturnsSameAsBuild ( ) throws Exception { } No newline ; at end ; of file ; }

Fix:
Supplier < Integer > start = ( ) -> ( RandomUtils . nextInt ( 0 , Integer . MAX_VALUE ) ) - ( RandomUtils . nextInt ( 0 , Integer . MAX_VALUE ) ) ;
Buggy code:
public class Selection_Statement extends Statement { public Expression expression ; public Statement statement1 ; public Statement statement2 ; public Selection_Statement ( Expression e , Statement s1 , Statement s2 ) { } @ Override public void print ( PrintWriter w , String tabLvl ) { } @ Override void genLLCode ( Function function ) throws CodeGenerationException { BasicBlock thenBlock = new BasicBlock ( function ) ; BasicBlock postBlock = new BasicBlock ( function ) ; BasicBlock elseBlock = null ; int tgtBlock = postBlock . getBlockNum ( ) ; if ( ( statement2 ) != null ) { elseBlock = new BasicBlock ( function ) ; tgtBlock = elseBlock . getBlockNum ( ) ; } expression . genLLCode ( function ) ; int branchReg = expression . getRegNum ( ) ; Operand branchRegOp = new Operand ( OperandType . REGISTER , branchReg ) ; Operand compRegOp = new Operand ( OperandType . REGISTER , expression . getRegNum ( ) ) ; Operand tgtOp = new Operand ( OperandType . BLOCK , tgtBlock ) ; BasicBlock curr = function . getCurrBlock ( ) ; Operation beqOper = new Operation ( OperationType . BEQ , curr ) ; beqOper . setSrcOperand ( 0 , branchRegOp ) ; beqOper . setSrcOperand ( 1 , compRegOp ) ; <START_BUG> beqOper . setDestOperand ( 0 , tgtOp ) ; <END_BUG> curr . appendOper ( beqOper ) ; function . appendToCurrentBlock ( thenBlock ) ; function . setCurrBlock ( thenBlock ) ; statement1 . genLLCode ( function ) ; function . appendToCurrentBlock ( postBlock ) ; if ( ( statement2 ) != null ) { function . setCurrBlock ( thenBlock ) ; curr = function . getCurrBlock ( ) ; statement1 . genLLCode ( function ) ; Operand jmpPost = new Operand ( OperandType . BLOCK , tgtBlock ) ; Operation jmpOper = new Operation ( OperationType . JMP , curr ) ; jmpOper . setSrcOperand ( 0 , jmpPost ) ; curr . appendOper ( jmpOper ) ; function . appendUnconnectedBlock ( elseBlock ) ; } function . setCurrBlock ( postBlock ) ; } }

Fix:
beqOper . setSrcOperand ( 2 , tgtOp ) ;
Buggy code:
public class PackageStateMBeanTest extends AbstractIntegrationTest { @ Configuration public static Option [ ] configuration ( ) { <START_BUG> Option [ ] options = CoreOptions . options ( CoreOptions . equinox ( ) , mavenBundle ( "org.ops4j.pax.logging" , "pax-logging-api" ) , mavenBundle ( "org.ops4j.pax.logging" , "pax-logging-service" ) , mavenBundle ( "org.apache.aries.jmx" , "org.apache.aries.jmx" ) ) ; <END_BUG> options = updateOptions ( options ) ; return options ; } @ Override public void doSetUp ( ) throws Exception { } @ Test public void testMBeanInterface ( ) throws IOException { } }

Fix:
Option [ ] options = CoreOptions . options ( CoreOptions . equinox ( ) , mavenBundle ( "org.ops4j.pax.logging" , "pax-logging-api" ) , mavenBundle ( "org.ops4j.pax.logging" , "pax-logging-service" ) , mavenBundle ( "org.apache.aries.jmx" , "org.apache.aries.jmx" ) , mavenBundle ( "org.apache.aries" , "org.apache.aries.util" ) ) ;
Buggy code:
public class GetPatientActivity extends Activity { private Patient currentPatient ; @ Override protected void onCreate ( Bundle savedInstanceState ) { } @ Override public boolean onCreateOptionsMenu ( Menu menu ) { } @ Override public boolean onOptionsItemSelected ( MenuItem item ) { } public Patient lookupPatient ( int pid ) { Patient p = new Patient ( "Brendan" ) ; <START_BUG> currpatient = p ; <END_BUG> return p ; } public void fillTable ( View view ) { } public void switchCheckFingerPrint ( View view ) { } public void switchMedicalHistoryActivity ( View view ) { } public void switchNewVisitActivity ( View view ) { } }

Fix:
currentPatient = p ;
Buggy code:
public class ReceiverThread extends Thread { public static String CRLF = "\r\n" ; private Network network ; private Socket receiverSocket ; private Socket senderSocket ; private BufferedReader bufferedReader ; private DataOutputStream dataOutputStream ; public ReceiverThread ( Network network ) { } private void initialize ( ) { } @ Override public void run ( ) { System . out . println ( "Receiver<seq2seq4repair_space>started." ) ; this . initialize ( ) ; String inputFromReceiver = null ; try { while ( ( inputFromReceiver = this . bufferedReader . readLine ( ) ) != null ) { byte [ ] fromReceiver = inputFromReceiver . getBytes ( ) ; if ( ( fromReceiver . length ) == 1 ) { if ( ( fromReceiver [ 0 ] ) == 255 ) { } } else { ACK ackFromReceiver = new ACK ( fromReceiver ) ; String networkAction = this . network . getRandomNetworkAction ( ) ; System . out . println ( ( ( ( "Received:<seq2seq4repair_space>ACK" + ( ackFromReceiver . getSequenceNumber ( ) ) ) + ",<seq2seq4repair_space>" ) + networkAction ) ) ; if ( networkAction . equals ( "PASS" ) ) { passPacketFromReceiverToSender ( ackFromReceiver ) ; } else if ( networkAction . equals ( "CORRUPT" ) ) { corruptPacketFromReceiverToSender ( ackFromReceiver ) ; } else if ( networkAction . equals ( "DROP" ) ) { dropPacketFromReceiverToSender ( ackFromReceiver ) ; } } } } catch ( IOException e ) { <START_BUG> System . out . println ( "An<seq2seq4repair_space>I//O<seq2seq4repair_space>Error<seq2seq4repair_space>occurred<seq2seq4repair_space>while<seq2seq4repair_space>trying<seq2seq4repair_space>to<seq2seq4repair_space>read<seq2seq4repair_space>from<seq2seq4repair_space>the<seq2seq4repair_space>Sender<seq2seq4repair_space>Socket." ) ; <END_BUG> } } private void sendPacketFromReceiverToSender ( String ack ) { } private void passPacketFromReceiverToSender ( ACK ack ) { } private void corruptPacketFromReceiverToSender ( ACK ack ) { } private void dropPacketFromReceiverToSender ( ACK ack ) { } No newline ; at end ; of file ; }

Fix:
System . out . println ( "An<seq2seq4repair_space>I//O<seq2seq4repair_space>Error<seq2seq4repair_space>occurred<seq2seq4repair_space>while<seq2seq4repair_space>trying<seq2seq4repair_space>to<seq2seq4repair_space>read<seq2seq4repair_space>from<seq2seq4repair_space>the<seq2seq4repair_space>Receiver<seq2seq4repair_space>Socket." ) ;
Buggy code:
public class CookieValuePersisterTest extends TestCase { private MockWebApplication application ; protected void setUp ( ) throws Exception { super . setUp ( ) ; application = new MockWebApplication ( null ) ; <START_BUG> application . getRequiredPageSettings ( ) . setHomePage ( CookieValuePersisterTestPage . class ) ; <END_BUG> application . setupRequestAndResponse ( ) ; application . processRequestCycle ( ) ; } public void test1 ( ) throws Exception { } private void copyCookieFromResponseToRequest ( final RequestCycle cycle ) { } private Cookie [ ] getRequestCookies ( final RequestCycle cycle ) { } private List getResponseCookies ( final RequestCycle cycle ) { } }

Fix:
application . setHomePage ( CookieValuePersisterTestPage . class ) ;
Buggy code:
public class CachedHeaderfields { protected static XmlElement headercache ; public static String [ ] INTERNAL_COMPRESSED_HEADERFIELDS = new String [ ] { "columba.flags.seen" , "columba.flags.recent" , "columba.flags.answered" , "columba.flags.flagged" , "columba.flags.expunged" , "columba.flags.draft" , "columba.attachment" , "columba.spam" } ; public static String [ ] INTERNAL_HEADERFIELDS = new String [ ] { "columba.priority" , "columba.from" , "columba.host" , "columba.date" , "columba.size" , "columba.subject" , "columba.color" , "account.uid" } ; public static String [ ] DEFAULT_HEADERFIELDS = new String [ ] { "Subject" , "From" , "To" , "Cc" , "Date" , "Message-Id" , "In-Reply-To" , "References" , "Content-Type" } ; public static String [ ] POP3_HEADERFIELDS = new String [ ] { "Subject" , "From" , "columba.date" , "columba.size" , "columba.pop3uid" , "columba.alreadyfetched" } ; public CachedHeaderfields ( ) { } public static ColumbaHeader stripHeaders ( ColumbaHeader h ) { } public static String [ ] getUserDefinedHeaderfieldArray ( ) { String additionalHeaderfields = CachedHeaderfields . headercache . getAttribute ( "headerfields" ) ; if ( ( additionalHeaderfields != null ) && ( ( additionalHeaderfields . length ( ) ) > 0 ) ) { List list = new Vector ( ) ; StringTokenizer tok = new StringTokenizer ( additionalHeaderfields , "<seq2seq4repair_space>" ) ; while ( tok . hasMoreTokens ( ) ) { String s = ( ( String ) ( tok . nextToken ( ) ) ) ; list . add ( s ) ; } String [ ] stringList = new String [ list . size ( ) ] ; for ( int i = 0 ; i < ( list . size ( ) ) ; i ++ ) { stringList [ i ] = ( ( String ) ( list . get ( i ) ) ) ; } return stringList ; } <START_BUG> return null ; <END_BUG> } public static String [ ] getCachedHeaderfieldArray ( ) { } public static String [ ] getDefaultHeaderfields ( ) { } }

Fix:
return new String [ ] { } ;
Buggy code:
public final class PrependContextPathHandler extends AbstractMarkupFilter { private static final Log log = LogFactory . getLog ( PrependContextPathHandler . class ) ; private static final String [ ] attributeNames = new String [ ] { "href" , "src" } ; private String contextPath ; public PrependContextPathHandler ( ) { } public MarkupElement nextTag ( ) throws ParseException { final ComponentTag tag = ( ( ComponentTag ) ( getParent ( ) . nextTag ( ) ) ) ; if ( tag == null ) { return tag ; } if ( ( contextPath ) == null ) { contextPath = ( ( wicket . protocol . http . WebRequestCycle ) ( wicket . RequestCycle . get ( ) ) ) . getWebRequest ( ) . getContextPath ( ) ; if ( ( contextPath ) == null ) { contextPath = "" ; } else if ( ( contextPath . endsWith ( "//" ) ) == false ) { contextPath += "//" ; } } if ( ( contextPath . length ( ) ) > 0 ) { for ( int i = 0 ; i < ( PrependContextPathHandler . attributeNames . length ) ; i ++ ) { String attrName = PrependContextPathHandler . attributeNames [ i ] ; String attrValue = tag . getAttributes ( ) . getString ( attrName ) ; <START_BUG> if ( ( ( attrValue != null ) && ( ( attrValue . startsWith ( "//" ) ) == false ) ) && ( ( attrValue . contains ( ":" ) ) == false ) ) { <END_BUG> String url = ( contextPath ) + attrValue ; tag . getAttributes ( ) . put ( attrName , url ) ; tag . setModified ( true ) ; } } } return tag ; } }

Fix:
if ( ( ( attrValue != null ) && ( ( attrValue . startsWith ( "//" ) ) == false ) ) && ( ( attrValue . indexOf ( ":" ) ) < 0 ) ) {
Buggy code:
public class Factions2Hook extends RegionsPlugin < Factions > { public Factions2Hook ( ) throws IOException { } @ Override public String getName ( ) { } @ Override protected boolean init ( ) { } @ Override public boolean canBuild_i ( final Player p , final Location l ) { } @ YggdrasilID ( "FactionsRegion" ) public final class FactionsRegion extends Region { private transient Faction faction ; @ SuppressWarnings ( { "null" , "unused" } ) private FactionsRegion ( ) { } public FactionsRegion ( final Faction f ) { } @ Override public boolean contains ( final Location l ) { } @ Override public boolean isMember ( final OfflinePlayer p ) { } @ Override public Collection < OfflinePlayer > getMembers ( ) { } @ Override public boolean isOwner ( final OfflinePlayer p ) { } @ SuppressWarnings ( "null" ) @ Override public Collection < OfflinePlayer > getOwners ( ) { } @ Override public Iterator < Block > getBlocks ( ) { } @ Override public String toString ( ) { } @ Override public Fields serialize ( ) { } @ Override public void deserialize ( final Fields fields ) throws StreamCorruptedException { } @ Override public RegionsPlugin < ? > getPlugin ( ) { } @ Override public boolean equals ( @ Nullable final Object o ) { } @ Override public int hashCode ( ) { } } @ SuppressWarnings ( "null" ) @ Override public Collection < ? extends Region > getRegionsAt_i ( final Location l ) { <START_BUG> return Arrays . asList ( new Factions2Hook . FactionsRegion ( BoardColls . get ( ) . getFactionAt ( PS . valueOf ( l ) ) ) ) ; <END_BUG> } @ Override @ Nullable public Region getRegion_i ( final World world , final String name ) { } @ Override public boolean hasMultipleOwners_i ( ) { } @ Override protected Class < ? extends Region > getRegionClass ( ) { } }

Fix:
return Arrays . asList ( new Factions2Hook . FactionsRegion ( BoardColl . get ( ) . getFactionAt ( com . massivecraft . massivecore . ps . PS . valueOf ( l ) ) . getName ( ) ) ) ;
Buggy code:
public class SecurityRealmAddHandler extends AbstractAddStepHandler implements DescriptionProvider { public static final SecurityRealmAddHandler INSTANCE = new SecurityRealmAddHandler ( ) ; public static final String OPERATION_NAME = ModelDescriptionConstants . ADD ; protected void populateModel ( ModelNode operation , ModelNode model ) { } @ Override protected boolean requiresRuntime ( OperationContext context ) { <START_BUG> return ( ( context . getType ( ) ) == ( Type . SERVER ) ) || ( ( context . getType ( ) ) == ( Type . HOST ) ) ; <END_BUG> } protected void performRuntime ( OperationContext context , ModelNode operation , ModelNode model , ServiceVerificationHandler verificationHandler , List < ServiceController < ? > > newControllers ) throws OperationFailedException { } public ModelNode getModelDescription ( Locale locale ) { } protected boolean requiresRuntimeVerification ( ) { } private ServiceName addLdapService ( ModelNode ldap , ServiceName realmServiceName , ServiceTarget serviceTarget , List < ServiceController < ? > > newControllers ) { } private ServiceName addPropertiesService ( ModelNode properties , ServiceName realmServiceName , String realmName , ServiceTarget serviceTarget , List < ServiceController < ? > > newControllers ) { } private ServiceName addSSLService ( OperationContext context , ModelNode ssl , ServiceName realmServiceName , ServiceTarget serviceTarget , List < ServiceController < ? > > newControllers ) throws OperationFailedException { } private ServiceName addSecretService ( ModelNode secret , ServiceName realmServiceName , ServiceTarget serviceTarget , List < ServiceController < ? > > newControllers ) { } private ServiceName addUsersService ( OperationContext context , ModelNode users , ServiceName realmServiceName , String realmName , ServiceTarget serviceTarget , List < ServiceController < ? > > newControllers ) throws OperationFailedException { } private static ServiceName pathName ( String relativeTo ) { } private String unmaskSslKeystorePassword ( OperationContext context , ModelNode ssl ) throws OperationFailedException { } private ModelNode unmaskUsersPasswords ( OperationContext context , ModelNode users ) throws OperationFailedException { } }

Fix:
return true ;
Buggy code:
public class FormDispatchEventTest extends WicketTestCase { private final class MyForm extends Form { private static final long serialVersionUID = 1L ; private MyForm ( String id ) { } protected void onSubmit ( ) { } public String getHiddenField ( ) { } } private boolean selection ; private boolean submit ; public FormDispatchEventTest ( String name ) { } public void testDropDownEvent ( ) throws Exception { FormDispatchEventTest . MyForm form = new FormDispatchEventTest . MyForm ( "form" ) ; DropDownChoice dropDown = new DropDownChoice ( "dropdown" , new Model ( ) , new ArrayList ( ) ) { private static final long serialVersionUID = 1L ; protected void onSelectionChanged ( Object newSelection ) { selection = true ; } protected boolean wantOnSelectionChangedNotifications ( ) { return true ; } } ; form . add ( dropDown ) ; MockPage page = new MockPage ( ) ; page . add ( form ) ; application . setupRequestAndResponse ( ) ; RequestCycle cycle = application . createRequestCycle ( ) ; page . urlFor ( INTERFACE ) ; cycle . getSession ( ) . touch ( page ) ; cycle . getSession ( ) . update ( ) ; form . onFormSubmitted ( ) ; assertTrue ( "form<seq2seq4repair_space>should<seq2seq4repair_space>should<seq2seq4repair_space>set<seq2seq4repair_space>value<seq2seq4repair_space>" , submit ) ; <START_BUG> application . getServletRequest ( ) . setParameter ( form . getHiddenField ( ) , dropDown . urlFor ( IOnChangeListener . INTERFACE ) ) ; <END_BUG> form . onFormSubmitted ( ) ; assertTrue ( "Selection<seq2seq4repair_space>should<seq2seq4repair_space>be<seq2seq4repair_space>called" , selection ) ; } }

Fix:
application . getServletRequest ( ) . setParameter ( form . getHiddenField ( ) , dropDown . urlFor ( IOnChangeListener . INTERFACE ) . toString ( ) ) ;
Buggy code:
public class SharedCacheResource extends ClusteredCacheResource { public SharedCacheResource ( PathElement pathElement , ResourceDescriptionResolver descriptionResolver , AbstractAddStepHandler addHandler , OperationStepHandler removeHandler ) { } @ Override public void registerAttributes ( ManagementResourceRegistration resourceRegistration ) { } @ Override public void registerOperations ( ManagementResourceRegistration resourceRegistration ) { } @ Override public void registerChildren ( ManagementResourceRegistration resourceRegistration ) { super . registerChildren ( resourceRegistration ) ; <START_BUG> resourceRegistration . registerSubModel ( INSTANCE ) ; <END_BUG> } }

Fix:
resourceRegistration . registerSubModel ( new StateTransferResource ( ) ) ;
Buggy code:
public class BooleanConstant extends Constant { boolean value ; public BooleanConstant ( boolean value ) { } public boolean booleanValue ( ) { } public String stringValue ( ) { <START_BUG> String s = new Boolean ( value ) . toString ( ) ; <END_BUG> if ( s == null ) return "null" ; else return s ; } public String toString ( ) { } public int typeID ( ) { } }

Fix:
String s = Boolean . valueOf ( value ) . toString ( ) ;
Buggy code:
public class Theories extends JUnit4ClassRunner { public Theories ( Class < ? > klass ) throws InitializationError { } @ Override protected void collectInitializationErrors ( List < Throwable > errors ) { } @ Override protected List < FrameworkMethod > computeTestMethods ( ) { } @ Override public Statement childBlock ( final FrameworkMethod method ) { } public class TheoryAnchor extends Statement { private int successes = 0 ; private FrameworkMethod fTestMethod ; private List < AssumptionViolatedException > fInvalidParameters = new ArrayList < AssumptionViolatedException > ( ) ; public TheoryAnchor ( FrameworkMethod method ) { } @ Override public void evaluate ( ) throws Throwable { <START_BUG> runWithAssignment ( Assignments . allUnassigned ( fTestMethod . getMethod ( ) , getTestClass ( ) . getJavaClass ( ) ) ) ; <END_BUG> if ( ( successes ) == 0 ) Assume . fail ( ( "Never<seq2seq4repair_space>found<seq2seq4repair_space>parameters<seq2seq4repair_space>that<seq2seq4repair_space>satisfied<seq2seq4repair_space>method.<seq2seq4repair_space>Violated<seq2seq4repair_space>assumptions:<seq2seq4repair_space>" + ( fInvalidParameters ) ) ) ; } protected void runWithAssignment ( Assignments parameterAssignment ) throws Throwable { } protected void runWithIncompleteAssignment ( Assignments incomplete ) throws IllegalAccessException , InstantiationException , Throwable { } protected void runWithCompleteAssignment ( final Assignments complete ) throws IllegalAccessException , InstantiationException , NoSuchMethodException , Throwable , InvocationTargetException { } private Statement methodCompletesWithParameters ( final FrameworkMethod method , final Assignments complete , final Object freshInstance ) { } protected void handleAssumptionViolation ( AssumptionViolatedException e ) { } protected void reportParameterizedError ( Throwable e , Object ... params ) throws Throwable { } private boolean nullsOk ( ) { } protected void handleDataPointSuccess ( ) { } } }

Fix:
runWithAssignment ( Assignments . allUnassigned ( fTestMethod . getMethod ( ) , getTestClass ( ) ) ) ;
Buggy code:
public class ElitisticListPopulation extends ListPopulation { private double elitismRate = 0.9 ; public ElitisticListPopulation ( final List < Chromosome > chromosomes , final int populationLimit , final double elitismRate ) { } public ElitisticListPopulation ( final int populationLimit , final double elitismRate ) { } public Population nextGeneration ( ) { } public void setElitismRate ( final double elitismRate ) { if ( ( elitismRate < 0 ) || ( elitismRate > 1 ) ) { <START_BUG> throw new org . apache . commons . math . exception . OutOfRangeException ( LocalizedFormats . OUT_OF_RANGE_ELITISM_RATE , elitismRate , 0 , 1 ) ; <END_BUG> } this . elitismRate = elitismRate ; } public double getElitismRate ( ) { } }

Fix:
throw new org . apache . commons . math . exception . OutOfRangeException ( LocalizedFormats . ELITISM_RATE , elitismRate , 0 , 1 ) ;
Buggy code:
public class ResourceAdaptersSubsystemTestCase extends AbstractSubsystemBaseTest { public ResourceAdaptersSubsystemTestCase ( ) { } @ Override protected String getSubsystemXml ( ) throws IOException { } @ Test public void testFullConfig ( ) throws Exception { } @ Test public void testFullConfigXa ( ) throws Exception { } @ Test public void testExpressionConfig ( ) throws Exception { } @ Test public void testExpressionConfigXa ( ) throws Exception { } @ Test public void testTransformerAS712 ( ) throws Exception { } @ Test public void testTransformerAS713 ( ) throws Exception { } @ Test public void tesExpressionsAS712 ( ) throws Exception { } @ Test public void testExpressionsAS713 ( ) throws Exception { } private void testTransformer ( String subsystemXml , ModelTestControllerVersion controllerVersion , ModelVersion modelVersion ) throws Exception { KernelServicesBuilder builder = createKernelServicesBuilder ( MANAGEMENT ) . setSubsystemXmlResource ( subsystemXml ) ; <START_BUG> builder . createLegacyKernelServicesBuilder ( null , controllerVersion , modelVersion ) . addMavenResourceURL ( ( "org.jboss.as:jboss-as-connector:" + ( controllerVersion . getMavenGavVersion ( ) ) ) ) . setExtensionClassName ( "org.jboss.as.connector.subsystems.resourceadapters.ResourceAdaptersExtension" ) . addOperationValidationResolve ( "add" , PathAddress . pathAddress ( PathElement . pathElement ( SUBSYSTEM , mainSubsystemName ) , PathElement . pathElement ( "resource-adapter" , "*" ) , PathElement . pathElement ( "connection-definitions" , "*" ) ) ) . skipReverseControllerCheck ( ) ; <END_BUG> KernelServices mainServices = builder . build ( ) ; Assert . assertTrue ( mainServices . isSuccessfulBoot ( ) ) ; KernelServices legacyServices = mainServices . getLegacyServices ( modelVersion ) ; Assert . assertTrue ( legacyServices . isSuccessfulBoot ( ) ) ; Assert . assertNotNull ( legacyServices ) ; checkSubsystemModelTransformation ( mainServices , modelVersion ) ; } protected AdditionalInitialization createAdditionalInitialization ( ) { } protected KernelServices standardSubsystemTest ( final String configId , final String configIdResolvedModel , boolean compareXml ) throws Exception { } }

Fix:
builder . createLegacyKernelServicesBuilder ( null , controllerVersion , modelVersion ) . addMavenResourceURL ( ( "org.jboss.as:jboss-as-connector:" + ( controllerVersion . getMavenGavVersion ( ) ) ) ) . setExtensionClassName ( "org.jboss.as.connector.subsystems.resourceadapters.ResourceAdaptersExtension" ) . addOperationValidationResolve ( "add" , PathAddress . pathAddress ( PathElement . pathElement ( SUBSYSTEM , mainSubsystemName ) , PathElement . pathElement ( "resource-adapter" , "*" ) , PathElement . pathElement ( "connection-definitions" , "*" ) ) ) ;
Buggy code:
final class EmbedClob extends ConnectionChild implements Clob , EngineLOB { private InternalClob clob ; private boolean isValid = true ; private int locator ; EmbedClob ( EmbedConnection con ) throws SQLException { } protected EmbedClob ( EmbedConnection con , StringDataValue dvd ) throws StandardException { } public long length ( ) throws SQLException { } public String getSubString ( long pos , int length ) throws SQLException { } public Reader getCharacterStream ( ) throws SQLException { } public InputStream getAsciiStream ( ) throws SQLException { } public long position ( String searchStr , long start ) throws SQLException { } public long position ( Clob searchClob , long start ) throws SQLException { } public int setString ( long pos , String str ) throws SQLException { } public int setString ( long pos , String str , int offset , int len ) throws SQLException { } public OutputStream setAsciiStream ( long pos ) throws SQLException { } public Writer setCharacterStream ( long pos ) throws SQLException { } public void truncate ( long len ) throws SQLException { } public void free ( ) throws SQLException { } public Reader getCharacterStream ( long pos , long length ) throws SQLException { checkValidity ( ) ; if ( pos <= 0 ) { throw Util . generateCsSQLException ( BLOB_BAD_POSITION , new Long ( pos ) ) ; } if ( length < 0 ) { throw Util . generateCsSQLException ( BLOB_NONPOSITIVE_LENGTH , new Long ( length ) ) ; } <START_BUG> if ( length > ( ( this . length ( ) ) - pos ) ) { <END_BUG> throw Util . generateCsSQLException ( POS_AND_LENGTH_GREATER_THAN_LOB , new Long ( pos ) , new Long ( length ) ) ; } try { return new ClobUpdatableReader ( this , pos , length ) ; } catch ( IOException ioe ) { throw Util . setStreamFailure ( ioe ) ; } } private void checkValidity ( ) throws SQLException { } private void makeWritableClobClone ( ) throws IOException , SQLException { } private void makeWritableClobClone ( long len ) throws IOException , SQLException { } InternalClob getInternalClob ( ) { } public int getLocator ( ) { } }

Fix:
if ( length > ( ( this . length ( ) ) - ( pos - 1 ) ) ) {