auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void onEntityConstructing(AttachCapabilitiesEvent<Entity> e) { Entity obj = e.getObject(); if (obj instanceof EntityPlayer && !(obj instanceof FakePlayer)) { EntityPlayer player = (EntityPlayer) obj; <START> e.addCapability(ResourceHelperDE.getResource("toggleShield"), new PlayerCapabilitiesProvider()); <END> } }</code><technical_language>uppercase letters in a resource location. ok in this situation in general a good idea result in forge yelling game starting. toggle_shield</technical_language>

Target:
public void onEntityConstructing(AttachCapabilitiesEvent<Entity> e) { Entity obj = e.getObject(); if (obj instanceof EntityPlayer && !(obj instanceof FakePlayer)) { EntityPlayer player = (EntityPlayer) obj; e.addCapability(ResourceHelperDE.getResource("toggle_shield"), new ShieldStateProvider()); } }
Source:
<code>public void call(Subscriber<? super R> s) { Observable<? extends T>[] sources = this.sources; int count = 0; if (sources == null) { if (sourcesIterable instanceof List) { <START> sources = (Observable[])(((List)sourcesIterable).toArray(EMPTY)); <END> count = sources.length; } else { sources = new Observable[8]; for (Observable<? extends T> p : sourcesIterable) { if (count == sources.length) { Observable<? extends T>[] b = new Observable[count + (count >> 2)]; System.arraycopy(sources, 0, b, 0, count); sources = b; } sources[count++] = p; } } } else { count = sources.length; } if (count == 0) { s.onCompleted(); return; } LatestCoordinator<T, R> lc = new LatestCoordinator<T, R>(s, combiner, count, bufferSize, delayError); lc.subscribe(sources); }</code><technical_language>toArray(new Observable[list.size()])</technical_language>

Target:
public void call(Subscriber<? super R> s) { Observable<? extends T>[] sources = this.sources; int count = 0; if (sources == null) { if (sourcesIterable instanceof List) { List list = (List)sourcesIterable; sources = (Observable[])list.toArray(new Observable[list.size()]); count = sources.length; } else { sources = new Observable[8]; for (Observable<? extends T> p : sourcesIterable) { if (count == sources.length) { Observable<? extends T>[] b = new Observable[count + (count >> 2)]; System.arraycopy(sources, 0, b, 0, count); sources = b; } sources[count++] = p; } } } else { count = sources.length; } if (count == 0) { s.onCompleted(); return; } LatestCoordinator<T, R> lc = new LatestCoordinator<T, R>(s, combiner, count, bufferSize, delayError); lc.subscribe(sources); }
Source:
<code>public static <T> WeldInjectionTarget<T> createInjectionTarget(Class<?> componentClass, Bean<T> bean, BeanManagerImpl beanManager, boolean interceptionSupport) { final ClassTransformer transformer = beanManager.getServices().get(ClassTransformer.class); @SuppressWarnings("unchecked") final Class<T> clazz = (Class<T>) componentClass; EnhancedAnnotatedType<T> type = transformer.getEnhancedAnnotatedType(clazz, beanManager.getId()); if (!type.getJavaClass().equals(componentClass)) { final ClassLoader classLoader; if (WildFlySecurityManager.isChecking()) { <START> classLoader = AccessController.doPrivileged((PrivilegedAction<ClassLoader>) () -> componentClass.getClassLoader()); <END> } else { classLoader = componentClass.getClassLoader(); } final String bdaId = beanManager.getId() + classLoader.hashCode(); type = transformer.getEnhancedAnnotatedType(clazz, bdaId); } if (Beans.getBeanConstructor(type) == null) { return beanManager.getInjectionTargetFactory(type).createNonProducibleInjectionTarget(); } WeldInjectionTargetBuilder<T> builder = beanManager.createInjectionTargetBuilder(type); builder.setBean(bean); builder.setResourceInjectionEnabled(false); if (interceptionSupport) { return builder.build(); } else { return builder.setInterceptionEnabled(false).setTargetClassLifecycleCallbacksEnabled(false).setDecorationEnabled(false).build(); } }</code><technical_language>@soul2zimate lamdas generally. is a GetClassLoaderAction do work for privileged case</technical_language>

Target:
public static <T> WeldInjectionTarget<T> createInjectionTarget(Class<?> componentClass, Bean<T> bean, BeanManagerImpl beanManager, boolean interceptionSupport) { final ClassTransformer transformer = beanManager.getServices().get(ClassTransformer.class); @SuppressWarnings("unchecked") final Class<T> clazz = (Class<T>) componentClass; EnhancedAnnotatedType<T> type = transformer.getEnhancedAnnotatedType(clazz, beanManager.getId()); if (!type.getJavaClass().equals(componentClass)) { final ClassLoader classLoader = WildFlySecurityManager.isChecking() ? doPrivileged(new GetClassLoaderAction(componentClass)) : componentClass.getClassLoader(); final String bdaId = beanManager.getId() + classLoader.hashCode(); type = transformer.getEnhancedAnnotatedType(clazz, bdaId); } if (Beans.getBeanConstructor(type) == null) { return beanManager.getInjectionTargetFactory(type).createNonProducibleInjectionTarget(); } WeldInjectionTargetBuilder<T> builder = beanManager.createInjectionTargetBuilder(type); builder.setBean(bean); builder.setResourceInjectionEnabled(false); if (interceptionSupport) { return builder.build(); } else { return builder.setInterceptionEnabled(false).setTargetClassLifecycleCallbacksEnabled(false).setDecorationEnabled(false).build(); } }
Source:
<code>private void checkIfPathContainsShardingKey(String path) { <START> if (!path.startsWith(_zkRealmShardingKey)) { <END> throw new IllegalArgumentException( "Given path: " + path + " does not match the sharding key: " + _zkRealmShardingKey + " for this DedicatedZkClient!"); } }</code><technical_language>If sharding key is /abcde, paths expected pass this check supposed this zkclient: - /abcde_0/xxx - /abcde/abcde-0/xxx</technical_language>

Target:
private void checkIfPathContainsShardingKey(String path) { try { String zkRealmForPath = _metadataStoreRoutingData.getMetadataStoreRealm(path); if (!_zkRealmAddress.equals(zkRealmForPath)) { throw new IllegalArgumentException("Given path: " + path + "'s ZK realm: " + zkRealmForPath + " does not match the ZK realm: " + _zkRealmAddress + " and sharding key: " + _zkRealmShardingKey + " for this DedicatedZkClient!"); } } catch (NoSuchElementException e) { throw new IllegalArgumentException( "Given path: " + path + " does not have a valid sharding key!"); } }
Source:
<code>public ActionResult execute() { String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); StudentAttributes student = null; if (userInfo == null) { Optional<StudentAttributes> studentCheck = getUnregisteredStudent(); if (studentCheck.isPresent()) { student = studentCheck.get(); } } else if (userInfo.isInstructor) { String studentEmail = getNonNullRequestParamValue(Const.ParamsNames.STUDENT_EMAIL); student = logic.getStudentForEmail(courseId, studentEmail); } else if (userInfo.isStudent) { student = logic.getStudentForGoogleId(courseId, userInfo.id); } if (student == null) { return new JsonResult("No student found", HttpStatus.SC_NOT_FOUND); } StudentData studentData = new StudentData(student); <START> if (userInfo == null || userInfo.isStudent) { <END> studentData.setComments(null); studentData.setJoinState(null); } return new JsonResult(studentData); }</code><technical_language>I hide data in branches here. A user a student instructor of course</technical_language>

Target:
public ActionResult execute() { String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); StudentAttributes student = null; String studentEmail = getRequestParamValue(Const.ParamsNames.STUDENT_EMAIL); if (studentEmail == null) { student = getUnregisteredStudent().orElseGet(() -> { if (userInfo == null) { return null; } return logic.getStudentForGoogleId(courseId, userInfo.id); }); } else { student = logic.getStudentForEmail(courseId, studentEmail); } if (student == null) { return new JsonResult(STUDENT_NOT_FOUND, HttpStatus.SC_NOT_FOUND); } StudentData studentData = new StudentData(student); if (studentEmail == null) { studentData.setComments(null); studentData.setJoinState(null); } return new JsonResult(studentData); }
Source:
<code>public void disconnectContentType(@NonNull IContentType contentType) { for (IPath path : connectedDocuments.keySet()) { IFile[] foundFiles = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocationURI(path.toFile().toURI()); if(foundFiles.length != 0) { try { <START> if (contentType.equals(foundFiles[0].getContentDescription().getContentType())) { <END> disconnect(path); } } catch (CoreException e) { LanguageServerPlugin.logError( "Error occured while disabling Language Server for content type " + contentType, e); } } } }</code><technical_language>A file multiple content type. file is of content-type, please check Platform.getContentTypeManager().findContentTypes(...). LanguageServiceAccessor:224 it. approach find content type for a file needs (and factorized)</technical_language>

Target:
public void disconnectContentType(@NonNull IContentType contentType) { for (IPath path : connectedDocuments.keySet()) { IFile[] foundFiles = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocationURI(path.toFile().toURI()); if(foundFiles.length != 0) { if (LSPEclipseUtils.getFileContentTypes(foundFiles[0]).stream() .anyMatch(foundContentType -> contentType.equals(foundContentType))) { disconnect(path); } } } }
Source:
<code>public void setHint(final String hint, final Serializable... args) { String currHint = getHint(); <START> <END> if (!Objects.equals(hint, currHint)) { getOrCreateComponentModel().hint = I18nUtilities.asMessage(hint, args); } }</code><technical_language>This test response asMessage current value</technical_language>

Target:
public void setHint(final String hint, final Serializable... args) { Serializable currHint = getComponentModel().hint; Serializable hintToBeSet = I18nUtilities.asMessage(hint, args); if (!Objects.equals(hintToBeSet, currHint)) { getOrCreateComponentModel().hint = hintToBeSet; } }
Source:
<code>private static RefundGatewayRequest buildRefundRequest(ChargeEntity chargeEntity, Long refundAmount){ <START> return RefundGatewayRequest.valueOf(new RefundEntity(chargeEntity, refundAmount, null)); <END> }</code><technical_language>I want pass actual dummy null. allow column in database null account for fact record this data in past, in future record a user create a refund, null passed constructor. I clearer if test reflected this</technical_language>

Target:
private static RefundGatewayRequest buildRefundRequest(ChargeEntity chargeEntity, Long refundAmount){ return RefundGatewayRequest.valueOf(new RefundEntity(chargeEntity, refundAmount, userExternalId)); }
Source:
<code>public AnalyzedKill analyze(KillStatement<Expression> killStatement, Function<ParameterExpression, Symbol> convertParamFunction, CoordinatorTxnCtx txnCtx) { <START> var exprAnalyzerWithoutFields = new ExpressionAnalyzer( <END> functions, txnCtx, convertParamFunction, FieldProvider.UNSUPPORTED, null); Symbol jobId; if (killStatement.jobId() != null) { jobId = exprAnalyzerWithoutFields.convert( killStatement.jobId(), new ExpressionAnalysisContext()); } else { jobId = null; } return new AnalyzedKill(jobId); }</code><technical_language>move this if brach below, is created for KILL</technical_language>

Target:
public AnalyzedKill analyze(KillStatement<Expression> killStatement, Function<ParameterExpression, Symbol> convertParamFunction, CoordinatorTxnCtx txnCtx) { Symbol jobId; if (killStatement.jobId() != null) { var exprAnalyzerWithoutFields = new ExpressionAnalyzer( functions, txnCtx, convertParamFunction, FieldProvider.UNSUPPORTED, null); jobId = exprAnalyzerWithoutFields.convert( killStatement.jobId(), new ExpressionAnalysisContext()); } else { jobId = null; } return new AnalyzedKill(jobId); }
Source:
<code>public void updateTopic(TopicName topicName, PatchData patch, String modifiedBy) { groupService.checkGroupExists(topicName.getGroupName()); Topic retrieved = getTopicDetails(topicName); Topic modified = Patch.apply(retrieved, patch); topicValidator.ensureUpdatedTopicIsValid(modified, retrieved); if (!retrieved.equals(modified)) { Instant beforeMigrationInstant = clock.instant(); if (retrieved.getRetentionTime() != modified.getRetentionTime()) { multiDCAwareService.manageTopic(brokerTopicManagement -> brokerTopicManagement.updateTopic(modified) ); } topicRepository.updateTopic(modified); if (!retrieved.wasMigratedFromJsonType() && modified.wasMigratedFromJsonType()) { logger.info("Waiting until all subscriptions have consumers assigned during topic content type migration...", topicName.qualifiedName()); topicContentTypeMigrationService.waitUntilAllSubscriptionsHasConsumersAssigned(modified, <START> Duration.ofSeconds(topicProperties.getCheckTopicSubscriptionsAssignmentCompletedTimeoutSeconds())); <END> logger.info("Notifying subscriptions' consumers about changes in topic content type...", topicName.qualifiedName()); topicContentTypeMigrationService.notifySubscriptions(modified, beforeMigrationInstant); } auditor.objectUpdated(modifiedBy, retrieved, modified); topicOwnerCache.onUpdatedTopic(retrieved, modified); } }</code><technical_language>woah getCheckTopicSubscriptionsAssignmentCompletedTimeoutSeconds</technical_language>

Target:
public void updateTopic(TopicName topicName, PatchData patch, String modifiedBy) { groupService.checkGroupExists(topicName.getGroupName()); Topic retrieved = getTopicDetails(topicName); Topic modified = Patch.apply(retrieved, patch); topicValidator.ensureUpdatedTopicIsValid(modified, retrieved); if (!retrieved.equals(modified)) { Instant beforeMigrationInstant = clock.instant(); if (retrieved.getRetentionTime() != modified.getRetentionTime()) { multiDCAwareService.manageTopic(brokerTopicManagement -> brokerTopicManagement.updateTopic(modified) ); } topicRepository.updateTopic(modified); if (!retrieved.wasMigratedFromJsonType() && modified.wasMigratedFromJsonType()) { logger.info("Waiting until all subscriptions have consumers assigned during topic content type migration...", topicName.qualifiedName()); topicContentTypeMigrationService.waitUntilAllSubscriptionsHasConsumersAssigned(modified, Duration.ofSeconds(topicProperties.getSubscriptionsAssignmentsCompletedTimeoutSeconds())); logger.info("Notifying subscriptions' consumers about changes in topic content type...", topicName.qualifiedName()); topicContentTypeMigrationService.notifySubscriptions(modified, beforeMigrationInstant); } auditor.objectUpdated(modifiedBy, retrieved, modified); topicOwnerCache.onUpdatedTopic(retrieved, modified); } }
Source:
<code>private static List<IProject> getSelectedProjects(ISelection selection) { List<IProject> projectSelection = new ArrayList<>(); if (selection instanceof IStructuredSelection) { for (Object element : ((StructuredSelection) selection).toList()) { if <START> (element instanceof AutomationSystem) { <END> projectSelection.add(((AutomationSystem) element).getProject()); } } } return projectSelection; }</code><technical_language>question here: is this limitation AutomationSystem wanted nad/or necessary? if a user other types of projects open, e.g. part of a research prototype</technical_language>

Target:
private static List<IProject> getSelectedProjects(ISelection selection) { List<IProject> projectSelection = new ArrayList<>(); if (selection instanceof IStructuredSelection) { for (Object element : ((StructuredSelection) selection).toList()) { if (element instanceof AutomationSystem) { projectSelection.add(((AutomationSystem) element).getProject()); } else if (element instanceof IProject) { projectSelection.add((IProject) element); } } } return projectSelection; }
Source:
<code>public Firehose connect(StringInputRowParser stringInputRowParser) throws IOException { Preconditions.checkNotNull(azureStorage, "null azureStorage"); final LinkedList<AzureBlob> objectQueue = Lists.newLinkedList(blobs); return new FileIteratingFirehose( new Iterator<LineIterator>() { @Override public boolean hasNext() { return !objectQueue.isEmpty(); } @Override public LineIterator next() { final AzureBlob nextURI = objectQueue.poll(); final String container = nextURI.getContainer(); final String path = nextURI.getPath().startsWith("/") ? nextURI.getPath().substring(1) : nextURI.getPath(); try { final InputStream innerInputStream = new AzureByteSource(azureStorage, container, path).openStream(); final InputStream outerInputStream = path.endsWith(".gz") ? CompressionUtils.gzipInputStream(innerInputStream) : innerInputStream; return IOUtils.lineIterator( new BufferedReader( new InputStreamReader(outerInputStream, Charsets.UTF_8) ) ); } catch (Exception e) { <START> log.error(e, <END> "Exception reading from container[%s] blob[%s]", container, path ); throw Throwables.propagate(e); } } @Override public void remove() { throw new UnsupportedOperationException(); } }, stringInputRowParser ); }</code><technical_language>Do need close innerInputStream in error case</technical_language>

Target:
public Firehose connect(StringInputRowParser stringInputRowParser) throws IOException { Preconditions.checkNotNull(azureStorage, "null azureStorage"); final LinkedList<AzureBlob> objectQueue = Lists.newLinkedList(blobs); return new FileIteratingFirehose( new Iterator<LineIterator>() { @Override public boolean hasNext() { return !objectQueue.isEmpty(); } @Override public LineIterator next() { final AzureBlob nextURI = objectQueue.poll(); final String container = nextURI.getContainer(); final String path = nextURI.getPath().startsWith("/") ? nextURI.getPath().substring(1) : nextURI.getPath(); try { final InputStream innerInputStream = new AzureByteSource(azureStorage, container, path).openStream(); final InputStream outerInputStream = path.endsWith(".gz") ? CompressionUtils.gzipInputStream(innerInputStream) : innerInputStream; return IOUtils.lineIterator( new BufferedReader( new InputStreamReader(outerInputStream, Charsets.UTF_8) ) ); } catch (Exception e) { log.error(e, "Exception opening container[%s] blob[%s]", container, path ); throw Throwables.propagate(e); } } @Override public void remove() { throw new UnsupportedOperationException(); } }, stringInputRowParser ); }
Source:
<code><START> public void whenStreamWrongPartitionsThenUnprocessableEntity() throws IOException { <END> final String et = createEventType().getName(); final Subscription s = createSubscriptionForEventType(et); final String body = "{\"partitions\":[" + "{\"event_type\":\"" + et + "\",\"partition\":\"0\"}," + "{\"event_type\":\"dummy-et-123\",\"partition\":\"0\"}," + "{\"event_type\":\"dummy-et-123\",\"partition\":\"1\"}]}"; given().body(body) .contentType(JSON) .when() .post("/subscriptions/{sid}/events", s.getId()) .then() .statusCode(HttpStatus.SC_UNPROCESSABLE_ENTITY) .body(JSON_HELPER.matchesObject(Problem.valueOf( MoreStatus.UNPROCESSABLE_ENTITY, "Wrong partitions specified - some partitions don't belong to subscription: " + "EventTypePartition{eventType='dummy-et-123', partition='0'}, " + "EventTypePartition{eventType='dummy-et-123', partition='1'}"))); }</code><technical_language>overkill, do useful a test get partition N + K, event type N partitions (where > 0)</technical_language>

Target:
public void whenStreamWrongPartitionsThenUnprocessableEntity() throws IOException { final String et = createEventType().getName(); final Subscription s = createSubscriptionForEventType(et); final String body = "{\"partitions\":[" + "{\"event_type\":\"" + et + "\",\"partition\":\"0\"}," + "{\"event_type\":\"" + et + "\",\"partition\":\"1\"}," + "{\"event_type\":\"dummy-et-123\",\"partition\":\"0\"}]}"; given().body(body) .contentType(JSON) .when() .post("/subscriptions/{sid}/events", s.getId()) .then() .statusCode(HttpStatus.SC_UNPROCESSABLE_ENTITY) .body(JSON_HELPER.matchesObject(Problem.valueOf( MoreStatus.UNPROCESSABLE_ENTITY, "Wrong partitions specified - some partitions don't belong to subscription: " + "EventTypePartition{eventType='" + et + "', partition='1'}, " + "EventTypePartition{eventType='dummy-et-123', partition='0'}"))); }
Source:
<code>private boolean isAwake(final long startMillis, final long endMillis){ if(endMillis - startMillis > MINIMUM_AWAKE_LENGTH_MILLIS){ return true; } double maxVote = 0; for(int i = 0; i < this.votes.size(); i++){ final Pair<Long, Double> vote = this.votes.get(i); if(vote.fst >= startMillis && vote.fst <= endMillis && vote.snd > maxVote){ maxVote = vote.snd; } } if(maxVote >= 3){ return true; } <START> <END> return false; }</code><technical_language>a maxVote some other numbers if add more features</technical_language>

Target:
private boolean isAwake(final long startMillis, final long endMillis){ if(endMillis - startMillis > MINIMUM_AWAKE_LENGTH_MILLIS){ return true; } double maxVote = 0; for(int i = 0; i < this.votes.size(); i++){ final Pair<Long, Double> vote = this.votes.get(i); if(vote.fst >= startMillis && vote.fst <= endMillis && vote.snd > maxVote){ maxVote = vote.snd; } } if(maxVote >= MIN_VOTE_FOR_AWAKE){ return true; } return false; }
Source:
<code>public AuthenticationContext(final String authority, final boolean validateAuthority, final ExecutorService service) throws MalformedURLException { if (StringHelper.isBlank(authority)) { throw new IllegalArgumentException("authority is null or empty"); } if (service == null) { throw new IllegalArgumentException("service is null"); } this.service = service; this.validateAuthority = validateAuthority; this.authority = this.canonicalizeUri(authority); <START> this.proxy = Proxy.NO_PROXY; <END> authenticationAuthority = new AuthenticationAuthority(new URL( this.getAuthority()), this.shouldValidateAuthority()); }</code><technical_language>prefer proxy=null. reasoning above</technical_language>

Target:
public AuthenticationContext(final String authority, final boolean validateAuthority, final ExecutorService service) throws MalformedURLException { if (StringHelper.isBlank(authority)) { throw new IllegalArgumentException("authority is null or empty"); } if (service == null) { throw new IllegalArgumentException("service is null"); } this.service = service; this.validateAuthority = validateAuthority; this.authority = this.canonicalizeUri(authority); authenticationAuthority = new AuthenticationAuthority(new URL( this.getAuthority()), this.shouldValidateAuthority()); }
Source:
<code>public HttpLogOptions setApplicationId(final String applicationId) { <START> if (applicationId != null <END> && (applicationId.length() > MAX_APPLICATION_ID_LENGTH || applicationId.contains(" "))) { if (applicationId.contains(" ")) { throw logger .logExceptionAsError(new IllegalArgumentException("'applicationId' must not contain a space.")); } else { throw logger .logExceptionAsError(new IllegalArgumentException("'applicationId' length cannot be greater than " + MAX_APPLICATION_ID_LENGTH)); } } else { this.applicationId = applicationId; } return this; }</code><technical_language>I logic simplified, right this is perform check multiple times. java if (!CoreUtils.isNullOrEmpty(applicationId)) { // issue arise if application ID is empty string? disallow that? if (applicationId.contains(" ")) { // throw error } else if (applicationId.length() > 24) { // throw error } else { this,applicationId = applicationId; } } return this;</technical_language>

Target:
public HttpLogOptions setApplicationId(final String applicationId) { if (!CoreUtils.isNullOrEmpty(applicationId)) { if (applicationId.length() > MAX_APPLICATION_ID_LENGTH) { throw logger .logExceptionAsError(new IllegalArgumentException("'applicationId' length cannot be greater than " + MAX_APPLICATION_ID_LENGTH)); } else if (applicationId.contains(" ")) { throw logger .logExceptionAsError(new IllegalArgumentException("'applicationId' must not contain a space.")); } else { this.applicationId = applicationId; } } return this; }
Source:
<code>public void setUp() <START> throws Exception { <END> super.setUp(); diskWithSnapshots = createDiskImage(); snapshotsList = createSnapshotsForDiskImage(diskWithSnapshots.getId()); diskWithoutSnapshots = createDiskImage(); ovfImage = createDiskImage(); ovfImage.setContentType(DiskContentType.OVF_STORE); cinderDisk = createCinderDisk(); lunDisk = createLunDisk(); setUpDaoMocks(); }</code><technical_language>it</technical_language>

Target:
public void setUp() throws Exception { super.setUp(); diskWithSnapshots = createDiskImage(null); snapshotsList = createSnapshotsForDiskImage(diskWithSnapshots.getId()); diskWithoutSnapshots = createDiskImage(null); ovfImage = createDiskImage(null); ovfImage.setContentType(DiskContentType.OVF_STORE); cinderDisk = createCinderDisk(); lunDisk = createLunDisk(); setUpImagesHandlerMocks(); }
Source:
<code>public void copyTo(final TemplateOptions to) { super.copyTo(to); if (to instanceof AzureComputeTemplateOptions) { final AzureComputeTemplateOptions eTo = AzureComputeTemplateOptions.class.cast(to); if (virtualNetworkName.isPresent()) { eTo.virtualNetworkName(virtualNetworkName.get()); } if (addressSpaceAddressPrefix.isPresent()) { eTo.addressSpaceAddressPrefix(addressSpaceAddressPrefix.get()); } if (subnetName.isPresent()) { eTo.subnetName(subnetName.get()); } if (networkSecurityGroupName.isPresent()) { eTo.subnetName(networkSecurityGroupName.get()); } if (subnetAddressPrefix.isPresent()) { eTo.subnetAddressPrefix(subnetAddressPrefix.get()); } if (storageAccountName.isPresent()) { eTo.storageAccountName(storageAccountName.get()); } if (storageAccountType.isPresent()) { eTo.storageAccountType(storageAccountType.get()); } final LoginCredentials credentials = new LoginCredentials.Builder(). user(loginUser). password(loginPassword == null || !loginPassword.isPresent() ? null : loginPassword.get()). privateKey(loginPrivateKey == null || !loginPrivateKey.isPresent() ? null : loginPrivateKey.get()). authenticateSudo(authenticateSudo == null ? false : authenticateSudo). build(); <START> eTo.overrideLoginCredentials(credentials); <END> } }</code><technical_language>Is this needed? superclass copy this</technical_language>

Target:
public void copyTo(final TemplateOptions to) { super.copyTo(to); if (to instanceof AzureComputeTemplateOptions) { final AzureComputeTemplateOptions eTo = AzureComputeTemplateOptions.class.cast(to); if (virtualNetworkName.isPresent()) { eTo.virtualNetworkName(virtualNetworkName.get()); } if (addressSpaceAddressPrefix.isPresent()) { eTo.addressSpaceAddressPrefix(addressSpaceAddressPrefix.get()); } if (subnetName.isPresent()) { eTo.subnetName(subnetName.get()); } if (networkSecurityGroupName.isPresent()) { eTo.subnetName(networkSecurityGroupName.get()); } if (subnetAddressPrefix.isPresent()) { eTo.subnetAddressPrefix(subnetAddressPrefix.get()); } if (storageAccountName.isPresent()) { eTo.storageAccountName(storageAccountName.get()); } if (storageAccountType.isPresent()) { eTo.storageAccountType(storageAccountType.get()); } } }
Source:
<code>public void requestResetPassword() { mockHealthCodeAndAccountRetrieval(); participantService.requestResetPassword(STUDY, ID); <START> verify(accountDao).requestResetPassword(accountIdCaptor.capture()); <END> AccountId accountId = accountIdCaptor.getValue(); assertEquals(STUDY.getIdentifier(), accountId.getStudyId()); assertEquals(ID, accountId.getId()); }</code><technical_language>Nitpick: eq(ACCOUNT_ID) a capture</technical_language>

Target:
public void requestResetPassword() { mockHealthCodeAndAccountRetrieval(); participantService.requestResetPassword(STUDY, ID); verify(accountDao).requestResetPassword(eq(STUDY), eq(ACCOUNT_ID)); }
Source:
<code>public static boolean checkIfPinEntry(){ if ((System.currentTimeMillis() - timestamp) > 10000 && <START> (System.currentTimeMillis() - lastStart) > 10000){ <END> SharedPreferences appPrefs = PreferenceManager.getDefaultSharedPreferences(MainApp.getAppContext()); if (appPrefs.getBoolean("set_pincode", false)) { lastStart = System.currentTimeMillis(); return true; } } return false; }</code><technical_language>Please, define timeout static var PINCODE_TIMEOUT</technical_language>

Target:
public static boolean checkIfPinEntry(){ if ((System.currentTimeMillis() - timestamp) > PINCODE_TIMEOUT && (System.currentTimeMillis() - lastStart) > PINCODE_TIMEOUT){ SharedPreferences appPrefs = PreferenceManager.getDefaultSharedPreferences(MainApp.getAppContext()); if (appPrefs.getBoolean("set_pincode", false)) { lastStart = System.currentTimeMillis(); return true; } } return false; }
Source:
<code>public static void init() { if (initialized) { return; } initialized = true; DebugOptions.DEV_ROOT_PATH = "engine/src/main/resources/"; final LwjglApplication application = new LwjglApplication(new SolApplication(new ModuleManager())); try { <START> Thread.sleep(10000L); END> } catch (InterruptedException e) { e.printStackTrace(); } game = ((SolApplication) application.getApplicationListener()).getGame(); }</code><technical_language>"Magic" a quick dirty assure modules stuff loaded running tests - check if is needed remove if not</technical_language>

Target:
public static void init() { if (initialized) { return; } initialized = true; DebugOptions.DEV_ROOT_PATH = "engine/src/main/resources/"; ModuleManager moduleManager = new ModuleManager(); GL20 mockGL = new MockGL(); Gdx.gl = mockGL; Gdx.gl20 = mockGL; final HeadlessApplication application = new HeadlessApplication(new SolApplication(moduleManager, 100), new HeadlessApplicationConfiguration()); game = ((SolApplication) application.getApplicationListener()).getGame(); }
Source:
<code>public void commit() { if ( !isActive( true ) ) { throw new IllegalStateException( "Transaction not successfully started" ); } <START> if ( LOG.isDebugEnabled() ) { <END> LOG.debug( "committing" ); } try { internalGetTransactionDriverControl().commit(); } catch (RuntimeException e) { throw exceptionConverter.convertCommitException( e ); } }</code><technical_language>wrt "logging protection"</technical_language>

Target:
public void commit() { if ( !isActive( true ) ) { throw new IllegalStateException( "Transaction not successfully started" ); } LOG.debug( "committing" ); try { internalGetTransactionDriverControl().commit(); } catch (RuntimeException e) { throw exceptionConverter.convertCommitException( e ); } }
Source:
<code>public void verify() { synchronized (controller) { processing.forEach(Expectation::verify); if (!expectations.isEmpty()) { throw controller.setFailure( new AssertionError( "expecting " + (expectations.size() + processing.size()) + " executions for '" + controller + "' but only " + processing.size() <START> + " occurred; the following were not executed: \r\n\t" <END> + expectations .stream() .map(Expectation::toString) .collect(Collectors.joining(ActionRegistry.CR_AND_INDENT)) + "\r\n")); } } }</code><technical_language>CR_AND_INDENT variable here? this entire string cleaner if done a string.format</technical_language>

Target:
public void verify() { synchronized (controller) { processing.forEach(Expectation::verify); if (!expectations.isEmpty()) { throw controller.setFailure( new AssertionError( String.format( "expecting %d executions for `%s` but only %d occurred; the following were not executed: %n\t%s%n", (expectations.size() + processing.size()), controller, processing.size(), expectations .stream() .map(Expectation::toString) .collect(Collectors.joining(ActionRegistry.NL_AND_INDENT))))); } } }
Source:
<code>public void setVisible(boolean visible) { if (visible != isVisible()) { if (!visible) { beforeHide(); } super.setVisible(visible); IContributionManager parent = getParent(); if (parent instanceof SubToolBarManager) { SubToolBarManager subManager = (SubToolBarManager) parent; IContributionItem item = subManager.getParent() .find(getId()); if (item != null) { item.setVisible(visible); } <START> } <END> bars.updateActionBars(); if (visible && toolbar != null) { openCloseToggle.setChecked(true); graph.getControl().setFocus(); toolbar.setFocus(); } else if (!visible && !graph.getControl().isDisposed()) { graph.getControl().setFocus(); } } }</code><technical_language>code in ControlContribution.setVisible()? Client code need bother that</technical_language>

Target:
public void setVisible(boolean visible) { if (visible != isVisible()) { if (!visible) { beforeHide(); } super.setVisible(visible); workAroundBug551067(visible); bars.updateActionBars(); if (visible && toolbar != null) { openCloseToggle.setChecked(true); graph.getControl().setFocus(); toolbar.setFocus(); } else if (!visible && !graph.getControl().isDisposed()) { graph.getControl().setFocus(); } } }
Source:
<code>public PositionalJob(String thingUID) { <START> checkNotNull(thingUID, "Thing UID cannot be null"); <END> this.thingUID = thingUID; }</code><technical_language>Please remove</technical_language>

Target:
public PositionalJob(String thingUID) { checkArgument(thingUID != null, "Thing UID cannot be null"); this.thingUID = thingUID; }
Source:
<code>public long writeTo(WritableByteChannel channel) throws IOException { long totalWritten = 0; if (bufferToSend == null) { bufferToSend = ByteBuffer.allocate(sizeExcludingData()); writeHeader(); bufferToSend.put(blobId.toBytes()); BlobPropertiesSerDe.putBlobPropertiesToBuffer(bufferToSend, properties); bufferToSend.putInt(usermetadata.capacity()); bufferToSend.put(usermetadata); <START> bufferToSend.putLong(dataSize); <END> bufferToSend.putShort((short) dataType.ordinal()); bufferToSend.flip(); } while (sentBytes < sizeInBytes()) { if (bufferToSend.remaining() > 0) { int toWrite = bufferToSend.remaining(); int written = channel.write(bufferToSend); totalWritten += written; sentBytes += written; if (toWrite != written || sentBytes == sizeInBytes()) { break; } } logger.trace("sent Bytes from Put Request {}", sentBytes); bufferToSend.clear(); int dataRead = data.read(bufferToSend.array(), 0, (int) Math.min(bufferToSend.capacity(), (sizeInBytes() - sentBytes))); bufferToSend.limit(dataRead); } return totalWritten; }</code><technical_language>If I understand this change right, changes need _necessarily_ deployed server front ends? If is case, need remember this fact. _read_ versions - write in latest version</technical_language>

Target:
public long writeTo(WritableByteChannel channel) throws IOException { long totalWritten = 0; if (bufferToSend == null) { bufferToSend = ByteBuffer.allocate(sizeExcludingBlobSize()); writeHeader(); bufferToSend.put(blobId.toBytes()); BlobPropertiesSerDe.putBlobPropertiesToBuffer(bufferToSend, properties); bufferToSend.putInt(usermetadata.capacity()); bufferToSend.put(usermetadata); bufferToSend.putShort((short) blobType.ordinal()); bufferToSend.putLong(blobSize); bufferToSend.flip(); } while (sentBytes < sizeInBytes()) { if (bufferToSend.remaining() > 0) { int toWrite = bufferToSend.remaining(); int written = channel.write(bufferToSend); totalWritten += written; sentBytes += written; if (toWrite != written || sentBytes == sizeInBytes()) { break; } } logger.trace("sent Bytes from Put Request {}", sentBytes); bufferToSend.clear(); int streamReadCount = blobStream .read(bufferToSend.array(), 0, (int) Math.min(bufferToSend.capacity(), (sizeInBytes() - sentBytes))); bufferToSend.limit(streamReadCount); } return totalWritten; }
Source:
<code>public static Collection<Supplier<Object[]>> buildGrids() { return ImmutableSet.of( () -> { try { return createRemotes(); <START> } catch (URISyntaxException | SSLException | CertificateException e) { <END> throw new RuntimeException(e); } }, () -> { try { return createInMemory(); } catch (Exception e) { throw new RuntimeException(e); } }); }</code><technical_language>please alphabetise</technical_language>

Target:
public static Collection<Supplier<Object[]>> buildGrids() { return ImmutableSet.of( () -> { try { return createRemotes(); } catch (CertificateException | SSLException | URISyntaxException e) { throw new RuntimeException(e); } }, () -> { try { return createInMemory(); } catch (Exception e) { throw new RuntimeException(e); } }); }
Source:
<code>public Response createLayer(@Context HttpServletRequest req, InputStream postBody) { Response response = null; String newId = IdGenerator.generate(); List<Service> added = null; try { <START> byte[] inmemory = IOUtils.toByteArray(postBody); <END> ByteArrayInputStream bais = new ByteArrayInputStream(inmemory); String metadataId = MetadataUtil.doCSWInsertFromString(MetadataUtil.extractMetadataFromShp(bais)); bais.reset(); added = GeoserverUtil.addLayer(bais, newId); added.add(MetadataUtil.makeCSWServiceForUrl(MetadataUtil.getMetadataByIdUrl(metadataId))); } catch (IOException | ParserConfigurationException | SAXException e) { log.error("Problem creating services from input", e); } if (added != null && !added.isEmpty()) { Layer layer = new Layer(); layer.setId(newId); layer.setServices(added); try (LayerManager manager = new LayerManager()) { manager.save(layer); } response = Response.created(layerURI(layer)).build(); } else { response = Response.serverError().entity("Unable to create layer").build(); } return response; }</code><technical_language>Is a possibility of out of mem error here</technical_language>

Target:
public Response createLayer(@Context HttpServletRequest req, InputStream postBody) { Response response = null; String newId = IdGenerator.generate(); List<Service> added = null; try { byte[] inmemory = IOUtils.toByteArray(postBody); try (ByteArrayInputStream bais = new ByteArrayInputStream(inmemory)) { String metadataId = MetadataUtil.doCSWInsertFromString(MetadataUtil.extractMetadataFromShp(bais)); bais.reset(); added = GeoserverUtil.addLayer(bais, newId); added.add(MetadataUtil.makeCSWServiceForUrl(MetadataUtil.getMetadataByIdUrl(metadataId))); } finally { inmemory = null; } } catch (IOException | ParserConfigurationException | SAXException e) { log.error("Problem creating services from input", e); } if (added != null && !added.isEmpty()) { Layer layer = new Layer(); layer.setId(newId); layer.setServices(added); try (LayerManager manager = new LayerManager()) { manager.save(layer); } response = Response.created(layerURI(layer)).build(); } else { response = Response.serverError().entity("Unable to create layer").build(); } return response; }
Source:
<code>public void testGroupingSets() { assertions.assertQuery( <START> "SELECT x, array_agg(y ORDER BY y), count(*) FROM (" + <END> "VALUES " + " (1, 3), " + " (1, 1), " + " (2, 3), " + " (2, 4)) t(x, y) " + "GROUP BY GROUPING SETS ((), (x))", "VALUES " + " (1, ARRAY[1, 3], BIGINT '2'), " + " (2, ARRAY[3, 4], BIGINT '2'), " + " (NULL, ARRAY[1, 3, 3, 4], BIGINT '4')"); }</code><technical_language>about: SELECT x, array_agg(y FILTER y > 1 ORDER y), count(*) (...); SELECT x, array_agg(DISTINCT y ORDER y), count(*) (...);</technical_language>

Target:
public void testGroupingSets() { assertions.assertQuery( "SELECT x, array_agg(y ORDER BY y), array_agg(y ORDER BY y) FILTER (WHERE y > 1), count(*) FROM (" + "VALUES " + " (1, 3), " + " (1, 1), " + " (2, 3), " + " (2, 4)) t(x, y) " + "GROUP BY GROUPING SETS ((), (x))", "VALUES " + " (1, ARRAY[1, 3], ARRAY[3], BIGINT '2'), " + " (2, ARRAY[3, 4], ARRAY[3, 4], BIGINT '2'), " + " (NULL, ARRAY[1, 3, 3, 4], ARRAY[3, 3, 4], BIGINT '4')"); assertions.assertQuery( "SELECT x, array_agg(DISTINCT y ORDER BY y), count(*) FROM (" + "VALUES " + " (1, 3), " + " (1, 1), " + " (1, 3), " + " (2, 3), " + " (2, 4)) t(x, y) " + "GROUP BY GROUPING SETS ((), (x))", "VALUES " + " (1, ARRAY[1, 3], BIGINT '3'), " + " (2, ARRAY[3, 4], BIGINT '2'), " + " (NULL, ARRAY[1, 3, 4], BIGINT '5')"); }
Source:
<code>public static boolean validateIsNotEmpty(TaskDataProvider provider) { <START> return !checkEmpty(new HashSet<>(), TASK_DATA_PROVIDER, "objects", provider.getObjects()); <END> }</code><technical_language>sense expose this method. all, check if provider.getObjects() is empty return true false. generated errors on, this completely removed</technical_language>

Target:
public static boolean validateIsNotEmpty(TaskDataProvider provider) { return !provider.getObjects().isEmpty(); }
Source:
<code>private void flushErrors() { if(cachePath == null) return; safeAsync(new Runnable() { @Override public void run() { <START> Notification notif = null; <END> File exceptionDir = new File(cachePath); if(exceptionDir.exists() && exceptionDir.isDirectory()) { for(File errorFile : exceptionDir.listFiles()) { try { if(notif == null) notif = createNotification(); notif.setError(errorFile); notif.deliver(); logger.debug("Deleting sent error file " + errorFile.getName()); errorFile.delete(); } catch (IOException e) { logger.warn("Problem reading unsent error from disk", e); } } } } }); }</code><technical_language>move this if statement</technical_language>

Target:
private void flushErrors() { if(cachePath == null) return; safeAsync(new Runnable() { @Override public void run() { File exceptionDir = new File(cachePath); if(exceptionDir.exists() && exceptionDir.isDirectory()) { Notification notif = null; for(File errorFile : exceptionDir.listFiles()) { try { if(notif == null) notif = createNotification(); notif.setError(errorFile); notif.deliver(); logger.debug("Deleting sent error file " + errorFile.getName()); errorFile.delete(); } catch (NetworkException e) { logger.warn("Could not send error(s) to Bugsnag, will try again later", e); } catch (Exception e) { logger.warn("Problem sending unsent error from disk", e); errorFile.delete(); } } } } }); }
Source:
<code>private Moshi(Builder builder) { <START> Set<JsonAdapter.Factory> factories = new LinkedHashSet<>(); <END> factories.addAll(builder.factories); factories.add(StandardJsonAdapters.FACTORY); factories.add(CollectionJsonAdapter.FACTORY); factories.add(MapJsonAdapter.FACTORY); factories.add(ArrayJsonAdapter.FACTORY); factories.add(ClassJsonAdapter.FACTORY); this.factories = Collections.unmodifiableList(new ArrayList<>(factories)); }</code><technical_language>This work, order wrong for factories StandardJsonAdapters.FACTORY</technical_language>

Target:
private Moshi(Builder builder) { List<JsonAdapter.Factory> factories = new ArrayList<>(); factories.addAll(builder.factories); factories.addAll(BUILT_IN_FACTORIES); this.factories = Collections.unmodifiableList(factories); }
Source:
<code>public void shouldConcatenateOneNonEmptyAndOneEmptyLists() { final List<Integer> list = Collections.unmodifiableList( <START> IntStream.range(0, 4) <END> .boxed() .collect(Collectors.toList()) ); final List<Integer> actual = ListOps.concat(EMPTY_LIST, list); final List<Integer> expected = IntStream.range(0, 4) .boxed() .collect(Collectors.toList()); assertNotNull(actual); assertFalse(actual.isEmpty()); assertEquals(expected, actual); }</code><technical_language>Arrays.asList(...) for short lists</technical_language>

Target:
public void shouldConcatenateOneNonEmptyAndOneEmptyLists() { final List<Integer> list = Collections.unmodifiableList( Arrays.asList(0, 1, 2, 3, 4) ); final List<Integer> actual = ListOps.concat(EMPTY_LIST, list); final List<Integer> expected = Arrays.asList(0, 1, 2, 3, 4); assertNotNull(actual); assertFalse(actual.isEmpty()); assertEquals(expected, actual); }
Source:
<code>public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) { <START> return isInitialized == 1; <END> } if (!hasContinent()) { memoizedIsInitialized = 0; return false; } if (!hasCity()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; }</code><technical_language>4 spaces</technical_language>

Target:
public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasContinent()) { memoizedIsInitialized = 0; return false; } if (!hasCity()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; }
Source:
<code>public ScheduleDefinition getSchedule(final TenantIdentifier tenant, final JobIdentifier jobIdentifier) { final TenantContext context = _tenantContextFactory.getContext(tenant); final String jobName = jobIdentifier.getName(); final JobContext jobContext = context.getJob(jobIdentifier); if (jobContext == null) { throw new IllegalArgumentException("No such job: " + jobName); } Map<String, String> jobMetadataProperties = null; if(jobContext.getJobFile().getType() == Type.ANALYSIS_JOB){ <START> final AnalysisJobMetadata analysisJobMetadata = getJobMetadataFromJobFile(context, jobContext); <END> jobMetadataProperties = analysisJobMetadata.getProperties(); } final String groupName = jobContext.getGroupName(); final RepositoryFolder jobsFolder = context.getJobFolder(); final RepositoryFile scheduleFile = jobsFolder.getFile(jobName + EXTENSION_SCHEDULE_XML); final JaxbScheduleReader reader = new JaxbScheduleReader(); final ScheduleDefinition schedule; if (scheduleFile == null) { schedule = new ScheduleDefinition(tenant, jobIdentifier, groupName); } else { schedule = scheduleFile.readFile(new Func<InputStream, ScheduleDefinition>() { @Override public ScheduleDefinition eval(InputStream inputStream) { return reader.read(inputStream, jobIdentifier, tenant, groupName); } }); } schedule.setJobMetadataProperties(jobMetadataProperties); return schedule; }</code><technical_language>if add a "getMetadataProperties()" method JobContext interface. is scheduling service's responsibility fetch it, JobEngine. separation of concerns way</technical_language>

Target:
public ScheduleDefinition getSchedule(final TenantIdentifier tenant, final JobIdentifier jobIdentifier) { final TenantContext context = _tenantContextFactory.getContext(tenant); final String jobName = jobIdentifier.getName(); final JobContext jobContext = context.getJob(jobIdentifier); if (jobContext == null) { throw new IllegalArgumentException("No such job: " + jobName); } final Map<String, String> jobMetadataProperties = jobContext.getMetadataProperties(); final String groupName = jobContext.getGroupName(); final RepositoryFolder jobsFolder = context.getJobFolder(); final RepositoryFile scheduleFile = jobsFolder.getFile(jobName + EXTENSION_SCHEDULE_XML); final JaxbScheduleReader reader = new JaxbScheduleReader(); final ScheduleDefinition schedule; if (scheduleFile == null) { schedule = new ScheduleDefinition(tenant, jobIdentifier, groupName); } else { schedule = scheduleFile.readFile(new Func<InputStream, ScheduleDefinition>() { @Override public ScheduleDefinition eval(InputStream inputStream) { return reader.read(inputStream, jobIdentifier, tenant, groupName); } }); } schedule.setJobMetadataProperties(jobMetadataProperties); return schedule; }
Source:
<code>protected void stop() { if (shutdownThread != null) { Runtime.getRuntime().removeShutdownHook(shutdownThread); shutdownThread = null; } try { if (process != null) { try { client.getControllerClient().executeAsync(Operations.createOperation("shutdown"), null); } catch (AssertionError | RuntimeException e) { } <START> if (process != null) { <END> if (process.waitFor(stopTimeout, TimeUnit.SECONDS)) { process = null; } else { process.destroy(); } } } } catch (Exception e) { try { if (process != null) { process.destroy(); process.waitFor(); } } catch (Exception ignore) { } throw new RuntimeException("Could not stop container", e); } finally { safeCloseClient(); } }</code><technical_language>I this return false now, removed</technical_language>

Target:
protected void stop() { if (shutdownThread != null) { Runtime.getRuntime().removeShutdownHook(shutdownThread); shutdownThread = null; } try { if (process != null) { try { client.getControllerClient().executeAsync(Operations.createOperation("shutdown"), null); } catch (AssertionError | RuntimeException e) { } if (!process.waitFor(stopTimeout, TimeUnit.SECONDS)) { process.destroy(); process.waitFor(); } process = null; } } catch (Exception e) { try { if (process != null) { process.destroy(); process.waitFor(); } } catch (Exception ignore) { } throw new RuntimeException("Could not stop container", e); } finally { safeCloseClient(); } }
Source:
<code>public static void switchFocus (Stage stage, Focusable widget) { if (focusedWidget == widget) return; if (focusedWidget != null) focusedWidget.focusLost(); <START> if (stage != null) stage.setKeyboardFocus(null); <END> focusedWidget = widget; focusedWidget.focusGained(); }</code><technical_language>thinking this more... I need set focusedWidget null calling setKeyboardFocus focusedWidget focusLost called twice</technical_language>

Target:
public static void switchFocus (Stage stage, Focusable widget) { if (focusedWidget == widget) return; if (focusedWidget != null) focusedWidget.focusLost(); focusedWidget = null; if (stage != null) stage.setKeyboardFocus(null); focusedWidget = widget; focusedWidget.focusGained(); }