nus-yam/ex-repair huggingface dataset:
Buggy code:
public class AWStructureStatics extends ModConfiguration { public AWStructureStatics ( Configuration config ) { } public static String templateExtension = "aws" ; public static boolean enableVillageGen = true ; public static boolean enableStructureGeneration = true ; public static boolean loadDefaultPack = true ; private static boolean exportBlockNames = false ; public static int clusterValueSearchRange = 16 ; public static int duplicateStructureSearchRange = 40 ; public static int maxClusterValue = 500 ; public static float randomGenerationChance = 0.075F ; public static int spawnProtectionRange = 12 ; public static int structureImageWidth = 512 ; public static int structureImageHeight = 288 ; public static Set < String > excludedSpawnerEntities = new HashSet < String > ( ) ; private static HashSet < String > skippableWorldGenBlocks = new HashSet < String > ( ) ; private static HashSet < String > worldGenTargetBlocks = new HashSet < String > ( ) ; private static HashSet < String > scannerSkippedBlocks = new HashSet < String > ( ) ; private static String worldGenCategory = "a_world-gen_settings" ; private static String villageGenCategory = "b_village-gen_settings" ; private static String excludedEntitiesCategory = "c_excluded_spawner_entities" ; private static String worldGenBlocks = "d_world_gen_skippable_blocks" ; private static String targetBlocks = "e_world_gen_target_blocks" ; private static String scanSkippedBlocks = "f_scanner_skipped_blocks" ; @ Override public void initializeCategories ( ) { } @ Override protected void initializeValues ( ) { } private void initializeScannerSkippedBlocks ( ) { } private void initializeDefaultSkippableBlocks ( ) { } private void initializeDefaultSkippedEntities ( ) { } private void initializeDefaultAdditionalTargetBlocks ( ) { } public static boolean skippableBlocksContains ( Block block ) { } public static Set < String > getUserDefinedTargetBlocks ( ) { } public static String getBiomeName ( BiomeGenBase biome ) { <START_BUG> return biome == null ? "null" : biome . biomeName . toLowerCase ( ) ; <END_BUG> } public static boolean shouldSkipScan ( Block block ) { } public void loadPostInitValues ( ) { } private void doBlockNameDump ( ) { } }

Fix:
return ( biome == null ) || ( ( biome . biomeName ) == null ) ? "null" : biome . biomeName . toLowerCase ( ) ;
Buggy code:
public class ActivityApplicationLogic { private ActivityData mData ; private ActivityGUI mGUI ; public ActivityApplicationLogic ( ActivityData mData , ActivityGUI mGUI ) { } private CountDownTimer createTimer ( long time ) { } private void applyDataToGUI ( ) { } private void setUpLayout ( ) { } public void onAnswer0ButtonClicked ( ) { } public void onAnswer1ButtonClicked ( ) { } public void onAnswer2ButtonClicked ( ) { } public void onAnswer3ButtonClicked ( ) { } private boolean evaluateAnswers ( ) { } private void defineActivityReturnValues ( boolean correct , boolean continueOrExit ) { Intent intent ; intent = new Intent ( ) ; intent . putExtra ( INTENT_ANSWER_CORRECT , correct ) ; intent . putExtra ( INTENT_ANSWER_CONTINUE , continueOrExit ) ; <START_BUG> intent . putExtra ( INTENT_ANSWER , this . mData . getmSelectedAnswer ( ) ) ; <END_BUG> intent . putExtra ( INTENT_ANSWER_QID , mData . getmQuestionID ( ) ) ; mData . getActivity ( ) . setResult ( RESULT_OK , intent ) ; } public void onContinueButtonClicked ( ) { } public void onExitButtonClicked ( ) { } }

Fix:
intent . putExtra ( INTENT_ANSWER , Integer . toString ( this . mData . getmSelectedAnswer ( ) ) ) ;
Buggy code:
public class TestBoostedQuery extends LuceneTestCase { static Directory dir ; static IndexReader ir ; static IndexSearcher is ; @ BeforeClass public static void beforeClass ( ) throws Exception { TestBoostedQuery . dir = newDirectory ( ) ; IndexWriterConfig iwConfig = newIndexWriterConfig ( TEST_VERSION_CURRENT , new org . apache . lucene . analysis . MockAnalyzer ( random ( ) ) ) ; iwConfig . setMergePolicy ( newLogMergePolicy ( ) ) ; RandomIndexWriter iw = new RandomIndexWriter ( random ( ) , TestBoostedQuery . dir , iwConfig ) ; Document document = new Document ( ) ; Field idField = new org . apache . lucene . document . StringField ( "id" , "" , Store . NO ) ; document . add ( idField ) ; iw . addDocument ( document ) ; TestBoostedQuery . ir = iw . getReader ( ) ; TestBoostedQuery . is = newSearcher ( TestBoostedQuery . ir ) ; <START_BUG> iw . close ( ) ; <END_BUG> } @ AfterClass public static void afterClass ( ) throws Exception { } public void testBasic ( ) throws Exception { } void assertHits ( Query q , float [ ] scores ) throws Exception { } }

Fix:
iw . shutdown ( ) ;
Buggy code:
public class JeremiePRODelegate implements PortableRemoteObjectDelegate { private int port ; private static String className = "org.objectweb.jeremie.libs.binding.moa.UnicastRemoteObject" ; private static Class unicastClass = null ; public JeremiePRODelegate ( ) throws Exception { } public void exportObject ( Remote obj ) throws RemoteException { try { Method exportO = JeremiePRODelegate . unicastClass . getMethod ( "exportObject" , new Class [ ] { Remote . class , Integer . TYPE } ) ; exportO . invoke ( JeremiePRODelegate . unicastClass , new Object [ ] { obj , new Integer ( port ) } ) ; } catch ( Exception e ) { <START_BUG> throw new RemoteException ( e . toString ( ) ) ; <END_BUG> } } public void unexportObject ( Remote obj ) throws NoSuchObjectException { } public void connect ( Remote target , Remote source ) throws RemoteException { } public Object narrow ( Object obj , Class newClass ) throws ClassCastException { } public Remote toStub ( Remote obj ) throws NoSuchObjectException { } }

Fix:
throw new RemoteException ( e . toString ( ) , e ) ;
Buggy code:
public class ProcessPortlet extends BasePortlet { private Map < String , String > processMap = new HashMap < String , String > ( ) ; public ProcessPortlet ( MainFramePanel portal ) { } @ Override public void refresh ( ) { } private void buildProcesses ( ) { } private void updateProcesses ( ) { service . getStandaloneProcess ( UrlUtil . getLanguage ( ) , new org . talend . mdm . webapp . base . client . SessionAwareAsyncCallback < Map < String , String > > ( ) { @ Override public void onSuccess ( Map < String , String > newProcessMap ) { <START_BUG> if ( compareProcesses ( newProcessMap ) ) { <END_BUG> processMap = newProcessMap ; fieldSet . removeAll ( ) ; buildProcesses ( ) ; } } } ) ; } protected boolean compareProcesses ( Map < String , String > newProcessMap ) { } }

Fix:
if ( ! ( compareProcesses ( newProcessMap ) ) ) {
Buggy code:
@ MessageBundle ( projectCode = "JBAS" ) public interface InfinispanMessages extends ClusteringMessages { InfinispanMessages MESSAGES = Messages . getBundle ( InfinispanMessages . class ) ; <START_BUG> @ Message ( id = 10350 , value = "Could<seq2seq4repair_space>not<seq2seq4repair_space>resolve<seq2seq4repair_space>destination<seq2seq4repair_space>address<seq2seq4repair_space>for<seq2seq4repair_space>outbound<seq2seq4repair_space>socket<seq2seq4repair_space>binding<seq2seq4repair_space>named<seq2seq4repair_space>'%s'" ) <END_BUG> InjectionException failedToInjectSocketBinding ( @ Cause UnknownHostException cause , OutboundSocketBinding binding ) ; }

Fix:
@ Message ( id = 10310 , value = "Could<seq2seq4repair_space>not<seq2seq4repair_space>resolve<seq2seq4repair_space>destination<seq2seq4repair_space>address<seq2seq4repair_space>for<seq2seq4repair_space>outbound<seq2seq4repair_space>socket<seq2seq4repair_space>binding<seq2seq4repair_space>named<seq2seq4repair_space>'%s'" )
Buggy code:
public class Client { boolean autoFetch = true ; String stateFilename ; ReentrantReadWriteLock stateLock ; SharedChannelOutput < NewState > writerChan ; SharedChannelInput writerDone ; Any2OneChannel < Boolean > fetchNowChan ; long lastErasureStorageTime ; String torAddress ; String server ; public KeyPair identity ; byte [ ] groupPriv ; byte [ ] [ ] preGroupPriv ; byte [ ] hmacKey = new byte [ 32 ] ; Integer generation ; SigningKey signingKey ; SecureRandom rand ; QueuedMessage [ ] outbox ; HashMap < Long , Draft > drafts ; HashMap < Long , Contact > contacts ; InboxMessage [ ] inbox ; LinkedBlockingQueue < QueuedMessage > queue ; ReentrantReadWriteLock queueLock ; One2OneChannel < NewMessage > newMessageChan ; One2OneChannel < MessageSendResult > messageSentChan ; One2OneChannel backgroundChan ; One2OneChannel < SigningRequest > signingRequestChan ; HashMap < Long , Boolean > usedIds ; Context context ; private static Client ourInstance = new Client ( ) ; public static Client getInstance ( ) { } private Client ( ) { } public void start ( String filename , Context con ) { } public Draft outboxToDraft ( QueuedMessage msg ) { } public String contactName ( long id ) { } public void enqueue ( QueuedMessage m ) { } public void logEvent ( Contact contact , String msg ) { } public Long randId ( ) { } public void registerId ( long id ) throws Exception { } public Contact contactByName ( String name ) { for ( Map . Entry entry : contacts . entrySet ( ) ) { Contact c = ( ( Contact ) ( entry . getValue ( ) ) ) ; <START_BUG> if ( ( c . name ) == name ) <END_BUG> return c ; } return null ; } public void deleteInboxMsg ( Long id ) { } public void dropSealedAndAckMessagesFrom ( Contact contact ) { } public void deleteOutboxMsg ( Long id ) { } public void removeQueuedMessage ( QueuedMessage msg ) { } public void moveContactsMessagesToEndOfQueue ( Long id ) { } public void deleteContact ( Contact contact ) { } }

Fix:
if ( c . name . equals ( name ) )
Buggy code:
public class WeightedRunningAverage implements Serializable , RunningAverage { private double totalWeight ; private double average ; public WeightedRunningAverage ( ) { } @ Override public synchronized void addDatum ( double datum ) { } public synchronized void addDatum ( double datum , double weight ) { double oldTotalWeight = totalWeight ; totalWeight += weight ; if ( oldTotalWeight <= 0.0 ) { <START_BUG> average = datum * weight ; <END_BUG> } else { average = ( ( ( average ) * oldTotalWeight ) // ( totalWeight ) ) + ( ( datum * weight ) // ( totalWeight ) ) ; } } @ Override public synchronized void removeDatum ( double datum ) { } public synchronized void removeDatum ( double datum , double weight ) { } @ Override public synchronized void changeDatum ( double delta ) { } public synchronized void changeDatum ( double delta , double weight ) { } public synchronized double getTotalWeight ( ) { } @ Override public synchronized int getCount ( ) { } @ Override public synchronized double getAverage ( ) { } @ Override public RunningAverage inverse ( ) { } @ Override public synchronized String toString ( ) { } }

Fix:
average = datum ;
Buggy code:
public class JavascriptStripper { private enum State { REGULAR_TEXT , STRING_SINGLE_QUOTE , STRING_DOUBLE_QUOTES , WHITE_SPACE , LINE_COMMENT , MULTILINE_COMMENT ; } public static String stripCommentsAndWhitespace ( String original ) { StringBuilder result = new StringBuilder ( ( ( original . length ( ) ) // 2 ) ) ; JavascriptStripper . State state = JavascriptStripper . State . REGULAR_TEXT ; for ( int i = 0 ; i < ( original . length ( ) ) ; ++ i ) { char c = original . charAt ( i ) ; char next = ( i < ( ( original . length ( ) ) - 1 ) ) ? original . charAt ( ( i + 1 ) ) : 0 ; char prev = ( i > 0 ) ? original . charAt ( ( i - 1 ) ) : 0 ; if ( state == ( JavascriptStripper . State . WHITE_SPACE ) ) { if ( ( Character . isWhitespace ( next ) ) == false ) { state = JavascriptStripper . State . REGULAR_TEXT ; } continue ; } if ( state == ( JavascriptStripper . State . REGULAR_TEXT ) ) { if ( ( c == '//' ) && ( next == '//' ) ) { state = JavascriptStripper . State . LINE_COMMENT ; continue ; } else if ( ( c == '//' ) && ( next == '*' ) ) { state = JavascriptStripper . State . MULTILINE_COMMENT ; ++ i ; continue ; } else if ( ( Character . isWhitespace ( c ) ) && ( Character . isWhitespace ( next ) ) ) { state = JavascriptStripper . State . WHITE_SPACE ; <START_BUG> c = '<seq2seq4repair_space>' ; <END_BUG> } else if ( c == '\'' ) { state = JavascriptStripper . State . STRING_SINGLE_QUOTE ; } else if ( c == '"' ) { state = JavascriptStripper . State . STRING_DOUBLE_QUOTES ; } result . append ( c ) ; continue ; } if ( state == ( JavascriptStripper . State . LINE_COMMENT ) ) { if ( c == '\n' ) { state = JavascriptStripper . State . REGULAR_TEXT ; continue ; } } if ( state == ( JavascriptStripper . State . MULTILINE_COMMENT ) ) { if ( ( c == '*' ) && ( next == '//' ) ) { state = JavascriptStripper . State . REGULAR_TEXT ; ++ i ; continue ; } } if ( state == ( JavascriptStripper . State . STRING_SINGLE_QUOTE ) ) { if ( ( c == '\'' ) && ( prev != '\\' ) ) { state = JavascriptStripper . State . REGULAR_TEXT ; } result . append ( c ) ; continue ; } if ( state == ( JavascriptStripper . State . STRING_DOUBLE_QUOTES ) ) { if ( ( c == '"' ) && ( prev != '\\' ) ) { state = JavascriptStripper . State . REGULAR_TEXT ; } result . append ( c ) ; continue ; } } return result . toString ( ) ; } }

Fix:
c = '\n' ;
Buggy code:
public class MutableObjectTest extends TestCase { public MutableObjectTest ( String testName ) { } public void testConstructors ( ) { } public void testGetSet ( ) { } public void testEquals ( ) { } public void testHashCode ( ) { } public void testToString ( ) { assertEquals ( "HI" , new MutableObject < String > ( "HI" ) . toString ( ) ) ; <START_BUG> assertEquals ( "10.0" , new MutableObject < Double > ( new Double ( 10 ) ) . toString ( ) ) ; <END_BUG> assertEquals ( "null" , new MutableObject < Object > ( null ) . toString ( ) ) ; } }

Fix:
assertEquals ( "10.0" , new MutableObject < Double > ( Double . valueOf ( 10 ) ) . toString ( ) ) ;
Buggy code:
public class TestCharArrayMap extends LuceneTestCase { Random r = newRandom ( ) ; public void doRandom ( int iter , boolean ignoreCase ) { CharArrayMap < Integer > map = new CharArrayMap < Integer > ( TEST_VERSION_CURRENT , 1 , ignoreCase ) ; HashMap < String , Integer > hmap = new HashMap < String , Integer > ( ) ; char [ ] key ; for ( int i = 0 ; i < iter ; i ++ ) { int len = r . nextInt ( 5 ) ; key = new char [ len ] ; for ( int j = 0 ; j < ( key . length ) ; j ++ ) { key [ j ] = ( ( char ) ( r . nextInt ( 127 ) ) ) ; } String keyStr = new String ( key ) ; <START_BUG> String hmapKey = ( ignoreCase ) ? keyStr . toLowerCase ( ) : keyStr ; <END_BUG> int val = r . nextInt ( ) ; Object o1 = map . put ( key , val ) ; Object o2 = hmap . put ( hmapKey , val ) ; assertEquals ( o1 , o2 ) ; assertEquals ( val , map . put ( keyStr , val ) . intValue ( ) ) ; assertEquals ( val , map . get ( key , 0 , key . length ) . intValue ( ) ) ; assertEquals ( val , map . get ( key ) . intValue ( ) ) ; assertEquals ( val , map . get ( keyStr ) . intValue ( ) ) ; assertEquals ( hmap . size ( ) , map . size ( ) ) ; } } public void testCharArrayMap ( ) { } public void testMethods ( ) { } public void testModifyOnUnmodifiable ( ) { } public void testToString ( ) { } }

Fix:
String hmapKey = ( ignoreCase ) ? keyStr . toLowerCase ( Locale . ENGLISH ) : keyStr ;
Buggy code:
public class JmsListenerContainerFactoryIntegrationTests { private final DefaultJmsListenerContainerFactory containerFactory = new DefaultJmsListenerContainerFactory ( ) ; private final DefaultJmsHandlerMethodFactory factory = new DefaultJmsHandlerMethodFactory ( ) ; private final JmsListenerContainerFactoryIntegrationTests . JmsEndpointSampleBean sample = new JmsListenerContainerFactoryIntegrationTests . JmsEndpointSampleBean ( ) ; @ Before public void setup ( ) { } @ Test public void messageConverterUsedIfSet ( ) throws JMSException { } static class JmsEndpointSampleBean { private final Map < String , Boolean > invocations = new HashMap < String , Boolean > ( ) ; public void expectFooBarUpperCase ( @ Payload String msg ) { } } @ SuppressWarnings ( "unchecked" ) private void invokeListener ( JmsListenerEndpoint endpoint , Message message ) throws JMSException { <START_BUG> DefaultMessageListenerContainer messageListenerContainer = containerFactory . createMessageListenerContainer ( endpoint ) ; <END_BUG> Object listener = messageListenerContainer . getMessageListener ( ) ; if ( listener instanceof SessionAwareMessageListener ) { ( ( SessionAwareMessageListener < Message > ) ( listener ) ) . onMessage ( message , mock ( Session . class ) ) ; } else { ( ( MessageListener ) ( listener ) ) . onMessage ( message ) ; } } private void assertListenerMethodInvocation ( String methodName ) { } private MethodJmsListenerEndpoint createMethodJmsEndpoint ( DefaultJmsHandlerMethodFactory factory , Method method ) { } private MethodJmsListenerEndpoint createDefaultMethodJmsEndpoint ( String methodName , Class < ? > ... parameterTypes ) { } private Method getListenerMethod ( String methodName , Class < ? > ... parameterTypes ) { } private void initializeFactory ( DefaultJmsHandlerMethodFactory factory ) { } private static class UpperCaseMessageConverter implements MessageConverter { @ Override public Message toMessage ( Object object , Session session ) throws JMSException , MessageConversionException { } @ Override public Object fromMessage ( Message message ) throws JMSException , MessageConversionException { } } }

Fix:
DefaultMessageListenerContainer messageListenerContainer = containerFactory . createListenerContainer ( endpoint ) ;
Buggy code:
public class NamespaceImportStatement extends SyntaxElement { private Identifier importedId ; public NamespaceImportStatement ( final Identifier importedID ) { } public Identifier getImportedId ( ) { } public void analyze ( ExecutionContext ctx , Set < AnalysationIssue > issues ) { try { if ( ( ctx . getCallback ( ) ) != null ) if ( ! ( ctx . getCallback ( ) . pre ( this , ctx ) ) ) return ; boolean knownNamespace = false ; if ( ! ( ctx . getNamespaces ( ) . contains ( importedId . getValue ( ) ) ) ) { for ( Type t : ctx . getAllTypes ( ) ) { if ( importedId . getValue ( ) . equals ( TypeNameUtil . withoutLastSegment ( t . getName ( ) ) ) ) { knownNamespace = true ; break ; } } } else { knownNamespace = true ; } if ( ! knownNamespace ) { final String msg = ( "Namespace<seq2seq4repair_space>" + ( this . getImportedId ( ) . getValue ( ) ) ) + "<seq2seq4repair_space>is<seq2seq4repair_space>unknown<seq2seq4repair_space>or<seq2seq4repair_space>unused." ; <START_BUG> issues . add ( new AnalysationIssue ( AnalysationIssue . INTERNAL_ERROR , msg , this ) ) ; <END_BUG> } } finally { if ( ( ctx . getCallback ( ) ) != null ) ctx . getCallback ( ) . post ( this , ctx , null ) ; } } }

Fix:
issues . add ( new AnalysationIssue ( AnalysationIssue . INTERNAL_ERROR , msg , this , true ) ) ;
Buggy code:
public class MetricsController { private Metrics metrics ; public MetricsController ( boolean init ) { } public boolean init ( ) { } public boolean isInit ( ) { } public boolean destroy ( ) { if ( ! ( isInit ( ) ) ) return true ; this . metrics = null ; <START_BUG> return isInit ( ) ; <END_BUG> } }

Fix:
return ! ( isInit ( ) ) ;
Buggy code:
public class GetLatencyTest extends OnesidedTestBase { private int size ; private int i ; int disp ; double tStart ; double tEnd ; private Win win ; private byte [ ] rbuf = new byte [ MAX_SIZE ] ; @ Override protected void initialize ( String [ ] args ) { super . initialize ( args ) ; <START_BUG> getReporter ( ) . setColumnNames ( new String [ ] { "Size<seq2seq4repair_space>(bytes)" , "Latency<seq2seq4repair_space>(µs)" } ) ; <END_BUG> } private double collectResult ( int size , double tStart , double tEnd ) { } private double collectResult ( int size , double tStart , double tEnd , double multiplier ) { } @ Override protected void runTestWithFlush ( ) { } @ Override protected void runTestWithFlushLocal ( ) { } @ Override protected void runTestWithLockAll ( ) { } @ Override protected void runTestWithFence ( ) { } @ Override protected void runTestWithPscw ( ) { } @ Override protected void runTestWithLock ( ) { } }

Fix:
getReporter ( ) . setColumnNames ( new String [ ] { "Size<seq2seq4repair_space>(bytes)" , "Latency<seq2seq4repair_space>(us)" } ) ;
Buggy code:
public class AccountDialog implements ActionListener , ListSelectionListener { private JDialog dialog ; private AccountItem accountItem ; private IdentityPanel identityPanel ; private IncomingServerPanel incomingServerPanel ; private OutgoingServerPanel outgoingServerPanel ; private SecurityPanel securityPanel ; private ReceiveOptionsPanel receiveOptionsPanel ; private JPanel selected = null ; public AccountDialog ( AccountItem item ) { } protected void createPanels ( ) { } protected void initComponents ( ) { } protected JPanel createButtonPanel ( ) { } public void actionPerformed ( ActionEvent e ) { String action = e . getActionCommand ( ) ; if ( action . equals ( "OK" ) ) { identityPanel . updateComponents ( false ) ; incomingServerPanel . updateComponents ( false ) ; receiveOptionsPanel . updateComponents ( false ) ; outgoingServerPanel . updateComponents ( false ) ; securityPanel . updateComponents ( false ) ; if ( accountItem . isPopAccount ( ) ) { int uid = accountItem . getUid ( ) ; POP3ServerController c = popServerCollection . uidGet ( uid ) ; c . restartTimer ( ) ; } else { int uid = accountItem . getUid ( ) ; IMAPRootFolder folder = ( ( IMAPRootFolder ) ( treeModel . getImapFolder ( uid ) ) ) ; <START_BUG> folder . restartTimer ( ) ; <END_BUG> } dialog . setVisible ( false ) ; } else if ( action . equals ( "CANCEL" ) ) { dialog . setVisible ( false ) ; } else if ( action . equals ( "HELP" ) ) { } } protected void setSelection ( JPanel panel ) { } public void valueChanged ( ListSelectionEvent e ) { } }

Fix:
folder . updateConfiguration ( ) ;
Buggy code:
@ Rule ( key = "ReservedNames" , name = "Reserved<seq2seq4repair_space>names<seq2seq4repair_space>should<seq2seq4repair_space>not<seq2seq4repair_space>be<seq2seq4repair_space>used<seq2seq4repair_space>for<seq2seq4repair_space>preprocessor<seq2seq4repair_space>macros" , tags = { Tags . PREPROCESSOR } , priority = Priority . BLOCKER ) @ ActivatedByDefault @ SqaleSubCharacteristic ( SubCharacteristics . COMPILER_RELATED_PORTABILITY ) @ SqaleConstantRemediation ( "5min" ) public class ReservedNamesCheck extends SquidCheck < Grammar > implements CxxCharsetAwareVisitor { private static String [ ] keywords = null ; private Charset charset ; @ Override public void init ( ) { } @ Override public void visitFile ( AstNode astNode ) { List < String > lines ; try { lines = Files . readLines ( getContext ( ) . getFile ( ) , charset ) ; } catch ( IOException e ) { throw new SonarException ( e ) ; } int nr = 0 ; for ( String line : lines ) { nr ++ ; String [ ] sub = line . split ( "^\\s*#define\\s+" , 2 ) ; if ( ( sub . length ) > 1 ) { String name = sub [ 1 ] . split ( "[\\s(]" , 2 ) [ 0 ] ; <START_BUG> if ( ( name . startsWith ( "_" ) ) && ( Character . isUpperCase ( name . charAt ( 1 ) ) ) ) { <END_BUG> getContext ( ) . createLineViolation ( this , "Reserved<seq2seq4repair_space>name<seq2seq4repair_space>used<seq2seq4repair_space>for<seq2seq4repair_space>macro<seq2seq4repair_space>(begins<seq2seq4repair_space>with<seq2seq4repair_space>underscore<seq2seq4repair_space>followed<seq2seq4repair_space>by<seq2seq4repair_space>a<seq2seq4repair_space>capital<seq2seq4repair_space>letter)" , nr ) ; } else if ( name . contains ( "__" ) ) { getContext ( ) . createLineViolation ( this , "Reserved<seq2seq4repair_space>name<seq2seq4repair_space>used<seq2seq4repair_space>for<seq2seq4repair_space>macro<seq2seq4repair_space>(contains<seq2seq4repair_space>two<seq2seq4repair_space>consecutive<seq2seq4repair_space>underscores)" , nr ) ; } else { name = name . toLowerCase ( ) ; for ( String keyword : ReservedNamesCheck . keywords ) { if ( name . equals ( keyword ) ) { getContext ( ) . createLineViolation ( this , "Reserved<seq2seq4repair_space>name<seq2seq4repair_space>used<seq2seq4repair_space>for<seq2seq4repair_space>macro<seq2seq4repair_space>(keyword<seq2seq4repair_space>or<seq2seq4repair_space>alternative<seq2seq4repair_space>token<seq2seq4repair_space>redefined)" , nr ) ; break ; } } } } } } @ Override public void setCharset ( Charset charset ) { } }

Fix:
if ( ( ( name . startsWith ( "_" ) ) && ( ( name . length ( ) ) > 1 ) ) && ( Character . isUpperCase ( name . charAt ( 1 ) ) ) ) {
Buggy code:
public final class Strings { public static String afterFirst ( final String s , final char c ) { } public static String afterFirstPathComponent ( final String path , final char separator ) { } public static String afterLast ( final String s , final char c ) { } public static String beforeFirst ( final String s , final char c ) { } public static String beforeLast ( final String s , final char c ) { } public static String beforeLastPathComponent ( final String path , final char separator ) { } public static String capitalize ( final String s ) { } public static String escapeMarkup ( final String s ) { } public static String escapeMarkup ( final String s , final boolean escapeSpaces ) { } public static String firstPathComponent ( final String path , final char separator ) { } public static boolean isEmpty ( final String string ) { } public static String lastPathComponent ( final String path , final char separator ) { } public static String replaceAll ( final String s , final String searchFor , final String replaceWith ) { } public static String stripEnding ( final String s , final String ending ) { } public static Boolean toBoolean ( final String s ) throws StringValueConversionException { } public static boolean isTrue ( final String s ) throws StringValueConversionException { if ( s != null ) { if ( s . equalsIgnoreCase ( "true" ) ) { return true ; } if ( s . equalsIgnoreCase ( "false" ) ) { return false ; } if ( ( ( ( s . equalsIgnoreCase ( "on" ) ) || ( s . equalsIgnoreCase ( "yes" ) ) ) || ( s . equalsIgnoreCase ( "y" ) ) ) || ( s . equalsIgnoreCase ( "1" ) ) ) { return true ; } if ( ( ( ( s . equalsIgnoreCase ( "off" ) ) || ( s . equalsIgnoreCase ( "no" ) ) ) || ( s . equalsIgnoreCase ( "n" ) ) ) || ( s . equalsIgnoreCase ( "0" ) ) ) { return false ; } <START_BUG> throw new StringValueConversionException ( ( ( "Boolean<seq2seq4repair_space>value<seq2seq4repair_space>\"" + s ) + "\"<seq2seq4repair_space>not<seq2seq4repair_space>recognized" ) ) ; <END_BUG> } return false ; } public static char toChar ( final String s ) throws StringValueConversionException { } public static String toMultilineMarkup ( final String s ) { } public static String toString ( final Object object ) { } public static String toString ( final Throwable throwable ) { } private Strings ( ) { } }

Fix:
return false ;
Buggy code:
public class WSDLInterfaceControlAdapter implements IInterfaceControlAdapter { private WSDLPortType _interface ; private Interface _related ; public WSDLInterfaceControlAdapter ( ) { } @ Override public Interface getInterface ( ) { } @ Override public void setRelatedInterface ( Interface related ) { } @ Override public void init ( Interface intf ) { } @ Override public boolean browse ( Shell shell , IJavaElement element ) { } @ Override public boolean open ( Shell shell , IJavaProject project , boolean useRelated ) { } private boolean openNewWSDLFileWizard ( Shell shell , IJavaProject project ) { } private boolean openJava2WSDLWizard ( Shell shell , IJavaProject project ) { final Java2WSDLWizard newWizard = new Java2WSDLWizard ( ) ; final WizardDialog dialog = new WizardDialog ( PlatformUI . getWorkbench ( ) . getActiveWorkbenchWindow ( ) . getShell ( ) , newWizard ) ; newWizard . init ( PlatformUI . getWorkbench ( ) , getResourceForInterface ( ( ( JavaInterface ) ( _related ) ) ) ) ; <START_BUG> if ( ( dialog . open ( ) ) == ( Window . OK ) ) { <END_BUG> return updateInterfaceFromNewFile ( newWizard . getWSDLFile ( ) , project ) ; } return false ; } private IStructuredSelection getResourceForInterface ( JavaInterface javaIntf ) { } private boolean updateInterfaceFromNewFile ( IFile newFile , IJavaProject project ) { } @ Override public String getText ( ) { } @ Override public IStatus validate ( IJavaProject project ) { } private String getInterfaceURL ( IJavaElement element , PortType portType ) { } }

Fix:
if ( ( ( ( dialog . open ( ) ) == ( Window . OK ) ) && ( ( newWizard . getWSDLFile ( ) ) != null ) ) && ( newWizard . getWSDLFile ( ) . exists ( ) ) ) {
Buggy code:
public class base64 { private static final String Base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+//=" ; private base64 ( ) { } public static String toString ( byte [ ] b ) { } public static String formatString ( byte [ ] b , int lineLength , String prefix , boolean addClose ) { String s = base64 . toString ( b ) ; StringBuffer sb = new StringBuffer ( ) ; for ( int i = 0 ; i < ( s . length ( ) ) ; i += lineLength ) { sb . append ( prefix ) ; if ( ( i + lineLength ) >= ( s . length ( ) ) ) { sb . append ( s . substring ( i ) ) ; if ( addClose ) sb . append ( "<seq2seq4repair_space>)" ) ; } else { <START_BUG> sb . append ( s . substring ( i , ( i + 64 ) ) ) ; <END_BUG> sb . append ( "\n" ) ; } } return sb . toString ( ) ; } public static byte [ ] fromString ( String str ) { } }

Fix:
sb . append ( s . substring ( i , ( i + lineLength ) ) ) ;
Buggy code:
public final class Locator { private Locator ( ) { } public static File getClassSource ( Class c ) { } public static File getResourceSource ( ClassLoader c , String resource ) { } public static String fromURI ( String uri ) { } private static String decodeUri ( String uri ) { } public static File getToolsJar ( ) { boolean toolsJarAvailable = false ; try { Class . forName ( "com.sun.tools.javac.Main" ) ; toolsJarAvailable = true ; } catch ( Exception e ) { try { Class . forName ( "sun.tools.javac.Main" ) ; toolsJarAvailable = true ; } catch ( Exception e2 ) { } } if ( toolsJarAvailable ) { return null ; } String javaHome = System . getProperty ( "java.home" ) ; <START_BUG> if ( javaHome . toLowerCase ( Locale . US ) . endsWith ( "jre" ) ) { <END_BUG> javaHome = javaHome . substring ( 0 , ( ( javaHome . length ( ) ) - 4 ) ) ; } File toolsJar = new File ( ( javaHome + "//lib//tools.jar" ) ) ; if ( ! ( toolsJar . exists ( ) ) ) { System . out . println ( ( ( "Unable<seq2seq4repair_space>to<seq2seq4repair_space>locate<seq2seq4repair_space>tools.jar.<seq2seq4repair_space>" + "Expected<seq2seq4repair_space>to<seq2seq4repair_space>find<seq2seq4repair_space>it<seq2seq4repair_space>in<seq2seq4repair_space>" ) + ( toolsJar . getPath ( ) ) ) ) ; return null ; } return toolsJar ; } public static URL [ ] getLocationURLs ( File location ) throws MalformedURLException { } public static URL [ ] getLocationURLs ( File location , final String [ ] extensions ) throws MalformedURLException { } }

Fix:
if ( javaHome . toLowerCase ( Locale . US ) . endsWith ( ( ( File . separator ) + "jre" ) ) ) {
Buggy code:
@ RunWith ( Arquillian . class ) @ Run ( RunModeType . IN_CONTAINER ) public class ManagedBeanTestCase { @ Deployment public static JavaArchive createDeployment ( ) throws Exception { } @ Test public void testManagedBean ( ) throws Exception { try { PollingUtils . retryWithTimeout ( 3000 , new PollingUtils . Task ( ) { public boolean execute ( ) throws Exception { return ( LookupService . bean ) != null ; } } ) ; BeanWithSimpleInjected bean = LookupService . bean ; Assert . assertNotNull ( bean ) ; Assert . assertNotNull ( bean . getSimple ( ) ) ; String s = bean . echo ( "Hello" ) ; Assert . assertNotNull ( s ) ; <START_BUG> Assert . assertEquals ( "#InterceptorFromParent##InterceptorBean##OtherInterceptorBean##BeanParent##BeanWithSimpleInjected#Hello" , s ) ; <END_BUG> } catch ( NamingException e ) { throw new RuntimeException ( e ) ; } } }

Fix:
Assert . assertEquals ( "#InterceptorBean##OtherInterceptorBean##BeanParent##BeanWithSimpleInjected#Hello" , s ) ;
Buggy code:
public class SignActionCraft extends SignAction { @ Override public void execute ( SignActionEvent info ) { if ( ! ( info . isAction ( MEMBER_ENTER , REDSTONE_ON , GROUP_ENTER ) ) ) { return ; } if ( info . isType ( "craft" , "crafter" ) ) { boolean docart = ( ( info . isAction ( MEMBER_ENTER , REDSTONE_ON ) ) && ( info . isCartSign ( ) ) ) && ( info . hasMember ( ) ) ; boolean dotrain = ( ( ( ! docart ) && ( info . isAction ( GROUP_ENTER , REDSTONE_ON ) ) ) && ( info . isTrainSign ( ) ) ) && ( info . hasGroup ( ) ) ; if ( ( ! docart ) && ( ! dotrain ) ) return ; if ( ! ( info . hasRailedMember ( ) ) ) return ; int radX ; int radY ; int radZ ; radX = radY = radZ = Util . parse ( info . getLine ( 1 ) , defaultTransferRadius ) ; BlockFace dir = info . getRailDirection ( ) ; if ( dir == ( BlockFace . SOUTH ) ) { radX = 0 ; } else if ( dir == ( BlockFace . WEST ) ) { radZ = 0 ; } World world = WorldUtil . getNative ( info . getWorld ( ) ) ; Block m = info . getRails ( ) ; int id ; Block w = null ; for ( int x = - radX ; ( x <= radX ) && ( w == null ) ; x ++ ) { for ( int y = - radY ; ( y <= radY ) && ( w == null ) ; y ++ ) { for ( int z = - radZ ; ( z <= radZ ) && ( w == null ) ; z ++ ) { id = world . getTypeId ( ( ( m . getX ( ) ) + x ) , ( ( m . getY ( ) ) + y ) , ( ( m . getZ ( ) ) + z ) ) ; if ( id == ( WORKBENCH . getId ( ) ) ) { w = m . getRelative ( x , y , z ) ; } } } } if ( w != null ) { Inventory inventory ; if ( docart ) { if ( ! ( info . getMember ( ) . isStorageCart ( ) ) ) return ; inventory = info . getMember ( ) . getInventory ( ) ; } else { inventory = info . getGroup ( ) . getInventory ( ) ; } if ( TrainCarts . showTransferAnimations ) { <START_BUG> inventory = new com . bergerkiller . bukkit . tc . itemanimation . InventoryWatcher ( w , info . getMember ( ) , inventory ) ; <END_BUG> } for ( ItemParser item : Util . getParsers ( info . getLine ( 2 ) , info . getLine ( 3 ) ) ) { RecipeUtil . craftItems ( item , inventory ) ; } } } } @ Override public void build ( SignChangeEvent event , String type , SignActionMode mode ) { } }

Fix:
inventory = InventoryWatcher . convert ( w , info . getMember ( ) , inventory ) ;
Buggy code:
public class Turret { Sprite turret = new Sprite ( new Texture ( "Turret.png" ) ) ; ArrayList < Shot > shots = new ArrayList < Shot > ( ) ; float shotSpeed = 360 ; int spread = 15 ; int shotDelay = 300 ; int shotTimer = 0 ; CollisionInformation colInfo = new CollisionInformation ( ) ; float health = 255.0F ; boolean alive = true ; public Turret ( final Vector2 pos ) { } public void update ( ) { } public void draw ( SpriteBatch batch ) { } public void collisionCheck ( final Ship ship ) { } public void collisionCheck ( final ArrayList < Shot > shots ) { } public void onCollision ( ) { <START_BUG> health -= 10 ; <END_BUG> turret . setColor ( 1.0F , 1.0F , 1.0F , ( 0.5F + ( ( ( health ) // 255.0F ) // 2 ) ) ) ; if ( ( health ) <= 0 ) { alive = false ; } } }

Fix:
health -= 5 ;
Buggy code:
public class CardGalleryActivity extends AppCompatActivity implements CardGalleryFragment . OnFragmentInteractionListener { @ Override protected void onCreate ( Bundle savedInstanceState ) { super . onCreate ( savedInstanceState ) ; setContentView ( activity_card_gallery ) ; getSupportActionBar ( ) . setDisplayHomeAsUpEnabled ( true ) ; String deckname = getIntent ( ) . getExtras ( ) . getString ( "deckname" ) ; CardGalleryFragment fragment = CardGalleryFragment . newInstance ( deckname , null ) ; LocalDeckLoader loader = new LocalDeckLoader ( ( ( getFilesDir ( ) ) + ( Settings . localFolder ) ) , deckname . toLowerCase ( ) , fragment ) ; loader . execute ( ) ; FragmentManager manager = getSupportFragmentManager ( ) ; FragmentTransaction transaction = manager . beginTransaction ( ) ; <START_BUG> transaction . add ( card_gallery_relativelayout , fragment , "cardgalleryfragment" ) ; <END_BUG> transaction . addToBackStack ( "cardgalleryfragment" ) ; transaction . commit ( ) ; } @ Override public void onFragmentInteraction ( Uri uri ) { } }

Fix:
transaction . replace ( card_gallery_relativelayout , fragment , "cardgalleryfragment" ) ;
Buggy code:
public class EntityDV extends TypeValidator { public short getAllowedFacets ( ) { } public Object getActualValue ( String content , ValidationContext context ) throws InvalidDatatypeValueException { } public void checkExtraRules ( Object value , ValidationContext context ) throws InvalidDatatypeValueException { <START_BUG> if ( ! ( context . isEntityDeclared ( ( ( String ) ( value ) ) ) ) ) { <END_BUG> throw new InvalidDatatypeValueException ( "UndeclaredEntity" , new Object [ ] { value } ) ; } } }

Fix:
if ( ! ( context . isEntityUnparsed ( ( ( String ) ( value ) ) ) ) ) {
Buggy code:
public class ToolBar extends Composite { int itemCount ; ToolItem [ ] items ; NSArray accessibilityAttributes = null ; public ToolBar ( Composite parent , int style ) { } int accessibilityAttributeNames ( int id , int sel ) { } int accessibilityAttributeValue ( int id , int sel , int arg0 ) { NSString nsAttributeName = new NSString ( arg0 ) ; if ( ( accessible ) != null ) { id returnObject = accessible . internal_accessibilityAttributeValue ( nsAttributeName , CHILDID_SELF ) ; if ( returnObject != null ) return returnObject . id ; } if ( ( nsAttributeName . isEqualToString ( NSAccessibilityRoleAttribute ) ) || ( nsAttributeName . isEqualToString ( NSAccessibilityRoleDescriptionAttribute ) ) ) { NSString role = OS . NSAccessibilityToolbarRole ; if ( nsAttributeName . isEqualToString ( NSAccessibilityRoleAttribute ) ) return role . id ; else { int roleDescription = OS . NSAccessibilityRoleDescription ( role . id , 0 ) ; return roleDescription ; } } else if ( nsAttributeName . isEqualToString ( NSAccessibilityEnabledAttribute ) ) { return NSNumber . numberWithBool ( isEnabled ( ) ) . id ; } else if ( nsAttributeName . isEqualToString ( NSAccessibilityFocusedAttribute ) ) { <START_BUG> boolean focused = hasFocus ( ) ; <END_BUG> return NSNumber . numberWithBool ( focused ) . id ; } return super . accessibilityAttributeValue ( id , sel , arg0 ) ; } boolean accessibilityIsIgnored ( int id , int sel ) { } static int checkStyle ( int style ) { } protected void checkSubclass ( ) { } public Point computeSize ( int wHint , int hHint , boolean changed ) { } void createHandle ( ) { } void createItem ( ToolItem item , int index ) { } void createWidget ( ) { } void destroyItem ( ToolItem item ) { } void drawBackground ( int id , NSGraphicsContext context , NSRect rect ) { } void enableWidget ( boolean enabled ) { } Widget findTooltip ( NSPoint pt ) { } public ToolItem getItem ( int index ) { } public ToolItem getItem ( Point pt ) { } public int getItemCount ( ) { } public ToolItem [ ] getItems ( ) { } public int getRowCount ( ) { } public int indexOf ( ToolItem item ) { } int [ ] layoutHorizontal ( int width , int height , boolean resize ) { } int [ ] layoutVertical ( int width , int height , boolean resize ) { } int [ ] layout ( int nWidth , int nHeight , boolean resize ) { } void relayout ( ) { } void releaseChildren ( boolean destroy ) { } void releaseHandle ( ) { } void removeControl ( Control control ) { } void resized ( ) { } void setFont ( NSFont font ) { } public void setRedraw ( boolean redraw ) { } }

Fix:
boolean focused = ( view . id ) == ( view . window ( ) . firstResponder ( ) . id ) ;
Buggy code:
public class OSGiAttachmentsDeploymentProcessor implements DeploymentUnitProcessor { private ServiceRegistry serviceRegistry ; public OSGiAttachmentsDeploymentProcessor ( ServiceRegistry serviceRegistry ) { } @ Override public void deploy ( final DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnitContext = phaseContext . getDeploymentUnit ( ) ; Deployment deployment = OSGiDeploymentAttachment . getAttachment ( deploymentUnitContext ) ; String location = InstallBundleInitiatorService . getLocation ( serviceRegistry , deploymentUnitContext . getName ( ) ) ; <START_BUG> VirtualFile virtualFile = phaseContext . getAttachment ( DEPLOYMENT_ROOT ) ; <END_BUG> BundleInfo info = BundleInfoAttachment . getBundleInfoAttachment ( deploymentUnitContext ) ; if ( ( deployment == null ) && ( info != null ) ) { deployment = DeploymentFactory . createDeployment ( info ) ; deployment . addAttachment ( BundleInfo . class , info ) ; OSGiDeploymentAttachment . attachDeployment ( deploymentUnitContext , deployment ) ; } OSGiMetaData metadata = OSGiMetaDataAttachment . getOSGiMetaDataAttachment ( deploymentUnitContext ) ; if ( ( deployment == null ) && ( metadata != null ) ) { String symbolicName = metadata . getBundleSymbolicName ( ) ; Version version = metadata . getBundleVersion ( ) ; deployment = DeploymentFactory . createDeployment ( AbstractVFS . adapt ( virtualFile ) , location , symbolicName , version ) ; deployment . addAttachment ( OSGiMetaData . class , metadata ) ; OSGiDeploymentAttachment . attachDeployment ( deploymentUnitContext , deployment ) ; } XModule resModule = XModuleAttachment . getXModuleAttachment ( deploymentUnitContext ) ; if ( ( deployment == null ) && ( resModule != null ) ) { String symbolicName = resModule . getName ( ) ; Version version = resModule . getVersion ( ) ; deployment = DeploymentFactory . createDeployment ( AbstractVFS . adapt ( virtualFile ) , location , symbolicName , version ) ; deployment . addAttachment ( XModule . class , resModule ) ; OSGiDeploymentAttachment . attachDeployment ( deploymentUnitContext , deployment ) ; } if ( deployment != null ) { MountHandle mount = phaseContext . getAttachment ( ATTACHMENT_KEY ) ; deployment . addAttachment ( MountHandle . class , mount ) ; deployment . setAutoStart ( true ) ; OSGiDeploymentService . addService ( phaseContext ) ; } } public void undeploy ( DeploymentUnit context ) { } }

Fix:
VirtualFile virtualFile = phaseContext . getAttachment ( DEPLOYMENT_ROOT ) . getRoot ( ) ;
Buggy code:
public class Menu extends Widget { public int handle ; int x ; int y ; int hwndCB ; int id0 ; int id1 ; boolean hasLocation ; MenuItem cascade ; Decorations parent ; ImageList imageList ; static final int ID_PPC = 100 ; static final int ID_SPMM = 102 ; static final int ID_SPBM = 103 ; static final int ID_SPMB = 104 ; static final int ID_SPBB = 105 ; static final int ID_SPSOFTKEY0 = 106 ; static final int ID_SPSOFTKEY1 = 107 ; public Menu ( Control parent ) { } public Menu ( Decorations parent , int style ) { } public Menu ( Menu parentMenu ) { } public Menu ( MenuItem parentItem ) { } Menu ( Decorations parent , int style , int handle ) { } void _setVisible ( boolean visible ) { } public void addHelpListener ( HelpListener listener ) { } public void addMenuListener ( MenuListener listener ) { } static Control checkNull ( Control control ) { } static Menu checkNull ( Menu menu ) { } static MenuItem checkNull ( MenuItem item ) { } static int checkStyle ( int style ) { } void createHandle ( ) { } void createItem ( MenuItem item , int index ) { } void createWidget ( ) { } int defaultBackground ( ) { } int defaultForeground ( ) { } void destroyAccelerators ( ) { } void destroyItem ( MenuItem item ) { } void destroyWidget ( ) { } void fixMenus ( Decorations newParent ) { } Rectangle getBounds ( ) { } public MenuItem getDefaultItem ( ) { } public boolean getEnabled ( ) { } public MenuItem getItem ( int index ) { } public int getItemCount ( ) { } public MenuItem [ ] getItems ( ) { } int GetMenuItemCount ( int handle ) { } String getNameText ( ) { } public Decorations getParent ( ) { } public MenuItem getParentItem ( ) { } public Menu getParentMenu ( ) { } public Shell getShell ( ) { } public boolean getVisible ( ) { } int imageIndex ( Image image ) { } public int indexOf ( MenuItem item ) { } public boolean isEnabled ( ) { } public boolean isVisible ( ) { } void redraw ( ) { } void releaseChild ( ) { } void releaseHandle ( ) { } void releaseWidget ( ) { MenuItem [ ] items = getItems ( ) ; for ( int i = 0 ; i < ( items . length ) ; i ++ ) { MenuItem item = items [ i ] ; <START_BUG> if ( ! ( item . isDisposed ( ) ) ) { <END_BUG> if ( ( OS . IsPPC ) && ( ( hwndCB ) != 0 ) ) { item . dispose ( ) ; } else { item . releaseResources ( ) ; } } } if ( ( OS . IsPPC ) && ( ( hwndCB ) != 0 ) ) { if ( ( imageList ) != null ) { OS . SendMessage ( hwndCB , TB_SETIMAGELIST , 0 , 0 ) ; display . releaseToolImageList ( imageList ) ; imageList = null ; } } super . releaseWidget ( ) ; if ( ( parent ) != null ) parent . removeMenu ( this ) ; parent = null ; cascade = null ; } public void removeHelpListener ( HelpListener listener ) { } public void removeMenuListener ( MenuListener listener ) { } public void setDefaultItem ( MenuItem item ) { } public void setEnabled ( boolean enabled ) { } public void setLocation ( int x , int y ) { } public void setLocation ( Point location ) { } public void setVisible ( boolean visible ) { } void update ( ) { } }

Fix:
if ( ( item != null ) && ( ! ( item . isDisposed ( ) ) ) ) {
Buggy code:
public class FileHandler extends Handler { public static final FileHandler INSTANCE = new FileHandler ( ) ; public static final AttributeDefinition PATH = new org . jboss . as . controller . SimpleAttributeDefinitionBuilder ( org . wildfly . extension . undertow . Constants . PATH , org . jboss . dmr . ModelType . STRING ) . setAllowNull ( true ) . setAllowExpression ( true ) . build ( ) ; public static final AttributeDefinition CACHE_BUFFER_SIZE = new org . jboss . as . controller . SimpleAttributeDefinitionBuilder ( "cache-buffer-size" , org . jboss . dmr . ModelType . LONG ) . setAllowNull ( true ) . setAllowExpression ( true ) . setDefaultValue ( new ModelNode ( 1024 ) ) . build ( ) ; public static final AttributeDefinition CACHE_BUFFERS = new org . jboss . as . controller . SimpleAttributeDefinitionBuilder ( "cache-buffers" , org . jboss . dmr . ModelType . LONG ) . setAllowNull ( true ) . setAllowExpression ( true ) . setDefaultValue ( new ModelNode ( 1024 ) ) . build ( ) ; public static final AttributeDefinition DIRECTORY_LISTING = new org . jboss . as . controller . SimpleAttributeDefinitionBuilder ( org . wildfly . extension . undertow . Constants . DIRECTORY_LISTING , org . jboss . dmr . ModelType . BOOLEAN ) . setAllowNull ( true ) . setAllowExpression ( true ) . setDefaultValue ( new ModelNode ( false ) ) . build ( ) ; private FileHandler ( ) { } @ Override public Collection < AttributeDefinition > getAttributes ( ) { } @ Override public HttpHandler createHandler ( final OperationContext context , ModelNode model ) throws OperationFailedException { String path = FileHandler . PATH . resolveModelAttribute ( context , model ) . asString ( ) ; boolean directoryListing = FileHandler . DIRECTORY_LISTING . resolveModelAttribute ( context , model ) . asBoolean ( ) ; ROOT_LOGGER . creatingFileHandler ( path ) ; <START_BUG> FileResourceManager resourceManager = new FileResourceManager ( new File ( path ) ) ; <END_BUG> ResourceHandler handler = new ResourceHandler ( ) ; handler . setResourceManager ( resourceManager ) ; handler . setDirectoryListingEnabled ( directoryListing ) ; return handler ; } }

Fix:
FileResourceManager resourceManager = new FileResourceManager ( new File ( path ) , ( 1024 * 1024 ) ) ;