auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void doSetUserClaimValues(String userName, Map<String, List<String>> multiValuedClaimsToAdd, Map<String, List<String>> multiValuedClaimsToDelete, Map<String, List<String>> claimsExcludingMultiValuedClaims, String profileName) throws UserStoreException, NotImplementedException { <START> if (profileName == null) { <END> profileName = UserCoreConstants.DEFAULT_PROFILE; } Map<String, List<String>> claimAttributeValueMapToAdd = resolveUserStoreAttributeValueMaps(userName, multiValuedClaimsToAdd); Map<String, List<String>> claimAttributeValueMapToDelete = resolveUserStoreAttributeValueMaps(userName, multiValuedClaimsToDelete); Map<String, List<String>> claimAttributeValueMapToModify = resolveUserStoreAttributeValueMaps(userName, claimsExcludingMultiValuedClaims); processAttributesBeforeUpdate(userName, claimAttributeValueMapToAdd, profileName); processAttributesBeforeUpdate(userName, claimAttributeValueMapToDelete, profileName); processAttributesBeforeUpdate(userName, claimAttributeValueMapToModify, profileName); doSetUserAttributes(userName, claimAttributeValueMapToAdd, claimAttributeValueMapToDelete, claimAttributeValueMapToModify, profileName); }</code><technical_language>check for StringUtils.isBlank</technical_language>

Target:
protected void doSetUserClaimValues(String userName, Map<String, List<String>> multiValuedClaimsToAdd, Map<String, List<String>> multiValuedClaimsToDelete, Map<String, List<String>> claimsExcludingMultiValuedClaims, String profileName) throws UserStoreException, NotImplementedException { if (StringUtils.isBlank(profileName)) { profileName = UserCoreConstants.DEFAULT_PROFILE; } Map<String, List<String>> claimAttributeValueMapToAdd = resolveUserStoreAttributeValueMaps(userName, multiValuedClaimsToAdd); Map<String, List<String>> claimAttributeValueMapToDelete = resolveUserStoreAttributeValueMaps(userName, multiValuedClaimsToDelete); Map<String, List<String>> claimAttributeValueMapToModify = resolveUserStoreAttributeValueMaps(userName, claimsExcludingMultiValuedClaims); processAttributesBeforeUpdate(userName, claimAttributeValueMapToAdd, profileName); processAttributesBeforeUpdate(userName, claimAttributeValueMapToDelete, profileName); processAttributesBeforeUpdate(userName, claimAttributeValueMapToModify, profileName); doSetUserAttributes(userName, claimAttributeValueMapToAdd, claimAttributeValueMapToDelete, claimAttributeValueMapToModify, profileName); }
Source:
<code>public void handleRequest(final HttpServerExchange exchange) throws Exception { ServletRequestContext src = exchange.getAttachment(ServletRequestContext.ATTACHMENT_KEY); <START> if( src != null && exchange.getStatusCode() > 399 && exchange.getResponseContentLength() == -1 ) { <END> ((HttpServletResponse)src.getServletResponse()).sendError(exchange.getStatusCode()); } else { next.handleRequest(exchange); } }</code><technical_language>This !exchange.isResponseStarted(), response content length anything, a lot of requests chunked encoding set it</technical_language>

Target:
public void handleRequest(final HttpServerExchange exchange) throws Exception { ServletRequestContext src = exchange.getAttachment(ServletRequestContext.ATTACHMENT_KEY); if( src != null && exchange.getStatusCode() > 399 && !exchange.isResponseStarted() ) { ((HttpServletResponse)src.getServletResponse()).sendError(exchange.getStatusCode()); } else { next.handleRequest(exchange); } }
Source:
<code>public void visitNode(Tree tree) { if (!hasSemantic()) { return; } ImportTree importTree = (ImportTree)tree; if (importTree.qualifiedIdentifier().is(Kind.MEMBER_SELECT)) { IdentifierTree identifier = ((MemberSelectExpressionTree) importTree.qualifiedIdentifier()).identifier(); if ("*".equals(identifier.name())) { <START> fileContainsWildcardImport = true; <END> return; } } importTrees.add(importTree); }</code><technical_language>fileContainsStarImport is more accurate</technical_language>

Target:
public void visitNode(Tree tree) { if (!hasSemantic()) { return; } ImportTree importTree = (ImportTree)tree; if (importTree.qualifiedIdentifier().is(Kind.MEMBER_SELECT)) { IdentifierTree identifier = ((MemberSelectExpressionTree) importTree.qualifiedIdentifier()).identifier(); if ("*".equals(identifier.name())) { fileContainsStarImport = true; return; } } importTrees.add(importTree); }
Source:
<code>private void onGoogleSignInAccountReady(@NonNull GoogleSignInAccount signInAccount) { synchronized (initializationLock) { if (isInitializing.get()) { Single.fromCallable(() -> { final String scopes = "oauth2:" + DriveScopes.DRIVE_APPDATA + " " + DriveScopes.DRIVE_FILE; return GoogleAuthUtil.getToken(context, signInAccount.getAccount(), scopes); }).doOnError(throwable -> { Logger.error(GoogleDriveBackupManager.this, "Failed to authenticate user with status: {}", throwable.getMessage()); }).subscribeOn(Schedulers.io()) <START> .subscribe(onSuccess -> GoogleSignInAccountFinalization(signInAccount, onSuccess), <END> onError -> { if (onError instanceof UserRecoverableAuthException) { activity.startActivityForResult(((UserRecoverableAuthException) onError).getIntent(), REQUEST_CODE_GOOGLE_SERVICE_REAUTH); } else if (onError instanceof UserRecoverableAuthIOException) { activity.startActivityForResult(((UserRecoverableAuthIOException) onError).getIntent(), REQUEST_CODE_GOOGLE_SERVICE_REAUTH); } }); } } }</code><technical_language>rename onSuccess token here</technical_language>

Target:
private void onGoogleSignInAccountReady(@NonNull GoogleSignInAccount signInAccount) { synchronized (initializationLock) { if (isInitializing.get()) { Single.fromCallable(() -> { final String scopes = "oauth2:" + DriveScopes.DRIVE_APPDATA + " " + DriveScopes.DRIVE_FILE; return GoogleAuthUtil.getToken(context, signInAccount.getAccount(), scopes); }).doOnError(throwable -> { Logger.error(GoogleDriveBackupManager.this, "Failed to authenticate user with status: {}", throwable.getMessage()); }).subscribeOn(Schedulers.io()) .subscribe(token -> GoogleSignInAccountFinalization(signInAccount, token), onError -> { if (onError instanceof UserRecoverableAuthException) { activity.startActivityForResult(((UserRecoverableAuthException) onError).getIntent(), REQUEST_CODE_GOOGLE_SERVICE_REAUTH); } else if (onError instanceof UserRecoverableAuthIOException) { activity.startActivityForResult(((UserRecoverableAuthIOException) onError).getIntent(), REQUEST_CODE_GOOGLE_SERVICE_REAUTH); } }); } } }
Source:
<code>private ConfigurationChangeResourceAddHandler() { <START> super(CONFIGURATION_CHANGES_CAPABILITY, MAX_HISTORY); <END> }</code><technical_language>pass CONFIGURATION_CHANGES_CAPABILITY ConfigurationChangeResourceDefinition constructor need pass add handler constructor</technical_language>

Target:
private ConfigurationChangeResourceAddHandler() { super(MAX_HISTORY); }
Source:
<code>public BlobHolder getBlobHolderAdapter(DocumentModel doc, String factoryName) { <START> if (StringUtils.isNotBlank(factoryName) && factoriesByName.containsKey(factoryName)) { <END> BlobHolderFactory factory = factoriesByName.get(factoryName); return factory.getBlobHolder(doc); } if (factories.containsKey(doc.getType())) { BlobHolderFactory factory = factories.get(doc.getType()); return factory.getBlobHolder(doc); } for (Map.Entry<String, BlobHolderFactory> entry : factoriesByFacets.entrySet()) { if (doc.hasFacet(entry.getKey())) { return entry.getValue().getBlobHolder(doc); } } if (doc.hasSchema("file")) { return new DocumentBlobHolder(doc, "file:content"); } else if (doc.hasSchema("note")) { String mt = null; try { mt = (String) doc.getPropertyValue("note:mime_type"); if (mt == null) { String note = (String) doc.getPropertyValue("note:note"); if (note != null && !"".equals(note)) { mt = "text/plain"; } } } catch (PropertyException e) { } return new DocumentStringBlobHolder(doc, "note:note", mt); } return null; }</code><technical_language>isNotBlank sense data user input. a regular API call, factoryName != null</technical_language>

Target:
public BlobHolder getBlobHolderAdapter(DocumentModel doc, String factoryName) { if (factoryName != null && factoriesByName.containsKey(factoryName)) { BlobHolderFactory factory = factoriesByName.get(factoryName); return factory.getBlobHolder(doc); } if (factories.containsKey(doc.getType())) { BlobHolderFactory factory = factories.get(doc.getType()); return factory.getBlobHolder(doc); } for (Map.Entry<String, BlobHolderFactory> entry : factoriesByFacets.entrySet()) { if (doc.hasFacet(entry.getKey())) { return entry.getValue().getBlobHolder(doc); } } if (doc.hasSchema("file")) { return new DocumentBlobHolder(doc, "file:content"); } else if (doc.hasSchema("note")) { String mt = null; try { mt = (String) doc.getPropertyValue("note:mime_type"); if (mt == null) { String note = (String) doc.getPropertyValue("note:note"); if (note != null && !"".equals(note)) { mt = "text/plain"; } } } catch (PropertyException e) { } return new DocumentStringBlobHolder(doc, "note:note", mt); } return null; }
Source:
<code>private Response handleError(UserInfoEndpointException e) throws OAuthSystemException { log.debug(e); OAuthResponse res = null; try { res = OAuthASResponse.errorResponse(HttpServletResponse.SC_BAD_REQUEST) .setError(e.getErrorCode()).setErrorDescription(e.getErrorMessage()) .buildJSONMessage(); } catch (OAuthSystemException e1) { <START> log.error(e1.getMessage(), e1); <END> OAuthResponse response = OAuthASResponse.errorResponse(HttpServletResponse.SC_INTERNAL_SERVER_ERROR) .setError(OAuth2ErrorCodes.SERVER_ERROR) .setErrorDescription(e1.getMessage()).buildJSONMessage(); return Response.status(response.getResponseStatus()).entity(response.getBody()).build(); } return Response.status(res.getResponseStatus()).entity(res.getBody()).build(); }</code><technical_language>remove e.getMessage</technical_language>

Target:
private Response handleError(UserInfoEndpointException e) throws OAuthSystemException { log.debug(e); OAuthResponse res = null; try { res = OAuthASResponse.errorResponse(HttpServletResponse.SC_BAD_REQUEST) .setError(e.getErrorCode()).setErrorDescription(e.getErrorMessage()) .buildJSONMessage(); } catch (OAuthSystemException e1) { log.error("Error while building the JSON message", e1); OAuthResponse response = OAuthASResponse.errorResponse(HttpServletResponse.SC_INTERNAL_SERVER_ERROR) .setError(OAuth2ErrorCodes.SERVER_ERROR) .setErrorDescription(e1.getMessage()).buildJSONMessage(); return Response.status(response.getResponseStatus()).entity(response.getBody()).build(); } return Response.status(res.getResponseStatus()).entity(res.getBody()).build(); }
Source:
<code>private ConnectorSplit createBucketSplit(int bucketNumber, Set<ShardNodes> shards) { String nodeId = bucketToNode.get().get(bucketNumber); Node node = nodesById.get(nodeId); if (node == null) { throw new PrestoException(NO_NODES_AVAILABLE, "Node for bucket is offline: " + nodeId); } Set<UUID> shardUuids = shards.stream() .map(ShardNodes::getShardUuid) .collect(toSet()); <START> ImmutableMap.Builder<UUID, UUID> shardMapBuilder = new ImmutableMap.Builder<>(); <END> shards.forEach( shard -> { if (shard.getDeltaShardUuid().isPresent()) { shardMapBuilder.put(shard.getShardUuid(), shard.getDeltaShardUuid().get()); } }); HostAddress address = node.getHostAndPort(); return new RaptorSplit( connectorId, shardUuids, shardMapBuilder.build(), tableSupportsDeltaDelete, bucketNumber, address, effectivePredicate, transactionId, columnTypes); }</code><technical_language>ImmutableMap.builder()</technical_language>

Target:
private ConnectorSplit createBucketSplit(int bucketNumber, Set<ShardNodes> shards) { String nodeId = bucketToNode.get().get(bucketNumber); Node node = nodesById.get(nodeId); if (node == null) { throw new PrestoException(NO_NODES_AVAILABLE, "Node for bucket is offline: " + nodeId); } Set<UUID> shardUuids = shards.stream() .map(ShardNodes::getShardUuid) .collect(toSet()); ImmutableMap.Builder<UUID, UUID> shardMapBuilder = ImmutableMap.builder(); shards.forEach( shard -> { if (shard.getDeltaShardUuid().isPresent()) { shardMapBuilder.put(shard.getShardUuid(), shard.getDeltaShardUuid().get()); } }); HostAddress address = node.getHostAndPort(); return new RaptorSplit( connectorId, shardUuids, shardMapBuilder.build(), tableSupportsDeltaDelete, bucketNumber, address, effectivePredicate, transactionId, columnTypes); }
Source:
<code>private void initActors(List<Sprite> sprites) { if (sprites.isEmpty()) { return; } for (Sprite sprite : sprites) { sprite.resetSprite(); sprite.look.createBrightnessContrastHueShader(); <START> if (!sprite.getLookList().isEmpty()) { <END> sprite.look.setLookData(sprite.getLookList().get(0)); } stage.addActor(sprite.look); } penActor = new PenActor(); stage.addActor(penActor); penActor.setZIndex(Z_LAYER_PEN_ACTOR); screenRatio = calculateScreenRatio(); embroideryActor = new EmbroideryActor(screenRatio); stage.addActor(embroideryActor); embroideryActor.setZIndex(Z_LAYER_EMBROIDERY_ACTOR); }</code><technical_language>Please move lines sprite.resetSprite(). a nice fix</technical_language>

Target:
private void initActors(List<Sprite> sprites) { if (sprites.isEmpty()) { return; } for (Sprite sprite : sprites) { sprite.resetSprite(); sprite.look.createBrightnessContrastHueShader(); stage.addActor(sprite.look); } penActor = new PenActor(); stage.addActor(penActor); penActor.setZIndex(Z_LAYER_PEN_ACTOR); screenRatio = calculateScreenRatio(); embroideryActor = new EmbroideryActor(screenRatio); stage.addActor(embroideryActor); embroideryActor.setZIndex(Z_LAYER_EMBROIDERY_ACTOR); }
Source:
<code>public User setupCommCareUser(){ User user = null; String commCareUserName = Context.getRuntimeProperties().getProperty("commcare.username", "commCareUser"); <START> String commCareUserPassword = Context.getRuntimeProperties().getProperty("commcare.password", "CommCare12"); <END> if (StringUtils.isNotBlank(commCareUserName)) { user = Context.getUserService().getUserByUsername(commCareUserName); if (user == null) { user = new User(); } user.setUsername(commCareUserName); Person person = user.getPerson(); if (person == null) { person = new Person(); person.addName(new PersonName("CommCare", "", "Integration")); person.setGender("M"); user.setPerson(person); } user.addRole(Context.getUserService().getRole("Authenticated")); user.addRole(Context.getUserService().getRole("Privilege Level: Full")); if (user.getId() == null ) { user = Context.getUserService().createUser(user, commCareUserPassword); } else { user = Context.getUserService().saveUser(user); } person = user.getPerson(); Collection<Provider> providers = Context.getProviderService().getProvidersByPerson(person); if (providers == null || providers.size() < 1 ){ Provider provider = new Provider(); provider.setPerson(person); Context.getProviderService().saveProvider(provider); } } return user; }</code><technical_language>default values blank install a user if values in runtime properties... inadvertently create a user username/password pair in plaintext in a public repo... :) set runtime properties in Puppet for servers need this user</technical_language>

Target:
public User setupCommCareUser(){ User user = null; String commCareUserName = Context.getRuntimeProperties().getProperty("commcare.username", null); String commCareUserPassword = Context.getRuntimeProperties().getProperty("commcare.password", null); if (StringUtils.isNotBlank(commCareUserName) && StringUtils.isNotBlank(commCareUserPassword)) { user = Context.getUserService().getUserByUsername(commCareUserName); if (user == null) { user = new User(); } user.setUsername(commCareUserName); Person person = user.getPerson(); if (person == null) { person = new Person(); person.addName(new PersonName("CommCare", "", "Integration")); person.setGender("M"); user.setPerson(person); } user.addRole(Context.getUserService().getRole("Authenticated")); user.addRole(Context.getUserService().getRole("Privilege Level: Full")); if (user.getId() == null ) { user = Context.getUserService().createUser(user, commCareUserPassword); } else { user = Context.getUserService().saveUser(user); } person = user.getPerson(); Collection<Provider> providers = Context.getProviderService().getProvidersByPerson(person); if (providers == null || providers.size() < 1 ){ Provider provider = new Provider(); provider.setUuid(PihCoreConstants.COMMCARE_PROVIDER_UUID); provider.setPerson(person); Context.getProviderService().saveProvider(provider); } } return user; }
Source:
<code>public void updateButtons() { super.updateButtons(); final Button nextButton = getButton(IDialogConstants.NEXT_ID); if (getCurrentPage() instanceof CreateContractInputFromBusinessObjectWizardPage) { <START> final CreateContractInputFromBusinessObjectWizardPage page = (CreateContractInputFromBusinessObjectWizardPage) getCurrentPage(); <END> nextButton.setText(Messages.preview); } else { nextButton.setText(IDialogConstants.NEXT_LABEL); } }</code><technical_language>page variable is used</technical_language>

Target:
public void updateButtons() { super.updateButtons(); final Button nextButton = getButton(IDialogConstants.NEXT_ID); if (getCurrentPage() instanceof CreateContractInputFromBusinessObjectWizardPage) { nextButton.setText(Messages.preview); } else { nextButton.setText(IDialogConstants.NEXT_LABEL); } }
Source:
<code>private static OGCGeometry tileToPolygon(BingTile tile) { Point upperLeftCorner = tileXYToLatitudeLongitude(tile.getX(), tile.getY(), tile.getZoomLevel()); Point lowerRightCorner = tileXYToLatitudeLongitude(tile.getX() + 1, tile.getY() + 1, tile.getZoomLevel()); Polyline boundary = new Polyline(); boundary.startPath(upperLeftCorner); boundary.lineTo(lowerRightCorner.getX(), upperLeftCorner.getY()); boundary.lineTo(lowerRightCorner); boundary.lineTo(upperLeftCorner.getX(), lowerRightCorner.getY()); <START> final Polygon polygon = new Polygon(); <END> polygon.add(boundary, false); return OGCGeometry.createFromEsriGeometry(polygon, null); }</code><technical_language>remove final</technical_language>

Target:
private static OGCGeometry tileToPolygon(BingTile tile) { Point upperLeftCorner = tileXYToLatitudeLongitude(tile.getX(), tile.getY(), tile.getZoomLevel()); Point lowerRightCorner = tileXYToLatitudeLongitude(tile.getX() + 1, tile.getY() + 1, tile.getZoomLevel()); Polyline boundary = new Polyline(); boundary.startPath(upperLeftCorner); boundary.lineTo(lowerRightCorner.getX(), upperLeftCorner.getY()); boundary.lineTo(lowerRightCorner); boundary.lineTo(upperLeftCorner.getX(), lowerRightCorner.getY()); Polygon polygon = new Polygon(); polygon.add(boundary, false); return OGCGeometry.createFromEsriGeometry(polygon, null); }
Source:
<code>public MouseOverArea[] createMouseOverAreas(float overCoordX, float overCoordY, <START> GameContainer container, String[] text,TrueTypeFont typeFont, <END> ResourcesWrapper res) throws SlickException { MouseOverArea[] areas = new MouseOverArea[text.length]; for (int i = 0; i < areas.length; i++) { Image button = res.createImage(typeFont.getWidth(text[i]), typeFont.getHeight()); Shape shape = new Rectangle(overCoordX, overCoordY + i * 50, typeFont.getWidth(text[0]), typeFont.getHeight()); areas[i] = new MouseOverArea(container, button, shape); } return areas; }</code><technical_language>this method protected</technical_language>

Target:
protected MouseOverArea[] createMouseOverAreas(float overCoordX, float overCoordY, GameContainer container, String[] text,TrueTypeFont typeFont, ResourcesWrapper res) throws SlickException { MouseOverArea[] areas = new MouseOverArea[text.length]; for (int i = 0; i < areas.length; i++) { Image button = res.createImage(typeFont.getWidth(text[i]), typeFont.getHeight()); Shape shape = new Rectangle(overCoordX, overCoordY + i * 50, typeFont.getWidth(text[0]), typeFont.getHeight()); areas[i] = new MouseOverArea(container, button, shape); } return areas; }
Source:
<code>public Order updateStatus(String orderReference) { Client mollie = new ClientBuilder().withApiKey(apiKey).build(); Order order = orderRepository.findByReference(orderReference) .orElseThrow(() -> new OrderNotFoundException("Order with reference " + orderReference + " not found")); try { ResponseOrError<Payment> molliePaymentStatus = mollie.payments().get(orderReference); if (molliePaymentStatus.getSuccess()) { switch (molliePaymentStatus.getData().getStatus()) { case "pending": { order.setStatus(OrderStatus.PENDING); break; } case "open": { order.setStatus(OrderStatus.PENDING); break; } case "cancelled": { order.setStatus(OrderStatus.CANCELLED); break; } case "failed": { order.setStatus(OrderStatus.CANCELLED); break; } case "expired": { order.setStatus(OrderStatus.EXPIRED); break; } case "paid": { order.setStatus(OrderStatus.PAID); <START> slackNotificationService.sendSlackMessage(order.getTickets().size() + " tickets bought!"); <END> break; } case "paidout": { order.setStatus(OrderStatus.PAID); break; } } return orderRepository.save(order); } else { handleMollieError(molliePaymentStatus); return order; } } catch (IOException e) { throw new PaymentServiceConnectionException(e.getMessage()); } }</code><technical_language>need a :tada: :money_with_wings: emoji in</technical_language>

Target:
public Order updateStatus(String orderReference) { Client mollie = new ClientBuilder().withApiKey(apiKey).build(); Order order = orderRepository.findByReference(orderReference) .orElseThrow(() -> new OrderNotFoundException("Order with reference " + orderReference + " not found")); try { ResponseOrError<Payment> molliePaymentStatus = mollie.payments().get(orderReference); if (molliePaymentStatus.getSuccess()) { switch (molliePaymentStatus.getData().getStatus()) { case "pending": { order.setStatus(OrderStatus.PENDING); break; } case "open": { order.setStatus(OrderStatus.PENDING); break; } case "cancelled": { order.setStatus(OrderStatus.CANCELLED); break; } case "failed": { order.setStatus(OrderStatus.CANCELLED); break; } case "expired": { order.setStatus(OrderStatus.EXPIRED); break; } case "paid": { order.setStatus(OrderStatus.PAID); break; } case "paidout": { order.setStatus(OrderStatus.PAID); break; } } return orderRepository.save(order); } else { handleMollieError(molliePaymentStatus); return order; } } catch (IOException e) { throw new PaymentServiceConnectionException(e.getMessage()); } }
Source:
<code>protected void setInputStream(InputStream is) { <START> this.is = is; <END> }</code><technical_language>Sorry, I trouble expressing days. I meant say, "Does sense add resetEntity() BuiltResponse.setInputStream()?"</technical_language>

Target:
protected void setInputStream(InputStream is) { this.is = is; resetEntity(); }
Source:
<code>protected MultivaluedMap<String, String> getQueryParams(String query) throws URISyntaxException { URIBuilder uri; uri = new URIBuilder(query); MultivaluedMap<String, String> queryParams = new MultivaluedHashMap<String, String>(); for (NameValuePair queryParam : uri.getQueryParams()) { queryParams.add(queryParam.getName(), queryParam.getValue()); } <START> log.debug("QueryParams: {}", queryParams); <END> return queryParams; }</code><technical_language>If log entire asyncQuery object, need of separate, sprinkled log messages</technical_language>

Target:
protected MultivaluedMap<String, String> getQueryParams(String query) throws URISyntaxException { URIBuilder uri; uri = new URIBuilder(query); MultivaluedMap<String, String> queryParams = new MultivaluedHashMap<String, String>(); for (NameValuePair queryParam : uri.getQueryParams()) { queryParams.add(queryParam.getName(), queryParam.getValue()); } return queryParams; }
Source:
<code>public void onStartup(final PlaceRequest place) { <START> signalProcessInstanceAction = new PrimaryActionMenuBuilder(constants.Signal(), <END> () -> signalProcessInstance()); abortProcessInstanceAction = new PrimaryActionMenuBuilder(constants.Abort(), () -> openAbortProcessInstancePopup()); this.place = place; }</code><technical_language>set methods in here</technical_language>

Target:
public void onStartup(final PlaceRequest place) { setSignalProcessInstanceAction(new PrimaryActionMenuBuilder(constants.Signal(), () -> signalProcessInstance())); setAbortProcessInstanceAction(new PrimaryActionMenuBuilder(constants.Abort(), () -> openAbortProcessInstancePopup())); this.place = place; }
Source:
<code><START> private void append(String arg) { <END> buf.append(arg); cursor = Position.pos(cursor.line, cursor.column + arg.length()); }</code><technical_language>in print() println()</technical_language>

Target:
private void append(String arg) { buf.append(arg); cursor = cursor.withColumn(cursor.column + arg.length()); }
Source:
<code><START> public CookieCredentials extract(final WebContext context) { <END> final Collection<Cookie> col = context.getRequestCookies(); if (col.contains(new Cookie(this.cookieName, this.cookieValue))) { return null; } return new CookieCredentials(this.cookieName, this.cookieValue, clientName); }</code><technical_language>I expected this extractor return of cookie (by name)</technical_language>

Target:
public TokenCredentials extract(final WebContext context) { final Collection<Cookie> col = context.getRequestCookies(); for (final Cookie c : col) { if (c.getName().equals(this.cookieName)) { return new TokenCredentials(c.getValue(), clientName); } } return null; }
Source:
<code><START> public void stop() throws XAException, SystemException, InvalidTransactionException, NamingException <END> { txbridgeLogger.logger.trace("InboundBridge.stop("+xid+")"); TransactionManager.transactionManager(new InitialContext()).suspend(); }</code><technical_language>This is changing a public interface deprecation rules apply</technical_language>

Target:
public void stop() throws XAException, SystemException, InvalidTransactionException { txbridgeLogger.logger.trace("InboundBridge.stop("+xid+")"); TransactionManager.transactionManager(ctx).suspend(); }
Source:
<code>protected DBObject normalizeResponse(DBObject rawJson) { List<DBObject> curatedList = new ArrayList<>(); for (DBObject dbObject: Transformer.convertToDbObjectList(rawJson)) { try { this.checkForErrorResponse(dbObject); this.normalizeRcv(dbObject); this.objectMapper.convertValue(dbObject, this.type); curatedList.add(dbObject); <START> } catch (Exception e) { <END> LOG.warn(this.getId(dbObject) + ": " + e.getLocalizedMessage()); } } BasicDBList list = new BasicDBList(); list.addAll(curatedList); return list; }</code><technical_language>variants myvariantinfo annotations this add a lot logs. ok for now, prolly save in some separate collection some point</technical_language>

Target:
protected DBObject normalizeResponse(DBObject rawJson) { List<DBObject> curatedList = new ArrayList<>(); for (DBObject dbObject: Transformer.convertToDbObjectList(rawJson)) { try { this.checkForErrorResponse(dbObject); this.objectMapper.convertValue(dbObject, this.type); curatedList.add(dbObject); } catch (MyVariantInfoNotFoundException e) { } catch (Exception e) { LOG.warn(this.getId(dbObject) + ": " + e.getLocalizedMessage()); } } BasicDBList list = new BasicDBList(); list.addAll(curatedList); return list; }
Source:
<code>public void setCompareMode(boolean compareMode) { if (compareModeAction!=null) { this.compareMode = !compareMode; <START> compareModeAction.run(); <END> } }</code><technical_language>wrong invert set action set back. :P option is do compareModeAction.setChecked(compareMode)</technical_language>

Target:
public void setCompareMode(boolean compareMode) { if (compareModeAction!=null) { this.compareMode = compareMode; compareModeAction.setChecked(compareMode); } }
Source:
<code>public void childModuleMissingModuleAnnotation() { <START> ObjectGraph.createWith(new TestingLoader(), new TestingLoader(), new ChildModuleMissingModuleAnnotation()); <END> }</code><technical_language>curious</technical_language>

Target:
public void childModuleMissingModuleAnnotation() { try { ObjectGraph.createWith(new TestingLoader(), new ChildModuleMissingModuleAnnotation()); } catch (IllegalArgumentException e) { assertThat(e.getMessage()) .contains("No @Module on dagger.ModuleTest$ModuleMissingModuleAnnotation"); } }
Source:
<code>public boolean isFirstBookingOK(ArrayList<LocalDate> dates) { try { WebElement firstVisitElement = findElement(FIRST_VISIT); if (firstVisitElement == null) { return true; } else { LocalDate date = LocalDate.parse((firstVisitElement.getAttribute("title")).toString()); <START> if (containsDate(dates, date)) { <END> return true; } return false; } } catch (Exception e) { return true; } }</code><technical_language>List contains method, need containsDate isSameDay methods</technical_language>

Target:
public boolean isFirstBookingOK(ArrayList<LocalDate> dates) { try { WebElement firstVisitElement = findElement(FIRST_VISIT); if (firstVisitElement == null) { return true; } else { LocalDate date = LocalDate.parse((firstVisitElement.getAttribute("title")).toString(), DateTimeFormat.forPattern("yyyy-MM-dd")); if (dates.contains(date)) { return true; } return false; } } catch (Exception e) { return true; } }
Source:
<code>private Object[] appendBookmarksIfFolder(String selection, String[] selectionArgs) { final SQLiteDatabase db = mOpenHelper.getReadableDatabase(); final String[] bookmarksProjection = new String[] { Bookmarks._ID, Bookmarks.IS_FOLDER }; StringBuilder newSelection = new StringBuilder(selection); newSelection.append(" OR " + TABLE_BOOKMARKS + "._id IN ("); List<String> newSelectionArgs = new ArrayList<String>(); Cursor cursor = null; try { cursor = db.query(TABLE_BOOKMARKS, bookmarksProjection, selection, selectionArgs, null, null, null); if (cursor != null) { while (cursor.moveToNext()) { String id = Long.toString(cursor.getLong(0)); newSelectionArgs.add(id); if (cursor.getInt(1) != 0) { Object[] bookmarks = appendBookmarksIfFolder( Bookmarks.PARENT + "=?", new String[] { id }); String[] bookmarkIds = (String[]) bookmarks[1]; for (String bookmarkId : bookmarkIds) { <START> newSelection.append("'" + bookmarkId + "',"); <END> newSelectionArgs.add(bookmarkId); } newSelection.deleteCharAt(newSelection.length() - 1); } } } } finally { if (cursor != null) { cursor.close(); } } newSelection.append(")"); return new Object[] { newSelection.toString(), newSelectionArgs.toArray(new String[newSelectionArgs.size()]) }; }</code><technical_language>this selectionArgs. If do this chance of hitting statement caches</technical_language>

Target:
private Object[] appendBookmarksIfFolder(String selection, String[] selectionArgs) { final SQLiteDatabase db = mOpenHelper.getReadableDatabase(); final String[] bookmarksProjection = new String[] { Bookmarks._ID, Bookmarks.IS_FOLDER }; StringBuilder newSelection = new StringBuilder(selection); List<String> newSelectionArgs = new ArrayList<String>(); Cursor cursor = null; try { cursor = db.query(TABLE_BOOKMARKS, bookmarksProjection, selection, selectionArgs, null, null, null); if (cursor != null) { while (cursor.moveToNext()) { String id = Long.toString(cursor.getLong(0)); newSelectionArgs.add(id); if (cursor.getInt(1) != 0) { Object[] bookmarks = appendBookmarksIfFolder( Bookmarks.PARENT + "=?", new String[] { id }); String[] bookmarkIds = (String[]) bookmarks[1]; if (bookmarkIds.length > 0) { newSelection.append(" OR " + TABLE_BOOKMARKS + "._id IN ("); for (String bookmarkId : bookmarkIds) { newSelection.append("?,"); newSelectionArgs.add(bookmarkId); } newSelection.deleteCharAt(newSelection.length() - 1); newSelection.append(")"); } } } } } finally { if (cursor != null) { cursor.close(); } } return new Object[] { newSelection.toString(), newSelectionArgs.toArray(new String[newSelectionArgs.size()]) }; }
Source:
<code><START> public void validate(final String name, final String value) throws ParameterException { <END> if (Strings.isNullOrEmpty(value)) { throw new ParameterException(name + " is null or empty"); } }</code><technical_language>is of a class a simple thing? a static method in a utility class is easier adds heap</technical_language>

Target:
public void validate(final String name, final String value) throws ParameterException { if (StringUtils.isBlank(value)) { throw new ParameterException(name + " is null or empty"); } }
Source:
<code>public void setFakeHash() { <START> if (hash.length() == 0) { <END> hash = this.pack.getId(); if (hash.length() == SpongeResourcePack.HASH_SIZE) { hash += " "; } } }</code><technical_language>Unqualified access instance variable hash</technical_language>

Target:
public String setFakeHash() { if (this.hash.length() == 0) { this.hash = this.pack.getId(); if (this.hash.length() == SpongeResourcePack.HASH_SIZE) { this.hash += " "; } } return this.hash.trim(); }
Source:
<code>protected void checkTarget(IDebugTarget target, boolean checked) { fThreadViewer.setChecked(target, checked); if (checked) { fThreadViewer.expandToLevel(target, AbstractTreeViewer.ALL_LEVELS); IThread[] threads; try { threads= target.getThreads(); } catch (DebugException exception) { JDIDebugUIPlugin.log(exception); return; } IThread thread; boolean checkedThread= false; for (IThread <START> thread2 : <END> threads) { thread= thread2; String name= null; try { name= thread.getName(); } catch (DebugException exception) { JDIDebugUIPlugin.log(exception); } if (MAIN.equals(name)) { checkedThread= fThreadViewer.setChecked(thread, true); } } if (!checkedThread) { for (IThread thread2 : threads) { if (fThreadViewer.setChecked(thread2, true)) { break; } } } } else { IThread[] threads; try { threads= target.getThreads(); } catch (DebugException exception) { JDIDebugUIPlugin.log(exception); return; } for (IThread thread : threads) { fThreadViewer.setChecked(thread, false); } } }</code><technical_language>rename targetThread</technical_language>

Target:
protected void checkTarget(IDebugTarget target, boolean checked) { fThreadViewer.setChecked(target, checked); if (checked) { fThreadViewer.expandToLevel(target, AbstractTreeViewer.ALL_LEVELS); IThread[] threads; try { threads= target.getThreads(); } catch (DebugException exception) { JDIDebugUIPlugin.log(exception); return; } IThread thread; boolean checkedThread= false; for (IThread targetThread : threads) { thread= targetThread; String name= null; try { name= thread.getName(); } catch (DebugException exception) { JDIDebugUIPlugin.log(exception); } if (MAIN.equals(name)) { checkedThread= fThreadViewer.setChecked(thread, true); } } if (!checkedThread) { for (IThread targetThread : threads) { if (fThreadViewer.setChecked(targetThread, true)) { break; } } } } else { IThread[] threads; try { threads= target.getThreads(); } catch (DebugException exception) { JDIDebugUIPlugin.log(exception); return; } for (IThread thread : threads) { fThreadViewer.setChecked(thread, false); } } }
Source:
<code><START> public Long getSplitsPerNode() <END> { return splitsPerNode; }</code><technical_language>Return OptionalLong</technical_language>

Target:
public Optional<Long> getSplitsPerNode() { return Optional.ofNullable(splitsPerNode); }
Source:
<code>private void setToCButtonFadedIn(boolean shouldFadeIn) { if (shouldFadeIn) { tocButton.removeCallbacks(hideToCButtonRunnable); tocButton.show(); <START> } else { <END> tocButton.postDelayed(hideToCButtonRunnable, TOC_BUTTON_HIDE_DELAY); } }</code><technical_language>remove callbacks in case prevent accidental double posting</technical_language>

Target:
private void setToCButtonFadedIn(boolean shouldFadeIn) { tocButton.removeCallbacks(hideToCButtonRunnable); if (shouldFadeIn) { tocButton.show(); } else { tocButton.postDelayed(hideToCButtonRunnable, TOC_BUTTON_HIDE_DELAY); } }
Source:
<code>public void edit(HostSetupNetworksModel uicommonModel) { driver.edit(uicommonModel); uicommonModel.getNicsChangedEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { HostSetupNetworksModel model = (HostSetupNetworksModel) sender; List<LogicalNetworkModel> networks = model.getNetworks(); List<NetworkInterfaceModel> nics = model.getNics(); updateNetworks(networks); updateNics(nics); rendered = true; } }); uicommonModel.getOperationCandidateEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { OperationCadidateEventArgs evtArgs = (OperationCadidateEventArgs) args; NetworkOperation candidate = evtArgs.getCandidate(); NetworkItemModel<?> op1 = evtArgs.getOp1(); NetworkItemModel<?> op2 = evtArgs.getOp2(); <START> if (evtArgs.isDryRun()) { <END> return; } if (candidate == null) { setErrorStatus(constants.noValidActionSetupNetwork()); } else { if (candidate.isErroneousOperation()) { setErrorStatus(candidate.getMessage(op1, op2)); } else { if (candidate.isDisplayNetworkAffected(op1, op2)) { setWarningStatus(applicationMessages.moveDisplayNetworkWarning(candidate.getMessage(op1, op2))); } else { setValidStatus(candidate.getMessage(op1, op2)); } } } } }); internalNetworkList.setSetupModel(uicommonModel); externalNetworkList.setSetupModel(uicommonModel); }</code><technical_language>If fix I wrote in HostSetupNetworksModel, this code removed</technical_language>

Target:
public void edit(HostSetupNetworksModel uicommonModel) { driver.edit(uicommonModel); uicommonModel.getNicsChangedEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { HostSetupNetworksModel model = (HostSetupNetworksModel) sender; List<LogicalNetworkModel> networks = model.getNetworks(); List<NetworkInterfaceModel> nics = model.getNics(); if (!keepStatusText) { initStatusPanel(); } keepStatusText = false; updateNetworks(networks); updateNics(nics); rendered = true; } }); uicommonModel.getOperationCandidateEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { OperationCadidateEventArgs evtArgs = (OperationCadidateEventArgs) args; NetworkOperation candidate = evtArgs.getCandidate(); NetworkItemModel<?> op1 = evtArgs.getOp1(); NetworkItemModel<?> op2 = evtArgs.getOp2(); if (candidate == null) { setErrorStatus(constants.noValidActionSetupNetwork()); } else { if (candidate.isErroneousOperation()) { setErrorStatus(candidate.getMessage(op1, op2)); } else { if (candidate.isDisplayNetworkAffected(op1, op2)) { setWarningStatus(applicationMessages.moveDisplayNetworkWarning(candidate.getMessage(op1, op2))); } else { setValidStatus(candidate.getMessage(op1, op2)); } } } } }); internalNetworkList.setSetupModel(uicommonModel); externalNetworkList.setSetupModel(uicommonModel); }
Source:
<code>protected boolean importDefinition() { File file = new File(getSchemaField().getText()); if (!file.canRead()) { showWarningDialog(Constant.messages.getString(MESSAGE_PREFIX + "badfile")); return false; } try { <START> GraphQlParser.parse(FileUtils.readFileToString(file, "UTF-8"), getEndpointUri()); <END> } catch (IOException e) { showWarningDialog(Constant.messages.getString(MESSAGE_PREFIX + "readerror")); } return true; }</code><technical_language>This done in a separate thread (guess GraphQlParser responsible for that), block EDT. importing URL</technical_language>

Target:
protected boolean importDefinition() { try { getParser().importFile(getSchemaField().getText()); return true; } catch (IOException e) { showWarningDialog(e.getMessage()); } return false; }
Source:
<code>public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Instance other = (Instance) obj; boolean equals = true; equals &= (this.hostname != null) ? (this.hostname.equals(other.hostname)) : (other.hostname == null); equals &= (this.cluster != null) ? (this.cluster.equals(other.cluster)) : (other.cluster == null); equals &= (this.isUp == other.isUp); if(attributes != null && attributes.get("port") != null){ String port = attributes.get("port"); if(other.getAttributes() != null && other.getAttributes().get("port") != null){ <START> equals &= (port == other.getAttributes().get("port")); <END> } } return equals; }</code><technical_language>This code is broken. comparing strings "==". false</technical_language>

Target:
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Instance other = (Instance) obj; boolean equals = true; equals &= (this.hostname != null) ? (this.hostname.equals(other.hostname)) : (other.hostname == null); equals &= (this.cluster != null) ? (this.cluster.equals(other.cluster)) : (other.cluster == null); equals &= (this.isUp == other.isUp); if(attributes != null && attributes.get("port") != null){ String port = attributes.get("port"); if(other.getAttributes() != null && other.getAttributes().get("port") != null){ equals &= (port.equals(other.getAttributes().get("port"))); } } return equals; }
Source:
<code>public Set<DiscoveryDruidNode> getAllNodes() { <START> return ImmutableSet.<DiscoveryDruidNode>builder().addAll(nodes.values()).build(); <END> }</code><technical_language>Collections.unmodifiableSet()</technical_language>

Target:
public Collection<DiscoveryDruidNode> getAllNodes() { return Collections.unmodifiableCollection(nodes.values()); }
Source:
<code>public void initColumnsWithTaskVarColumnsTest() { final ExtendedPagedTable<TaskSummary> currentListGrid = spy(new ExtendedPagedTable<>(new GridGlobalPreferences())); doAnswer(new Answer() { @Override public Void answer(InvocationOnMock invocationOnMock) throws Throwable { final List<ColumnMeta> columns = (List<ColumnMeta>) invocationOnMock.getArguments()[0]; <START> assertEquals(columns.size(), 18); <END> return null; } }).when(currentListGrid).addColumns(anyList()); ArrayList<GridColumnPreference> columnPreferences = new ArrayList<GridColumnPreference>(); columnPreferences.add(new GridColumnPreference("var1", 0, "40")); columnPreferences.add(new GridColumnPreference("var2", 1, "40")); columnPreferences.add(new GridColumnPreference("var3", 1, "40")); when(currentListGrid.getGridPreferencesStore()).thenReturn(gridPreferencesStore); when(gridPreferencesStore.getColumnPreferences()).thenReturn(columnPreferences); getView().initColumns(currentListGrid); verify(currentListGrid).addColumns(anyList()); }</code><technical_language>expected first</technical_language>

Target:
public void initColumnsWithTaskVarColumnsTest() { final ExtendedPagedTable<TaskSummary> currentListGrid = spy(new ExtendedPagedTable<>(new GridGlobalPreferences())); doAnswer(new Answer() { @Override public Void answer(InvocationOnMock invocationOnMock) throws Throwable { final List<ColumnMeta> columns = (List<ColumnMeta>) invocationOnMock.getArguments()[0]; assertEquals(18, columns.size()); return null; } }).when(currentListGrid).addColumns(anyList()); ArrayList<GridColumnPreference> columnPreferences = new ArrayList<GridColumnPreference>(); columnPreferences.add(new GridColumnPreference("var1", 0, "40")); columnPreferences.add(new GridColumnPreference("var2", 1, "40")); columnPreferences.add(new GridColumnPreference("var3", 1, "40")); when(currentListGrid.getGridPreferencesStore()).thenReturn(gridPreferencesStore); when(gridPreferencesStore.getColumnPreferences()).thenReturn(columnPreferences); getView().initColumns(currentListGrid); verify(currentListGrid).addColumns(anyList()); }
Source:
<code>private JSONArray buildMatchesJSONArray(final int fromIndex, final int toIndex) { Collections.sort(this.remoteMatches, new Comparator<RemotePatientSimilarityView>() { @Override public int compare(RemotePatientSimilarityView o1, RemotePatientSimilarityView o2) { double score1 = (Double) o1.getScore(); <START> double score2 = (Double) o2.getScore(); <END> return (int) Math.signum(score2 - score1); } }); final JSONArray matchesJson = new JSONArray(); for (int i = fromIndex; i <= toIndex; i++) { final JSONObject matchJson = this.remoteMatches.get(i).toJSON(); matchesJson.put(matchJson); } return matchesJson; }</code><technical_language>cast to/from Double? getScore returns a double, yes</technical_language>

Target:
private JSONArray buildMatchesJSONArray(final int fromIndex, final int toIndex) { Collections.sort(this.remoteMatches, new Comparator<RemotePatientSimilarityView>() { @Override public int compare(RemotePatientSimilarityView o1, RemotePatientSimilarityView o2) { double score1 = o1.getScore(); double score2 = o2.getScore(); return (int) Math.signum(score2 - score1); } }); final JSONArray matchesJson = new JSONArray(); for (int i = fromIndex; i <= toIndex; i++) { final JSONObject matchJson = this.remoteMatches.get(i).toJSON(); matchesJson.put(matchJson); } return matchesJson; }
Source:
<code><START> static void cleanupSingletonSessionId() { <END> File tempDir = new File(System.getProperty("java.io.tmpdir")); if (tempDir.exists()) { String[] jbpmSerFiles = tempDir.list(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.endsWith("-jbpmSessionId.ser"); } }); for (String file : jbpmSerFiles) { new File(tempDir, file).delete(); } } }</code><technical_language>This line</technical_language>

Target:
private static void cleanupSingletonSessionId() { File tempDir = new File(System.getProperty("java.io.tmpdir")); if (tempDir.exists()) { String[] jbpmSerFiles = tempDir.list(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.endsWith("-jbpmSessionId.ser"); } }); for (String file : jbpmSerFiles) { new File(tempDir, file).delete(); } } }}
Source:
<code>public void stop() { httpServer.removeContext(httpContext); serviceManager.stop(); if (cleaner != null) { try { cleaner.stopServer(); } catch (InterruptedException exp) { <START> System.err.println("Could not stop Jolokia server properly: " + exp); <END> } } }</code><technical_language>I wouldnt print stderr here, JolokiaServer is other directly, in circumstance running. Instead LogHandler muted, too. (Add a member variable log in init() for this)</technical_language>

Target:
public void stop() { httpServer.removeContext(httpContext); serviceManager.stop(); if (cleaner != null) { try { cleaner.stopServer(); } catch (InterruptedException exp) { logHandler.error("Could not stop Jolokia server properly: ", exp); } } }
Source:
<code>private static ClosableIterator<Tuple> doDistinct( final MongoDBQueryDescriptor queryDescriptor, final DBCollection collection) { <START> List distinctFieldValues = collection.distinct( queryDescriptor.getFieldName(), queryDescriptor.getCriteria() ); <END> MapTupleSnapshot snapshot = new MapTupleSnapshot( Collections.<String, Object>singletonMap( "n", distinctFieldValues ) ); return CollectionHelper.newClosableIterator( Collections.singletonList( new Tuple( snapshot, SnapshotType.UNKNOWN ) ) ); }</code><technical_language>I distinct method a ReadPreference option, check if sense pass argument returned tupleContext.getTupleTypeContext().getOptionsContext().getUnique( ReadPreferenceOption.class );</technical_language>

Target:
private static ClosableIterator<Tuple> doDistinct(final MongoDBQueryDescriptor queryDescriptor, final DBCollection collection) { DBCollectionDistinctOptions distinctOptions = new DBCollectionDistinctOptions().filter( queryDescriptor.getCriteria() ).collation( queryDescriptor.getCollation() ); List<?> distinctFieldValues = collection.distinct( queryDescriptor.getDistinctFieldName(), distinctOptions ); MapTupleSnapshot snapshot = new MapTupleSnapshot( Collections.<String, Object>singletonMap( "n", distinctFieldValues ) ); return CollectionHelper.newClosableIterator( Collections.singletonList( new Tuple( snapshot, SnapshotType.UNKNOWN ) ) ); }