nus-yam/ex-repair huggingface dataset:
Buggy code:
public final class MultiFormatReader implements Reader { private Hashtable hints ; private Vector readers ; public Result decode ( BinaryBitmap image ) throws NotFoundException { } public Result decode ( BinaryBitmap image , Hashtable hints ) throws NotFoundException { } public Result decodeWithState ( BinaryBitmap image ) throws NotFoundException { } public void setHints ( Hashtable hints ) { this . hints = hints ; boolean tryHarder = ( hints != null ) && ( hints . containsKey ( TRY_HARDER ) ) ; Vector formats = ( hints == null ) ? null : ( ( Vector ) ( hints . get ( POSSIBLE_FORMATS ) ) ) ; readers = new Vector ( ) ; if ( formats != null ) { boolean addOneDReader = ( ( ( ( ( ( ( ( ( formats . contains ( UPC_A ) ) || ( formats . contains ( UPC_E ) ) ) || ( formats . contains ( EAN_13 ) ) ) || ( formats . contains ( EAN_8 ) ) ) || ( formats . contains ( CODE_39 ) ) ) || ( formats . contains ( CODE_93 ) ) ) || ( formats . contains ( CODE_128 ) ) ) || ( formats . contains ( ITF ) ) ) || ( formats . contains ( RSS14 ) ) ) || ( formats . contains ( RSS_EXPANDED ) ) ; if ( addOneDReader && ( ! tryHarder ) ) { readers . addElement ( new MultiFormatOneDReader ( hints ) ) ; } if ( formats . contains ( QR_CODE ) ) { readers . addElement ( new QRCodeReader ( ) ) ; } <START_BUG> if ( formats . contains ( DATAMATRIX ) ) { <END_BUG> readers . addElement ( new DataMatrixReader ( ) ) ; } if ( formats . contains ( PDF417 ) ) { readers . addElement ( new PDF417Reader ( ) ) ; } if ( addOneDReader && tryHarder ) { readers . addElement ( new MultiFormatOneDReader ( hints ) ) ; } } if ( readers . isEmpty ( ) ) { if ( ! tryHarder ) { readers . addElement ( new MultiFormatOneDReader ( hints ) ) ; } readers . addElement ( new QRCodeReader ( ) ) ; if ( tryHarder ) { readers . addElement ( new MultiFormatOneDReader ( hints ) ) ; } } } public void reset ( ) { } private Result decodeInternal ( BinaryBitmap image ) throws NotFoundException { } }

Fix:
if ( formats . contains ( DATA_MATRIX ) ) {
Buggy code:
public class SearchManager { private UserSessionImpl session ; public static final String SERVER_URL = "http:////45.55.72.89" ; @ Inject private LocalRepository permisionsManager ; @ Inject public SearchManager ( UserSessionImpl session ) { } public SearchResult getSearchResults ( SearchDetails searchInfo ) { } private ArrayList < SearchResultData > filterResultsByPermission ( ArrayList < SearchResultData > listResults , ArrayList < String > pathList ) { } private ArrayList < SearchResultData > formatResultsDescription ( ArrayList < SearchResultData > listResults , String searchString ) { } private SearchResultFile getSearchResultFileFromJSONObject ( JSONObject hit ) { JSONObject hitSource ; JSONObject file ; JSONObject meta ; String filename ; String url ; String description ; String author ; String title ; String date ; List < String > keywords = null ; String realPath ; SearchResultFile result = null ; try { if ( ! ( hit . getString ( "_type" ) . equals ( "folder" ) ) ) { hitSource = hit . getJSONObject ( "_source" ) ; file = hitSource . getJSONObject ( "file" ) ; filename = file . getString ( "filename" ) ; realPath = hitSource . getJSONObject ( "path" ) . getString ( "real" ) ; <START_BUG> url = realPath . replace ( "//var//www//html" , SearchManager . SERVER_URL ) ; <END_BUG> description = hitSource . getString ( "content" ) ; meta = hitSource . getJSONObject ( "meta" ) ; author = meta . getString ( "author" ) ; title = meta . getString ( "title" ) ; date = meta . getString ( "date" ) ; result = new SearchResultFile ( filename , url , description , author , title , date , keywords , realPath ) ; } } catch ( JSONException e ) { e . printStackTrace ( ) ; } return result ; } private String getFormattedDescription ( String description , String searchText ) { } private ArrayList < Integer > getAllIndex ( String text , String word ) { } private ArrayList < SearchResultData > GetFakeData ( int amount , String searchText ) { } }

Fix:
url = realPath . replace ( "//var//www//files" , SearchManager . SERVER_URL ) ;
Buggy code:
public class Task implements Serializable , Comparable < Task > { private String _title ; private LocalDate _startDate ; private LocalDate _endDate ; private LocalTime _startTime ; private LocalTime _endTime ; private Boolean _isDone ; public Task ( ) { } public Task ( String title ) { } public Task ( String title , LocalDate endDate ) { } public Task ( String title , LocalDate endDate , LocalTime endTime ) { } public Task ( String title , LocalDate startDate , LocalDate endDate ) { } public Task ( String title , LocalDate startDate , LocalTime startTime , LocalDate endDate , LocalTime endTime ) { } public Task ( Task task ) { } public String getTitle ( ) { } public void setTitle ( String _title ) { } public LocalDateTime getStartDateTime ( ) { } public void setStartDateTime ( LocalDateTime startDateTime ) throws TaskDateInvalidException , TaskDateNotSetException { } public LocalDateTime getEndDateTime ( ) { } public void setEndDateTime ( LocalDateTime endDateTime ) throws TaskDateInvalidException , TaskDateNotSetException { } public LocalDate getStartDate ( ) { } public void setStartDate ( LocalDate startDate ) throws TaskDateInvalidException { <START_BUG> if ( ( ( _endDate ) == null ) || ( _endDate . isAfter ( startDate ) ) ) { <END_BUG> throw new TaskDateInvalidException ( "startDate<seq2seq4repair_space>is<seq2seq4repair_space>after<seq2seq4repair_space>endDate" ) ; } else { this . _startDate = startDate ; } } public LocalDate getEndDate ( ) { } public void setEndDate ( LocalDate endDate ) throws TaskDateInvalidException { } public LocalTime getStartTime ( ) { } public void setStartTime ( LocalTime startTime ) throws TaskDateInvalidException , TaskDateNotSetException { } public LocalTime getEndTime ( ) { } public void setEndTime ( LocalTime endTime ) throws TaskDateInvalidException , TaskDateNotSetException { } public void setTaskDone ( ) { } public void setTaskUndone ( ) { } public Boolean isDone ( ) { } public TaskType getTaskType ( ) { } private boolean isValidDateTime ( LocalDateTime start , LocalDateTime end ) { } public int compareTo ( Task other ) { } public int compareTo ( LocalDateTime now ) { } public boolean equals ( Task other ) { } private boolean equalsTitle ( Task other ) { } private boolean equalsStartDate ( Task other ) { } private boolean equalsEndDate ( Task other ) { } private boolean equalsStartTime ( Task other ) { } private boolean equalsEndTime ( Task other ) { } public String toString ( ) { } No newline ; at end ; of file ; }

Fix:
if ( ( ( _endDate ) == null ) || ( startDate . isAfter ( _endDate ) ) ) {
Buggy code:
public class TestTopDocsCollector extends LuceneTestCase { private static final class MyTopsDocCollector extends TopDocsCollector { private int idx = 0 ; private int base = 0 ; public MyTopsDocCollector ( int size ) { } protected TopDocs newTopDocs ( ScoreDoc [ ] results , int start ) { } public void collect ( int doc ) throws IOException { } public void setNextReader ( IndexReader reader , int docBase ) throws IOException { } public void setScorer ( Scorer scorer ) throws IOException { } public boolean acceptsDocsOutOfOrder ( ) { } } private static final float [ ] scores = new float [ ] { 0.7767749F , 1.7839992F , 8.9925785F , 7.9608946F , 0.07948637F , 2.6356435F , 7.4950366F , 7.1490803F , 8.108544F , 4.961808F , 2.2423935F , 7.285586F , 4.6699767F , 2.9655676F , 6.953706F , 5.383931F , 6.9916306F , 8.365894F , 7.888485F , 8.723962F , 3.1796896F , 0.39971232F , 1.3077754F , 6.8489285F , 9.17561F , 5.060466F , 7.9793315F , 8.601509F , 4.1858315F , 0.28146625F } ; private static final float MAX_SCORE = 9.17561F ; private Directory dir = new RAMDirectory ( ) ; private TopDocsCollector doSearch ( int numResults ) throws IOException { Query q = new MatchAllDocsQuery ( ) ; <START_BUG> IndexSearcher searcher = new IndexSearcher ( dir ) ; <END_BUG> TopDocsCollector tdc = new TestTopDocsCollector . MyTopsDocCollector ( numResults ) ; searcher . search ( q , tdc ) ; searcher . close ( ) ; return tdc ; } protected void setUp ( ) throws Exception { } protected void tearDown ( ) throws Exception { } public void testInvalidArguments ( ) throws Exception { } public void testZeroResults ( ) throws Exception { } public void testFirstResultsPage ( ) throws Exception { } public void testSecondResultsPages ( ) throws Exception { } public void testGetAllResults ( ) throws Exception { } public void testGetResultsFromStart ( ) throws Exception { } public void testMaxScore ( ) throws Exception { } public void testResultsOrder ( ) throws Exception { } }

Fix:
IndexSearcher searcher = new IndexSearcher ( dir , true ) ;
Buggy code:
public class WriteOnceAddressSpace { private CorfuDBClient client ; private final Logger log = LoggerFactory . getLogger ( WriteOnceAddressSpace . class ) ; public WriteOnceAddressSpace ( CorfuDBClient client ) { } public void write ( long address , byte [ ] data ) throws OverwriteException , TrimmedException { while ( true ) { try { CorfuDBViewSegment segments = client . getView ( ) . getSegments ( ) . get ( 0 ) ; int mod = segments . getGroups ( ) . size ( ) ; int groupnum = ( ( int ) ( address % mod ) ) ; List < IServerProtocol > chain = segments . getGroups ( ) . get ( groupnum ) ; long mappedAddress = address // mod ; for ( IServerProtocol unit : chain ) { <START_BUG> ( ( org . corfudb . client . logunits . IWriteOnceLogUnit ) ( unit ) ) . write ( address , data ) ; <END_BUG> return ; } } catch ( NetworkException e ) { log . warn ( "Unable<seq2seq4repair_space>to<seq2seq4repair_space>write,<seq2seq4repair_space>requesting<seq2seq4repair_space>new<seq2seq4repair_space>view." , e ) ; client . invalidateViewAndWait ( ) ; } } } public byte [ ] read ( long address ) throws TrimmedException , UnwrittenException { } }

Fix:
( ( org . corfudb . client . logunits . IWriteOnceLogUnit ) ( unit ) ) . write ( mappedAddress , data ) ;
Buggy code:
@ Service public class UserRelationServiceImpl implements UserRelationService { @ Autowired private UserRelationMapper userRelationMapper ; @ Autowired private UserMapper userMapper ; public UserMapper getUserMapper ( ) { } public void setUserMapper ( UserMapper userMapper ) { } public UserRelationMapper getUserRelationMapper ( ) { } public void setUserRelationMapper ( UserRelationMapper userRelationMapper ) { } @ Override public Collection < User > findByFollowerIdAndType ( long fromId , String type ) { } @ Override public User findByFollowerIdAndType ( long fromId , long toId , String type ) { UserRelation relation = userRelationMapper . findByFromIdAndToIdAndType ( fromId , toId , type ) ; if ( relation == null ) return null ; <START_BUG> User user = userMapper . findByUserId ( relation . getFollowerId ( ) ) ; <END_BUG> return user ; } }

Fix:
User user = userMapper . findByUserId ( relation . getFollowedId ( ) ) ;
Buggy code:
abstract class XidTransactionManagementTask implements Runnable { protected final short invocationId ; protected final ChannelAssociation channelAssociation ; protected final EJBRemoteTransactionsRepository transactionsRepository ; protected final XidTransactionID xidTransactionID ; protected final MarshallerFactory marshallerFactory ; protected final TransactionRequestHandler transactionRequestHandler ; XidTransactionManagementTask ( final TransactionRequestHandler txRequestHandler , final EJBRemoteTransactionsRepository transactionsRepository , final MarshallerFactory marshallerFactory , final XidTransactionID xidTransactionID , final ChannelAssociation channelAssociation , final short invocationId ) { } @ Override public void run ( ) { } protected abstract void manageTransaction ( ) throws Throwable { } protected void resumeTransaction ( final Transaction transaction ) throws Exception { } protected SubordinateTransaction tryRecoveryForImportedTransaction ( ) throws Exception { final XATerminator xaTerminator = SubordinationManager . getXATerminator ( ) ; if ( xaTerminator instanceof XATerminatorImple ) { <START_BUG> ROOT_LOGGER . debug ( ( "Trying<seq2seq4repair_space>to<seq2seq4repair_space>recover<seq2seq4repair_space>an<seq2seq4repair_space>imported<seq2seq4repair_space>transaction<seq2seq4repair_space>for<seq2seq4repair_space>Xid<seq2seq4repair_space>" + ( this . xidTransactionID . getXid ( ) ) ) ) ; <END_BUG> ( ( XATerminatorImple ) ( xaTerminator ) ) . doRecover ( null , null ) ; } return SubordinationManager . getTransactionImporter ( ) . getImportedTransaction ( this . xidTransactionID . getXid ( ) ) ; } }

Fix:
ROOT_LOGGER . debugf ( "Trying<seq2seq4repair_space>to<seq2seq4repair_space>recover<seq2seq4repair_space>an<seq2seq4repair_space>imported<seq2seq4repair_space>transaction<seq2seq4repair_space>for<seq2seq4repair_space>Xid<seq2seq4repair_space>%s" , this . xidTransactionID . getXid ( ) ) ;
Buggy code:
public class BeanArchiveProcessor implements DeploymentUnitProcessor { private static final Logger log = Logger . getLogger ( "org.jboss.weld" ) ; @ Override public void deploy ( DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { } private void processEjbComponents ( DeploymentUnit deploymentUnit , Map < ResourceRoot , BeanDeploymentArchiveImpl > bdaMap , BeanDeploymentArchiveImpl rootBda , Map < ResourceRoot , Index > indexes ) { final EEModuleDescription moduleDescription = deploymentUnit . getAttachment ( EE_MODULE_DESCRIPTION ) ; for ( AbstractComponentDescription component : moduleDescription . getComponentDescriptions ( ) ) { if ( component instanceof SessionBeanComponentDescription ) { SessionBeanComponentDescription componentDescription = ( ( SessionBeanComponentDescription ) ( component ) ) ; BeanDeploymentArchiveImpl bda = resolveSessionBeanBda ( componentDescription . getEJBClassName ( ) , bdaMap , rootBda , indexes ) ; <START_BUG> bda . addEjbDescriptor ( new org . jboss . as . weld . deployment . EjbDescriptorImpl < Object > ( componentDescription , bda ) ) ; <END_BUG> } } } private BeanDeploymentArchiveImpl resolveSessionBeanBda ( String ejbClassName , Map < ResourceRoot , BeanDeploymentArchiveImpl > bdaMap , BeanDeploymentArchiveImpl rootBda , Map < ResourceRoot , Index > indexes ) { } private BeanDeploymentArchiveImpl createBeanDeploymentArchive ( final Index index , BeanArchiveMetadata beanArchiveMetadata , Module module , String beanArchivePrefix ) throws DeploymentUnitProcessingException { } @ Override public void undeploy ( DeploymentUnit context ) { } }

Fix:
bda . addEjbDescriptor ( new org . jboss . as . weld . deployment . EjbDescriptorImpl < Object > ( componentDescription , bda , deploymentUnit ) ) ;
Buggy code:
public class HostControllerConnectionService implements Service < Channel > { public static final ServiceName SERVICE_NAME = JBOSS . append ( "host" , "controller" , "channel" ) ; private final InjectedValue < InetSocketAddress > hcAddressInjector = new InjectedValue < InetSocketAddress > ( ) ; private final InjectedValue < Endpoint > endpointInjector = new InjectedValue < Endpoint > ( ) ; private volatile Channel channel ; private volatile ProtocolChannelClient client ; private volatile Connection connection ; private final String serverName ; private final byte [ ] authKey ; private HostControllerConnectionService ( final String serverName , final byte [ ] authKey ) { } public static void install ( ServiceTarget serviceTarget , final ServiceName endpointName , final InetSocketAddress managementSocket , final String serverName , final byte [ ] authKey ) { } public synchronized void start ( StartContext context ) throws StartException { ProtocolChannelClient client ; try { ProtocolChannelClient . Configuration configuration = new ProtocolChannelClient . Configuration ( ) ; configuration . setEndpoint ( endpointInjector . getValue ( ) ) ; configuration . setUri ( new URI ( ( ( ( "remote:////" + ( hcAddressInjector . getValue ( ) . getHostName ( ) ) ) + ":" ) + ( hcAddressInjector . getValue ( ) . getPort ( ) ) ) ) ) ; client = ProtocolChannelClient . create ( configuration ) ; } catch ( Exception e ) { throw new StartException ( e ) ; } try { <START_BUG> connection = client . connect ( new HostControllerConnectionService . ClientCallbackHandler ( ) ) . get ( ) ; <END_BUG> channel = connection . openChannel ( SERVER_CHANNEL , EMPTY ) . get ( ) ; } catch ( IOException e ) { throw new StartException ( "Failed<seq2seq4repair_space>to<seq2seq4repair_space>start<seq2seq4repair_space>remote<seq2seq4repair_space>Host<seq2seq4repair_space>Controller<seq2seq4repair_space>connection" , e ) ; } } public synchronized void stop ( StopContext context ) { } public synchronized Channel getValue ( ) throws IllegalStateException { } private class ClientCallbackHandler implements CallbackHandler { public void handle ( Callback [ ] callbacks ) throws IOException , UnsupportedCallbackException { } } }

Fix:
connection = client . connectSync ( new HostControllerConnectionService . ClientCallbackHandler ( ) ) ;
Buggy code:
public class ZatchBotMain { static String Server ; static String Channel ; public static void main ( String [ ] arg ) throws Exception { File file = new File ( "Config.txt" ) ; if ( ! ( file . exists ( ) ) ) { file . createNewFile ( ) ; FileWriter fw = new FileWriter ( file . getAbsoluteFile ( ) , true ) ; BufferedWriter bw = new BufferedWriter ( fw ) ; bw . write ( ( "<seq2seq4repair_space>=--Connection--=" + "\r\n" ) ) ; bw . write ( ( "--IRC<seq2seq4repair_space>Server--" + "\r\n" ) ) ; bw . write ( ( "irc.rizon.net" + "\r\n" ) ) ; bw . write ( ( "--Channels--" + "\r\n" ) ) ; <START_BUG> bw . write ( ( "==<seq2seq4repair_space>To<seq2seq4repair_space>add<seq2seq4repair_space>Multipul<seq2seq4repair_space>Channels<seq2seq4repair_space>use<seq2seq4repair_space>a<seq2seq4repair_space>comma(,)<seq2seq4repair_space>inbetween<seq2seq4repair_space>with<seq2seq4repair_space>no<seq2seq4repair_space>spaces<seq2seq4repair_space>==" + "\r\n" ) ) ; <END_BUG> bw . write ( ( "#chat" + "\r\n" ) ) ; bw . write ( ( "<seq2seq4repair_space>==--IRC<seq2seq4repair_space>Bot--==" + "\r\n" ) ) ; bw . write ( ( "--Toggle<seq2seq4repair_space>Hostname<seq2seq4repair_space>Verification<seq2seq4repair_space>for<seq2seq4repair_space>Ops--" + "\r\n" ) ) ; bw . write ( ( "false<seq2seq4repair_space>" + "\r\n" ) ) ; bw . write ( ( "--Toggle<seq2seq4repair_space>Nick<seq2seq4repair_space>Verification<seq2seq4repair_space>for<seq2seq4repair_space>Ops--" + "\r\n" ) ) ; bw . write ( ( "true<seq2seq4repair_space>" + "\r\n" ) ) ; bw . write ( ( "--Bot<seq2seq4repair_space>Name--" + "\r\n" ) ) ; bw . write ( ( "Zatch" + "\r\n" ) ) ; bw . write ( ( "--Master--" + "\r\n" ) ) ; bw . write ( ( "Chanku" + "\r\n" ) ) ; bw . write ( ( "--Op<seq2seq4repair_space>Nicks--" + "\r\n" ) ) ; bw . write ( "\r\n" ) ; bw . write ( ( "--Op<seq2seq4repair_space>Hostnames" + "\r\n" ) ) ; bw . write ( "\r\n" ) ; bw . write ( ( "--Toggle<seq2seq4repair_space>Logs" + "\r\n" ) ) ; bw . write ( ( "false" + "\r\n" ) ) ; bw . write ( ( "--Logs<seq2seq4repair_space>Location--" + "\r\n" ) ) ; bw . write ( "\r\n" ) ; bw . close ( ) ; } BufferedReader saveFile = new BufferedReader ( new FileReader ( "Config.txt" ) ) ; saveFile . readLine ( ) ; saveFile . readLine ( ) ; ZatchBotMain . Server = saveFile . readLine ( ) ; saveFile . readLine ( ) ; saveFile . readLine ( ) ; ZatchBotMain . Channel = saveFile . readLine ( ) ; saveFile . close ( ) ; String [ ] Channels = ZatchBotMain . Channel . split ( "," ) ; ZatchBot bot = new ZatchBot ( ) ; bot . setVerbose ( true ) ; bot . connect ( ZatchBotMain . Server ) ; for ( int ChannelAmount = 0 ; ChannelAmount < ( Channels . length ) ; ++ ChannelAmount ) { bot . joinChannel ( Channels [ ChannelAmount ] ) ; } } No newline ; at end ; of file ; }

Fix:
bw . write ( ( "==<seq2seq4repair_space>To<seq2seq4repair_space>add<seq2seq4repair_space>Multiple<seq2seq4repair_space>Channels<seq2seq4repair_space>use<seq2seq4repair_space>a<seq2seq4repair_space>comma(,)<seq2seq4repair_space>inbetween<seq2seq4repair_space>with<seq2seq4repair_space>no<seq2seq4repair_space>spaces<seq2seq4repair_space>==" + "\r\n" ) ) ;
Buggy code:
public class ActivityModel extends StateMachine { public Vector _partition ; public ActivityModel ( ) { } public ActivityModel ( Name name ) { } public ActivityModel ( String nameStr ) { } public Vector getPartition ( ) { } public void setPartition ( Vector x ) throws PropertyVetoException { if ( ( _partition ) == null ) _partition = new Vector ( ) ; <START_BUG> fireVetoableChange ( "partition" , _partition , x ) ; <END_BUG> _partition = x ; } public void addPartition ( Partition x ) throws PropertyVetoException { } public void removePartition ( Partition x ) throws PropertyVetoException { } }

Fix:
fireVetoableChangeNoCompare ( "partition" , _partition , x ) ;
Buggy code:
public class TypeValidator extends AbstractValidator { private Locale locale = null ; private Class type ; public TypeValidator ( final Class type ) { } public TypeValidator ( final Class type , final Locale locale ) { } public final Class getType ( ) { } public String toString ( ) { } public final void validate ( final FormComponent component ) { } protected void conversionError ( final FormComponent component , final String input , final ConversionException e ) { <START_BUG> error ( component , resourceKey ( component ) , messageModel ( component , input , e ) , input ) ; <END_BUG> } protected Map messageModel ( final FormComponent component , final String input , final ConversionException e ) { } private final Locale getLocale ( ) { } }

Fix:
error ( component , resourceKey ( component ) , messageModel ( component , input , e ) ) ;
Buggy code:
public class TSVDatasetWriter implements DatasetWriter { private final int requiredColumnCount ; public TSVDatasetWriter ( ) { } public TSVDatasetWriter ( int requiredColumnCount ) { } @ Override public void write ( Dataset dataset , OutputStream destination ) throws IOException { Writer outputStreamWriter = new OutputStreamWriter ( destination , Charset . forName ( "UTF-8" ) ) ; try ( CSVWriter tsvWriter = new CSVWriter ( outputStreamWriter , '\t' ) ) { int actualColumnCount = Math . max ( requiredColumnCount , dataset . getFields ( ) . size ( ) ) ; String [ ] line = new String [ actualColumnCount ] ; for ( int i = 0 ; i < ( dataset . getFields ( ) . size ( ) ) ; i ++ ) { line [ i ] = dataset . getFields ( ) . get ( i ) . getName ( ) ; } for ( int i = dataset . getFields ( ) . size ( ) ; i < actualColumnCount ; i ++ ) { line [ i ] = "fill-" + ( ( i - ( dataset . getFields ( ) . size ( ) ) ) + 1 ) ; } tsvWriter . writeNext ( line ) ; for ( Entry entry : dataset . getEntries ( ) ) { <START_BUG> for ( int i = 0 ; i < ( ( dataset . getFields ( ) . size ( ) ) + 1 ) ; i ++ ) { <END_BUG> Field field = dataset . getFields ( ) . get ( i ) ; line [ i ] = entry . get ( field ) . get ( ) . toString ( ) ; } for ( int i = dataset . getFields ( ) . size ( ) ; i < actualColumnCount ; i ++ ) { line [ i ] = "0.00" ; } tsvWriter . writeNext ( line ) ; } } } }

Fix:
for ( int i = 0 ; i < ( dataset . getFields ( ) . size ( ) ) ; i ++ ) {
Buggy code:
public class StackFilterTest extends TestCase { String fFiltered ; String fUnfiltered ; public StackFilterTest ( String name ) { } protected void setUp ( ) { } public void testFilter ( ) { <START_BUG> assertEquals ( fFiltered , BaseTestRunner . filterStack ( fUnfiltered ) ) ; <END_BUG> } }

Fix:
assertEquals ( fFiltered , BaseTestRunner . getFilteredTrace ( fUnfiltered ) ) ;
Buggy code:
public class StringLiteral extends Expression { private String escapedValue = "\"\"" ; StringLiteral ( AST ast ) { } public int getNodeType ( ) { } ASTNode clone ( AST target ) { } public boolean subtreeMatch ( ASTMatcher matcher , Object other ) { } void accept0 ( ASTVisitor visitor ) { <START_BUG> boolean visitChildren = visitor . visit ( this ) ; <END_BUG> visitor . endVisit ( this ) ; } public String getEscapedValue ( ) { } public void setEscapedValue ( String token ) { } public String getLiteralValue ( ) { } public void setLiteralValue ( String value ) { } int memSize ( ) { } int treeSize ( ) { } }

Fix:
visitor . visit ( this ) ;
Buggy code:
public class MathConfigurationExceptionTest extends TestCase { public void testConstructor ( ) { } public void testConstructorPatternArguments ( ) { } public void testConstructorCause ( ) { } public void testConstructorPatternArgumentsCause ( ) { String pattern = "a<seq2seq4repair_space>{0}x{1}<seq2seq4repair_space>matrix<seq2seq4repair_space>cannot<seq2seq4repair_space>be<seq2seq4repair_space>a<seq2seq4repair_space>rotation<seq2seq4repair_space>matrix" ; Object [ ] arguments = new Object [ ] { Integer . valueOf ( 6 ) , Integer . valueOf ( 4 ) } ; String inMsg = "inner<seq2seq4repair_space>message" ; Exception cause = new Exception ( inMsg ) ; <START_BUG> MathConfigurationException ex = new MathConfigurationException ( pattern , arguments , cause ) ; <END_BUG> assertEquals ( cause , ex . getCause ( ) ) ; assertEquals ( pattern , ex . getPattern ( ) ) ; assertEquals ( arguments . length , ex . getArguments ( ) . length ) ; for ( int i = 0 ; i < ( arguments . length ) ; ++ i ) { assertEquals ( arguments [ i ] , ex . getArguments ( ) [ i ] ) ; } assertFalse ( pattern . equals ( ex . getMessage ( ) ) ) ; assertFalse ( ex . getMessage ( ) . equals ( ex . getMessage ( Locale . FRENCH ) ) ) ; } }

Fix:
MathConfigurationException ex = new MathConfigurationException ( cause , pattern , arguments ) ;
Buggy code:
public class MarkupComponentBorder implements IComponentBorder { private static final long serialVersionUID = 1L ; private transient MarkupStream markupStream ; public void renderBefore ( Component component ) { } public void renderAfter ( Component component ) { } private MarkupStream getMarkupStream ( Component component ) { } private MarkupStream findMarkupStream ( Component owner ) { final String markupType = getMarkupType ( owner ) ; final IResourceStreamLocator locator = Application . get ( ) . getResourceSettings ( ) . getResourceStreamLocator ( ) ; final Session session = Session . get ( ) ; final String style = session . getStyle ( ) ; final Locale locale = session . getLocale ( ) ; MarkupResourceStream markupResourceStream = null ; Class containerClass = getClass ( ) ; while ( ! ( containerClass . equals ( MarkupComponentBorder . class ) ) ) { String path = containerClass . getName ( ) . replace ( '.' , '//' ) ; IResourceStream resourceStream = locator . locate ( containerClass , path , style , locale , markupType ) ; if ( resourceStream != null ) { ContainerInfo ci = new ContainerInfo ( containerClass , locale , style , null , markupType ) ; markupResourceStream = new MarkupResourceStream ( resourceStream , ci , containerClass ) ; break ; } containerClass = containerClass . getSuperclass ( ) ; } if ( markupResourceStream == null ) { throw new WicketRuntimeException ( ( ( "Could<seq2seq4repair_space>not<seq2seq4repair_space>find<seq2seq4repair_space>markup<seq2seq4repair_space>for<seq2seq4repair_space>component<seq2seq4repair_space>border<seq2seq4repair_space>`" + ( getClass ( ) . getName ( ) ) ) + "`" ) ) ; } try { <START_BUG> Markup markup = Application . get ( ) . getMarkupSettings ( ) . getMarkupParserFactory ( ) . newMarkupParser ( ) . readAndParse ( markupResourceStream ) ; <END_BUG> return new MarkupStream ( markup ) ; } catch ( Exception e ) { throw new WicketRuntimeException ( ( "Could<seq2seq4repair_space>not<seq2seq4repair_space>parse<seq2seq4repair_space>markup<seq2seq4repair_space>from<seq2seq4repair_space>markup<seq2seq4repair_space>resource<seq2seq4repair_space>stream:<seq2seq4repair_space>" + ( markupResourceStream . toString ( ) ) ) ) ; } } private String getMarkupType ( Component component ) { } }

Fix:
Markup markup = Application . get ( ) . getMarkupSettings ( ) . getMarkupParserFactory ( ) . newMarkupParser ( markupResourceStream ) . parse ( ) ;
Buggy code:
@ WebServlet ( "//payment" ) public class PaymentController extends HttpServlet { private static final long serialVersionUID = 1L ; @ Autowired private RewardDAO rewardDAO ; @ Override protected void doGet ( HttpServletRequest request , HttpServletResponse response ) throws IOException , ServletException { <START_BUG> if ( ( request . getParameter ( "rewardId" ) ) != null ) { <END_BUG> Reward reward = rewardDAO . get ( Integer . valueOf ( request . getParameter ( "rewardId" ) ) ) ; request . setAttribute ( "amount" , reward . getPledgeSum ( ) ) ; } request . getRequestDispatcher ( "view//Payment.jsp" ) . forward ( request , response ) ; } @ Override public void init ( ) throws ServletException { } }

Fix:
if ( ( ( request . getParameter ( "rewardId" ) ) != null ) && ( ! ( request . getParameter ( "rewardId" ) . equals ( "0" ) ) ) ) {
Buggy code:
@ Repository public class ProfesionalDAOImpl implements ProfesionalDAO { @ Autowired private SessionFactory sessionFactory ; public void add ( Profesional profesional ) { } @ SuppressWarnings ( "unchecked" ) public List < Profesional > findAll ( ) { <START_BUG> return this . sessionFactory . getCurrentSession ( ) . createQuery ( "FROM<seq2seq4repair_space>Profesional<seq2seq4repair_space>p<seq2seq4repair_space>ORDER<seq2seq4repair_space>BY<seq2seq4repair_space>p.profesionalId<seq2seq4repair_space>DESC" ) . list ( ) ; <END_BUG> } public void delete ( Integer profesionalId ) { } public Profesional findProfesionalById ( Integer profesionalId ) { } public void edit ( Profesional profesional ) { } public void deleteProfesionalEspecialidad ( Integer profesionalId ) { } public Page < Profesional > findProfesionalesByPageable ( Pageable pageable ) { } public Page < Profesional > findProfesionalesBySearch ( String search , Pageable pageable ) { } @ SuppressWarnings ( "unchecked" ) public OrdenAlarmaDTO countProfesionales ( ) { } }

Fix:
return this . sessionFactory . getCurrentSession ( ) . createQuery ( "FROM<seq2seq4repair_space>Profesional<seq2seq4repair_space>p<seq2seq4repair_space>ORDER<seq2seq4repair_space>BY<seq2seq4repair_space>p.apellido<seq2seq4repair_space>ASC" ) . list ( ) ;
Buggy code:
public class IntLiteral extends NumberLiteral { public int value ; public static final IntLiteral One = new IntLiteral ( new char [ ] { '1' } , 0 , 0 , 1 ) ; static final Constant FORMAT_ERROR = new DoubleConstant ( ( 1.0 // 0.0 ) ) ; public IntLiteral ( char [ ] token , int s , int e ) { } public IntLiteral ( char [ ] token , int s , int e , int value ) { } public IntLiteral ( int intValue ) { } public void computeConstant ( ) { } public void generateCode ( BlockScope currentScope , CodeStream codeStream , boolean valueRequired ) { } public TypeBinding literalType ( BlockScope scope ) { } public final boolean mayRepresentMIN_VALUE ( ) { } public TypeBinding resolveType ( BlockScope scope ) { TypeBinding tb = super . resolveType ( scope ) ; if ( ( constant ) == ( IntLiteral . FORMAT_ERROR ) ) { constant = NotAConstant ; scope . problemReporter ( ) . constantOutOfFormat ( this ) ; <START_BUG> this . expressionType = null ; <END_BUG> return null ; } return tb ; } public String toStringExpression ( ) { } public void traverse ( IAbstractSyntaxTreeVisitor visitor , BlockScope scope ) { } }

Fix:
this . resolvedType = null ;
Buggy code:
public abstract class EggType < T > { protected T value ; private static final ClassLoader eggTypeLoader = new EggTypeClassLoader ( ) ; public abstract void onEvent ( PlayerEggThrowEvent event ) { } protected abstract void processArguments ( Player sender , CommandArgs args ) throws ProcessingArgsException { } protected boolean checkPermission ( Player player ) throws DontHaveThePermissionException { String perm ; if ( this . getClass ( ) . isAnnotationPresent ( EggPermission . class ) ) perm = this . getClass ( ) . getAnnotation ( EggPermission . class ) . permission ( ) ; else { String simpleName = this . getClass ( ) . getSimpleName ( ) ; <START_BUG> perm = simpleName . substring ( 0 , ( ( simpleName . length ( ) ) - 4 ) ) . toLowerCase ( ) ; <END_BUG> } if ( ( perm == null ) || ( ( perm != null ) && ( perm . isEmpty ( ) ) ) ) return true ; if ( ! ( PermissionManager . hasPerm ( player , perm , false ) ) ) throw new DontHaveThePermissionException ( Utils . I18n ( "errorNotPerm" , "p" , perm ) ) ; return true ; } public T getValue ( ) { } public void setValue ( T value ) { } public static EggType < ? > createEggType ( Player player , CommandArgs args ) throws DontHaveThePermissionException , ProcessingArgsException { } @ SuppressWarnings ( "unchecked" ) private static EggType < ? > matchEggClass ( String name ) throws ClassNotFoundException , IllegalAccessException , InstantiationException { } @ Override public String toString ( ) { } @ Override public int hashCode ( ) { } @ SuppressWarnings ( "rawtypes" ) @ Override public boolean equals ( Object obj ) { } }

Fix:
perm = "admincmd.egg." + ( simpleName . substring ( 0 , ( ( simpleName . length ( ) ) - 3 ) ) . toLowerCase ( ) ) ;
Buggy code:
public class ClientTests implements ITaskNotifyCallback { private Client client ; @ BeforeClass public static void setUpBeforeClass ( ) throws Exception { } @ AfterClass public static void tearDownAfterClass ( ) throws Exception { } @ Before public void setUp ( ) throws Exception { } @ After public void tearDown ( ) throws Exception { } @ Test public void testConnect ( ) throws Exception { } @ Test public void testRegisterTask ( ) throws Exception { } @ Test public void testRegisterTaskWithException ( ) throws Exception { } @ Test public void testTaskRun ( ) throws Exception { client . connect ( ) ; Task task = new Task ( "TestTask" , "*//5<seq2seq4repair_space>*<seq2seq4repair_space>*<seq2seq4repair_space>*<seq2seq4repair_space>*<seq2seq4repair_space>?" ) ; client . registerTask ( task , new ITaskNotifyCallback ( ) { @ Override public void onTaskNotify ( Client client , Task task , String instanceId ) { client . taskStart ( instanceId ) ; try { Thread . sleep ( 10000L ) ; client . taskRunning ( instanceId , 10 ) ; Thread . sleep ( 10000L ) ; client . taskRunning ( instanceId , 50 ) ; Thread . sleep ( 10000L ) ; client . taskComplete ( instanceId ) ; client . close ( ) ; } catch ( InterruptedException e ) { e . printStackTrace ( ) ; } } } ) ; <START_BUG> client . start ( ) ; <END_BUG> } @ Override public void onTaskNotify ( Client client , Task task , String instanceId ) { } }

Fix:
client . waitTillClose ( ) ;
Buggy code:
@ Entity @ Table ( name = "EMPLOYEE" ) public class Employee { @ Id @ GeneratedValue ( strategy = GenerationType . IDENTITY ) private int id ; @ Column ( name = "NAME" , nullable = false ) private String name ; @ Column ( name = "JOINING_DATE" , nullable = false ) @ Type ( type = "org.jadira.usertype.dateandtime.joda.PersistentLocalDate" ) private LocalDate joiningDate ; @ Column ( name = "SALARY" , nullable = false ) private BigDecimal salary ; @ Column ( name = "SSN" , unique = true , nullable = false ) private String ssn ; <START_BUG> public int getId ( ) { <END_BUG> return id ; } public void setId ( int id ) { } public String getName ( ) { } public void setName ( String name ) { } public LocalDate getJoiningDate ( ) { } public void setJoiningDate ( LocalDate joiningDate ) { } public BigDecimal getSalary ( ) { } public void setSalary ( BigDecimal salary ) { } public String getSsn ( ) { } public void setSsn ( String ssn ) { } @ Override public int hashCode ( ) { } @ Override public boolean equals ( Object obj ) { } @ Override public String toString ( ) { } }

Fix:
public Integer getId ( ) {
Buggy code:
public class PatternReplaceCharFilter extends BaseCharFilter { @ Deprecated public static final int DEFAULT_MAX_BLOCK_CHARS = 10000 ; private final Pattern pattern ; private final String replacement ; private Reader transformedInput ; public PatternReplaceCharFilter ( Pattern pattern , String replacement , Reader in ) { } @ Deprecated public PatternReplaceCharFilter ( Pattern pattern , String replacement , int maxBlockChars , String blockDelimiter , Reader in ) { } @ Override public int read ( char [ ] cbuf , int off , int len ) throws IOException { } private void fill ( ) throws IOException { StringBuilder buffered = new StringBuilder ( ) ; char [ ] temp = new char [ 1024 ] ; <START_BUG> for ( int cnt = in . read ( temp ) ; cnt > 0 ; cnt = in . read ( temp ) ) { <END_BUG> buffered . append ( temp , 0 , cnt ) ; } transformedInput = new StringReader ( processPattern ( buffered ) . toString ( ) ) ; } @ Override public int read ( ) throws IOException { } @ Override protected int correct ( int currentOff ) { } CharSequence processPattern ( CharSequence input ) { } }

Fix:
for ( int cnt = input . read ( temp ) ; cnt > 0 ; cnt = input . read ( temp ) ) {
Buggy code:
public interface HttpRequest { public static final int STATE_UNINITIALIZED = 0 ; public static final int STATE_LOADING = 1 ; public static final int STATE_LOADED = 2 ; public static final int STATE_INTERACTIVE = 3 ; public static final int STATE_COMPLETE = 4 ; <START_BUG> public ReadyState getReadyState ( ) ; <END_BUG> public String getResponseText ( ) { } public Document getResponseXML ( ) { } public void setRequestHeader ( String header , String value ) { } public Image getResponseImage ( ) { } public byte [ ] getResponseBytes ( ) { } public int getStatus ( ) { } public String getStatusText ( ) { } public void abort ( ) { } public String getAllResponseHeaders ( ) { } public String getResponseHeader ( String headerName ) { } public void open ( String method , String url ) throws IOException { } public void open ( String method , URL url ) throws IOException { } public void open ( String method , URL url , boolean asyncFlag ) throws IOException { } public void open ( String method , String url , boolean asyncFlag ) throws IOException { } public void open ( String method , URL url , boolean asyncFlag , String userName ) throws IOException { } public void open ( String method , URL url , boolean asyncFlag , String userName , String password ) throws IOException { } public void send ( String content ) throws IOException { } public void addReadyStateChangeListener ( ReadyStateChangeListener listener ) { } }

Fix:
public int getReadyState ( ) ;
Buggy code:
public class WicketTagPanelTest extends TestCase { private static final Log log = LogFactory . getLog ( WicketTagPanelTest . class ) ; private WicketTester application ; public WicketTagPanelTest ( String name ) { } protected void setUp ( ) throws Exception { } protected void tearDown ( ) throws Exception { } public void testRenderHomePage ( ) throws Exception { } private boolean validatePage1 ( String document ) { HtmlDocumentValidator validator = new HtmlDocumentValidator ( ) ; Tag html = new Tag ( "html" ) ; Tag body = new Tag ( "body" ) ; html . addExpectedChild ( body ) ; body . addExpectedChild ( new TextContent ( "\\s+" ) ) ; Tag span = new Tag ( "span" ) ; body . addExpectedChild ( span ) ; <START_BUG> Tag wicket = new Tag ( "org.apache.wicket:panel" ) ; <END_BUG> span . addExpectedChild ( wicket ) ; wicket . addExpectedChild ( new TextContent ( "\\s*Panel<seq2seq4repair_space>Content" ) ) ; validator . addRootElement ( html ) ; return validator . isDocumentValid ( document ) ; } public void testRenderHomePageWicketTagRemoved ( ) throws Exception { } private boolean validatePage2 ( String document ) { } }

Fix:
Tag wicket = new Tag ( "wicket:panel" ) ;
Buggy code:
public class StopTomcat { static final String DEFAULT_CONFIG = "conf//server.xml" ; private static StringManager sm = StringManager . getManager ( "org.apache.tomcat.resources" ) ; String configFile ; String tomcatHome ; Log loghelper = new Log ( "tc_log" , "StopTomcat" ) ; public StopTomcat ( ) { } public void setConfig ( String s ) { } public void setF ( String s ) { } public void setH ( String s ) { } public void setHome ( String s ) { } public void execute ( ) throws Exception { } void stopTomcat ( ) throws TomcatException { } public void execute ( ContextManager cm ) throws TomcatException { int portInt = 8007 ; InetAddress address = null ; <START_BUG> BaseInterceptor [ ] ci = cm . getContextInterceptors ( ) ; <END_BUG> for ( int i = 0 ; i < ( ci . length ) ; i ++ ) { Object con = ci [ i ] ; if ( con instanceof Ajp12ConnectionHandler ) { PoolTcpConnector tcpCon = ( ( PoolTcpConnector ) ( con ) ) ; portInt = tcpCon . getPort ( ) ; address = tcpCon . getAddress ( ) ; } if ( con instanceof Ajp12Interceptor ) { Ajp12Interceptor tcpCon = ( ( Ajp12Interceptor ) ( con ) ) ; portInt = tcpCon . getPort ( ) ; address = tcpCon . getAddress ( ) ; } } try { if ( address == null ) address = InetAddress . getLocalHost ( ) ; Socket socket = new Socket ( address , portInt ) ; OutputStream os = socket . getOutputStream ( ) ; byte [ ] stopMessage = new byte [ 2 ] ; stopMessage [ 0 ] = ( ( byte ) ( 254 ) ) ; stopMessage [ 1 ] = ( ( byte ) ( 15 ) ) ; os . write ( stopMessage ) ; socket . close ( ) ; } catch ( Exception ex ) { throw new TomcatException ( ( ( ( "Error<seq2seq4repair_space>stopping<seq2seq4repair_space>Tomcat<seq2seq4repair_space>with<seq2seq4repair_space>Ajp12<seq2seq4repair_space>on<seq2seq4repair_space>" + address ) + ":" ) + portInt ) , ex ) ; } } }

Fix:
BaseInterceptor [ ] ci = cm . getInterceptors ( ) ;
Buggy code:
public class War extends Jar { private File deploymentDescriptor ; private boolean needxmlfile = true ; private File addedWebXmlFile ; private static final FileUtils FILE_UTILS = FileUtils . getFileUtils ( ) ; private static final String XML_DESCRIPTOR_PATH = "WEB-INF//web.xml" ; private static final String XML_DESCRIPTOR_PATH_LC = War . XML_DESCRIPTOR_PATH . toLowerCase ( Locale . ENGLISH ) ; public War ( ) { } public void setWarfile ( File warFile ) { } public void setWebxml ( File descr ) { } public void setNeedxmlfile ( boolean needxmlfile ) { } public void addLib ( ZipFileSet fs ) { } public void addClasses ( ZipFileSet fs ) { } public void addWebinf ( ZipFileSet fs ) { } protected void initZipOutputStream ( ZipOutputStream zOut ) throws IOException , BuildException { } protected void zipFile ( File file , ZipOutputStream zOut , String vPath , int mode ) throws IOException { } protected void cleanUp ( ) { if ( ( ( ( ( addedWebXmlFile ) == null ) && ( ( deploymentDescriptor ) == null ) ) && ( needxmlfile ) ) && ( ! ( isInUpdateMode ( ) ) ) ) { <START_BUG> throw new BuildException ( ( "No<seq2seq4repair_space>WEB-INF//web.xml<seq2seq4repair_space>file<seq2seq4repair_space>was<seq2seq4repair_space>added.\n" + "If<seq2seq4repair_space>this<seq2seq4repair_space>is<seq2seq4repair_space>your<seq2seq4repair_space>intent,<seq2seq4repair_space>set<seq2seq4repair_space>needxml='false'<seq2seq4repair_space>" ) ) ; <END_BUG> } addedWebXmlFile = null ; super . cleanUp ( ) ; } }

Fix:
throw new BuildException ( ( "No<seq2seq4repair_space>WEB-INF//web.xml<seq2seq4repair_space>file<seq2seq4repair_space>was<seq2seq4repair_space>added.\n" + "If<seq2seq4repair_space>this<seq2seq4repair_space>is<seq2seq4repair_space>your<seq2seq4repair_space>intent,<seq2seq4repair_space>set<seq2seq4repair_space>needxmlfile='false'<seq2seq4repair_space>" ) ) ;
Buggy code:
public class CreateStorageAccountForm extends JDialog { private JPanel contentPane ; private JButton buttonOK ; private JButton buttonCancel ; private JComboBox subscriptionComboBox ; private JTextField nameTextField ; private JComboBox regionOrAffinityGroupComboBox ; private JComboBox replicationComboBox ; private JProgressBar createProgressBar ; private Runnable onCreate ; private Subscription subscription ; private StorageAccount storageAccount ; private enum ReplicationTypes { Standard_LRS , Standard_GRS , Standard_RAGRS ; public String getDescription ( ) { switch ( this ) { case Standard_GRS : return "Geo-Redundant" ; case Standard_LRS : return "Locally<seq2seq4repair_space>Redundant" ; case Standard_RAGRS : <START_BUG> return "Read_Access<seq2seq4repair_space>Geo-Redundant" ; <END_BUG> } return super . toString ( ) ; } } public CreateStorageAccountForm ( ) { } private void validateEmptyFields ( ) { } private void onOK ( ) { } private void onCancel ( ) { } public void fillFields ( final Subscription subscription , Project project ) { } public void setOnCreate ( Runnable onCreate ) { } public StorageAccount getStorageAccount ( ) { } }

Fix:
return "Read<seq2seq4repair_space>Access<seq2seq4repair_space>Geo-Redundant" ;
Buggy code:
public class TestGrowthList < E > extends AbstractTestList < E > { public TestGrowthList ( String testName ) { } @ Override public List < E > makeObject ( ) { } @ Override public List < E > makeFullCollection ( ) { List < E > list = new ArrayList < E > ( ) ; list . addAll ( Arrays . asList ( TestGrowthList . getFullElements ( ) ) ) ; <START_BUG> return GrowthList . decorate ( list ) ; <END_BUG> } public void testGrowthAdd ( ) { } public void testGrowthAddAll ( ) { } public void testGrowthSet1 ( ) { } public void testGrowthSet2 ( ) { } @ Override public void testListAddByIndexBoundsChecking ( ) { } @ Override public void testListAddByIndexBoundsChecking2 ( ) { } @ Override public void testListSetByIndexBoundsChecking ( ) { } @ Override public void testListSetByIndexBoundsChecking2 ( ) { } @ Override public String getCompatibilityVersion ( ) { } }

Fix:
return GrowthList . growthList ( list ) ;
Buggy code:
public class EntityReferenceImpl extends ParentNode implements EntityReference { static final long serialVersionUID = - 7381452955687102062L ; protected String name ; protected String baseURI ; public EntityReferenceImpl ( CoreDocumentImpl ownerDoc , String name ) { } public short getNodeType ( ) { } public String getNodeName ( ) { } public Node cloneNode ( boolean deep ) { } public String getBaseURI ( ) { if ( needsSyncData ( ) ) { synchronizeData ( ) ; } if ( ( baseURI ) == null ) { DocumentType doctype ; NamedNodeMap entities ; EntityImpl entDef ; if ( ( null != ( doctype = getOwnerDocument ( ) . getDoctype ( ) ) ) && ( null != ( entities = doctype . getEntities ( ) ) ) ) { entDef = ( ( EntityImpl ) ( entities . getNamedItem ( getNodeName ( ) ) ) ) ; if ( entDef != null ) { return entDef . getBaseURI ( ) ; } } } else if ( ( ( baseURI ) != null ) && ( ( baseURI . length ( ) ) != 0 ) ) { try { <START_BUG> baseURI = new URI ( baseURI ) . toString ( ) ; <END_BUG> } catch ( org . apache . xerces . util e ) { return null ; } } return baseURI ; } public void setBaseURI ( String uri ) { } protected String getEntityRefValue ( ) { } protected void synchronizeChildren ( ) { } public void setReadOnly ( boolean readOnly , boolean deep ) { } }

Fix:
return new URI ( baseURI ) . toString ( ) ;
Buggy code:
public class PerlNamespaceElementImpl extends LeafPsiElement implements PerlNamespaceElement { protected AtomicNotNullLazyValue < PsiReference [ ] > myReferences ; public PerlNamespaceElementImpl ( @ NotNull IElementType type , CharSequence text ) { } private void createMyReferences ( ) { } @ Override public void accept ( @ NotNull PsiElementVisitor visitor ) { } @ NotNull @ Override public String getName ( ) { } public String getCanonicalName ( ) { } @ NotNull @ Override public PsiReference [ ] getReferences ( ) { } @ Override public PsiReference getReference ( ) { } @ Override public boolean isBuiltin ( ) { } @ Override public boolean isPragma ( ) { } @ Override public boolean isSUPER ( ) { } @ Override public boolean isMain ( ) { } @ Override public boolean isCORE ( ) { } @ Override public boolean isUNIVERSAL ( ) { } @ Override public boolean isDeprecated ( ) { } @ Override public List < PerlNamespaceDefinition > getNamespaceDefinitions ( ) { } @ Override public List < PerlFileImpl > getNamespaceFiles ( ) { List < PerlFileImpl > namespaceFiles = new ArrayList < PerlFileImpl > ( ) ; PsiReference [ ] references = getReferences ( ) ; for ( PsiReference reference : references ) { if ( reference instanceof PerlNamespaceFileReference ) { ResolveResult [ ] results = ( ( PerlNamespaceFileReference ) ( reference ) ) . multiResolve ( false ) ; for ( ResolveResult result : results ) { PsiElement targetElement = result . getElement ( ) ; assert targetElement != null ; <START_BUG> assert targetElement instanceof PerlFileImpl ; <END_BUG> namespaceFiles . add ( ( ( PerlFileImpl ) ( targetElement ) ) ) ; } } } return namespaceFiles ; } @ Override public TextRange getTextRange ( ) { } @ Override public void clearCaches ( ) { } }

Fix:
assert targetElement instanceof PerlFileImpl : "Got:" + targetElement ;