nus-yam/ex-repair huggingface dataset:
Buggy code:
public class ProgressMonitorJobsDialog extends ProgressMonitorDialog { private NewProgressViewer viewer ; private int viewerHeight = - 1 ; Composite viewerComposite ; private Button detailsButton ; private long watchTime = - 1 ; protected boolean alreadyClosed = false ; private IProgressMonitor wrapperedMonitor ; protected boolean enableDetailsButton = false ; public ProgressMonitorJobsDialog ( Shell parent ) { } protected Control createDialogArea ( Composite parent ) { } void handleDetailsButtonSelect ( ) { Shell shell = getShell ( ) ; Point shellSize = shell . getSize ( ) ; Composite composite = ( ( Composite ) ( getDialogArea ( ) ) ) ; if ( ( viewer ) != null ) { viewer . getControl ( ) . dispose ( ) ; viewer = null ; composite . layout ( ) ; shell . setSize ( shellSize . x , ( ( shellSize . y ) - ( viewerHeight ) ) ) ; detailsButton . setText ( ProgressMonitorJobsDialog_DetailsTitle ) ; } else { if ( ( ProgressManager . getInstance ( ) . getRootElements ( DEBUG_SHOW_SYSTEM_JOBS ) . length ) == 0 ) { detailsButton . setEnabled ( false ) ; return ; } viewer = new NewProgressViewer ( viewerComposite , ( ( ( ( SWT . MULTI ) | ( SWT . H_SCROLL ) ) | ( SWT . V_SCROLL ) ) | ( SWT . BORDER ) ) ) ; viewer . setUseHashlookup ( true ) ; viewer . setSorter ( new ViewerSorter ( ) { public int compare ( Viewer testViewer , Object e1 , Object e2 ) { return ( ( Comparable ) ( e1 ) ) . compareTo ( e2 ) ; } } ) ; <START_BUG> ProgressTreeContentProvider provider = new ProgressTreeContentProvider ( viewer , ( ! ( Policy . DEBUG_SHOW_SYSTEM_JOBS ) ) ) ; <END_BUG> viewer . setContentProvider ( provider ) ; viewer . setInput ( provider ) ; viewer . setLabelProvider ( new ProgressLabelProvider ( ) ) ; GridData viewerData = new GridData ( GridData . FILL_BOTH ) ; viewer . getControl ( ) . setLayoutData ( viewerData ) ; GridData viewerCompositeData = ( ( GridData ) ( viewerComposite . getLayoutData ( ) ) ) ; viewerCompositeData . heightHint = convertHeightInCharsToPixels ( 10 ) ; viewerComposite . layout ( true ) ; viewer . getControl ( ) . setVisible ( true ) ; viewerHeight = viewerComposite . computeTrim ( 0 , 0 , 0 , viewerCompositeData . heightHint ) . height ; detailsButton . setText ( ProgressMonitorJobsDialog_HideTitle ) ; shell . setSize ( shellSize . x , ( ( shellSize . y ) + ( viewerHeight ) ) ) ; } } protected void createButtonsForButtonBar ( Composite parent ) { } protected void createSpacer ( Composite parent ) { } protected void createDetailsButton ( Composite parent ) { } protected Control createButtonBar ( Composite parent ) { } protected void clearCursors ( ) { } protected void updateForSetBlocked ( IStatus reason ) { } public void run ( boolean fork , boolean cancelable , IRunnableWithProgress runnable ) throws InterruptedException , InvocationTargetException { } protected void enableDetails ( boolean enableState ) { } public void watchTicks ( ) { } public void createWrapperedMonitor ( ) { } public IProgressMonitor getProgressMonitor ( ) { } public boolean close ( ) { } }

Fix:
ProgressTreeContentProvider provider = new ProgressTreeContentProvider ( viewer , Policy . DEBUG_SHOW_SYSTEM_JOBS ) ;
Buggy code:
public class JPASubsystemTestCase extends AbstractSubsystemBaseTest { public JPASubsystemTestCase ( ) { } @ Override protected String getSubsystemXml ( ) throws IOException { } @ Test public void testTransformers_1_1_0 ( ) throws Exception { System . setProperty ( "org.jboss.as.jpa.testBadExpr" , "hello" ) ; try { ModelVersion oldVersion = ModelVersion . create ( 1 , 1 , 0 ) ; KernelServicesBuilder builder = createKernelServicesBuilder ( null ) . setSubsystemXml ( getSubsystemXml ( ) ) ; builder . createLegacyKernelServicesBuilder ( null , oldVersion ) . setExtensionClassName ( JPAExtension . class . getName ( ) ) . addMavenResourceURL ( "org.jboss.as:jboss-as-jpa:7.1.2.Final" ) ; KernelServices mainServices = builder . build ( ) ; KernelServices legacyServices = mainServices . getLegacyServices ( oldVersion ) ; Assert . assertNotNull ( legacyServices ) ; <START_BUG> checkSubsystemTransformer ( mainServices , oldVersion ) ; <END_BUG> final ModelNode operation = new ModelNode ( ) ; operation . get ( OP ) . set ( WRITE_ATTRIBUTE_OPERATION ) ; operation . get ( OP_ADDR ) . add ( SUBSYSTEM , SUBSYSTEM_NAME ) ; operation . get ( NAME ) . set ( DEFAULT_DATASOURCE . getName ( ) ) ; operation . get ( VALUE ) . set ( "${org.jboss.as.jpa.testBadExpr}" ) ; final ModelNode mainResult = mainServices . executeOperation ( operation ) ; System . out . println ( mainResult ) ; Assert . assertTrue ( SUCCESS . equals ( mainResult . get ( OUTCOME ) . asString ( ) ) ) ; try { mainServices . transformOperation ( oldVersion , operation ) ; Assert . fail ( "should<seq2seq4repair_space>reject<seq2seq4repair_space>the<seq2seq4repair_space>expression" ) ; } catch ( OperationFailedException e ) { } } finally { System . clearProperty ( "org.jboss.as.jpa.testBadExpr" ) ; } } }

Fix:
checkSubsystemModelTransformation ( mainServices , oldVersion ) ;
Buggy code:
public class mainGame { public static void main ( String [ ] args ) { <START_BUG> new GameWindow ( ) . setVisible ( true ) ; <END_BUG> } }

Fix:
new GameWindow ( null ) . setVisible ( true ) ;
Buggy code:
public class ActionProvider extends AbstractProvider { private AbstractElement [ ] cachedElements ; private Map idToElement = new HashMap ( ) ; public String getId ( ) { } public AbstractElement getElementForId ( String id ) { } public AbstractElement [ ] getElements ( ) { if ( ( cachedElements ) == null ) { WorkbenchWindow window = ( ( WorkbenchWindow ) ( PlatformUI . getWorkbench ( ) . getActiveWorkbenchWindow ( ) ) ) ; if ( window != null ) { MenuManager menu = window . getMenuManager ( ) ; Set result = new HashSet ( ) ; collectContributions ( menu , result ) ; ActionContributionItem [ ] actions = ( ( ActionContributionItem [ ] ) ( result . toArray ( new ActionContributionItem [ result . size ( ) ] ) ) ) ; cachedElements = new AbstractElement [ actions . length ] ; for ( int i = 0 ; i < ( actions . length ) ; i ++ ) { <START_BUG> ActionElement actionElement = new ActionElement ( actions [ i ] ) ; <END_BUG> cachedElements [ i ] = actionElement ; idToElement . put ( actionElement . getId ( ) , actionElement ) ; } } } return cachedElements ; } private void collectContributions ( MenuManager menu , Set result ) { } public ImageDescriptor getImageDescriptor ( ) { } public String getName ( ) { } }

Fix:
ActionElement actionElement = new ActionElement ( actions [ i ] , this ) ;
Buggy code:
public class Caverphone1 extends AbstractCaverphone { private static final String SIX_1 = "111111" ; @ Override <START_BUG> public String encode ( String source ) { <END_BUG> String txt = source ; if ( ( txt == null ) || ( ( txt . length ( ) ) == 0 ) ) { return Caverphone1 . SIX_1 ; } txt = txt . toLowerCase ( Locale . ENGLISH ) ; txt = txt . replaceAll ( "[^a-z]" , "" ) ; txt = txt . replaceAll ( "^cough" , "cou2f" ) ; txt = txt . replaceAll ( "^rough" , "rou2f" ) ; txt = txt . replaceAll ( "^tough" , "tou2f" ) ; txt = txt . replaceAll ( "^enough" , "enou2f" ) ; txt = txt . replaceAll ( "^gn" , "2n" ) ; txt = txt . replaceAll ( "mb$" , "m2" ) ; txt = txt . replaceAll ( "cq" , "2q" ) ; txt = txt . replaceAll ( "ci" , "si" ) ; txt = txt . replaceAll ( "ce" , "se" ) ; txt = txt . replaceAll ( "cy" , "sy" ) ; txt = txt . replaceAll ( "tch" , "2ch" ) ; txt = txt . replaceAll ( "c" , "k" ) ; txt = txt . replaceAll ( "q" , "k" ) ; txt = txt . replaceAll ( "x" , "k" ) ; txt = txt . replaceAll ( "v" , "f" ) ; txt = txt . replaceAll ( "dg" , "2g" ) ; txt = txt . replaceAll ( "tio" , "sio" ) ; txt = txt . replaceAll ( "tia" , "sia" ) ; txt = txt . replaceAll ( "d" , "t" ) ; txt = txt . replaceAll ( "ph" , "fh" ) ; txt = txt . replaceAll ( "b" , "p" ) ; txt = txt . replaceAll ( "sh" , "s2" ) ; txt = txt . replaceAll ( "z" , "s" ) ; txt = txt . replaceAll ( "^[aeiou]" , "A" ) ; txt = txt . replaceAll ( "[aeiou]" , "3" ) ; txt = txt . replaceAll ( "3gh3" , "3kh3" ) ; txt = txt . replaceAll ( "gh" , "22" ) ; txt = txt . replaceAll ( "g" , "k" ) ; txt = txt . replaceAll ( "s+" , "S" ) ; txt = txt . replaceAll ( "t+" , "T" ) ; txt = txt . replaceAll ( "p+" , "P" ) ; txt = txt . replaceAll ( "k+" , "K" ) ; txt = txt . replaceAll ( "f+" , "F" ) ; txt = txt . replaceAll ( "m+" , "M" ) ; txt = txt . replaceAll ( "n+" , "N" ) ; txt = txt . replaceAll ( "w3" , "W3" ) ; txt = txt . replaceAll ( "wy" , "Wy" ) ; txt = txt . replaceAll ( "wh3" , "Wh3" ) ; txt = txt . replaceAll ( "why" , "Why" ) ; txt = txt . replaceAll ( "w" , "2" ) ; txt = txt . replaceAll ( "^h" , "A" ) ; txt = txt . replaceAll ( "h" , "2" ) ; txt = txt . replaceAll ( "r3" , "R3" ) ; txt = txt . replaceAll ( "ry" , "Ry" ) ; txt = txt . replaceAll ( "r" , "2" ) ; txt = txt . replaceAll ( "l3" , "L3" ) ; txt = txt . replaceAll ( "ly" , "Ly" ) ; txt = txt . replaceAll ( "l" , "2" ) ; txt = txt . replaceAll ( "j" , "y" ) ; txt = txt . replaceAll ( "y3" , "Y3" ) ; txt = txt . replaceAll ( "y" , "2" ) ; txt = txt . replaceAll ( "2" , "" ) ; txt = txt . replaceAll ( "3" , "" ) ; txt = txt + ( Caverphone1 . SIX_1 ) ; return txt . substring ( 0 , Caverphone1 . SIX_1 . length ( ) ) ; } }

Fix:
public String encode ( final String source ) {
Buggy code:
class ConfigAdminDescribeHandler extends GenericSubsystemDescribeHandler { static final ConfigAdminDescribeHandler INSTANCE = new ConfigAdminDescribeHandler ( ) ; public void execute ( OperationContext context , ModelNode operation ) throws OperationFailedException { super . execute ( context , operation ) ; <START_BUG> context . completeStep ( ) ; <END_BUG> } }

Fix:
context . completeStep ( NOOP_ROLLBACK_HANDLER ) ;
Buggy code:
public final class DeploymentReflectionIndex { private final Map < Class < ? > , ClassReflectionIndex < ? > > classes = new HashMap < Class < ? > , ClassReflectionIndex < ? > > ( ) ; DeploymentReflectionIndex ( ) { } private static final Permission DEPLOYMENT_REFLECTION_INDEX_PERMISSION = new RuntimePermission ( "createDeploymentReflectionIndex" ) ; public static DeploymentReflectionIndex create ( ) { } @ SuppressWarnings ( { "unchecked" } ) public synchronized < T > ClassReflectionIndex < T > getClassIndex ( Class < T > clazz ) { ClassReflectionIndex < T > index = ( ( ClassReflectionIndex < T > ) ( classes . get ( clazz ) ) ) ; if ( index == null ) { <START_BUG> classes . put ( clazz , ( index = new ClassReflectionIndex < T > ( clazz ) ) ) ; <END_BUG> } return index ; } }

Fix:
classes . put ( clazz , ( index = new ClassReflectionIndex < T > ( clazz , this ) ) ) ;
Buggy code:
public class MyServiceActivator implements ServiceActivator { private static final String CONTAINER_NAME = "server" ; private static final String CACHE_NAME = "default" ; public static final String PREFERRED_NODE = ClusteringTestConstants . NODE_2 ; @ Override public void activate ( ServiceActivatorContext context ) { } private static void install ( ServiceName name , int quorum , ServiceActivatorContext context ) { InjectedValue < ServerEnvironment > env = new InjectedValue ( ) ; MyService service = new MyService ( env ) ; ServiceController < ? > factoryService = context . getServiceRegistry ( ) . getRequiredService ( SERVICE_NAME . append ( MyServiceActivator . CONTAINER_NAME , MyServiceActivator . CACHE_NAME ) ) ; SingletonServiceBuilderFactory factory = ( ( SingletonServiceBuilderFactory ) ( factoryService . getValue ( ) ) ) ; <START_BUG> factory . createSingletonServiceBuilder ( name , service ) . electionPolicy ( new org . wildfly . clustering . singleton . election . PreferredSingletonElectionPolicy ( new org . wildfly . clustering . singleton . election . SimpleSingletonElectionPolicy ( ) , new org . wildfly . clustering . singleton . election . NamePreference ( ( ( MyServiceActivator . PREFERRED_NODE ) + "//ee" ) ) ) ) . requireQuorum ( quorum ) . build ( context . getServiceTarget ( ) ) . addDependency ( ServerEnvironmentService . SERVICE_NAME , ServerEnvironment . class , env ) . setInitialMode ( ServiceController . Mode . ACTIVE ) . install ( ) ; <END_BUG> } }

Fix:
factory . createSingletonServiceBuilder ( name , service ) . electionPolicy ( new org . wildfly . clustering . singleton . election . PreferredSingletonElectionPolicy ( new org . wildfly . clustering . singleton . election . SimpleSingletonElectionPolicy ( ) , new org . wildfly . clustering . singleton . election . NamePreference ( ( ( ( MyServiceActivator . PREFERRED_NODE ) + "//" ) + ( MyServiceActivator . CONTAINER_NAME ) ) ) ) ) . requireQuorum ( quorum ) . build ( context . getServiceTarget ( ) ) . addDependency ( ServerEnvironmentService . SERVICE_NAME , ServerEnvironment . class , env ) . setInitialMode ( ServiceController . Mode . ACTIVE ) . install ( ) ;
Buggy code:
public class ZipFileWeaver { File inFile ; public ZipFileWeaver ( File inFile ) { } public void weave ( BcelWeaver weaver , File outFile ) throws IOException { int count = 0 ; long startTime = System . currentTimeMillis ( ) ; <START_BUG> weaver . addJarFile ( inFile , new File ( "." ) ) ; <END_BUG> weaver . weave ( outFile ) ; long stopTime = System . currentTimeMillis ( ) ; System . out . println ( ( ( ( ( "handled<seq2seq4repair_space>" + count ) + "<seq2seq4repair_space>entries,<seq2seq4repair_space>in<seq2seq4repair_space>" ) + ( ( stopTime - startTime ) // 1000.0 ) ) + "<seq2seq4repair_space>seconds" ) ) ; } }

Fix:
weaver . addJarFile ( inFile , new File ( "." ) , false ) ;
Buggy code:
@ SuppressWarnings ( "serial" ) public class MainPanel extends AstroPanel { private JPanel currentDay ; private JPanel otherDays ; private JPanel hourScroll ; private JPanel buttonGrid ; private JPanel topPanel ; private JLabel currentDayLabel ; private JScrollPane dayScrollPane ; private HomeButton windBtn ; private HomeButton tempBtn ; private HomeButton cloudCoverBtn ; private HomeButton lunarBtn ; private HomeButton precipBtn ; private HomeButton humidityBtn ; private HourButton [ ] hourButtons ; private DayPanel [ ] dayPanels ; private data [ ] hourData ; private data [ ] dayData ; private TopButton settingsButton ; private TopButton backButton ; public MainPanel ( final Main parent , final boolean orientation , boolean loadHour , int numberToLoad ) { } public void loadDay ( int day ) { } public void loadHour ( int hour ) { data thisHourData = hourData [ hour ] ; <START_BUG> currentDayLabel = new DayLabel ( thisHourData . getTimeAsHour ( ) ) ; <END_BUG> topPanel . add ( currentDayLabel , BorderLayout . CENTER ) ; cloudCoverBtn = new CloudCoverageButton ( thisHourData . getCloudCoverAsInt ( ) ) ; lunarBtn = new MoonPhaseButton ( parent . getForecast ( ) . getDaily ( ) . getData ( ) [ 0 ] . getMoonPhaseAsAngle ( ) ) ; windBtn = new WindDirectionButton ( thisHourData . getWindBearing ( ) , ( ( int ) ( thisHourData . getWindSpeed ( ) ) ) ) ; tempBtn = new TemperatureButton ( ( ( int ) ( thisHourData . getTemperature ( ) ) ) ) ; tempBtn . addActionListener ( new ActionListener ( ) { @ Override public void actionPerformed ( ActionEvent e ) { } } ) ; humidityBtn = new HumidityButton ( thisHourData . getHumidityAsPercentage ( ) ) ; humidityBtn . addActionListener ( new ActionListener ( ) { @ Override public void actionPerformed ( ActionEvent e ) { } } ) ; precipBtn = new PrecipitationButton ( thisHourData . getPrecipProbabilityAsPercentage ( ) ) ; precipBtn . addActionListener ( new ActionListener ( ) { @ Override public void actionPerformed ( ActionEvent e ) { } } ) ; } public void portraitInit ( ) { } public void landscapeInit ( ) { } public void changeOrientation ( boolean newOrientation ) { } }

Fix:
currentDayLabel = new DayLabel ( thisHourData . getTimeAsDayAndHour ( ) ) ;
Buggy code:
public abstract class DefaultAbstractTree extends AbstractTree { private static final PackageResourceReference CSS = new PackageResourceReference ( DefaultAbstractTree . class , "tree.css" ) ; private static final ResourceReference MINUS = new PackageResourceReference ( DefaultAbstractTree . class , "minus.gif" ) ; private static final ResourceReference PLUS = new PackageResourceReference ( DefaultAbstractTree . class , "plus.gif" ) ; private static final ResourceReference BLANK = new PackageResourceReference ( Tree . class , "blank.gif" ) ; public DefaultAbstractTree ( MarkupContainer parent , String id , TreeModel model , boolean rootLess ) { } public DefaultAbstractTree ( MarkupContainer parent , String id , IModel < TreeModel > model , boolean rootLess ) { } public DefaultAbstractTree ( MarkupContainer parent , String id , boolean rootLess ) { } private void init ( ) { } public enum LinkType { REGULAR , AJAX , AJAX_FALLBACK ; } private DefaultAbstractTree . LinkType linkType = DefaultAbstractTree . LinkType . AJAX ; public void setLinkType ( DefaultAbstractTree . LinkType linkType ) { } public DefaultAbstractTree . LinkType getLinkType ( ) { } protected interface LinkCallback extends Serializable { public void onClick ( AjaxRequestTarget target ) { } } protected WebMarkupContainer createLink ( MarkupContainer parent , String id , final DefaultAbstractTree . LinkCallback callback ) { } protected void createJunctionLink ( MarkupContainer parent , final String id , final String imageId , final TreeNode node ) { } protected Image createJunctionImage ( MarkupContainer parent , final String id , final TreeNode node ) { } protected MarkupContainer createIndentation ( MarkupContainer parent , String id , final int level ) { } protected WebMarkupContainer createNodeLink ( MarkupContainer parent , String id , final TreeNode node ) { } protected String getIndentationString ( ) { <START_BUG> return "&nbsp;&nbsp;&nbsp;" ; <END_BUG> } protected PackageResourceReference getCSS ( ) { } protected ResourceReference getMinus ( ) { } protected ResourceReference getPlus ( ) { } protected ResourceReference getBlank ( ) { } }

Fix:
return "&nbsp;&nbsp;&nbsp;&nbsp;" ;
Buggy code:
public class AppContext { private static Context context ; public static Context getContext ( ) { } public static void setRoot ( String root ) { <START_BUG> AppContext . context . setRoot ( root ) ; <END_BUG> } }

Fix:
AppContext . getContext ( ) . setRoot ( root ) ;
Buggy code:
public class RemoteServiceRegistrationImpl implements Serializable , IRemoteServiceRegistration { private static final long serialVersionUID = - 3206899332723536545L ; transient Object service ; protected String [ ] clazzes ; protected RemoteServiceRegistrationImpl . Properties properties ; protected int serviceranking ; protected transient Object registrationLock = new Object ( ) ; protected int state = RemoteServiceRegistrationImpl . REGISTERED ; public static final int REGISTERED = 0 ; public static final int UNREGISTERING = 1 ; public static final int UNREGISTERED = 2 ; protected transient RemoteServiceReferenceImpl reference = null ; protected transient RegistrySharedObject sharedObject = null ; protected IRemoteServiceID remoteServiceID ; public RemoteServiceRegistrationImpl ( ) { } public boolean equals ( Object o ) { } public int hashCode ( ) { } public void publish ( RegistrySharedObject sharedObject1 , RemoteServiceRegistryImpl registry , Object svc , String [ ] clzzes , Dictionary props ) { } public Object getService ( ) { } public ID getContainerID ( ) { } protected String [ ] getClasses ( ) { } public IRemoteServiceReference getReference ( ) { } public void setProperties ( Dictionary properties ) { } public void unregister ( ) { } protected RemoteServiceRegistrationImpl . Properties createProperties ( Dictionary props ) { final RemoteServiceRegistrationImpl . Properties resultProps = new RemoteServiceRegistrationImpl . Properties ( props ) ; resultProps . setProperty ( REMOTEOBJECTCLASS , clazzes ) ; resultProps . setProperty ( REMOTESERVICE_ID , new Long ( getID ( ) . getContainerRelativeID ( ) ) ) ; <START_BUG> final Object ranking = resultProps . getProperty ( REMOTESERVICE_RANKING ) ; <END_BUG> serviceranking = ( ranking instanceof Integer ) ? ( ( Integer ) ( ranking ) ) . intValue ( ) : 0 ; return resultProps ; } static class Properties extends Hashtable { private static final long serialVersionUID = - 3684607010228779249L ; private Properties ( int size , Dictionary props ) { } protected Properties ( Dictionary props ) { } protected Object getProperty ( String key ) { } protected synchronized String [ ] getPropertyKeys ( ) { } protected synchronized Object setProperty ( String key , Object value ) { } protected static Object cloneValue ( Object value ) { } public synchronized String toString ( ) { } } public Object getProperty ( String key ) { } public String [ ] getPropertyKeys ( ) { } public long getServiceId ( ) { } public Object callService ( RemoteCallImpl call ) throws Exception { } public String toString ( ) { } public IRemoteServiceID getID ( ) { } }

Fix:
final Object ranking = props . get ( REMOTESERVICE_RANKING ) ;
Buggy code:
public final class JSLPDiscoveryJob extends Job { private JSLPDiscoveryContainer discoveryContainer ; private Map services ; public JSLPDiscoveryJob ( JSLPDiscoveryContainer container ) { } protected IStatus run ( IProgressMonitor monitor ) { Assert . isNotNull ( monitor ) ; try { <START_BUG> Map availableServices = Activator . getDefault ( ) . getServiceURLs ( ) ; <END_BUG> Map removedServices = new HashMap ( services ) ; for ( Iterator itr = availableServices . entrySet ( ) . iterator ( ) ; ( itr . hasNext ( ) ) && ( ! ( monitor . isCanceled ( ) ) ) ; ) { Map . Entry entry = ( ( Map . Entry ) ( itr . next ( ) ) ) ; ServiceURL url = ( ( ServiceURL ) ( entry . getKey ( ) ) ) ; if ( removedServices . containsKey ( url ) ) { removedServices . remove ( url ) ; } else { IServiceInfo serviceInfo = new org . eclipse . ecf . provider . jslp . container . JSLPServiceInfo ( new ServiceURLAdapter ( url ) , ( - 1 ) , ( - 1 ) , new ServicePropertiesAdapter ( ( ( List ) ( entry . getValue ( ) ) ) ) ) ; services . put ( url , serviceInfo ) ; discoveryContainer . fireServiceDiscovered ( serviceInfo ) ; } monitor . worked ( 1 ) ; } for ( Iterator itr = removedServices . keySet ( ) . iterator ( ) ; ( itr . hasNext ( ) ) && ( ! ( monitor . isCanceled ( ) ) ) ; ) { Object key = itr . next ( ) ; discoveryContainer . fireServiceUndiscovered ( ( ( IServiceInfo ) ( removedServices . get ( key ) ) ) ) ; services . remove ( key ) ; monitor . worked ( 1 ) ; } } catch ( ServiceLocationException e ) { Trace . catching ( PLUGIN_ID , EXCEPTIONS_CATCHING , this . getClass ( ) , "run" , e ) ; } this . schedule ( REDISCOVER ) ; return Status . OK_STATUS ; } public boolean shouldRun ( ) { } }

Fix:
Map availableServices = Activator . getDefault ( ) . getLocator ( ) . getServiceURLs ( ) ;
Buggy code:
public class TestBoolean2 extends LuceneTestCase { private IndexSearcher searcher ; private IndexSearcher bigSearcher ; private IndexReader reader ; private static int NUM_EXTRA_DOCS = 6000 ; public static final String field = "field" ; private Directory dir2 ; private int mulFactor ; @ Override public void setUp ( ) throws Exception { } @ Override public void tearDown ( ) throws Exception { } private String [ ] docFields = new String [ ] { "w1<seq2seq4repair_space>w2<seq2seq4repair_space>w3<seq2seq4repair_space>w4<seq2seq4repair_space>w5" , "w1<seq2seq4repair_space>w3<seq2seq4repair_space>w2<seq2seq4repair_space>w3" , "w1<seq2seq4repair_space>xx<seq2seq4repair_space>w2<seq2seq4repair_space>yy<seq2seq4repair_space>w3" , "w1<seq2seq4repair_space>w3<seq2seq4repair_space>xx<seq2seq4repair_space>w2<seq2seq4repair_space>yy<seq2seq4repair_space>w3" } ; public Query makeQuery ( String queryText ) throws ParseException { <START_BUG> Query q = new org . apache . lucene . queryParser . QueryParser ( org . apache . lucene . util . Version . LUCENE_CURRENT , TestBoolean2 . field , new org . apache . lucene . analysis . WhitespaceAnalyzer ( ) ) . parse ( queryText ) ; <END_BUG> return q ; } public void queriesTest ( String queryText , int [ ] expDocNrs ) throws Exception { } public void testQueries01 ( ) throws Exception { } public void testQueries02 ( ) throws Exception { } public void testQueries03 ( ) throws Exception { } public void testQueries04 ( ) throws Exception { } public void testQueries05 ( ) throws Exception { } public void testQueries06 ( ) throws Exception { } public void testQueries07 ( ) throws Exception { } public void testQueries08 ( ) throws Exception { } public void testQueries09 ( ) throws Exception { } public void testQueries10 ( ) throws Exception { } public void testRandomQueries ( ) throws Exception { } public static interface Callback { public void postCreate ( BooleanQuery q ) { } } public static BooleanQuery randBoolQuery ( Random rnd , boolean allowMust , int level , String field , String [ ] vals , TestBoolean2 . Callback cb ) { } }

Fix:
Query q = new org . apache . lucene . queryParser . QueryParser ( TEST_VERSION_CURRENT , TestBoolean2 . field , new org . apache . lucene . analysis . WhitespaceAnalyzer ( ) ) . parse ( queryText ) ;
Buggy code:
public class CS56ProjectList { public static String readAllBytes ( String filename ) throws Exception { } public static void main ( String [ ] args ) { try { String oauthToken = Demo1 . readAllBytes ( "tokens//MostPrivileges.txt" ) ; <START_BUG> URL url = new URL ( "https:////api.github.com//orgs//UCSB-CS56-Projects//repos" ) ; <END_BUG> InputStream is = url . openStream ( ) ; JsonParser parser = Json . createParser ( is ) ; File file = new File ( "data.csv" ) ; file . createNewFile ( ) ; FileWriter writer = new FileWriter ( file ) ; while ( parser . hasNext ( ) ) { Event e = parser . next ( ) ; if ( e == ( Event . KEY_NAME ) ) { switch ( parser . getString ( ) ) { case "name" : parser . next ( ) ; writer . write ( parser . getString ( ) ) ; writer . write ( ",<seq2seq4repair_space>" ) ; break ; case "description" : parser . next ( ) ; writer . write ( parser . getString ( ) . replace ( "," , "\",\"" ) . replace ( "|" , "," ) ) ; writer . write ( "\n" ) ; break ; } } } writer . flush ( ) ; writer . close ( ) ; } catch ( MalformedURLException e ) { e . printStackTrace ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } }

Fix:
URL url = new URL ( "https:////api.github.com//orgs//UCSB-CS56-Projects//repos?per_page=100" ) ;
Buggy code:
@ WebServlet ( "//venue_admin_login" ) public class VenueAdminLoginServlet extends HttpServlet { private static final long serialVersionUID = 1L ; private static final String VENUE_ADMIN_LOGIN = "vAdminLogin" ; private static final String VENUE_ADMIN_PASSWORD = "vAdminPassword" ; private static final String VENUE_ID = "venueId" ; public VenueAdminLoginServlet ( ) { } protected void doPost ( HttpServletRequest request , HttpServletResponse response ) throws IOException , ServletException { } protected void forwardToStats ( HttpServletRequest request , HttpServletResponse response , int venueId ) throws IOException , ServletException { } protected void saveCredentialsInSession ( HttpSession session , String login , String password , int venueId ) { } protected boolean isLoggedIn ( HttpSession session ) { boolean result ; Object oLogin = session . getAttribute ( "login" ) ; Object oPassword = session . getAttribute ( "password" ) ; Object oVenueId = session . getAttribute ( "venueId" ) ; if ( ( ( oLogin == null ) || ( oPassword == null ) ) || ( oVenueId == null ) ) { result = false ; } else { int venueId = ( ( Integer ) ( oVenueId ) ) ; String login = oLogin . toString ( ) ; String password = oPassword . toString ( ) ; Map < String , Object > credentialCheck = VenuesDAO . checkAdmin ( login , password , venueId ) ; <START_BUG> if ( credentialCheck . get ( "starus" ) . toString ( ) . equals ( STATUS_SUCCESS ) ) { <END_BUG> result = true ; } else { result = false ; } } return result ; } }

Fix:
if ( credentialCheck . get ( "status" ) . toString ( ) . equals ( STATUS_SUCCESS ) ) {
Buggy code:
public class BcelSourceContext implements ISourceContext { private BcelObjectType inObject ; private String sourceFileName ; private int [ ] lineBreaks ; public BcelSourceContext ( BcelObjectType inObject ) { } public ISourceLocation makeSourceLocation ( IHasPosition position ) { String fileName = sourceFileName ; if ( fileName == null ) inObject . getJavaClass ( ) . getFileName ( ) ; if ( fileName == null ) <START_BUG> fileName = ( inObject . getName ( ) ) + ".class" ; <END_BUG> if ( ( lineBreaks ) != null ) { int line = Arrays . binarySearch ( lineBreaks , position . getStart ( ) ) ; if ( line < 0 ) line = - line ; return new SourceLocation ( new File ( fileName ) , line ) ; } else { return new SourceLocation ( new File ( fileName ) , 0 ) ; } } public void addAttributeInfo ( SourceContextAttribute sourceContextAttribute ) { } }

Fix:
fileName = ( inObject . getResolvedTypeX ( ) . getName ( ) ) + ".class" ;
Buggy code:
public class TestNot extends LuceneTestCase { public void testNot ( ) throws Exception { Directory store = newDirectory ( ) ; RandomIndexWriter writer = new RandomIndexWriter ( random ( ) , store ) ; Document d1 = new Document ( ) ; d1 . add ( newTextField ( "field" , "a<seq2seq4repair_space>b" , YES ) ) ; writer . addDocument ( d1 ) ; IndexReader reader = writer . getReader ( ) ; IndexSearcher searcher = newSearcher ( reader ) ; BooleanQuery query = new BooleanQuery ( ) ; query . add ( new TermQuery ( new Term ( "field" , "a" ) ) , SHOULD ) ; query . add ( new TermQuery ( new Term ( "field" , "b" ) ) , MUST_NOT ) ; ScoreDoc [ ] hits = searcher . search ( query , null , 1000 ) . scoreDocs ; assertEquals ( 0 , hits . length ) ; <START_BUG> writer . close ( ) ; <END_BUG> reader . close ( ) ; store . close ( ) ; } }

Fix:
writer . shutdown ( ) ;
Buggy code:
public abstract class Command { public static final int UNDOABLE_OPERATION = 0 ; public static final int NORMAL_OPERATION = 1 ; public static final int NO_UNDO_OPERATION = 2 ; public static final int DAEMON_PRIORITY = - 10 ; public static final int NORMAL_PRIORITY = 0 ; public static final int REALTIME_PRIORITY = 10 ; public static final int DEFINETLY_NEXT_OPERATION_PRIORITY = 20 ; public static final int FIRST_EXECUTION = 0 ; public static final int UNDO = 1 ; public static final int REDO = 2 ; protected int priority ; protected int commandType ; protected boolean synchronize ; protected int timeStamp ; protected Lock [ ] folderLocks ; private DefaultCommandReference [ ] references ; private DefaultCommandReference [ ] undoReferences ; protected AbstractFrameController frameController ; public Command ( DefaultCommandReference [ ] references ) { } public Command ( AbstractFrameController frameController , DefaultCommandReference [ ] references ) { } public void process ( Worker worker , int operationMode ) throws Exception { } public void updateGUI ( ) throws Exception { } public abstract void execute ( Worker worker ) throws Exception { } public void undo ( Worker worker ) throws Exception { } public void redo ( Worker worker ) throws Exception { } public boolean canBeProcessed ( int operationMode ) { } public void releaseAllFolderLocks ( int operationMode ) { DefaultCommandReference [ ] references = getReferences ( operationMode ) ; int size = Array . getLength ( references ) ; for ( int i = 0 ; i < size ; i ++ ) { if ( ( references [ i ] ) != null ) <START_BUG> references [ i ] . releaseLock ( ) ; <END_BUG> } } public DefaultCommandReference [ ] getReferences ( int operationMode ) { } public int getCommandType ( ) { } public int getPriority ( ) { } public void incPriority ( ) { } public boolean isSynchronize ( ) { } public void setSynchronize ( boolean synchronize ) { } public void setPriority ( int priority ) { } public void setUndoReferences ( DefaultCommandReference [ ] undoReferences ) { } public int getTimeStamp ( ) { } public void setTimeStamp ( int timeStamp ) { } public DefaultCommandReference [ ] getReferences ( ) { } public DefaultCommandReference [ ] getUndoReferences ( ) { } public void finish ( ) throws Exception { } public AbstractFrameController getFrameController ( ) { } }

Fix:
references [ i ] . releaseLock ( this ) ;
Buggy code:
public abstract class AbstractEmptyMapIterator < K , V > extends AbstractEmptyIterator < K > { public AbstractEmptyMapIterator ( ) { } public K getKey ( ) { } public V getValue ( ) { } <START_BUG> public V setValue ( V value ) { <END_BUG> throw new IllegalStateException ( "Iterator<seq2seq4repair_space>contains<seq2seq4repair_space>no<seq2seq4repair_space>elements" ) ; } }

Fix:
public V setValue ( final V value ) {
Buggy code:
public class ExecTask extends Task { private String os ; private File dir ; protected boolean failOnError = false ; protected boolean newEnvironment = false ; private Long timeout = null ; private Environment env = new Environment ( ) ; protected Commandline cmdl = new Commandline ( ) ; private String resultProperty ; private boolean failIfExecFails = true ; private String executable ; private boolean resolveExecutable = false ; private Redirector redirector = new Redirector ( this ) ; private boolean vmLauncher = true ; public void setTimeout ( Long value ) { } public void setTimeout ( Integer value ) { } public void setExecutable ( String value ) { } public void setDir ( File d ) { } public void setOs ( String os ) { } public void setCommand ( Commandline cmdl ) { } public void setOutput ( File out ) { } public void setInput ( File input ) { } public void setInputString ( String inputString ) { } public void setLogError ( boolean logError ) { } public void setError ( File error ) { } public void setOutputproperty ( String outputProp ) { } public void setErrorProperty ( String errorProperty ) { } public void setFailonerror ( boolean fail ) { } public void setNewenvironment ( boolean newenv ) { } public void setResolveExecutable ( boolean resolveExecutable ) { } public void addEnv ( Environment . Variable var ) { } public Argument createArg ( ) { } public void setResultProperty ( String resultProperty ) { } protected void maybeSetResultPropertyValue ( int result ) { } public void setFailIfExecutionFails ( boolean flag ) { } public void setAppend ( boolean append ) { } private String resolveExecutable ( ) { } public void execute ( ) throws BuildException { } protected void checkConfiguration ( ) throws BuildException { } protected boolean isValidOs ( ) { } public void setVMLauncher ( boolean vmLauncher ) { } protected Execute prepareExec ( ) throws BuildException { } protected final void runExecute ( Execute exe ) throws IOException { int returnCode = - 1 ; returnCode = exe . execute ( ) ; if ( exe . killedProcess ( ) ) { log ( "Timeout:<seq2seq4repair_space>killed<seq2seq4repair_space>the<seq2seq4repair_space>sub-process" , MSG_WARN ) ; } maybeSetResultPropertyValue ( returnCode ) ; <START_BUG> if ( returnCode != 0 ) { <END_BUG> if ( failOnError ) { throw new BuildException ( ( ( ( getTaskType ( ) ) + "<seq2seq4repair_space>returned:<seq2seq4repair_space>" ) + returnCode ) , getLocation ( ) ) ; } else { log ( ( "Result:<seq2seq4repair_space>" + returnCode ) , MSG_ERR ) ; } } redirector . complete ( ) ; } protected void runExec ( Execute exe ) throws BuildException { } protected ExecuteStreamHandler createHandler ( ) throws BuildException { } protected ExecuteWatchdog createWatchdog ( ) throws BuildException { } protected void logFlush ( ) { } }

Fix:
if ( Execute . isFailure ( returnCode ) ) {
Buggy code:
public abstract class UMLDiagram extends ArgoDiagram implements MElementListener { protected static Category cat = Category . getInstance ( UMLDiagram . class ) ; protected static Action _actionSelect = new CmdSetMode ( ModeSelect . class , "Select" ) ; protected static Action _actionBroom = new CmdSetMode ( ModeBroom . class , "Broom" ) ; protected static Action _actionRectangle = new CmdSetMode ( ModeCreateFigRect . class , "Rectangle" ) ; protected static Action _actionRRectangle = new CmdSetMode ( ModeCreateFigRRect . class , "RRect" ) ; protected static Action _actionCircle = new CmdSetMode ( ModeCreateFigCircle . class , "Circle" ) ; protected static Action _actionLine = new CmdSetMode ( ModeCreateFigLine . class , "Line" ) ; protected static Action _actionText = new CmdSetMode ( ModeCreateFigText . class , "Text" ) ; protected static Action _actionPoly = new CmdSetMode ( ModeCreateFigPoly . class , "Polygon" ) ; protected static Action _actionSpline = new CmdSetMode ( ModeCreateFigSpline . class , "Spline" ) ; protected static Action _actionInk = new CmdSetMode ( ModeCreateFigInk . class , "Ink" ) ; protected MNamespace _namespace ; protected DiagramInfo _diagramName = new DiagramInfo ( this ) ; public UMLDiagram ( ) { } public UMLDiagram ( MNamespace ns ) { } public UMLDiagram ( String diagramName , MNamespace ns ) { } public void initialize ( Object owner ) { } public MNamespace getNamespace ( ) { } public void setNamespace ( Object ns ) { } public String getClassAndModelID ( ) { } public MModelElement getOwner ( ) { } public void setName ( String n ) throws PropertyVetoException { } static final long serialVersionUID = - 401219134410459387L ; public ToolBar getToolBar ( ) { } public void initToolBar ( ) { } protected abstract void initToolBar ( JToolBar toolbar ) { } private PopupToolBoxButton buildShapePopup ( ) { } public void removed ( MElementEvent e ) { UmlModelEventPump . getPump ( ) . removeModelEventListener ( this , _namespace , REMOVE ) ; ProjectManager . getManager ( ) . getCurrentProject ( ) . moveToTrash ( this ) ; Object newTarget = ProjectManager . getManager ( ) . getCurrentProject ( ) . getDiagrams ( ) . get ( 0 ) ; <START_BUG> TheInstance . setTarget ( newTarget ) ; <END_BUG> } public void propertySet ( MElementEvent e ) { } public void roleAdded ( MElementEvent e ) { } public void roleRemoved ( MElementEvent e ) { } public void listRoleItemSet ( MElementEvent e ) { } public void recovered ( MElementEvent e ) { } public void removeAsTarget ( ) { } public void setAsTarget ( ) { } }

Fix:
ProjectBrowser . getInstance ( ) . setTarget ( newTarget ) ;
Buggy code:
public class Cells { int [ ] cell = new int [ 9 ] ; int krestik = 0 ; int nolik = 0 ; public void fillCell ( int x , int y ) { } public int changeValueOfCellIfItsNecessary ( int value ) { } public int enterRequiredNumber ( int value ) { } public boolean checkWinner ( int [ ] gF ) { if ( ( ( ( ( gF [ 0 ] ) == 1 ) || ( ( gF [ 0 ] ) == 2 ) ) && ( ( gF [ 0 ] ) == ( gF [ 1 ] ) ) ) && ( ( gF [ 1 ] ) == ( gF [ 2 ] ) ) ) { return true ; } else <START_BUG> if ( ( ( ( ( gF [ 0 ] ) == 1 ) || ( ( gF [ 0 ] ) == 2 ) ) && ( ( gF [ 3 ] ) == ( gF [ 4 ] ) ) ) && ( ( gF [ 4 ] ) == ( gF [ 5 ] ) ) ) { <END_BUG> return true ; } else if ( ( ( ( ( gF [ 6 ] ) == 1 ) || ( ( gF [ 6 ] ) == 2 ) ) && ( ( gF [ 6 ] ) == ( gF [ 7 ] ) ) ) && ( ( gF [ 7 ] ) == ( gF [ 8 ] ) ) ) { return true ; } else if ( ( ( ( ( gF [ 0 ] ) == 1 ) || ( ( gF [ 0 ] ) == 2 ) ) && ( ( gF [ 0 ] ) == ( gF [ 3 ] ) ) ) && ( ( gF [ 3 ] ) == ( gF [ 6 ] ) ) ) { return true ; } else if ( ( ( ( ( gF [ 1 ] ) == 1 ) || ( ( gF [ 1 ] ) == 2 ) ) && ( ( gF [ 1 ] ) == ( gF [ 4 ] ) ) ) && ( ( gF [ 4 ] ) == ( gF [ 7 ] ) ) ) { return true ; } else if ( ( ( ( ( gF [ 2 ] ) == 1 ) || ( ( gF [ 2 ] ) == 2 ) ) && ( ( gF [ 2 ] ) == ( gF [ 5 ] ) ) ) && ( ( gF [ 5 ] ) == ( gF [ 8 ] ) ) ) { return true ; } else if ( ( ( ( ( gF [ 0 ] ) == 1 ) || ( ( gF [ 0 ] ) == 2 ) ) && ( ( gF [ 0 ] ) == ( gF [ 4 ] ) ) ) && ( ( gF [ 4 ] ) == ( gF [ 8 ] ) ) ) { return true ; } else if ( ( ( ( ( gF [ 2 ] ) == 1 ) || ( ( gF [ 2 ] ) == 2 ) ) && ( ( gF [ 2 ] ) == ( gF [ 4 ] ) ) ) && ( ( gF [ 4 ] ) == ( gF [ 6 ] ) ) ) { return true ; } return false ; } public boolean checkAvailabilityOfCells ( ) { } }

Fix:
if ( ( ( ( ( gF [ 3 ] ) == 1 ) || ( ( gF [ 3 ] ) == 2 ) ) && ( ( gF [ 3 ] ) == ( gF [ 4 ] ) ) ) && ( ( gF [ 4 ] ) == ( gF [ 5 ] ) ) ) {
Buggy code:
@ Entity @ Table ( name = "appstudent" ) public class StudentEntity extends BaseEntity { private static final long serialVersionUID = 5211680592412307619L ; private String firstName ; private String lastName ; private String className ; private String userName ; private String password ; private String creatorName ; public String getFirstName ( ) { } public void setFirstName ( String firstName ) { } public String getLastName ( ) { } public void setLastName ( String lastName ) { } public String getClassName ( ) { } public void setClassName ( String className ) { } public String getUserName ( ) { } public void setUserName ( int n ) { } public String getPassword ( ) { } public void setPassword ( ) { } public String getCreatorName ( ) { } public void setCreatorName ( String creatorName ) { <START_BUG> this . creatorName = "temporary" ; <END_BUG> } }

Fix:
this . creatorName = creatorName ;
Buggy code:
public class ServiceModuleLoader extends ModuleLoader implements Service < ServiceModuleLoader > { private static final ServerLogger log = ServerLogger . MODULE_SERVICE_LOGGER ; private class ModuleSpecLoadListener extends AbstractServiceListener < ModuleSpec > { private final CountDownLatch latch = new CountDownLatch ( 1 ) ; private final ModuleIdentifier identifier ; private volatile StartException startException ; private volatile ModuleSpec moduleSpec ; private ModuleSpecLoadListener ( ModuleIdentifier identifier ) { } @ Override public void listenerAdded ( ServiceController < ? extends ModuleSpec > controller ) { } @ Override public void transition ( final ServiceController < ? extends ModuleSpec > controller , final ServiceController . Transition transition ) { } private void done ( ServiceController < ? extends ModuleSpec > controller , StartException reason ) { } public ModuleSpec getModuleSpec ( ) throws ModuleLoadException { if ( ( moduleSpec ) != null ) return moduleSpec ; if ( ( startException ) != null ) throw new ModuleLoadException ( startException . getCause ( ) ) ; try { ServiceModuleLoader . log . tracef ( "waiting<seq2seq4repair_space>for:<seq2seq4repair_space>%s" , identifier ) ; if ( ( latch . await ( 2000 , TimeUnit . MILLISECONDS ) ) == false ) <START_BUG> throw new ModuleLoadException ( ( "Timeout<seq2seq4repair_space>waiting<seq2seq4repair_space>for<seq2seq4repair_space>module<seq2seq4repair_space>service:<seq2seq4repair_space>" + ( identifier ) ) ) ; <END_BUG> } catch ( InterruptedException e ) { } return moduleSpec ; } } public static final ServiceName MODULE_SPEC_SERVICE_PREFIX = JBOSS . append ( "module" , "spec" , "service" ) ; public static final ServiceName MODULE_SERVICE_PREFIX = JBOSS . append ( "module" , "service" ) ; public static final String MODULE_PREFIX = "deployment." ; private final ModuleLoader mainModuleLoader ; private volatile ServiceContainer serviceContainer ; public ServiceModuleLoader ( ModuleLoader mainModuleLoader ) { } @ Override protected Module preloadModule ( final ModuleIdentifier identifier ) throws ModuleLoadException { } @ SuppressWarnings ( "unchecked" ) @ Override public ModuleSpec findModule ( ModuleIdentifier identifier ) throws ModuleLoadException { } @ Override public String toString ( ) { } @ Override public synchronized void start ( StartContext context ) throws StartException { } @ Override public synchronized void stop ( StopContext context ) { } @ Override public ServiceModuleLoader getValue ( ) throws IllegalArgumentException , IllegalStateException { } public void relinkModule ( Module module ) throws ModuleLoadException { } public static void addService ( final ServiceTarget serviceTarget , final Bootstrap . Configuration configuration ) { } public static ServiceName moduleSpecServiceName ( ModuleIdentifier identifier ) { } public static ServiceName moduleServiceName ( ModuleIdentifier identifier ) { } }

Fix:
throw MESSAGES . timeoutWaitingForModuleService ( identifier ) ;
Buggy code:
public class Canvas extends Composite { Caret caret ; IME ime ; Canvas ( ) { } public Canvas ( Composite parent , int style ) { } void clearArea ( int x , int y , int width , int height ) { } public void drawBackground ( GC gc , int x , int y , int width , int height ) { } public Caret getCaret ( ) { } public IME getIME ( ) { } void releaseChildren ( boolean destroy ) { } public void scroll ( int destX , int destY , int x , int y , int width , int height , boolean all ) { } public void setCaret ( Caret caret ) { } public void setFont ( Font font ) { } public void setIME ( IME ime ) { } int windowProc ( int hwnd , int msg , int wParam , int lParam ) { } LRESULT WM_CHAR ( int wParam , int lParam ) { } LRESULT WM_IME_COMPOSITION ( int wParam , int lParam ) { } LRESULT WM_IME_COMPOSITION_START ( int wParam , int lParam ) { } LRESULT WM_IME_ENDCOMPOSITION ( int wParam , int lParam ) { } LRESULT WM_INPUTLANGCHANGE ( int wParam , int lParam ) { } LRESULT WM_KILLFOCUS ( int wParam , int lParam ) { } LRESULT WM_LBUTTONDOWN ( int wParam , int lParam ) { } LRESULT WM_SETFOCUS ( int wParam , int lParam ) { LRESULT result = super . WM_SETFOCUS ( wParam , lParam ) ; <START_BUG> if ( ( caret ) != null ) <END_BUG> caret . setFocus ( ) ; return result ; } LRESULT WM_SIZE ( int wParam , int lParam ) { } LRESULT WM_WINDOWPOSCHANGED ( int wParam , int lParam ) { } LRESULT WM_WINDOWPOSCHANGING ( int wParam , int lParam ) { } }

Fix:
if ( ( ( caret ) != null ) && ( caret . isFocusCaret ( ) ) )
Buggy code:
public class XWalkWebChromeClient { private Context mContext ; private View mCustomXWalkView ; private XWalkViewInternal mXWalkView ; private XWalkWebChromeClient . CustomViewCallback mCustomViewCallback ; private XWalkContentsClient mContentsClient = null ; private long XWALK_MAX_QUOTA = ( 1024 * 1024 ) * 100 ; public XWalkWebChromeClient ( XWalkViewInternal view ) { } void setContentsClient ( XWalkContentsClient client ) { } public void onReceivedIcon ( XWalkViewInternal view , Bitmap icon ) { } public interface CustomViewCallback { public void onCustomViewHidden ( ) { } } public void onShowCustomView ( View view , XWalkWebChromeClient . CustomViewCallback callback ) { } public void onShowCustomView ( View view , int requestedOrientation , XWalkWebChromeClient . CustomViewCallback callback ) { } public void onHideCustomView ( ) { Activity activity = mXWalkView . getActivity ( ) ; if ( ( ( mCustomXWalkView ) == null ) || ( activity == null ) ) return ; if ( ( mContentsClient ) != null ) { <START_BUG> mContentsClient . onToggleFullscreen ( true ) ; <END_BUG> } FrameLayout decor = ( ( FrameLayout ) ( activity . getWindow ( ) . getDecorView ( ) ) ) ; decor . removeView ( mCustomXWalkView ) ; mCustomViewCallback . onCustomViewHidden ( ) ; mCustomXWalkView = null ; mCustomViewCallback = null ; } @ SuppressWarnings ( "deprecation" ) public void onExceededDatabaseQuota ( String url , String databaseIdentifier , long quota , long estimatedDatabaseSize , long totalQuota , WebStorage . QuotaUpdater quotaUpdater ) { } @ SuppressWarnings ( "deprecation" ) public void onReachedMaxAppCacheSize ( long requiredStorage , long quota , WebStorage . QuotaUpdater quotaUpdater ) { } public void onGeolocationPermissionsShowPrompt ( String origin , XWalkGeolocationPermissions . Callback callback ) { } public void onGeolocationPermissionsHidePrompt ( ) { } public boolean onJsTimeout ( ) { } @ Deprecated public void onConsoleMessage ( String message , int lineNumber , String sourceID ) { } public boolean onConsoleMessage ( ConsoleMessage consoleMessage ) { } public void getVisitedHistory ( ValueCallback < String [ ] > callback ) { } public void setInstallableWebApp ( ) { } public void setupAutoFill ( Message msg ) { } }

Fix:
mContentsClient . onToggleFullscreen ( false ) ;