auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void rendersBoutPage() throws Exception { final MkBase base = new MkBase(); final String urn = "urn:test:1"; final User user = base.user(new URN(urn)); user.aliases().add("jeff"); final Alias alias = user.aliases().iterate().iterator().next(); final Bout bout = alias.inbox().bout(alias.inbox().start()); bout.attachments().create("a1"); bout.messages().post("hello, world!"); bout.friends().invite(alias.name()); MatcherAssert.assertThat( XhtmlMatchers.xhtml( new RsPrint( new FkBout(TkIndexTest.REGEX, new TkIndex(base)).route( new RqWithHeader( new RqWithAuth( urn, new RqFake( RqMethod.GET, String.format("/b/%d", bout.number()) ) ), <START> HEADER_ACCEPT, <END> MIME_TEXT_XML ) ).get() ).printBody() ), XhtmlMatchers.hasXPaths( "/page/bout[number=1]", "/page/bout[title='untitled']", "/page/bout[unread=0]", "/page/bout/friends/friend[alias='jeff']", "/page/bout/friends/friend/links/link[@rel='photo']", "/page/bout/friends/friend/links/link[@rel='kick']", "/page/bout/attachments/attachment/links/link[@rel='delete']", "/page/bout/messages/message[text='hello, world!']" ) ); }</code><technical_language>@exper0 full path TkIndexTest.HEADER_ACCEPT</technical_language>

Target:
public void rendersBoutPage() throws Exception { final MkBase base = new MkBase(); final String urn = "urn:test:1"; final User user = base.user(new URN(urn)); user.aliases().add("jeff"); final Alias alias = user.aliases().iterate().iterator().next(); final Bout bout = alias.inbox().bout(alias.inbox().start()); bout.attachments().create("a1"); bout.messages().post("hello, world!"); bout.friends().invite(alias.name()); MatcherAssert.assertThat( XhtmlMatchers.xhtml( new RsPrint( new FkBout(TkIndexTest.REGEX, new TkIndex(base)).route( new RqWithAuth( urn, new RqFake( RqMethod.GET, String.format("/b/%d", bout.number()) ) ) ).get() ).printBody() ), XhtmlMatchers.hasXPaths( "/page/bout[number=1]", "/page/bout[title='untitled']", "/page/bout[unread=0]", "/page/bout/friends/friend[alias='jeff']", "/page/bout/friends/friend/links/link[@rel='photo']", "/page/bout/friends/friend/links/link[@rel='kick']", "/page/bout/attachments/attachment/links/link[@rel='delete']", "/page/bout/messages/message[text='hello, world!']" ) ); }
Source:
<code><START> private Integer getPrecedenceLevel(RouterErrorCode routerErrorCode) { <END> switch (routerErrorCode) { case BlobDeleted: return 0; case BlobExpired: return 1; case AmbryUnavailable: return 2; case UnexpectedInternalError: return 3; case OperationTimedOut: return 4; case BlobDoesNotExist: return 5; default: return Integer.MIN_VALUE; } }</code><technical_language>return int instead of Integer</technical_language>

Target:
private int getPrecedenceLevel(RouterErrorCode routerErrorCode) { switch (routerErrorCode) { case BlobDeleted: return 0; case BlobExpired: return 1; case AmbryUnavailable: return 2; case UnexpectedInternalError: return 3; case OperationTimedOut: return 4; case BlobDoesNotExist: return 5; default: return Integer.MIN_VALUE; } }
Source:
<code>public void doBeforeTest() throws Exception { assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_12); super.doBeforeTest(); resolveLineTagLocations(SOURCE_NAME, LINE_TAGS); <START> fSession = getGDBLaunch().getSession(); <END> Runnable runnable = new Runnable() { @Override public void run() { fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId()); Assert.assertTrue(fServicesTracker != null); fCommandControl = fServicesTracker.getService(IGDBControl.class); Assert.assertTrue(fCommandControl != null); fMultiRunControl = fServicesTracker.getService(IMultiRunControl.class); Assert.assertTrue(fMultiRunControl != null); fGdbSync = fServicesTracker.getService(IGDBSynchronizer.class); Assert.assertTrue(fGdbSync != null); IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class); Assert.assertTrue(procService != null); fSession.addServiceEventListener(ThreadStackFrameSyncTest.this, null); } }; fSession.getExecutor().submit(runnable).get(); }</code><technical_language>performing null checks, get assertion Assert.assertNotNull(fSession);</technical_language>

Target:
public void doBeforeTest() throws Exception { assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_12); super.doBeforeTest(); resolveLineTagLocations(SOURCE_NAME, LINE_TAGS); fSession = getGDBLaunch().getSession(); Assert.assertNotNull(fSession); Runnable runnable = new Runnable() { @Override public void run() { fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId()); Assert.assertTrue(fServicesTracker != null); fCommandControl = fServicesTracker.getService(IGDBControl.class); Assert.assertTrue(fCommandControl != null); fMultiRunControl = fServicesTracker.getService(IMultiRunControl.class); Assert.assertTrue(fMultiRunControl != null); fGdbSync = fServicesTracker.getService(IGDBSynchronizer.class); Assert.assertTrue(fGdbSync != null); IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class); Assert.assertTrue(procService != null); fSession.addServiceEventListener(ThreadStackFrameSyncTest.this, null); } }; fSession.getExecutor().submit(runnable).get(); }
Source:
<code>public void versionSampleRequest() { HttpRequest request = HttpRequest.builder() .method("POST") .endpoint("<LINK_0>") .addHeader("Host", "iam.amazonaws.com") .payload("Action=CoolVersionWordAction") .build(); request.getPayload().getContentMetadata().setContentType("application/x-www-form-urlencoded; charset=utf-8"); FormSignerV4 filter = new FormSignerV4(apiVersion, accessAndSecretKey, timestamp, serviceAndRegion); HttpRequest filtered = filter.filter(request); assertEquals(filtered.getFirstHeaderOrNull("X-Amz-Date"), timestamp.get()); <START> assertThat(filtered.getPayload().getRawContent().toString().contains("&Version=")); <END> }</code><technical_language>Assert parameter expected value, for completeness</technical_language>

Target:
public void versionSampleRequest() { HttpRequest request = HttpRequest.builder() .method("POST") .endpoint("<LINK_0>") .addHeader("Host", "iam.amazonaws.com") .payload("Action=CoolVersionWordAction") .build(); request.getPayload().getContentMetadata().setContentType("application/x-www-form-urlencoded; charset=utf-8"); FormSignerV4 filter = new FormSignerV4(apiVersion, accessAndSecretKey, timestamp, serviceAndRegion); HttpRequest filtered = filter.filter(request); assertEquals(filtered.getFirstHeaderOrNull("X-Amz-Date"), timestamp.get()); assertThat(filtered.getPayload().getRawContent().toString().contains("&Version=2010-05-08")); }
Source:
<code>public PlanNodeStatsEstimate calculateStats(PlanNode node, StatsProvider sourceStats, Lookup lookup, Session session, Map<Symbol, Type> types) { Iterator<Rule<?>> ruleIterator = getCandidates(node).iterator(); while (ruleIterator.hasNext()) { Rule<?> rule = ruleIterator.next(); <START> Optional<PlanNodeStatsEstimate> calculatedStats = calculatedStats(rule, node, sourceStats, lookup, session, types); <END> if (calculatedStats.isPresent()) { return calculatedStats.get(); } } return PlanNodeStatsEstimate.UNKNOWN_STATS; }</code><technical_language>@SuppressWarnings({"rawtypes", "unchecked"}) Optional<PlanNodeStatsEstimate> calculatedStats = ((Rule) rule).calculate(node, sourceStats, lookup, session, types);</technical_language>

Target:
public PlanNodeStatsEstimate calculateStats(PlanNode node, StatsProvider sourceStats, Lookup lookup, Session session, Map<Symbol, Type> types) { Iterator<Rule<?>> ruleIterator = getCandidates(node).iterator(); while (ruleIterator.hasNext()) { Rule<?> rule = ruleIterator.next(); Optional<PlanNodeStatsEstimate> calculatedStats = calculateStats(rule, node, sourceStats, lookup, session, types); if (calculatedStats.isPresent()) { return calculatedStats.get(); } } return PlanNodeStatsEstimate.UNKNOWN_STATS; }
Source:
<code>void checkGlobalOutcome(ManagementClient managementClient, String operation, boolean mustBeUP, String probeName) throws IOException { final ModelNode address = new ModelNode(); address.add("subsystem", "microprofile-health-smallrye"); ModelNode checkOp = getEmptyOperation(operation, address); <START> System.out.println("checkOp = " + checkOp); <END> ModelNode response = managementClient.getControllerClient().execute(checkOp); System.out.println("response = " + response); final String opOutcome = response.get("outcome").asString(); assertEquals("success", opOutcome); ModelNode result = response.get("result"); assertEquals(mustBeUP? "UP" : "DOWN", result.get("status").asString()); if (probeName != null) { for (ModelNode check : result.get("checks").asList()) { if (probeName.equals(check.get("name").asString())) { assertEquals(mustBeUP? "UP" : "DOWN", check.get("status").asString()); return; } } fail("Probe named " + probeName + " not found in " + result); } }</code><technical_language>org.jboss.logging.Logger instead of System.out printouts</technical_language>

Target:
void checkGlobalOutcome(ManagementClient managementClient, String operation, boolean mustBeUP, String probeName) throws IOException { final ModelNode address = new ModelNode(); address.add("subsystem", "microprofile-health-smallrye"); ModelNode checkOp = getEmptyOperation(operation, address); ModelNode response = managementClient.getControllerClient().execute(checkOp); final String opOutcome = response.get("outcome").asString(); assertEquals("success", opOutcome); ModelNode result = response.get("result"); assertEquals(mustBeUP? "UP" : "DOWN", result.get("status").asString()); if (probeName != null) { for (ModelNode check : result.get("checks").asList()) { if (probeName.equals(check.get("name").asString())) { assertEquals(mustBeUP? "UP" : "DOWN", check.get("status").asString()); return; } } fail("Probe named " + probeName + " not found in " + result); } }
Source:
<code>public void close() throws IOException { if (reader.ready()) { writeUntilEOF(); } reader.close(); writer.close(); Files.copy(temporaryPath, Paths.get(filePath), StandardCopyOption.REPLACE_EXISTING); <START> temporaryPath.toFile().delete(); <END> }</code><technical_language>do this copy + delete simply rename</technical_language>

Target:
public void close() throws IOException { if (reader.ready()) { writeUntilEOF(); } reader.close(); writer.close(); if (!temporaryPath.toFile().renameTo(filePath.toFile())) { throw new IOException("Fixed file could not be renamed. Original path = " + filePath.toAbsolutePath()); } temporaryPath.toFile().delete(); }
Source:
<code>public Builder onlyScaleDown() { <START> onlyScaleDown = true; <END> return this; }</code><technical_language>This needs throw exception is resize called</technical_language>

Target:
public Builder onlyScaleDown() { if (targetHeight == 0 && targetWidth == 0) { throw new IllegalStateException("onlyScaleDown can not be applied without resize"); } onlyScaleDown = true; return this; }
Source:
<code>public void visitToken(DetailAST detailAST) { final DetailAST objBlock = detailAST.findFirstToken(TokenTypes.OBJBLOCK); TokenUtil.forEachChild(objBlock, TokenTypes.COMMA, comma -> { final int type = comma.getNextSibling().getType(); <START> if (type != TokenTypes.VARIABLE_DEF && type != TokenTypes.ENUM_CONSTANT_DEF) { <END> log(comma, MSG_KEY); } }); }</code><technical_language>I understand a VARIABLE_DEF? in start of enum ENUM_CONSTANT_DEF? If hit a variable def, means end ; for list of enumerations</technical_language>

Target:
public void visitToken(DetailAST detailAST) { final DetailAST nextSibling = detailAST.getNextSibling(); if (nextSibling.getType() == TokenTypes.COMMA) { final DetailAST nextToNextSibling = nextSibling.getNextSibling(); if (nextToNextSibling.getType() != TokenTypes.ENUM_CONSTANT_DEF) { log(nextSibling, MSG_KEY); } } }
Source:
<code>private void updateTarget(SolGame game) { if (targetPilot == null) { return; } ObjectManager om = game.getObjectManager(); List<SolObject> objs = om.getObjects(); List<FarShip> farShips = om.getFarShips(); if (target != null) { if (objs.contains(target)) { return; } target = null; for (FarShip ship : farShips) { if (ship.getPilot() != targetPilot) { continue; } farTarget = ship; return; } applyAction(Action.MOVE); return; } if (farTarget == null) { <START> throw new AssertionError("Far target " + farTarget + " does not exist!"); <END> } if (om.getFarShips().contains(farTarget)) { return; } farTarget = null; for (SolObject o : objs) { if ((o instanceof SolShip)) { SolShip ship = (SolShip) o; if (ship.getPilot() != targetPilot) { continue; } target = ship; return; } } applyAction(Action.MOVE); }</code><technical_language>If farTarget is null, printing is work</technical_language>

Target:
private void updateTarget(SolGame game) { if (targetPilot == null) { return; } ObjectManager om = game.getObjectManager(); List<SolObject> objs = om.getObjects(); List<FarShip> farShips = om.getFarShips(); if (target != null) { if (objs.contains(target)) { return; } target = null; for (FarShip ship : farShips) { if (ship.getPilot() != targetPilot) { continue; } farTarget = ship; return; } applyAction(Action.MOVE); return; } if (farTarget == null) { throw new AssertionError("Far target is a null reference!"); } if (om.getFarShips().contains(farTarget)) { return; } farTarget = null; for (SolObject o : objs) { if ((o instanceof SolShip)) { SolShip ship = (SolShip) o; if (ship.getPilot() != targetPilot) { continue; } target = ship; return; } } applyAction(Action.MOVE); }
Source:
<code>public Subcategory getSubcategory() { <START> return subcategories.get(0); <END> }</code><technical_language>incompatible change: if subcategories return null, throwing null pointer</technical_language>

Target:
public Subcategory getSubcategory() { return subcategories.isEmpty() ? null : subcategories.get(0); }
Source:
<code>public FeedItemFilter(String[] properties) { this.mProperties = properties; Log.d("***xxx***", Arrays.toString(properties)); for (String property : properties) { <START> switch ("" + property) { <END> case "unplayed": showUnplayed = true; break; case "paused": showPaused = true; break; case "not_paused": showNotPaused = true; break; case "played": showPlayed = true; break; case "queued": showQueued = true; break; case "not_queued": showNotQueued = true; break; case "downloaded": showDownloaded = true; break; case "not_downloaded": showNotDownloaded = true; break; case "has_media": showHasMedia = true; break; case "no_media": showNoMedia = true; break; case "is_favorite": showIsFavorite = true; break; case "not_favorite": showNotFavorite = true; break; default: return; } } }</code><technical_language>is this needed</technical_language>

Target:
public FeedItemFilter(String[] properties) { this.mProperties = properties; for (String property : properties) { switch (property) { case "unplayed": showUnplayed = true; break; case "paused": showPaused = true; break; case "not_paused": showNotPaused = true; break; case "played": showPlayed = true; break; case "queued": showQueued = true; break; case "not_queued": showNotQueued = true; break; case "downloaded": showDownloaded = true; break; case "not_downloaded": showNotDownloaded = true; break; case "has_media": showHasMedia = true; break; case "no_media": showNoMedia = true; break; case "is_favorite": showIsFavorite = true; break; case "not_favorite": showNotFavorite = true; break; default: break; } } }
Source:
<code>public MetricDto insert(DbSession session, MetricDto dto) { <START> mapper(session).insert(validate(dto)); <END> return dto; }</code><technical_language>AFAIK, responsability of DAO validate dto. This in a higher layer, a XXXUpdater WS</technical_language>

Target:
public MetricDto insert(DbSession session, MetricDto dto) { mapper(session).insert(dto); return dto; }
Source:
<code>public AbstractScoreDirector clone() { <START> AbstractScoreDirector clone = (AbstractScoreDirector) scoreDirectorFactory.buildScoreDirector(); <END> setWorkingSolution(workingSolution.cloneSolution()); return clone; }</code><technical_language>need cast this class is generic: class AbstractScoreDirector<F extends AbstractScoreDirectorFactory></technical_language>

Target:
public ScoreDirector clone() { ScoreDirector clone = scoreDirectorFactory.buildScoreDirector(); clone.setWorkingSolution(workingSolution.cloneSolution()); return clone; }
Source:
<code>public <T extends Serializable> T computeIfAbsent(String originator, TaskId taskid, String channel, String key, String mappingFunction) throws InvalidChannelException, CompilationException, IOException { T answer; try { Channel<T> chosenChannel = getChannel(channel); answer = chosenChannel.computeIfAbsent(key, (Function<? super String, ? extends T>) evaluateClosure(mappingFunction, Function.class)); commitIfNeeded(channel); logWithContext(taskid, channel, "Run computeIfAbsent" + ON_KEY + QUOTE + key + QUOTE + RESULT_IS + answer, Level.DEBUG); } catch (InvalidChannelException | CompilationException | IOException e) { <START> throw e; <END> } catch (Exception e) { throw new ClosureEvaluationException(EXCEPTION_WHEN_EVALUATING_CLOSURE + StackTraceUtil.getStackTrace(e)); } return answer; }</code><technical_language>String::format easier</technical_language>

Target:
public Serializable computeIfAbsent(String originator, TaskId taskid, String channel, String key, String mappingFunction) throws InvalidChannelException, CompilationException, IOException { Serializable answer; try { Channel chosenChannel = getChannel(channel); answer = chosenChannel.computeIfAbsent(key, (Function<? super String, ? extends Serializable>) evaluateClosure(mappingFunction, Function.class)); logWithContextAndPersist(taskid, channel, "Run computeIfAbsent" + ON_KEY + QUOTE + key + QUOTE + RESULT_IS + answer, Level.DEBUG); } catch (InvalidChannelException | CompilationException | IOException e) { throw e; } catch (Exception e) { throw new ClosureEvaluationException(EXCEPTION_WHEN_EVALUATING_CLOSURE + StackTraceUtil.getStackTrace(e)); } return answer; }
Source:
<code>void scheduleFullSync(final Project.NameKey project, final String urlMatch) { if (!running) { log.warn("Replication plugin did not finish startup before event"); return; } <START> <END> for (Destination cfg : configs) { for (URIish uri : cfg.getURIs(project, urlMatch)) { cfg.schedule(project, PushOne.ALL_REFS, uri); } } }</code><technical_language>check for wouldPushProject here. Otherwise, try replicating projects for remotes want them. Fixed in Patch Set 10</technical_language>

Target:
void scheduleFullSync(final Project.NameKey project, final String urlMatch) { if (!running) { log.warn("Replication plugin did not finish startup before event"); return; } for (Destination cfg : configs) { if (cfg.wouldPushProject(project)) { for (URIish uri : cfg.getURIs(project, urlMatch)) { cfg.schedule(project, PushOne.ALL_REFS, uri); } } } }
Source:
<code>protected Node createLocalNode(String nodeName) { Node localNode = null; try { localNode = NodeFactory.createLocalNode(nodeName, false, null, nodeName + "vnname"); if (localNode == null) { logger.error(ExitStatus.RMNODE_NULL.description); System.exit(ExitStatus.RMNODE_NULL.exitCode); } <START> RMNodeStarter.addKeyPairForNode(localNode.getNodeInformation().getURL()); <END> for (Object key : System.getProperties().keySet()) { localNode.setProperty(key.toString(), System.getProperty(key.toString())); } } catch (Throwable t) { logger.error("Unable to create the local node " + nodeName, t); System.exit(ExitStatus.RMNODE_ADD_ERROR.exitCode); } return localNode; }</code><technical_language>do need RMNodeStarter prefix</technical_language>

Target:
protected Node createLocalNode(String nodeName) { Node localNode = null; try { localNode = NodeFactory.createLocalNode(nodeName, false, null, nodeName + "vnname"); if (localNode == null) { logger.error(ExitStatus.RMNODE_NULL.description); System.exit(ExitStatus.RMNODE_NULL.exitCode); } for (Object key : System.getProperties().keySet()) { localNode.setProperty(key.toString(), System.getProperty(key.toString())); } } catch (Throwable t) { logger.error("Unable to create the local node " + nodeName, t); System.exit(ExitStatus.RMNODE_ADD_ERROR.exitCode); } return localNode; }
Source:
<code>public View getView(int position, View convertView, ViewGroup parent) { int type = getItemViewType(position); if (convertView == null) { switch (type) { case SectionRow.ITEM: convertView = mInflater.inflate(R.layout.row_course_outline_list, null); break; case SectionRow.SECTION: convertView = mInflater.inflate(R.layout.row_section_header, null); break; } } final SectionRow row = this.getItem(position); switch (type) { case SectionRow.ITEM: IUnit unit = (IUnit)row.component; ImageView image = (ImageView) convertView.findViewById(R.id.vertical_type); image.setVisibility(View.INVISIBLE); <START> if ( "video".equalsIgnoreCase(unit.getCategory())){ <END> image.setVisibility(View.VISIBLE); image.setImageResource(R.drawable.unit_video); } else { image.setVisibility(View.VISIBLE); image.setImageResource(R.drawable.unit_html); } image = (ImageView) convertView.findViewById(R.id.bulk_download); image.setVisibility(View.INVISIBLE); if ( "video".equalsIgnoreCase(unit.getCategory())){ image.setVisibility(View.VISIBLE); } TextView view = (TextView) convertView.findViewById(R.id.chapter_name); view.setText(unit.getName()); convertView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { rowClicked(row); } }); break; case SectionRow.SECTION: IVertical vertical = (IVertical)row.component; ((TextView)convertView).setText(vertical.getName()); break; } return convertView; }</code><technical_language>worth a "categoryIsVideo" method somewhere, string around</technical_language>

Target:
public View getView(int position, View convertView, ViewGroup parent) { int type = getItemViewType(position); if (convertView == null) { switch (type) { case SectionRow.ITEM: convertView = mInflater.inflate(R.layout.row_course_outline_list, null); break; case SectionRow.SECTION: convertView = mInflater.inflate(R.layout.row_section_header, null); break; } } final SectionRow row = this.getItem(position); switch (type) { case SectionRow.ITEM: IUnit unit = (IUnit)row.component; ImageView image = (ImageView) convertView.findViewById(R.id.vertical_type); image.setVisibility(View.INVISIBLE); if ( "video".equals(unit.getCategory())){ image.setVisibility(View.VISIBLE); image.setImageResource(R.drawable.unit_video); } else { image.setVisibility(View.VISIBLE); image.setImageResource(R.drawable.unit_html); } image = (ImageView) convertView.findViewById(R.id.bulk_download); image.setVisibility(View.INVISIBLE); if ( "video".equals(unit.getCategory())){ image.setVisibility(View.VISIBLE); } TextView view = (TextView) convertView.findViewById(R.id.chapter_name); view.setText(unit.getName()); convertView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { rowClicked(row); } }); break; case SectionRow.SECTION: IVertical vertical = (IVertical)row.component; ((TextView)convertView).setText(vertical.getName()); break; } return convertView; }
Source:
<code>public Object visit(ASTLocalVariableDeclaration node, Object data) { super.visit(node, data); <START> ASTType type = node.getFirstChildOfType(ASTType.class); <END> if (type != null && type.isTypeInferred()) { ASTVariableInitializer initializer = node.getFirstDescendantOfType(ASTVariableInitializer.class); if (initializer != null && initializer.jjtGetChild(0) instanceof ASTExpression) { ASTExpression expression = (ASTExpression) initializer.jjtGetChild(0); type.setTypeDefinition(expression.getTypeDefinition()); populateVariableDeclaratorFromType(node); } } return data; }</code><technical_language>do node.getTypeNode(). a isTypeInferred ASTLocalVariableDeclaration is Type node. basic contract for VariableDeclaratorId: decl.isTypeInferred() implies decl.getTypeNode() == null</technical_language>

Target:
public Object visit(ASTLocalVariableDeclaration node, Object data) { super.visit(node, data); ASTType type = node.getTypeNode(); if (type == null) { ASTVariableInitializer initializer = node.getFirstDescendantOfType(ASTVariableInitializer.class); if (initializer != null && initializer.jjtGetChild(0) instanceof ASTExpression) { ASTExpression expression = (ASTExpression) initializer.jjtGetChild(0); populateVariableDeclaratorFromType(node, expression.getTypeDefinition()); } } return data; }
Source:
<code>public boolean isRecycleBinSkippingActivated() { Boolean isRecycleBinSkippingActivated = this.configurationSource.getProperty("isRecycleBinSkippingActivated", false); <START> return isRecycleBinSkippingActivated != null && isRecycleBinSkippingActivated; <END> }</code><technical_language>check for null a default</technical_language>

Target:
public boolean isRecycleBinSkippingActivated() { return this.configurationSource.getProperty("isRecycleBinSkippingActivated", false); }
Source:
<code>public void clear() { List<String> world_script_events = new ArrayList<String>(); Map<String, dObject> context = new HashMap<String, dObject>(); dPlayer player = null; if (dPlayer.matches(flagOwner)) player = dPlayer.valueOf(flagOwner); dNPC npc = null; if (dNPC.matches(flagOwner)) npc = dNPC.valueOf(flagOwner); String type; if (player != null) { type = "player"; world_script_events.add("player flag cleared"); world_script_events.add("player flag " + flagName + " cleared"); } else if (npc != null) { type = "npc"; world_script_events.add("npc flag cleared"); world_script_events.add("npc flag " + flagName + " cleared"); } else { type = "server"; world_script_events.add("server flag cleared"); world_script_events.add("server flag " + flagName + " cleared"); } context.put("owner", Element.valueOf(flagOwner)); context.put("name", Element.valueOf(flagName)); context.put("type", Element.valueOf(type)); context.put("old_value", value.size() > 1 ? new dList(denizen.getSaves().getStringList(flagPath)) : value.size() == 1 ? new Element(value.get(0).asString()): Element.valueOf("null")); world_script_events.add("flag cleared"); denizen.getSaves().set(flagPath, null); denizen.getSaves().set(flagPath + "-expiration", null); rebuild(); EventManager.doEvents(world_script_events, <START> npc, player != null ? player : null, context, 1); <END> }</code><technical_language>ummm. player != null ? player : null is player</technical_language>

Target:
public void clear() { List<String> world_script_events = new ArrayList<String>(); Map<String, dObject> context = new HashMap<String, dObject>(); dPlayer player = null; if (dPlayer.matches(flagOwner)) player = dPlayer.valueOf(flagOwner); dNPC npc = null; if (dNPC.matches(flagOwner)) npc = dNPC.valueOf(flagOwner); String type; if (player != null) { type = "player"; world_script_events.add("player flag cleared"); world_script_events.add("player flag " + flagName + " cleared"); } else if (npc != null) { type = "npc"; world_script_events.add("npc flag cleared"); world_script_events.add("npc flag " + flagName + " cleared"); } else { type = "server"; world_script_events.add("server flag cleared"); world_script_events.add("server flag " + flagName + " cleared"); } context.put("owner", Element.valueOf(flagOwner)); context.put("name", Element.valueOf(flagName)); context.put("type", Element.valueOf(type)); context.put("old_value", value.size() > 1 ? new dList(denizen.getSaves().getStringList(flagPath)) : value.size() == 1 ? new Element(value.get(0).asString()): Element.valueOf("null")); world_script_events.add("flag cleared"); denizen.getSaves().set(flagPath, null); denizen.getSaves().set(flagPath + "-expiration", null); rebuild(); EventManager.doEvents(world_script_events, npc, player, context, 1); }
Source:
<code><START> public XBee64BitAddress(byte[] address) { <END> this.address = address; }</code><technical_language>Throw a NullPointerException if address is null. byte array provided establish a concrete length a min/max length</technical_language>

Target:
public XBee64BitAddress(byte[] address) { if (address == null) throw new NullPointerException("Address cannot be null."); if (address.length > 8) throw new IllegalArgumentException("Address cannot contain more than 8 bytes."); this.address = address; }
Source:
<code>protected void configure() { <START> bind(DevfileSchemaValidator.class); <END> bind(DevfileService.class); DevfileBindings.addComponentProvisioners( binder(), EditorComponentProvisioner.class, PluginProvisioner.class); DevfileBindings.onWorkspaceApplierBinder( binder(), binder -> { binder.addBinding(EDITOR_COMPONENT_TYPE).to(EditorComponentToWorkspaceApplier.class); binder.addBinding(PLUGIN_COMPONENT_TYPE).to(PluginComponentToWorkspaceApplier.class); }); bind(DevfileToWorkspaceConfigConverter.class).to(DevfileConverter.class); DevfileBindings.onComponentIntegrityValidatorBinder( binder(), binder -> { binder.addBinding(PLUGIN_COMPONENT_TYPE).to(NoopComponentIntegrityValidator.class); binder.addBinding(EDITOR_COMPONENT_TYPE).to(NoopComponentIntegrityValidator.class); }); }</code><technical_language>related changes, this binding unneeded</technical_language>

Target:
protected void configure() { bind(DevfileService.class); DevfileBindings.addComponentProvisioners( binder(), EditorComponentProvisioner.class, PluginProvisioner.class); DevfileBindings.onWorkspaceApplierBinder( binder(), binder -> { binder.addBinding(EDITOR_COMPONENT_TYPE).to(EditorComponentToWorkspaceApplier.class); binder.addBinding(PLUGIN_COMPONENT_TYPE).to(PluginComponentToWorkspaceApplier.class); }); DevfileBindings.onComponentIntegrityValidatorBinder( binder(), binder -> { binder.addBinding(PLUGIN_COMPONENT_TYPE).to(NoopComponentIntegrityValidator.class); binder.addBinding(EDITOR_COMPONENT_TYPE).to(NoopComponentIntegrityValidator.class); }); }
Source:
<code>public void refresh() { if (tableViewer != null && !tableViewer.getTable().isDisposed()) { List<?> lastRefreshSelection = ((StructuredSelection) tableViewer.getSelection()).toList(); tableViewer.getTable().deselectAll(); tableViewer.setItemCount(contentProvider.getNumberOfElements()); tableViewer.refresh(); if (tableViewer.getTable().getItemCount() > 0) { if (!hasAlreadyBeenRefreshed) { hasAlreadyBeenRefreshed = true; <START> if (!getInitialElementSelections().isEmpty()) { <END> refreshWithLastSelection = true; if (!multi) { lastRefreshSelection = new ArrayList<>(asList(getInitialElementSelections().get(0))); } else { lastRefreshSelection = getInitialElementSelections(); } } } if (refreshWithLastSelection && lastRefreshSelection != null && lastRefreshSelection.size() > 0) { tableViewer.setSelection(new StructuredSelection(lastRefreshSelection)); } else { refreshWithLastSelection = true; tableViewer.getTable().setSelection(0); tableViewer.getTable().notifyListeners(SWT.Selection, new Event()); } } else { tableViewer.setSelection(StructuredSelection.EMPTY); } } scheduleProgressMessageRefresh(); }</code><technical_language>Please extract local variable here. empty lines helpful for reader: if want separate some logical block means need extract separated block a method</technical_language>

Target:
public void refresh() { if (tableViewer != null && !tableViewer.getTable().isDisposed()) { List<Object> lastRefreshSelection = ((StructuredSelection) tableViewer.getSelection()).toList(); tableViewer.getTable().deselectAll(); tableViewer.setItemCount(contentProvider.getNumberOfElements()); tableViewer.refresh(); if (tableViewer.getTable().getItemCount() > 0) { if (isShownForTheFirstTime) { isShownForTheFirstTime = false; lastRefreshSelection = prepareInitialSelection(lastRefreshSelection); } if (refreshWithLastSelection && lastRefreshSelection != null && lastRefreshSelection.size() > 0) { tableViewer.setSelection(new StructuredSelection(lastRefreshSelection)); } else { refreshWithLastSelection = true; tableViewer.getTable().setSelection(0); tableViewer.getTable().notifyListeners(SWT.Selection, new Event()); } } else { tableViewer.setSelection(StructuredSelection.EMPTY); } } scheduleProgressMessageRefresh(); }
Source:
<code>public static synchronized Injector getInjector() { if (injector == null) { <START> throw new RuntimeException("Injector has not been initialized yet"); <END> } return injector; }</code><technical_language>overwritten in merge - get tests running this change</technical_language>

Target:
public static synchronized Injector getInjector() { if (injector == null) { injector = Guice.createInjector(new ThucydidesModule()); } return injector; }
Source:
<code>void bindItem(ReadingListPage page) { this.page = page; getView().setItem(page); getView().setTitle(page.title()); getView().setDescription(StringUtils.capitalize(page.description())); getView().setImageUrl(page.thumbUrl()); getView().setSelected(page.selected()); getView().setActionIcon(R.drawable.ic_more_vert_white_24dp); getView().setActionTint(R.attr.material_theme_de_emphasised_color); getView().setActionHint(R.string.abc_action_menu_overflow_description); getView().setSecondaryActionIcon(page.saving() ? R.drawable.ic_download_in_progress : R.drawable.ic_download_circle_gray_24dp, !page.offline() || page.saving()); getView().setCircularProgressVisibility(page.downloadProgress() > 0 && page.downloadProgress() < MAX_PROGRESS); getView().setProgress(page.downloadProgress() == MAX_PROGRESS ? 0 : page.downloadProgress()); getView().setSecondaryActionHint(R.string.reading_list_article_make_offline); viewsGreyedOutHandler.update((page.offline() && !page.saving()) || DeviceUtil.isOnline(), ReadingListPage.toPageTitle(page), (shouldGreyedOut -> <START> getView().setViewsGreyedOut(shouldGreyedOut))); <END> }</code><technical_language>is a slight chance fragment destroyed this callback is reached. this protected isAdded() check</technical_language>

Target:
void bindItem(ReadingListPage page) { this.page = page; getView().setItem(page); getView().setTitle(page.title()); getView().setDescription(StringUtils.capitalize(page.description())); getView().setImageUrl(page.thumbUrl()); getView().setSelected(page.selected()); getView().setActionIcon(R.drawable.ic_more_vert_white_24dp); getView().setActionTint(R.attr.material_theme_de_emphasised_color); getView().setActionHint(R.string.abc_action_menu_overflow_description); getView().setSecondaryActionIcon(page.saving() ? R.drawable.ic_download_in_progress : R.drawable.ic_download_circle_gray_24dp, !page.offline() || page.saving()); getView().setCircularProgressVisibility(page.downloadProgress() > 0 && page.downloadProgress() < MAX_PROGRESS); getView().setProgress(page.downloadProgress() == MAX_PROGRESS ? 0 : page.downloadProgress()); getView().setSecondaryActionHint(R.string.reading_list_article_make_offline); PageExistsInCacheHandler.update((page.offline() && !page.saving()) || DeviceUtil.isOnline(), ReadingListPage.toPageTitle(page), (shouldGreyedOut -> { if (isAdded()) { getView().setViewsGreyedOut(shouldGreyedOut); } })); }
Source:
<code>private void compliant() { int i = 0; <START> while (i < 5) { <END> i++; } for (int j; j < 5;) { j++; } for (int j; j < 5; j++) { } for (;; i++) { } for (;;) { } }</code><technical_language>is purpose of testing a while loop? :)</technical_language>

Target:
private void compliant() { int i = 0; for (int j; j < 5;) { j++; } for (int j; j < 5; j++) { } for (;; i++) { } for (;;) { } }
Source:
<code>public void paint(@NotNull Inlay inlay, @NotNull Graphics g, @NotNull Rectangle targetRegion, @NotNull TextAttributes textAttributes) { g.setColor(selected ? SELECTED_BACKGROUND_JB_COLOR : BACKGROUND_JB_COLOR); <START> g.fillRoundRect(targetRegion.x, targetRegion.y + VERTICAL_PADDING, targetRegion.width - RIGHT_MARGIN, targetRegion.height - 2 * VERTICAL_PADDING, 2, 2); <END> FontInfo fontInfo = getFontInfo(inlay.getEditor()); g.setFont(fontInfo.getFont()); g.setColor(INDEX_JB_COLOR); g.drawString(index, targetRegion.x + HORIZONTAL_PADDING, targetRegion.y + fontInfo.fontMetrics().getAscent() + 1); }</code><technical_language>I rounded corners rendered correctly bottom. I push a fix for this</technical_language>

Target:
public void paint(@NotNull Inlay inlay, @NotNull Graphics g, @NotNull Rectangle targetRegion, @NotNull TextAttributes textAttributes) { GraphicsUtil.setupRoundedBorderAntialiasing(g); g.setColor(selected ? SELECTED_BACKGROUND_JB_COLOR : BACKGROUND_JB_COLOR); g.fillRoundRect( targetRegion.x + HORIZONTAL_MARGIN, targetRegion.y + VERTICAL_PADDING, targetRegion.width - 2 * HORIZONTAL_MARGIN, targetRegion.height - 2 * VERTICAL_PADDING, ARC_RADIUS, ARC_RADIUS ); FontInfo fontInfo = getFontInfo(inlay.getEditor()); g.setFont(fontInfo.getFont()); g.setColor(selected ? SELECTED_INDEX_JB_COLOR : INDEX_JB_COLOR); g.drawString(index, targetRegion.x + HORIZONTAL_PADDING + HORIZONTAL_MARGIN, targetRegion.y + fontInfo.fontMetrics().getAscent() + 2); }
Source:
<code>private static VmBalloonInfo getBalloonInfo(Map<String, Object> xmlRpcStruct) { Map<String, Object> balloonInfo = (Map<String, Object>) xmlRpcStruct.get(VdsProperties.vm_balloonInfo); VmBalloonInfo vmBalloonInfo = new VmBalloonInfo(); if (balloonInfo != null && balloonInfo.size() > 0) { vmBalloonInfo.setCurrentMemory(AssignLongValue(balloonInfo, VdsProperties.vm_balloon_cur)); vmBalloonInfo.setBalloonMaxMemory(AssignLongValue(balloonInfo, VdsProperties.vm_balloon_max)); <START> vmBalloonInfo.setBalloonTargetMemory(AssignLongValue(balloonInfo, VdsProperties.vm_balloon_target)); <END> vmBalloonInfo.setBalloonMinMemory(AssignLongValue(balloonInfo, VdsProperties.vm_balloon_min)); } else { vmBalloonInfo.setBalloonDeviceEnabled(false); } return vmBalloonInfo; }</code><technical_language>New engine work older vdsm well. Please check this provide NPE if curr max</technical_language>

Target:
private static VmBalloonInfo getBalloonInfo(Map<String, Object> xmlRpcStruct) { Map<String, Object> balloonInfo = (Map<String, Object>) xmlRpcStruct.get(VdsProperties.vm_balloonInfo); VmBalloonInfo vmBalloonInfo = new VmBalloonInfo(); if (balloonInfo != null && balloonInfo.size() > 0) { vmBalloonInfo.setCurrentMemory(AssignLongValue(balloonInfo, VdsProperties.vm_balloon_cur)); vmBalloonInfo.setBalloonMaxMemory(AssignLongValue(balloonInfo, VdsProperties.vm_balloon_max)); vmBalloonInfo.setBalloonTargetMemory(AssignLongValue(balloonInfo, VdsProperties.vm_balloon_target)); vmBalloonInfo.setBalloonMinMemory(AssignLongValue(balloonInfo, VdsProperties.vm_balloon_min)); if (balloonInfo.size() >= 4) { vmBalloonInfo.setBalloonDeviceEnabled(true); } } else { vmBalloonInfo.setBalloonDeviceEnabled(false); } return vmBalloonInfo; }
Source:
<code>public void notifiedKey(K key) { PrimitiveIterator.OfInt iter = justCompletedSegments; if (iter != null) { <START> iter.forEachRemaining(completeSegment); <END> } justCompletedSegments = null; }</code><technical_language>IMO if iterator instance, a regular while (iter.hasNext()) loop for inlining for memory (metaspace) usage</technical_language>

Target:
public void notifiedKey(K key) { PrimitiveIterator.OfInt iter = justCompletedSegments; if (iter != null) { while (iter.hasNext()) { completeSegment(iter.nextInt()); } } justCompletedSegments = null; }
Source:
<code>public void put(String path, URIStatus status) { try { CachedItem item = mCache.get(path, new Callable<CachedItem>() { @Override public CachedItem call() throws Exception { return new CachedItem(); } <START> }); <END> item.setStatus(status); } catch (Exception e) { e.printStackTrace(); } }</code><technical_language>lambda syntax here? () -> new CachedItem()); edit: simply CachedItem::new</technical_language>

Target:
public void put(String path, URIStatus status) { try { CachedItem item = mCache.get(path, () -> new CachedItem()); item.setStatus(status); } catch (ExecutionException e) { LOG.warn("Failed to cache meta data for path {}", path); } }
Source:
<code>public final String getId() { <START> return "main"; <END> }</code><technical_language>Ha a simpler constant! I "" is fine too</technical_language>

Target:
public final String getId() { return UNIQUE_DESCRIPTOR_ID; }
Source:
<code>public void testSingleRecord() throws IOException { final String testId = "testSingleRecord"; final int recordCount = 1; final int taskRunInterval = 10; final int deferredWriteDelay = 50; final IMonitoringController controller = this.createController(testId, taskRunInterval, deferredWriteDelay); for (int recordIndex = 0; recordIndex < recordCount; recordIndex++) { final OperationExecutionRecord record = new OperationExecutionRecord("op()", "SESS-ID", 0, recordIndex, recordIndex, "host", recordIndex, 1); controller.newMonitoringRecord(record); } try { controller.terminateMonitoring(); controller.waitForTermination(2000); <START> } catch (InterruptedException e) { <END> Assert.fail(e.getMessage()); } final byte[] data = TestRawDataStorage.getInstance().getData(testId); final ByteBuffer dataBuffer = ByteBuffer.wrap(data); dataBuffer.position(data.length - 4); final int stringTableOffset = dataBuffer.getInt() + 8; dataBuffer.position(stringTableOffset); final int numberOfStrings = VariableLengthEncoding.decodeInt(dataBuffer); Assert.assertEquals(9, numberOfStrings); }</code><technical_language>do catch this exception? propagated upwards</technical_language>

Target:
public void testSingleRecord() throws IOException, InterruptedException { final String testId = "testSingleRecord"; final int recordCount = 1; final int taskRunInterval = 10; final int deferredWriteDelay = 50; final IMonitoringController controller = this.createController(testId, taskRunInterval, deferredWriteDelay); for (int recordIndex = 0; recordIndex < recordCount; recordIndex++) { final OperationExecutionRecord record = new OperationExecutionRecord("op()", "SESS-ID", 0, recordIndex, recordIndex, "host", recordIndex, 1); controller.newMonitoringRecord(record); } controller.terminateMonitoring(); controller.waitForTermination(2000); final byte[] data = TestRawDataStorage.getInstance().getData(testId); final ByteBuffer dataBuffer = ByteBuffer.wrap(data); dataBuffer.position(data.length - 4); final int stringTableOffset = dataBuffer.getInt() + 8; dataBuffer.position(stringTableOffset); final int numberOfStrings = VariableLengthEncoding.decodeInt(dataBuffer); Assert.assertEquals(9, numberOfStrings); }
Source:
<code>public AuditLogBuilder causedByCurrentUser() { UserInfo user = UserContext.getCurrentUser(); <START> return causedByUser(user.getUserId(), user.getUserName()).forTenant(user.getTenantId(), <END> user.getTenantName()); }</code><technical_language>this overwrite tenant set in forcurrentuser? this wrong tenant tenant of user log for</technical_language>

Target:
public AuditLogBuilder causedByCurrentUser() { UserInfo user = UserContext.getCurrentUser(); return causedByUser(user.getUserId(), user.getUserName()); }
Source:
<code>private void submitSearch(@Nullable final String query, boolean delayed) { if (delayed) { mHandler.postDelayed(new Runnable() { @Override public void run() { if (StringUtils.equals(query, getSearchQuery())) { <START> submitSearch(query, false); <END> } } }, 250); } else { clearSearchResults(); if (shouldSearch()) { fetchPlugins(PluginListType.SEARCH, false); } else { mSearchPluginsListStatus.setValue(PluginListStatus.DONE); } } }</code><technical_language>submitSearch protected package-private avoid creating synthetic accessor methods</technical_language>

Target:
protected void submitSearch(@Nullable final String query, boolean delayed) { if (delayed) { mHandler.postDelayed(new Runnable() { @Override public void run() { if (StringUtils.equals(query, getSearchQuery())) { submitSearch(query, false); } } }, 250); } else { clearSearchResults(); if (shouldSearch()) { fetchPlugins(PluginListType.SEARCH, false); } else { mSearchPluginsListStatus.setValue(PluginListStatus.DONE); } } }
Source:
<code>public void setInetAddress(String addrString) { try { this.address = InetAddress.getByName(addrString); } catch (UnknownHostException e) { <START> <END> } }</code><technical_language>a good spot for warn log entry, of this.address remain unchanged exception</technical_language>

Target:
public void setInetAddress(String addrString) { try { this.address = InetAddress.getByName(addrString); } catch (UnknownHostException e) { this.address = null; logger.warn("could not set address from {}", addrString); } }
Source:
<code>boolean setResourceStatus(JID fullJid, ContactStatus status, boolean sarosSupport) { ContactStatus oldStatus = getStatus(); boolean oldSarosSupport = hasSarosSupport(); <START> resources.stream().filter(r -> compareRawJid(r.fullJid, fullJid)).map(resources::remove); <END> resources.add(new Resource(fullJid, status, sarosSupport)); updateBestResource(); if (oldSarosSupport != hasSarosSupport()) return true; return !getStatus().equals(oldStatus); }</code><technical_language>removing element a collection a stream operation work this lead ConcurrentModificationExceptions? removeIf() instead? Also, new logic removes matching entries while logic removed entry. this a difference is match</technical_language>

Target:
boolean setResourceStatus(JID fullJid, ContactStatus status, boolean sarosSupport) { ContactStatus oldStatus = getStatus(); boolean oldSarosSupport = hasSarosSupport(); resources.removeIf(r -> compareRawJid(r.fullJid, fullJid)); resources.add(new Resource(fullJid, status, sarosSupport)); updateBestResource(); if (oldSarosSupport != hasSarosSupport()) return true; return !getStatus().equals(oldStatus); }
Source:
<code>public void testGetstorage_domain_by_type_for_storagePoolId() { <START> StorageDomain result = dao.getStorageDomainByTypeAndPool(Guid.createGuidFromString("6d849ebf-755f-4552-ad09-9a090cda105d"), StorageDomainType.Master); <END> assertNotNull(result); assertGetResult(result); }</code><technical_language>new Guid(String) - this literal null</technical_language>

Target:
public void testGetstorage_domain_by_type_for_storagePoolId() { StorageDomain result = dao.getStorageDomainByTypeAndPool(new Guid("6d849ebf-755f-4552-ad09-9a090cda105d"), StorageDomainType.Master); assertNotNull(result); assertGetResult(result); }
Source:
<code>public int getMaximumSize() { <START> return 1; <END> }</code><technical_language>this 8? size of a char</technical_language>

Target:
public int getMaximumSize() { return 8; }
Source:
<code>public void testProhibitRenameOverExistingNode() throws Exception { final String NOTE = "Rename node to name of another node should fail."; Node nodeA = j.createSlave("nodeA", null, null); Node nodeB = j.createSlave("nodeB", null, null); WebClient wc = j.createWebClient(); HtmlForm form = wc.getPage(nodeB, "configure").getFormByName("config"); form.getInputByName("_.name").setValueAttribute("nodeA"); try { j.submit(form); fail(NOTE); } catch (FailingHttpStatusCodeException e) { <START> assertThat(NOTE, e.getStatusCode(), equalTo(400)); <END> } }</code><technical_language>sense check error message. operation fails due this issue</technical_language>

Target:
public void testProhibitRenameOverExistingNode() throws Exception { final String NOTE = "Rename node to name of another node should fail."; Node nodeA = j.createSlave("nodeA", null, null); Node nodeB = j.createSlave("nodeB", null, null); WebClient wc = j.createWebClient(); HtmlForm form = wc.getPage(nodeB, "configure").getFormByName("config"); form.getInputByName("_.name").setValueAttribute("nodeA"); try { j.submit(form); fail(NOTE); } catch (FailingHttpStatusCodeException e) { assertThat(NOTE, e.getStatusCode(), equalTo(400)); assertThat(NOTE, e.getResponse().getContentAsString(), containsString("Slave called ‘nodeA’ already exists")); } }