nus-yam/ex-repair huggingface dataset:
Buggy code:
@ WebServlet ( "//user//login.api" ) public class Login extends HttpServlet { private static final String UID = "uid" ; private static final String PASS = "pass" ; private static final String M = "m" ; private static final String E = "e" ; protected UserDao userDao = UserDao . getInstance ( ) ; protected Authorizer authorizer = Authorizer . getInstance ( ) ; protected RSAKeyCache keyCache = RSAKeyCache . getInstance ( ) ; protected RSACrypto rsa = RSACrypto . getInstance ( ) ; @ Override public void doPost ( HttpServletRequest req , HttpServletResponse resp ) throws ServletException , IOException { req . setCharacterEncoding ( "utf-8" ) ; try { Long uid = needLong ( req , Login . UID ) ; byte [ ] pass = needByteArray ( req , Login . PASS ) ; byte [ ] m = needByteArray ( req , Login . M ) ; byte [ ] e = needByteArray ( req , Login . E ) ; PrivateKey key = ( ( PrivateKey ) ( notNull ( this . keyCache . get ( uid ) ) ) ) ; pass = this . rsa . decrypt ( pass , key ) ; this . userDao . begin ( ) ; User u = this . authorizer . login ( uid , pass ) ; PublicKey publicKey = this . rsa . generatePublic ( m , e ) ; String encryptedSecret = this . rsa . byteToHex ( this . rsa . encrypt ( u . getSecret ( ) , publicKey ) ) ; JSONObject json = ( ( JSONObject ) ( jsonize ( null , u , JSONIZER_CONFIG_USER ) ) ) ; json . put ( "secret" , encryptedSecret ) ; <START_BUG> write ( resp , jsonize ( null , u , null ) ) ; <END_BUG> this . userDao . commit ( ) ; } catch ( Exception ex ) { req . setAttribute ( ATTR_KEY_EXCEPTION , ex ) ; req . getRequestDispatcher ( URI_ERROR_HANDLER ) . forward ( req , resp ) ; } finally { this . userDao . close ( ) ; } return ; } }

Fix:
write ( resp , json ) ;
Buggy code:
class ContainerWithAssociatedMarkupHelper extends AbstractBehavior { private static final long serialVersionUID = 1L ; private boolean checkedBody = false ; private final WebMarkupContainerWithAssociatedMarkup container ; ContainerWithAssociatedMarkupHelper ( final WebMarkupContainerWithAssociatedMarkup container ) { } protected final void renderHeadFromAssociatedMarkupFile ( final HtmlHeaderContainer htmlContainer ) { final MarkupStream markupStream = container . getAssociatedMarkupStream ( false ) ; if ( markupStream == null ) { return ; } while ( ( nextHeaderMarkup ( markupStream ) ) != ( - 1 ) ) { <START_BUG> Class markupClass = ( ( wicket . markup . WicketTag ) ( markupStream . getTag ( ) ) ) . getWicketHeaderClass ( ) ; <END_BUG> if ( markupClass == null ) { markupClass = markupStream . getContainerClass ( ) ; } final HeaderPartContainer headerPart = getHeaderPart ( markupClass , markupStream . getCurrentIndex ( ) ) ; if ( headerPart != null ) { if ( htmlContainer . okToRenderComponent ( headerPart . getScope ( ) , headerPart . getId ( ) ) ) { htmlContainer . autoAdd ( headerPart ) ; if ( ( checkedBody ) == false ) { checkedBody = true ; checkBodyOnLoad ( ) ; } } else { Response response = container . getRequestCycle ( ) . getResponse ( ) ; try { container . getRequestCycle ( ) . setResponse ( NullResponse . getInstance ( ) ) ; htmlContainer . autoAdd ( headerPart ) ; } finally { container . getRequestCycle ( ) . setResponse ( response ) ; } } } markupStream . skipComponent ( ) ; } } private void checkBodyOnLoad ( ) { } private final HeaderPartContainer getHeaderPart ( final Class markupClass , final int index ) { } private final int nextHeaderMarkup ( final MarkupStream associatedMarkupStream ) { } }

Fix:
Class markupClass = ( ( wicket . markup . WicketTag ) ( markupStream . getTag ( ) ) ) . getMarkupClass ( ) ;
Buggy code:
@ Service @ Transactional @ CommonsLog public class AccountService { @ Autowired AccountRepository accountRepository ; @ Autowired ContactRepository contactRepository ; @ Autowired AccessControlService accessControlService ; public void loginAsUser ( final Long accountId ) { } public AccountEditOutput loadAccountForEditing ( final Long accountId ) { } public List < ContactReferenceOutput > loadContacts ( ) { } public List < ContactReferenceOutput > loadSentContactRequests ( ) { } public List < ContactReferenceOutput > loadReceivedContactRequests ( ) { } public List < ContactReferenceOutput > loadAccountsNotContacts ( ) { log . debug ( "Loading<seq2seq4repair_space>non-contact<seq2seq4repair_space>accounts<seq2seq4repair_space>as<seq2seq4repair_space>contacts" ) ; final List < ContactReferenceOutput > output = new ArrayList < > ( ) ; <START_BUG> for ( final AccountEntity account : accountRepository . findAll ( new Sort ( "username" ) ) ) { <END_BUG> if ( isNonContactAccount ( account ) ) { output . add ( new ContactReferenceOutput ( account ) ) ; } } return output ; } private boolean isNonContactAccount ( final AccountEntity account ) { } private ContactEntity findContact ( final Set < ContactEntity > contacts , final Long contactId ) { } public ContactViewOutput loadContact ( final Long contactId ) { } public void createContactRequest ( final Long accountId ) { } public void deleteContact ( final Long contactId ) { } private void deleteContact ( final Long contactId , final Set < ContactEntity > contacts ) { } public void declineContactRequest ( final Long contactId ) { } public void acceptContactRequest ( final Long contactId ) { } public ContactEntity createContact ( final AccountEntity owner , final ContactType contactType , final AccountEntity account ) { } public ContactEntity mirrorContact ( final ContactEntity original ) { } }

Fix:
for ( final AccountEntity account : accountRepository . findAll ( new Sort ( "name" ) ) ) {
Buggy code:
public class AsciidoctorEngine extends MarkupEngine { private static final Logger LOGGER = LoggerFactory . getLogger ( AsciidoctorEngine . class ) ; private final ReentrantReadWriteLock lock = new ReentrantReadWriteLock ( ) ; private Asciidoctor engine ; public AsciidoctorEngine ( ) { } private Asciidoctor getEngine ( ) { } @ Override public void processHeader ( final ParserContext context ) { final Asciidoctor asciidoctor = getEngine ( ) ; DocumentHeader header = asciidoctor . readDocumentHeader ( context . getFile ( ) ) ; Map < String , Object > contents = context . getContents ( ) ; if ( ( header . getDocumentTitle ( ) ) != null ) { <START_BUG> contents . put ( "title" , header . getDocumentTitle ( ) ) ; <END_BUG> } Map < String , Object > attributes = header . getAttributes ( ) ; for ( String key : attributes . keySet ( ) ) { if ( key . startsWith ( "jbake-" ) ) { Object val = attributes . get ( key ) ; if ( val != null ) { String pKey = key . substring ( 6 ) ; contents . put ( pKey , val ) ; } } if ( key . equals ( "revdate" ) ) { if ( ( ( attributes . get ( key ) ) != null ) && ( ( attributes . get ( key ) ) instanceof String ) ) { DateFormat df = new SimpleDateFormat ( context . getConfig ( ) . getString ( DATE_FORMAT ) ) ; Date date = null ; try { date = df . parse ( ( ( String ) ( attributes . get ( key ) ) ) ) ; contents . put ( "date" , date ) ; } catch ( ParseException e ) { e . printStackTrace ( ) ; } } } if ( key . equals ( "jbake-tags" ) ) { if ( ( ( attributes . get ( key ) ) != null ) && ( ( attributes . get ( key ) ) instanceof String ) ) { contents . put ( "tags" , ( ( String ) ( attributes . get ( key ) ) ) . split ( "," ) ) ; } } else { contents . put ( key , attributes . get ( key ) ) ; } } } @ Override public void processBody ( ParserContext context ) { } private void processAsciiDoc ( ParserContext context ) { } private Options getAsciiDocOptionsAndAttributes ( ParserContext context ) { } private static Object guessTypeByContent ( String value ) { } }

Fix:
contents . put ( "title" , header . getDocumentTitle ( ) . getMain ( ) ) ;
Buggy code:
public class TlvDecoder { public TlvDecoder ( ByteBuffer input ) { } public final int readVarNumber ( ) throws EncodingException { } public final int readExtendedVarNumber ( int firstOctet ) throws EncodingException { } public final int readTypeAndLength ( int expectedType ) throws EncodingException { } public final int readNestedTlvsStart ( int expectedType ) throws EncodingException { } public final void finishNestedTlvs ( int endOffset ) throws EncodingException { if ( ( input_ . position ( ) ) == endOffset ) return ; while ( ( input_ . position ( ) ) < endOffset ) { readVarNumber ( ) ; int length = readVarNumber ( ) ; int newPosition = ( input_ . position ( ) ) + length ; <START_BUG> if ( newPosition > ( input_ . remaining ( ) ) ) <END_BUG> throw new EncodingException ( "TLV<seq2seq4repair_space>length<seq2seq4repair_space>exceeds<seq2seq4repair_space>the<seq2seq4repair_space>buffer<seq2seq4repair_space>length" ) ; input_ . position ( newPosition ) ; } if ( ( input_ . position ( ) ) != endOffset ) throw new EncodingException ( "TLV<seq2seq4repair_space>length<seq2seq4repair_space>does<seq2seq4repair_space>not<seq2seq4repair_space>equal<seq2seq4repair_space>the<seq2seq4repair_space>total<seq2seq4repair_space>length<seq2seq4repair_space>of<seq2seq4repair_space>the<seq2seq4repair_space>nested<seq2seq4repair_space>TLVs" ) ; } public final boolean peekType ( int expectedType , int endOffset ) throws EncodingException { } public final long readNonNegativeInteger ( int length ) throws EncodingException { } public final long readNonNegativeIntegerTlv ( int expectedType ) throws EncodingException { } public final long readOptionalNonNegativeIntegerTlv ( int expectedType , int endOffset ) throws EncodingException { } public final ByteBuffer readBlobTlv ( int expectedType ) throws EncodingException { } public final ByteBuffer readOptionalBlobTlv ( int expectedType , int endOffset ) throws EncodingException { } public final boolean readBooleanTlv ( int expectedType , int endOffset ) throws EncodingException { } public final int getOffset ( ) { } public final void seek ( int offset ) { } private final ByteBuffer input_ ; }

Fix:
if ( newPosition > ( input_ . limit ( ) ) )
Buggy code:
public class DynamicSememeImpl extends SememeVersionImpl < DynamicSememeImpl > implements MutableDynamicSememe < DynamicSememeImpl > { private DynamicSememeDataBI [ ] data_ = null ; public DynamicSememeImpl ( SememeChronologyImpl < DynamicSememeImpl > container , int stampSequence , short versionSequence , DataBuffer data ) { } public DynamicSememeImpl ( SememeChronologyImpl < DynamicSememeImpl > container , int stampSequence , short versionSequence ) { } @ Override protected void writeVersionData ( DataBuffer data ) { super . writeVersionData ( data ) ; if ( ( getData ( ) ) != null ) { data . putInt ( getData ( ) . length ) ; for ( DynamicSememeDataBI column : getData ( ) ) { if ( column == null ) { data . putInt ( UNKNOWN . getTypeToken ( ) ) ; } else { data . putInt ( column . getDynamicSememeDataType ( ) . getTypeToken ( ) ) ; <START_BUG> data . put ( column . getData ( ) ) ; <END_BUG> } } } else { data . putInt ( 0 ) ; } } @ Override public SememeType getSememeType ( ) { } @ Override public DynamicSememeDataBI [ ] getData ( ) { } @ Override public DynamicSememeDataBI getData ( int columnNumber ) throws IndexOutOfBoundsException { } @ Override public DynamicSememeDataBI getData ( String columnName ) throws InvalidNameException { } @ Override public DynamicSememeUsageDescriptionBI getDynamicSememeUsageDescription ( ) { } @ Override public void setData ( DynamicSememeDataBI [ ] data ) { } @ Override public String toString ( ) { } }

Fix:
data . putByteArrayField ( column . getData ( ) ) ;
Buggy code:
public class RecipeWidget extends Table { @ Inject private TabWidget tabPanel ; @ Inject private EventBus eventBus ; @ Inject private API api ; private Map < Item , IconWidget > materialSet ; @ PostConstruct public void init ( ) { } @ Handler public void onEvent ( MouseEvent < ? > event ) { } @ Handler public void onItemEvent ( ItemEvent event ) { } private boolean isModified ( ) { } private Actor generateDescription ( Item item ) { } private Actor generateTop ( Item item ) { } private Actor generateMaterials ( Item item ) { materialSet . clear ( ) ; Table table = new Table ( ) ; addCaption ( MATERIALS , table ) ; Table materialTable = new Table ( ) ; table . add ( materialTable ) ; ItemBag materials = api . findIngredients ( item ) ; materialTable . setWidth ( 500.0F ) ; int index = 0 ; for ( Map . Entry < Item , Integer > entry : materials ) { int amount = api . getItemAmount ( entry . getKey ( ) ) ; IconWidget widget = new IconWidget ( entry . getKey ( ) , amount ) ; materialSet . put ( entry . getKey ( ) , widget ) ; <START_BUG> widget . setIconText ( new RecipeWidget . MaterialIconText ( amount ) ) ; <END_BUG> widget . setWidth ( MATERIAL_ICON ) ; widget . setHeight ( MATERIAL_ICON ) ; Tooltip . create ( widget ) . text ( items . get ( entry . getKey ( ) . getId ( ) . toString ( ) ) ) ; Cell < IconWidget > cell = materialTable . add ( widget ) ; if ( ( index > 0 ) && ( ( index % 2 ) == 0 ) ) { cell . row ( ) ; } index ++ ; } return table ; } private Actor generateRewards ( Item item ) { } private void addCaption ( String key , Table target ) { } private class MaterialIconText implements IconText { private int required ; public MaterialIconText ( int required ) { } @ Override public Color getColor ( int currentAmount ) { } @ Override public String getContent ( int currentAmount ) { } @ Override public boolean isVisible ( int currentAmount ) { } } No newline ; at end ; of file ; }

Fix:
widget . setIconText ( new RecipeWidget . MaterialIconText ( entry . getValue ( ) ) ) ;
Buggy code:
@ Singleton public class DocumentSearcherImpl implements DocumentSearcher { private static final Logger LOG = Logger . getLogger ( DocumentSearcherImpl . class ) ; private final List < LuceneFieldPlugin > luceneFieldPlugins ; private QueryParser queryParser ; private QueryParser queryParserCaseSensitive ; private IndexSearcher indexSearcher ; private boolean searcherInitialized = false ; private File indexLocation ; private ConfigurationReader configurationReader ; @ Inject public DocumentSearcherImpl ( ConfigurationReader configurationReader , LuceneFieldPluginLoader luceneFieldPluginLoader ) { } @ Override public synchronized List < SearchResultDto > search ( String searchString , boolean caseSensitive , Set < String > repositoryNames , Set < String > repositoryGroupNames , int maxResults ) throws IOException , ParseException , InvalidIndexException { if ( ! ( searcherInitialized ) ) { initSearcher ( ) ; } List < SearchResultDto > results = new LinkedList < SearchResultDto > ( ) ; String finalSearchString = parseQuery ( searchString , repositoryNames , repositoryGroupNames ) ; Query query ; if ( caseSensitive ) { query = queryParserCaseSensitive . parse ( finalSearchString ) ; } else { for ( LuceneFieldPlugin plugin : luceneFieldPlugins ) { if ( ( plugin . getLowerCaseAnalyzer ( ) ) != null ) { finalSearchString = finalSearchString . replace ( ( ( plugin . getFieldName ( ) ) + ":" ) , ( ( ( plugin . getFieldName ( ) ) + ( IndexConstants . LC_POSTFIX ) ) + ":" ) ) ; } } query = queryParser . parse ( finalSearchString ) ; } DocumentSearcherImpl . LOG . info ( ( "Searching<seq2seq4repair_space>index<seq2seq4repair_space>with<seq2seq4repair_space>query:<seq2seq4repair_space>" + ( query . toString ( ) ) ) ) ; TopDocs topDocs = indexSearcher . search ( query , maxResults ) ; DocumentSearcherImpl . LOG . info ( ( ( "Found<seq2seq4repair_space>" + ( topDocs . scoreDocs . length ) ) + "<seq2seq4repair_space>results" ) ) ; Document doc ; for ( ScoreDoc sd : topDocs . scoreDocs ) { doc = indexSearcher . doc ( sd . doc ) ; SearchResultDto searchResult = new SearchResultDto ( ) ; searchResult . setRepository ( doc . get ( INDEX_FIELD_REPOSITORY ) ) ; searchResult . setFilePath ( doc . get ( INDEX_FIELD_FILEPATH ) ) ; <START_BUG> searchResult . setRevision ( doc . get ( INDEX_FIELD_REVISION ) ) ; <END_BUG> searchResult . setRelevance ( sd . score ) ; results . add ( searchResult ) ; } return results ; } @ Override public synchronized void refreshIndex ( ) throws InvalidIndexException { } private String parseQuery ( String query , Set < String > repositoryNames , Set < String > repositoryGroupNames ) { } private void initSearcher ( ) throws InvalidIndexException { } }

Fix:
searchResult . setLastRevision ( doc . get ( INDEX_FIELD_REVISION ) ) ;
Buggy code:
public class HttpDownAnalysis implements Runnable { private static final String TAG = "HttpDownAnalysis" ; private DownloadFile dFile ; private static final int SEGM_REFERENCE = ( 1024 * 1024 ) * 3 ; private static final int MAX_SEGM_TASK = 3 ; public HttpDownAnalysis ( DownloadFile dFile , HttpDownAnalysis . OnDownloadAnalysis mAnalysis ) { } private HttpDownAnalysis . OnDownloadAnalysis mAnalysis ; private FilePartAction mFilePartAction ; public void setFilePartAction ( FilePartAction action ) { } @ Override public void run ( ) { } static class DefaultFilePartAction implements FilePartAction { @ Override public DownloadInfo [ ] partTask ( DownloadFile dFile , int length ) { int s = ( length // ( HttpDownAnalysis . SEGM_REFERENCE ) ) + 1 ; if ( s == 1 ) { return new DownloadInfo [ ] { new DownloadInfo ( dFile , 0 , DownloadInfo . RANGE_NONE ) } ; } if ( s > ( HttpDownAnalysis . MAX_SEGM_TASK ) ) { s = HttpDownAnalysis . MAX_SEGM_TASK ; } int p = length // s ; DownloadInfo [ ] infos = new DownloadInfo [ s ] ; <START_BUG> infos [ 0 ] = new DownloadInfo ( dFile , DownloadInfo . RANGE_NONE , p ) ; <END_BUG> for ( int i = 1 ; i < ( s - 1 ) ; i ++ ) { infos [ i ] = new DownloadInfo ( dFile , ( ( p * i ) + i ) , ( ( p * ( i + 1 ) ) + i ) ) ; } infos [ ( s - 1 ) ] = new DownloadInfo ( dFile , ( ( p * ( s - 1 ) ) + ( s - 1 ) ) , DownloadInfo . RANGE_NONE ) ; return infos ; } } public static interface OnDownloadAnalysis { void onComplete ( DownloadInfo [ ] infos ) { } } }

Fix:
infos [ 0 ] = new DownloadInfo ( dFile , 0 , p ) ;
Buggy code:
public class StaticPartitionConnections { Map < Integer , SimpleConsumer > _kafka = new HashMap < Integer , SimpleConsumer > ( ) ; KafkaConfig _config ; StaticHosts hosts ; public StaticPartitionConnections ( KafkaConfig conf ) { } public SimpleConsumer getConsumer ( int partition ) { if ( ! ( _kafka . containsKey ( partition ) ) ) { <START_BUG> HostPort hp = hosts . getPartitionInformation ( ) . getHostFor ( partition ) ; <END_BUG> _kafka . put ( partition , new SimpleConsumer ( hp . host , hp . port , _config . socketTimeoutMs , _config . bufferSizeBytes , _config . clientId ) ) ; } return _kafka . get ( partition ) ; } public void close ( ) { } }

Fix:
Broker hp = hosts . getPartitionInformation ( ) . getBrokerFor ( partition ) ;
Buggy code:
public class MovieListActivity extends ActionBarActivity implements MenuItemCompat . OnActionExpandListener { private PreferencesUtils utils ; private static final int POPULAR_FRAGMENT = 0 ; private static final int UPCOMING_FRAGMENT = 1 ; private static final int TOP_RATED_FRAGMENT = 2 ; private static final int SEARCH_FRAGMENT = 3 ; private static final int DISCOVER_FRAGMENT = 4 ; private static final int FAVORITE_FRAGMENT = 5 ; private static final int WATCHLIST_FRAGMENT = 6 ; private static final int LOG_IN_OUT = 7 ; private static final int FRAGMENT_COUNT = ( MovieListActivity . WATCHLIST_FRAGMENT ) + 1 ; private Fragment [ ] fragments = new Fragment [ MovieListActivity . FRAGMENT_COUNT ] ; public static Result drawerResult ; private FragmentManager fm ; protected SearchView searchView ; @ Override protected void onCreate ( Bundle savedInstanceState ) { } private void hideFragment ( ) { } protected void showFragment ( int fragmentIndex ) { } @ Override public boolean onCreateOptionsMenu ( Menu menu ) { } @ Override public boolean onOptionsItemSelected ( MenuItem item ) { } @ Override public boolean onMenuItemActionExpand ( MenuItem item ) { } @ Override public boolean onMenuItemActionCollapse ( MenuItem item ) { <START_BUG> MovieListActivity . drawerResult . setSelection ( 2 ) ; <END_BUG> showFragment ( MovieListActivity . TOP_RATED_FRAGMENT ) ; return true ; } }

Fix:
MovieListActivity . drawerResult . setSelection ( MovieListActivity . TOP_RATED_FRAGMENT ) ;
Buggy code:
public class GenericBinding implements Binding { private ValueModel valueModel ; private BindingContext bindingContext ; private ValueBuffer buffer ; private BindingStatus bindingStatus ; private Object sourceValue ; private Exception invalidSourceValueCause ; public GenericBinding ( ValueModel valueModel , BindingContext bindingContext ) { } public String getRenderValue ( ) { } public Object getValue ( ) { } public Class < ? > getValueType ( ) { } public boolean isEditable ( ) { } public boolean isEnabled ( ) { } public boolean isVisible ( ) { } @ SuppressWarnings ( "unchecked" ) public void applySourceValue ( Object sourceValue ) { } public Object getInvalidSourceValue ( ) { } public BindingStatus getBindingStatus ( ) { } public ValidationStatus getValidationStatus ( ) { } public Alert getStatusAlert ( ) { } public void validate ( ) { } public void commit ( ) { } public void revert ( ) { } public Binding getNestedBinding ( String property ) { <START_BUG> return bindingContext . getBinding ( property ) ; <END_BUG> } public boolean isList ( ) { } public Binding getListElementBinding ( int index ) { } public boolean isMap ( ) { } public Binding getMapValueBinding ( Object key ) { } @ SuppressWarnings ( "unchecked" ) public String formatValue ( Object value ) { } @ SuppressWarnings ( "unchecked" ) private String format ( Object value , Formatter formatter ) { } private Locale getLocale ( ) { } @ SuppressWarnings ( "unchecked" ) private Class getFormattedObjectType ( Class formatterClass ) { } @ SuppressWarnings ( "unchecked" ) private Object coerseToValueType ( Object parsed ) { } private void assertEditable ( ) { } private void assertEnabled ( ) { } abstract static class AbstractAlert implements Alert { public String toString ( ) { } } }

Fix:
return bindingContext . getNestedBinding ( property ) ;
Buggy code:
public class MLResultTraverser extends ResultTraverser { public static MLResultTraverser _ = new MLResultTraverser ( ) ; protected MLResultTraverser ( ) { } @ Override protected void process ( GraphHandler handler , PFlow pf , Statement s , Statement parent , QCAVector rr , int level , boolean isOne , int pos , boolean isLast ) throws IOException { if ( s != null ) { if ( ( s instanceof MLOperator ) || ( s instanceof VALUE ) ) { if ( s instanceof Prefix ) { node = rr . getClosest ( ) . getEndNode ( ) ; It it = new It ( node ) ; String [ ] param = new String [ ] { null , null } ; try { if ( it . hasNext ( ) ) { Object p = it . next ( ) ; param [ 0 ] = param ( pf , p ) ; if ( ! ( s instanceof ELEMENT ) ) { param [ 1 ] = param ( pf , it ) ; if ( ( param [ 1 ] ) == null ) { if ( s instanceof NS ) { if ( QNAME . _ . name ( ) . equals ( ( p instanceof String ? p : ( ( org . neo4j . graphdb . Relationship ) ( p ) ) . getType ( ) . name ( ) ) ) ) { param [ 1 ] = "" ; } else { param [ 1 ] = param [ 0 ] ; param [ 0 ] = "" ; } } } } handler . start ( s , parent , param , ( level ++ ) , isOne , pos , isLast ) ; iterate ( handler , pf , rr , s , it , level ) ; handler . end ( s , parent , param , ( -- level ) , isOne , pos , isLast ) ; } } finally { it . remove ( ) ; } } else if ( ( ! ( s instanceof VALUE ) ) || ( ( s instanceof VALUE ) && ( level > 0 ) ) ) { String param = STRING . serialize ( pf , rr ) ; handler . start ( s , parent , param , ( level ++ ) , isOne , pos , isLast ) ; handler . end ( s , parent , param , ( -- level ) , isOne , pos , isLast ) ; } } else { <START_BUG> super . process ( handler , pf , s , null , rr , level , isOne , pos , isLast ) ; <END_BUG> } } } private String param ( PFlow pf , It it ) throws IOException { } private String param ( PFlow pf , Object o ) throws IOException { } }

Fix:
super . process ( handler , pf , s , parent , rr , level , isOne , pos , isLast ) ;
Buggy code:
public final class TimeStamp implements Serializable { private long creationTime = 0L ; private long lastAccessedTime = creationTime ; private long thisAccessedTime = creationTime ; private boolean isNew = true ; private long maxInactiveInterval = - 1 ; private boolean isValid = false ; MessageBytes name ; int id = - 1 ; Object parent ; public TimeStamp ( ) { } public void touch ( long time ) { } public MessageBytes getName ( ) { if ( ( name ) == null ) <START_BUG> name = new MessageBytes ( ) ; <END_BUG> return name ; } public int getId ( ) { } public void setId ( int id ) { } public void setParent ( Object o ) { } public Object getParent ( ) { } public void setCreationTime ( long time ) { } public long getLastAccessedTime ( ) { } public long getMaxInactiveInterval ( ) { } public void setMaxInactiveInterval ( long interval ) { } public boolean isValid ( ) { } public void setValid ( boolean isValid ) { } public boolean isNew ( ) { } public void setNew ( boolean isNew ) { } public long getCreationTime ( ) { } public void recycle ( ) { } }

Fix:
name = MessageBytes . newInstance ( ) ;
Buggy code:
public class FivePlusUnsuccessfulInPast14DaysTrigger extends EmailTrigger { public static final String TRIGGER_NAME = ">5<seq2seq4repair_space>unsuccessful<seq2seq4repair_space>in<seq2seq4repair_space>past<seq2seq4repair_space>14<seq2seq4repair_space>days" ; public static final int MILLIS_PER_DAY = ( ( 24 * 60 ) * 60 ) * 1000 ; public static final int NUM_BUILDS_UNSUCCESSFUL_LIMIT = 5 ; public static final int NUM_DAYS_IN_WINDOW = 14 ; public static final int DELTA_FOR_AGE_THRESHOLD = ( FivePlusUnsuccessfulInPast14DaysTrigger . NUM_DAYS_IN_WINDOW ) * ( FivePlusUnsuccessfulInPast14DaysTrigger . MILLIS_PER_DAY ) ; @ SuppressWarnings ( "UnusedDeclaration" ) public static FivePlusUnsuccessfulInPast14DaysTrigger createDefault ( ) { } @ DataBoundConstructor public FivePlusUnsuccessfulInPast14DaysTrigger ( boolean sendToList , boolean sendToDevs , boolean sendToRequestor , boolean sendToCulprits , String recipientList , String replyTo , String subject , String body , String attachmentsPattern , int attachBuildLog , String contentType ) { } @ Override public boolean trigger ( AbstractBuild < ? , ? > build , TaskListener listener ) { <START_BUG> return ( ( ( UnsuccessfulTrigger . isBuildUnsuccessful ( build . getResult ( ) ) ) && ( FivePlusUnsuccessfulInPast14DaysTrigger . hasFiveUnsuccessfulBuildsInPast14Days ( build , 0 ) ) ) && ( ! ( FivePlusUnsuccessfulInPast14DaysTrigger . hasFiveUnsuccessfulBuildsInPast14Days ( build . getPreviousBuild ( ) , 0 ) ) ) ) && ( ! ( ThreePlusConsecutiveUnsuccessfulTrigger . lastXBuildsUnsuccessful ( 3 , build . getPreviousBuild ( ) ) ) ) ; <END_BUG> } public static boolean hasFiveUnsuccessfulBuildsInPast14Days ( AbstractBuild < ? , ? > currentBuild , int currentCount ) { } private static long getBuildStartTime ( AbstractBuild < ? , ? > build ) { } private static boolean exceedsUnsuccessfulLimit ( int currentCount ) { } private static long minBuildTimeInMillis ( ) { } @ Extension public static class DescriptorImpl extends EmailTriggerDescriptor { public String getDisplayName ( ) { } @ Override public boolean getDefaultSendToList ( ) { } @ Override public boolean getDefaultSendToDevs ( ) { } @ Override public boolean getDefaultSendToRequester ( ) { } } }

Fix:
return ( ( ( UnsuccessfulTrigger . isBuildUnsuccessful ( build . getResult ( ) ) ) && ( FivePlusUnsuccessfulInPast14DaysTrigger . hasFiveUnsuccessfulBuildsInPast14Days ( build , 0 ) ) ) && ( ! ( FivePlusUnsuccessfulInPast14DaysTrigger . hasFiveUnsuccessfulBuildsInPast14Days ( build . getPreviousBuild ( ) , 0 ) ) ) ) && ( ! ( ThreePlusConsecutiveUnsuccessfulTrigger . lastXBuildsUnsuccessful ( 3 , build ) ) ) ;
Buggy code:
public class Suggester extends SolrSpellChecker { private static final Logger LOG = LoggerFactory . getLogger ( Suggester . class ) ; public static final String LOCATION = "sourceLocation" ; public static final String FIELD = "field" ; public static final String LOOKUP_IMPL = "lookupImpl" ; public static final String THRESHOLD_TOKEN_FREQUENCY = "threshold" ; public static final String STORE_DIR = "storeDir" ; protected String sourceLocation ; protected File storeDir ; protected String field ; protected float threshold ; protected Dictionary dictionary ; protected IndexReader reader ; protected Lookup lookup ; protected String lookupImpl ; protected SolrCore core ; @ Override public String init ( NamedList config , SolrCore core ) { Suggester . LOG . info ( ( "init:<seq2seq4repair_space>" + config ) ) ; String name = super . init ( config , core ) ; <START_BUG> threshold = ( ( config . get ( Suggester . THRESHOLD_TOKEN_FREQUENCY ) ) == null ) ? 0.0F : ( ( Float ) ( config . get ( Suggester . THRESHOLD_TOKEN_FREQUENCY ) ) ) ; <END_BUG> sourceLocation = ( ( String ) ( config . get ( Suggester . LOCATION ) ) ) ; field = ( ( String ) ( config . get ( Suggester . FIELD ) ) ) ; lookupImpl = ( ( String ) ( config . get ( Suggester . LOOKUP_IMPL ) ) ) ; if ( ( lookupImpl ) == null ) { lookupImpl = JaspellLookup . class . getName ( ) ; } String store = ( ( String ) ( config . get ( Suggester . STORE_DIR ) ) ) ; if ( store != null ) { storeDir = new File ( store ) ; if ( ! ( storeDir . isAbsolute ( ) ) ) { storeDir = new File ( ( ( ( core . getDataDir ( ) ) + ( File . separator ) ) + ( storeDir ) ) ) ; } if ( ! ( storeDir . exists ( ) ) ) { storeDir . mkdirs ( ) ; } } return name ; } @ Override public void build ( SolrCore core , SolrIndexSearcher searcher ) { } @ Override public void reload ( SolrCore core , SolrIndexSearcher searcher ) throws IOException { } public void add ( String query , int numHits ) { } static SpellingResult EMPTY_RESULT = new SpellingResult ( ) ; @ Override public SpellingResult getSuggestions ( Collection < Token > tokens , IndexReader reader , int count , boolean onlyMorePopular , boolean extendedResults ) throws IOException { } @ Override public SpellingResult getSuggestions ( SpellingOptions options ) throws IOException { } }

Fix:
threshold = ( ( config . get ( Suggester . THRESHOLD_TOKEN_FREQUENCY ) ) == null ) ? 0.0F : Float . valueOf ( ( ( String ) ( config . get ( Suggester . THRESHOLD_TOKEN_FREQUENCY ) ) ) ) ;
Buggy code:
public class Driver40UnbootedTest extends BaseJDBCTestCase { private static final String SUCCESS = "Success" ; public Driver40UnbootedTest ( String name ) { } public static Test suite ( ) { } public static void main ( String [ ] args ) throws Exception { } public void test_notBooted ( ) throws Exception { if ( ! ( getTestConfiguration ( ) . loadingFromJars ( ) ) ) { return ; } StringBuffer buffer = new StringBuffer ( ) ; String classpath = getSystemProperty ( "java.class.path" ) ; buffer . append ( ( ( getJavaExecutableName ( ) ) + "<seq2seq4repair_space>-classpath<seq2seq4repair_space>" ) ) ; buffer . append ( classpath ) ; buffer . append ( "<seq2seq4repair_space>-Demma.verbosity.level=silent<seq2seq4repair_space>" ) ; buffer . append ( getClass ( ) . getName ( ) ) ; final String command = buffer . toString ( ) ; println ( ( "Server<seq2seq4repair_space>command<seq2seq4repair_space>is<seq2seq4repair_space>" + command ) ) ; Process process = Runtime . getRuntime ( ) . exec ( command ) ; SpawnedProcess spawned = new SpawnedProcess ( process , "UnbootedTest" ) ; <START_BUG> assertEquals ( 0 , spawned . complete ( false ) ) ; <END_BUG> assertEquals ( Driver40UnbootedTest . SUCCESS , spawned . getFullServerOutput ( ) ) ; } }

Fix:
assertEquals ( 0 , spawned . complete ( ) ) ;
Buggy code:
public class MessageBrokerBeanDefinitionParserTests { private GenericWebApplicationContext appContext ; @ Before public void setup ( ) { } @ Test public void simpleBroker ( ) { } @ Test public void stompBrokerRelay ( ) { } @ Test public void annotationMethodMessageHandler ( ) { loadBeanDefinitions ( "websocket-config-broker-simple.xml" ) ; SimpAnnotationMethodMessageHandler annotationMethodMessageHandler = this . appContext . getBean ( SimpAnnotationMethodMessageHandler . class ) ; assertNotNull ( annotationMethodMessageHandler ) ; MessageConverter messageConverter = annotationMethodMessageHandler . getMessageConverter ( ) ; assertNotNull ( messageConverter ) ; assertTrue ( ( messageConverter instanceof CompositeMessageConverter ) ) ; CompositeMessageConverter compositeMessageConverter = this . appContext . getBean ( CompositeMessageConverter . class ) ; assertNotNull ( compositeMessageConverter ) ; SimpMessagingTemplate simpMessagingTemplate = this . appContext . getBean ( SimpMessagingTemplate . class ) ; assertNotNull ( simpMessagingTemplate ) ; <START_BUG> assertEquals ( "//personal" , simpMessagingTemplate . getUserDestinationPrefix ( ) ) ; <END_BUG> List < MessageConverter > converters = compositeMessageConverter . getConverters ( ) ; assertThat ( converters . size ( ) , Matchers . is ( 3 ) ) ; assertThat ( converters . get ( 0 ) , Matchers . instanceOf ( MappingJackson2MessageConverter . class ) ) ; assertThat ( converters . get ( 1 ) , Matchers . instanceOf ( StringMessageConverter . class ) ) ; assertThat ( converters . get ( 2 ) , Matchers . instanceOf ( ByteArrayMessageConverter . class ) ) ; ContentTypeResolver resolver = ( ( MappingJackson2MessageConverter ) ( converters . get ( 0 ) ) ) . getContentTypeResolver ( ) ; assertEquals ( APPLICATION_JSON , ( ( org . springframework . messaging . converter . DefaultContentTypeResolver ) ( resolver ) ) . getDefaultMimeType ( ) ) ; } @ Test public void customChannels ( ) { } @ Test public void customChannelsWithDefaultExecutor ( ) { } @ Test public void messageConverters ( ) { } @ Test public void messageConvertersDefaultsOff ( ) { } private void testChannel ( String channelName , List < Class < ? extends MessageHandler > > subscriberTypes , int interceptorCount ) { } private void testExecutor ( String channelName , int corePoolSize , int maxPoolSize , int keepAliveSeconds ) { } private void loadBeanDefinitions ( String fileName ) { } private WebSocketHandler unwrapWebSocketHandler ( WebSocketHandler handler ) { } }

Fix:
assertEquals ( "//personal//" , simpMessagingTemplate . getUserDestinationPrefix ( ) ) ;
Buggy code:
public class CreateFilterOnSubjectAction extends FrameAction implements SelectionListener { public CreateFilterOnSubjectAction ( AbstractFrameController frameController ) { } public void actionPerformed ( ActionEvent evt ) { <START_BUG> FolderCommandReference [ ] r = ( ( org . columba . mail . gui . frame . AbstractMailFrameController ) ( getFrameController ( ) ) ) . getTableSelection ( ) ; <END_BUG> CreateFilterOnMessageCommand c = new CreateFilterOnMessageCommand ( r , CreateFilterOnMessageCommand . FILTER_ON_SUBJECT ) ; processor . addOp ( c ) ; } public void selectionChanged ( SelectionChangedEvent e ) { } }

Fix:
FolderCommandReference [ ] r = ( ( org . columba . mail . gui . frame . AbstractMailFrameController ) ( getFrameMediator ( ) ) ) . getTableSelection ( ) ;
Buggy code:
public class Room implements Comparable < Room > , RoomInterface { protected ArrayList < ConnectionToClient > list ; private int limit = DEFAULT_LIMIT ; private String name = "commons" ; private int id ; private boolean open = true ; public Room ( ) { } public int getClientIndex ( int itemName ) { } public ConnectionToClient getClientById ( int id ) { } public ConnectionToClient getClientByName ( String name ) { } public String getName ( ) { } public void setName ( String name ) { } public int getLimit ( ) { } public void setLimit ( int limit ) { } public int getId ( ) { } public void setId ( int id ) { } public boolean isOpen ( ) { } public void setOpen ( boolean open ) { } public String toString ( ) { } @ Override public int compareTo ( Room o ) { } @ Override public boolean equals ( Object o ) { if ( ( this ) == o ) return true ; if ( ( o == null ) || ( ( this . getClass ( ) ) != ( o . getClass ( ) ) ) ) { return false ; } <START_BUG> ClientInfo guest = ( ( ClientInfo ) ( o ) ) ; <END_BUG> return ( this . getId ( ) ) == ( guest . getId ( ) ) ; } @ Override public int hashCode ( ) { } public Iterator < ConnectionToClient > getIter ( ) { } @ Override public boolean add ( ConnectionToClient e ) { } @ Override public void add ( int index , ConnectionToClient element ) { } @ Override public boolean addAll ( Collection < ? extends ConnectionToClient > c ) { } @ Override public boolean addAll ( int index , Collection < ? extends ConnectionToClient > c ) { } @ Override public void clear ( ) { } @ Override public boolean contains ( Object o ) { } @ Override public boolean containsAll ( Collection < ? > c ) { } @ Override public ConnectionToClient get ( int index ) { } @ Override public int indexOf ( Object o ) { } @ Override public boolean isEmpty ( ) { } @ Override public Iterator < ConnectionToClient > iterator ( ) { } @ Override public int lastIndexOf ( Object o ) { } @ Override public ListIterator < ConnectionToClient > listIterator ( ) { } @ Override public ListIterator < ConnectionToClient > listIterator ( int index ) { } @ Override public boolean remove ( Object o ) { } @ Override public ConnectionToClient remove ( int index ) { } @ Override public boolean removeAll ( Collection < ? > c ) { } @ Override public boolean retainAll ( Collection < ? > c ) { } @ Override public ConnectionToClient set ( int index , ConnectionToClient element ) { } @ Override public int size ( ) { } @ Override public List < ConnectionToClient > subList ( int fromIndex , int toIndex ) { } @ Override public Object [ ] toArray ( ) { } @ Override public < T > T [ ] toArray ( T [ ] a ) { } No newline ; at end ; of file ; }

Fix:
ConnectionToClient guest = ( ( ConnectionToClient ) ( o ) ) ;
Buggy code:
public class Utility { public static final int VAT_EXCLUSIVE = 1 ; public static final int SECOND_HAND = 2 ; public static final int DEFAULT_TYPE = 3 ; public static final String LOG_TAG = Utility . class . getSimpleName ( ) ; public static String standardiseAddress ( String in ) { if ( in != null ) { String rVal = in . trim ( ) . toLowerCase ( ) ; if ( ! ( rVal . endsWith ( "." ) ) ) { <START_BUG> rVal += rVal + "." ; <END_BUG> } return rVal ; } return null ; } public static int getPreferredNumberOfDaysToKeep ( Context context ) { } public static String getPreferredLocation ( Context context ) { } public static String formatPrice ( Context context , String price ) { } static String formatDate ( long dateInMilliseconds ) { } public static final String DATE_FORMAT = "yyyyMMdd" ; public static String getFriendlyDayString ( Context context , long dateInMillis ) { } public static String getFormattedMonthDay ( Context context , long dateInMillis ) { } public static int getIconResourceForPropType ( int propTypeId , int numBeds ) { } public static int getArtResourceForPropType ( int propTypeId , int numBeds ) { } public static boolean isMatchedAddress ( ContentValues brochureValues , String address ) { } public static boolean isMatchedAddress ( String brochureAddress , String searchedAddress ) { } No newline ; at end ; of file ; }

Fix:
rVal = rVal + "." ;
Buggy code:
public abstract class CreateTypeMemberOperation extends CreateElementInCUOperation { protected String source = null ; protected String alteredName ; protected ASTNode createdNode ; public CreateTypeMemberOperation ( IJavaElement parentElement , String source , boolean force ) { } protected StructuralPropertyDescriptor getChildPropertyDescriptor ( ASTNode parent ) { } protected ASTNode generateElementAST ( ASTRewrite rewriter , IDocument document , ICompilationUnit cu ) throws JavaModelException { } private String removeIndentAndNewLines ( String code , IDocument document , ICompilationUnit cu ) { IJavaProject project = cu . getJavaProject ( ) ; Map options = project . getOptions ( true ) ; int tabWidth ; try { <START_BUG> tabWidth = Integer . parseInt ( ( ( String ) ( options . get ( FORMATTER_TAB_LENGTH ) ) ) ) ; <END_BUG> } catch ( NumberFormatException e ) { tabWidth = 4 ; } int indent = Indents . computeIndent ( code , tabWidth ) ; int firstNonWhiteSpace = - 1 ; int length = code . length ( ) ; while ( firstNonWhiteSpace < ( length - 1 ) ) if ( ! ( Character . isWhitespace ( code . charAt ( ( ++ firstNonWhiteSpace ) ) ) ) ) break ; int lastNonWhiteSpace = length ; while ( lastNonWhiteSpace > 0 ) if ( ! ( Character . isWhitespace ( code . charAt ( ( -- lastNonWhiteSpace ) ) ) ) ) break ; String lineDelimiter = TextUtilities . getDefaultLineDelimiter ( document ) ; return Indents . changeIndent ( code . substring ( firstNonWhiteSpace , ( lastNonWhiteSpace + 1 ) ) , indent , tabWidth , "" , lineDelimiter ) ; } protected abstract SimpleName rename ( ASTNode node , SimpleName newName ) { } protected String generateSyntaxIncorrectAST ( ) { } protected IType getType ( ) { } protected void setAlteredName ( String newName ) { } public IJavaModelStatus verify ( ) { } protected IJavaModelStatus verifyNameCollision ( ) { } }

Fix:
tabWidth = Integer . parseInt ( ( ( String ) ( options . get ( DefaultCodeFormatterConstants . FORMATTER_INDENTATION_SIZE ) ) ) ) ;
Buggy code:
public class HighlightHTMLReportGenerator { private final String title ; private final File [ ] executionDataFiles ; private final File [ ] classesDirectories ; private final File [ ] sourceDirectories ; private final File reportDirectory ; private final File parseParamDirectory ; private ExecFileLoader execFileLoader ; public HighlightHTMLReportGenerator ( HighlightHTMLReportParams params ) { } public void create ( ) throws IOException { } private void createReport ( final IBundleCoverage bundleCoverage ) throws IOException { } private void loadExecutionData ( ) throws IOException { } private IBundleCoverage analyzeStructure ( ) throws IOException { } private static HighlightHTMLReportParams parseArgs ( final String [ ] args ) { int i = 0 ; HighlightHTMLReportParams params = new HighlightHTMLReportParams ( ) ; <START_BUG> Path root = Paths . get ( "." ) ; <END_BUG> while ( i < ( args . length ) ) { switch ( args [ i ] ) { case "-o" : if ( ( ++ i ) >= ( args . length ) ) HighlightHTMLReportGenerator . usage ( ) ; params . reportDirectory = root . resolve ( args [ i ] ) . toFile ( ) ; break ; case "-c" : if ( ( ++ i ) >= ( args . length ) ) HighlightHTMLReportGenerator . usage ( ) ; PathMatcher cpm = FileSystems . getDefault ( ) . getPathMatcher ( ( "glob:" + ( args [ i ] ) ) ) ; HighlightHTMLReportGenerator . findFiles ( root , cpm , params . classesDirectories ) ; break ; case "-s" : if ( ( ++ i ) >= ( args . length ) ) HighlightHTMLReportGenerator . usage ( ) ; PathMatcher spm = FileSystems . getDefault ( ) . getPathMatcher ( ( "glob:" + ( args [ i ] ) ) ) ; HighlightHTMLReportGenerator . findFiles ( root , spm , params . sourceDirectories ) ; break ; case "-e" : if ( ( ++ i ) >= ( args . length ) ) HighlightHTMLReportGenerator . usage ( ) ; PathMatcher epm = FileSystems . getDefault ( ) . getPathMatcher ( ( "glob:" + ( args [ i ] ) ) ) ; HighlightHTMLReportGenerator . findFiles ( root , epm , params . executionDataFiles ) ; break ; case "-t" : if ( ( ++ i ) >= ( args . length ) ) HighlightHTMLReportGenerator . usage ( ) ; params . title = args [ i ] ; break ; case "-p" : if ( ( ++ i ) >= ( args . length ) ) HighlightHTMLReportGenerator . usage ( ) ; params . parseParamsFile = root . resolve ( args [ i ] ) . toFile ( ) ; break ; default : root = Paths . get ( args [ i ] ) . toAbsolutePath ( ) . normalize ( ) ; } ++ i ; } if ( params . title . isEmpty ( ) ) params . title = root . toAbsolutePath ( ) . normalize ( ) . getFileName ( ) . toString ( ) ; return params ; } private static void findFiles ( Path root , final PathMatcher pm , final List < File > files ) { } private static void usage ( ) { } public static void main ( final String [ ] args ) throws IOException { } No newline ; at end ; of file ; }

Fix:
Path root = Paths . get ( System . getProperty ( "user.dir" ) ) ;
Buggy code:
public class JsonUtilities { private String error = "" ; public String getError ( ) { } public String extractStringKeyword ( JsonNode node , String keyword , boolean isRequired ) { } public Double extractDoubleKeyword ( JsonNode node , String keyword , boolean isRequired ) { error = "" ; JsonNode keyNode = node . path ( keyword ) ; if ( keyNode . isMissingNode ( ) ) { if ( isRequired ) { error = ( "Keyword<seq2seq4repair_space>" + keyword ) + "<seq2seq4repair_space>is<seq2seq4repair_space>missing!" ; return null ; } return null ; } if ( keyNode . isDouble ( ) ) { return keyNode . asDouble ( ) ; } else { <START_BUG> error = ( "Keyword<seq2seq4repair_space>" + keyword ) + "<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>of<seq2seq4repair_space>type<seq2seq4repair_space>Int!" ; <END_BUG> return null ; } } public Integer extractIntKeyword ( JsonNode node , String keyword , boolean isRequired ) { } public Boolean extractBooleanKeyword ( JsonNode node , String keyword , boolean isRequired ) { } public static String getNodeTypeAsString ( JsonNode node ) { } }

Fix:
error = ( "Keyword<seq2seq4repair_space>" + keyword ) + "<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>of<seq2seq4repair_space>type<seq2seq4repair_space>Double!" ;
Buggy code:
public class WicketFilter implements Filter { public static final String APP_FACT_PARAM = "applicationFactoryClassName" ; public static final String FILTER_MAPPING_PARAM = "filterMappingUrlPattern" ; private static final Logger log = LoggerFactory . getLogger ( WicketFilter . class ) ; static final String SERVLET_PATH_HOLDER = "<servlet>" ; private FilterConfig filterConfig ; private String filterPath ; private WebApplication webApplication ; private boolean servletMode = false ; public void destroy ( ) { } public void doFilter ( ServletRequest request , ServletResponse response , FilterChain chain ) throws IOException , ServletException { } public final void doGet ( final HttpServletRequest servletRequest , final HttpServletResponse servletResponse ) throws IOException , ServletException { } public FilterConfig getFilterConfig ( ) { } public String getRelativePath ( HttpServletRequest request ) { <START_BUG> String path = request . getRequestURI ( ) ; <END_BUG> String contextPath = request . getContextPath ( ) ; path = path . substring ( contextPath . length ( ) ) ; if ( servletMode ) { String servletPath = request . getServletPath ( ) ; path = path . substring ( servletPath . length ( ) ) ; } filterPath = getFilterPath ( request ) ; if ( ( path . length ( ) ) > 0 ) { path = path . substring ( 1 ) ; } if ( ! ( path . startsWith ( filterPath ) ) ) { if ( filterPath . equals ( ( path + "//" ) ) ) { path += "//" ; } } if ( path . startsWith ( filterPath ) ) { path = path . substring ( filterPath . length ( ) ) ; } return path ; } public void init ( FilterConfig filterConfig ) throws ServletException { } private String getFilterPath ( String filterName , InputStream is ) throws ServletException { } private boolean isWicketRequest ( String relativePath ) { } private void maybeSetLastModified ( final HttpServletResponse resp , final long lastModified ) { } protected IWebApplicationFactory getApplicationFactory ( ) { } protected ClassLoader getClassLoader ( ) { } protected String getFilterPath ( HttpServletRequest request ) { } long getLastModified ( final HttpServletRequest request ) { } }

Fix:
String path = Strings . stripJSessionId ( request . getRequestURI ( ) ) ;
Buggy code:
public class CacheContainerMetricsHandler extends AbstractRuntimeOnlyHandler { @ Override protected void executeRuntimeStep ( OperationContext context , ModelNode operation ) { <START_BUG> String containerName = Operations . getPathAddress ( operation ) . getLastElement ( ) . getValue ( ) ; <END_BUG> String name = Operations . getAttributeName ( operation ) ; CacheContainerMetric metric = CacheContainerMetric . forName ( name ) ; if ( metric == null ) { context . getFailureDescription ( ) . set ( ROOT_LOGGER . unknownMetric ( name ) ) ; } else { CacheContainer container = ServiceContainerHelper . findValue ( context . getServiceRegistry ( false ) , CACHE_CONTAINER . getServiceName ( containerName ) ) ; if ( container != null ) { ModelNode result = metric . getValue ( container ) ; context . getResult ( ) . set ( ( ( result != null ) && ( result . isDefined ( ) ) ? result : new ModelNode ( "N//A" ) ) ) ; } } context . completeStep ( NOOP_RESULT_HANDLER ) ; } }

Fix:
String containerName = context . getCurrentAddressValue ( ) ;