auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private String tryAppendTrailingDocumentation(String documentation) { while (pos < data.length) { char c = data[pos]; if (c == ' ' || c == '\t') { pos++; } else if (c == '/') { pos++; break; } else { <START> pos--; <END> return documentation; } } if (pos == data.length || data[pos] != '/') { throw unexpected("expected '/'"); } pos++; if (pos < data.length && data[pos] == ' ') { pos++; } int start = pos; while (pos < data.length) { char c = data[pos++]; if (c == '\n') { newline(); break; } } if (start == pos - 1) { return documentation; } String trailingDocumentation = new String(data, start, pos - 1 - start); if (documentation.isEmpty()) { return trailingDocumentation; } return documentation + "\n" + trailingDocumentation; }</code><technical_language>I this is necessary. increment pos decrementing it</technical_language>

Target:
private String tryAppendTrailingDocumentation(String documentation) { while (pos < data.length) { char c = data[pos]; if (c == ' ' || c == '\t') { pos++; } else if (c == '/') { pos++; break; } else { return documentation; } } if (pos == data.length || data[pos] != '/') { throw unexpected("expected '/'"); } pos++; if (pos < data.length && data[pos] == ' ') { pos++; } int start = pos; while (pos < data.length) { char c = data[pos++]; if (c == '\n') { newline(); break; } } String trailingDocumentation = new String(data, start, pos - 1 - start); if (documentation.isEmpty()) { return trailingDocumentation; } return documentation + '\n' + trailingDocumentation; }
Source:
<code>public void updateAndRetrieveEmail() throws Exception { final MkBase base = new MkBase(); final User user = NbRule.get(); final Alias alias = user.aliases().iterate().iterator().next(); final String verified; <START> if (alias.email().contains("!")) { <END> verified = alias.email().substring(0, alias.email().indexOf('!')); } else { verified = alias.email(); } final String unverified = base.randomAlias().email(); alias.email(unverified); MatcherAssert.assertThat( alias.email(), Matchers.is(String.format("%s!%s", verified, unverified)) ); }</code><technical_language>@CarlosGines extract alias.email() a final variable improve readibility</technical_language>

Target:
public void updateAndRetrieveEmail() throws Exception { final MkBase base = new MkBase(); final User user = NbRule.get(); final Alias alias = user.aliases().iterate().iterator().next(); final String email = base.randomAlias().email(); alias.email(email); MatcherAssert.assertThat(alias.email(), Matchers.is(email)); }
Source:
<code>public Resource getConfigurationResource() throws IOException { <START> return null; <END> }</code><technical_language>@ivanursul, I this was... idea is able import a strongbox.xml if is path, parameter. If is (and is configuration in OrientDB), load classpath (available in strongbox-storage-api-resources artifact)</technical_language>

Target:
public Resource getConfigurationResource() throws IOException { return configurationResourceResolver.getConfigurationResource("repository.config.xml", "etc/conf/strongbox.xml"); }
Source:
<code>public BlockPos getPosition() { <START> return new BlockPos(0, 0, 0); <END> }</code><technical_language>BlockPos.ORIGIN</technical_language>

Target:
public BlockPos getPosition() { return BlockPos.ORIGIN; }
Source:
<code>public String toString() { <START> return parsedPath.toString(); <END> }</code><technical_language>This throw NullPointerException if parsedPath is null. do: return toStringHelper(this) .add("rawPath", rawPath) .add("parsedPath", parsedPath != null ? Iterables.toString(parsedPath) : null) .toString();</technical_language>

Target:
public String toString() { return Joiner.on(", ").join(getParsedPath()); }
Source:
<code>public boolean canHandle(Object object) { <START> return ResourceAttachmentChangeMergeViewerItem.class.isInstance(object); <END> }</code><technical_language>Please object instanceof ResourceAtt..</technical_language>

Target:
public boolean canHandle(Object object) { return object instanceof ResourceAttachmentChangeMergeViewerItem; }
Source:
<code>public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { final HttpServletRequest httpRequest = (HttpServletRequest) request; final String token = tokenExtractor.getToken(httpRequest); if (isNullOrEmpty(token)) { chain.doFilter(request, response); return; } try { HttpSession session = ((HttpServletRequest) request).getSession(true); Subject sessionSubject = (Subject) session.getAttribute("che_subject"); if (sessionSubject == null || !sessionSubject.getToken().equals(token)) { try { sessionSubject = extractSubject(token); session.setAttribute("che_subject", sessionSubject); } catch (NotFoundException e) { sendErr( response, SC_UNAUTHORIZED, "Authentication with machine token failed because user for this token no longer exist."); return; } } try { EnvironmentContext.getCurrent().setSubject(sessionSubject); chain.doFilter(addUserInRequest(httpRequest, sessionSubject), response); } finally { EnvironmentContext.reset(); } } catch (NotMachineTokenJwtException ex) { chain.doFilter(request, response); } catch (ServerException | JwtException e) { <START> LOG.error(e.getMessage(), e); <END> sendErr( response, SC_UNAUTHORIZED, format("Authentication with machine token failed cause: %s", e.getMessage())); } }</code><technical_language>this logging removed</technical_language>

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { final HttpServletRequest httpRequest = (HttpServletRequest) request; final String token = tokenExtractor.getToken(httpRequest); if (isNullOrEmpty(token)) { chain.doFilter(request, response); return; } try { HttpSession session = ((HttpServletRequest) request).getSession(true); Subject sessionSubject = (Subject) session.getAttribute("che_subject"); if (sessionSubject == null || !sessionSubject.getToken().equals(token)) { try { sessionSubject = extractSubject(token); session.setAttribute("che_subject", sessionSubject); } catch (NotFoundException e) { sendErr( response, SC_UNAUTHORIZED, "Authentication with machine token failed because user for this token no longer exist."); return; } } try { EnvironmentContext.getCurrent().setSubject(sessionSubject); chain.doFilter(addUserInRequest(httpRequest, sessionSubject), response); } finally { EnvironmentContext.reset(); } } catch (NotMachineTokenJwtException ex) { chain.doFilter(request, response); } catch (ServerException | JwtException e) { sendErr( response, SC_UNAUTHORIZED, format("Authentication with machine token failed cause: %s", e.getMessage())); } }
Source:
<code>public static OfflinePlayer deserialize(Map<String, Object> val) { if (val.get("name") != null) { return Bukkit.getServer().getOfflinePlayer(val.get("name").toString()); } else { <START> return Bukkit.getServer().getOfflinePlayer(UUID.fromString(val.get("uuid").toString())); <END> } }</code><technical_language>This is a breaking change work</technical_language>

Target:
public static OfflinePlayer deserialize(Map<String, Object> val) { if (val.get("name") != null) { return Bukkit.getServer().getOfflinePlayer(val.get("name").toString()); } else { return Bukkit.getServer().getOfflinePlayer(UUID.fromString(val.get("UUID").toString())); } }
Source:
<code>public static void deleteTagsForId(Context context, String record) { SQLiteDatabase db = getDatabase(context); <START> db.delete("tags", "record = '"+record+"'", null); <END> db.close(); }</code><technical_language><LINK_0> spaces +</technical_language>

Target:
public static void deleteTagsForId(Context context, String record) { SQLiteDatabase db = getDatabase(context); db.delete("tags", "record = ?", new String[] {record}); db.close(); }
Source:
<code>public KuduEndpoint(String uri, KuduComponent component) { super(uri, component); this.setUri(uri); this.setEndpointUri(uri); <START> Pattern p = Pattern.compile("^(\\S+)\\:(\\d+)\\/(\\S+)$"); <END> Matcher m = p.matcher(uri); if (!m.matches()) { throw new RuntimeException("Unrecognizable url: " + uri); } this.setHost(m.group(1)); this.setPort(m.group(2)); this.setTableName(m.group(3)); }</code><technical_language>@Delawen I missed that, is perfectly fine view. add @UriPath annotations host, port tableName Camel generate correct metadata for docs</technical_language>

Target:
public KuduEndpoint(String uri, KuduComponent component) { super(uri, component); Pattern p = Pattern.compile("^(\\S+)\\:(\\d+)\\/(\\S+)$"); Matcher m = p.matcher(uri); if (!m.matches()) { throw new RuntimeException("Unrecognizable url: " + uri); } this.setHost(m.group(1)); this.setPort(m.group(2)); this.setTableName(m.group(3)); }
Source:
<code><START> public CosmosClientException setRequestTimeline(RequestTimeline requestTimeline) { <END> this.requestTimeline = requestTimeline; return this; }</code><technical_language>setter public. if setter needed for internal implementation similar CosmosClientException::setCosmosResponseDiagnostics(.)</technical_language>

Target:
CosmosClientException setRequestTimeline(RequestTimeline requestTimeline) { this.requestTimeline = requestTimeline; return this; }
Source:
<code>public void requestStop() { try { this.server.stop(); } catch (Exception e) { e.printStackTrace(); <START> } <END> }</code><technical_language>swallow exceptions here; requestStop() throw Exception (we catch in maxwellContext.shutdown)</technical_language>

Target:
public void requestStop() throws Exception { this.server.stop(); }
Source:
<code>public void setConfigAttributes(Object attributes) { Map attributeMap = (Map) attributes; if (attributeMap.containsKey(TYPE)) { type = (String) attributeMap.get(TYPE); } <START> if (type.equals(Approval.MANUAL) && attributeMap.containsKey("allowOnlyOnSuccess")) { <END> this.allowOnlyOnSuccess = attributeMap.get("allowOnlyOnSuccess").equals("1"); } }</code><technical_language>odd, I feel allow this flag manual automatic stages</technical_language>

Target:
public void setConfigAttributes(Object attributes) { Map attributeMap = (Map) attributes; if (attributeMap.containsKey(TYPE)) { type = (String) attributeMap.get(TYPE); } if (attributeMap.containsKey("allowOnlyOnSuccess")) { this.allowOnlyOnSuccess = attributeMap.get("allowOnlyOnSuccess").equals("true"); } }
Source:
<code>public Response remove() { get(); <START> return performAction(VdcActionType.RemoveMacPool, new RemoveMacPoolByIdParameters(asGuid(id))); <END> }</code><technical_language>Consider "guid" instead of "asGuid(id)", conversion less</technical_language>

Target:
public Response remove() { get(); return performAction(VdcActionType.RemoveMacPool, new RemoveMacPoolByIdParameters(guid)); }
Source:
<code>public void recordScheduleCreate(ScheduleRequest scheduleRequest) { Assert.notNull(scheduleRequest, "scheduleRequest must not be null"); Assert.hasText(scheduleRequest.getScheduleName(), "The scheduleName of the scheduleRequest must not be null or empty"); <START> Assert.notNull(scheduleRequest.getDefinition(), "The appDefinition of the scheduleRequest must not be null"); <END> final Map<String, Object> auditedData = new HashMap<>(3); auditedData.put(TASK_DEFINITION_NAME, scheduleRequest.getDefinition().getName()); if (scheduleRequest.getDefinition().getProperties() != null) { auditedData.put(TASK_DEFINITION_PROPERTIES, argumentSanitizer.sanitizeProperties(scheduleRequest.getDefinition().getProperties())); } if (scheduleRequest.getDeploymentProperties() != null) { auditedData.put(DEPLOYMENT_PROPERTIES, argumentSanitizer.sanitizeProperties(scheduleRequest.getDeploymentProperties())); } if (scheduleRequest.getCommandlineArguments() != null) { auditedData.put(COMMANDLINE_ARGUMENTS, argumentSanitizer.sanitizeArguments(scheduleRequest.getCommandlineArguments())); } this.populateAndSaveAuditRecordUsingMapData(AuditOperationType.SCHEDULE, AuditActionType.CREATE, scheduleRequest.getScheduleName(), auditedData); }</code><technical_language>say, taskDefinition instead of appDefinition</technical_language>

Target:
public void recordScheduleCreate(ScheduleRequest scheduleRequest) { Assert.notNull(scheduleRequest, "scheduleRequest must not be null"); Assert.hasText(scheduleRequest.getScheduleName(), "The scheduleName of the scheduleRequest must not be null or empty"); Assert.notNull(scheduleRequest.getDefinition(), "The task definition of the scheduleRequest must not be null"); final Map<String, Object> auditedData = new HashMap<>(3); auditedData.put(TASK_DEFINITION_NAME, scheduleRequest.getDefinition().getName()); if (scheduleRequest.getDefinition().getProperties() != null) { auditedData.put(TASK_DEFINITION_PROPERTIES, argumentSanitizer.sanitizeProperties(scheduleRequest.getDefinition().getProperties())); } if (scheduleRequest.getDeploymentProperties() != null) { auditedData.put(DEPLOYMENT_PROPERTIES, argumentSanitizer.sanitizeProperties(scheduleRequest.getDeploymentProperties())); } if (scheduleRequest.getCommandlineArguments() != null) { auditedData.put(COMMANDLINE_ARGUMENTS, argumentSanitizer.sanitizeArguments(scheduleRequest.getCommandlineArguments())); } this.populateAndSaveAuditRecordUsingMapData(AuditOperationType.SCHEDULE, AuditActionType.CREATE, scheduleRequest.getScheduleName(), auditedData); }
Source:
<code>private boolean checkMinCardinality(Context context, Item item, Relationship relationship, Integer minCardinality, boolean isLeft) throws SQLException { List<Relationship> list = this.findByItemAndRelationshipType(context, item, relationship.getRelationshipType(), <START> -1, -1, isLeft); <END> if (minCardinality != null && !(list.size() > minCardinality)) { return false; } return true; }</code><technical_language>do change call here? calls equal previous is shorter, I missing something</technical_language>

Target:
private boolean checkMinCardinality(Context context, Item item, Relationship relationship, Integer minCardinality, boolean isLeft) throws SQLException { List<Relationship> list = this.findByItemAndRelationshipType(context, item, relationship.getRelationshipType(), isLeft, -1, -1); if (minCardinality != null && !(list.size() > minCardinality)) { return false; } return true; }
Source:
<code>public Constraint baseConstraint(ProgramState state) { final Constraint leftConstraint = state.getConstraint(leftOperand); final Constraint rightConstraint = state.getConstraint(rightOperand); if (leftConstraint.isIncompatibleWith(rightConstraint)) { if (kind == Kind.STRICT_EQUAL_TO) { return Constraint.FALSE; } if (kind == Kind.STRICT_NOT_EQUAL_TO) { return Constraint.TRUE; } } if (isExactValueConstraint(leftConstraint) && isExactValueConstraint(rightConstraint)) { <START> Constraint exactValueConstraint = resolveExactValueEqualityConstraint(leftConstraint, rightConstraint); <END> if (exactValueConstraint != null) { return exactValueConstraint; } } return super.baseConstraint(state); }</code><technical_language>@inverno rename exactValueConstraint exactValueEqualityConstraint</technical_language>

Target:
public Constraint baseConstraint(ProgramState state) { final Constraint leftConstraint = state.getConstraint(leftOperand); final Constraint rightConstraint = state.getConstraint(rightOperand); if (leftConstraint.isIncompatibleWith(rightConstraint)) { if (kind == Kind.STRICT_EQUAL_TO) { return Constraint.FALSE; } if (kind == Kind.STRICT_NOT_EQUAL_TO) { return Constraint.TRUE; } } Constraint singleValueEqualityConstraint = resolveSingleValueEqualityConstraint(leftConstraint, rightConstraint); if (singleValueEqualityConstraint != null) { return singleValueEqualityConstraint; } return super.baseConstraint(state); }
Source:
<code>public boolean equals(Object obj) { if (obj == this) { return true; } if (obj == null) { return false; } <START> if (!(obj instanceof BaseEntity)) { <END> return false; } if (getId() == null) { return super.equals(obj); } BaseEntity other = (BaseEntity) obj; return getId().equals(other.getId()); }</code><technical_language>@timler I do a class comparison getClass() instead of "instance of" check subclasses considered equal e.g. a Donor a Donation id</technical_language>

Target:
public boolean equals(Object obj) { if (obj == this) { return true; } if (obj == null) { return false; } if (!(obj.getClass().equals(getClass()))) { return false; } if (getId() == null) { return super.equals(obj); } BaseEntity other = (BaseEntity) obj; return getId().equals(other.getId()); }
Source:
<code>public ReviewInput toReviewInput(@NotNull Review review) { ReviewInput reviewInput = new ReviewInput(); reviewInput.message = Joiner.on(". ").join(review.getMessages()); reviewInput.labels = new HashMap<>(review.getScores()); reviewInput.comments = new HashMap<>(); for (ReviewFile file : review.getFiles()) { List<ReviewInput.CommentInput> comments = new ArrayList<>(); for (Comment comment : file.getComments()) { if(commentFilter.filter(file.getReviewFilename(), comment.getLine())){ <START> log.debug("Filter comment in file line {}", file.getReviewFilename(), comment.getLine()); <END> continue; } ReviewInput.CommentInput commentInput = new ReviewInput.CommentInput(); commentInput.line = comment.getLine(); commentInput.message = comment.getMessage(); comments.add(commentInput); } reviewInput.comments.put(file.getReviewFilename(), comments); } return reviewInput; }</code><technical_language>This line is ambigous. excluded filtered out, message is clear</technical_language>

Target:
public ReviewInput toReviewInput(@NotNull Review review) { ReviewInput reviewInput = new ReviewInput(); reviewInput.message = Joiner.on(". ").join(review.getMessages()); reviewInput.labels = new HashMap<>(review.getScores()); reviewInput.comments = new HashMap<>(); for (ReviewFile file : review.getFiles()) { List<ReviewInput.CommentInput> comments = new ArrayList<>(); for (Comment comment : file.getComments()) { if (commentFilter.filter(file.getReviewFilename(), comment.getLine())) { log.debug("Comment excluded in file line {}", file.getReviewFilename(), comment.getLine()); continue; } ReviewInput.CommentInput commentInput = new ReviewInput.CommentInput(); commentInput.line = comment.getLine(); commentInput.message = comment.getMessage(); comments.add(commentInput); } reviewInput.comments.put(file.getReviewFilename(), comments); } return reviewInput; }
Source:
<code>LocalDateTime extractExpiryDate(Map<String, String> args, ZoneId effectiveTimeZone) { LocalDateTime expiry = null; if (args.containsKey("Expires".toLowerCase())) { val ts = args.get("Expires".toLowerCase()); val explicit = Instant.ofEpochMilli(Long.parseLong(ts) * 1000); expiry = LocalDateTime.ofInstant(explicit, effectiveTimeZone); } else if (args.containsKey("X-Amz-Expires".toLowerCase()) && (args.containsKey("X-Amz-Date".toLowerCase()))) { String ts = ""; try { ts = args.get("X-Amz-Date".toLowerCase()); <START> val formatter = DateTimeFormatter.ofPattern("yyyyMMdd'T'HHmmssX"); <END> val reqDate = ZonedDateTime.parse(ts, formatter); log.trace("Request DateTime (Zoned): %s%n", reqDate); val expSeconds = Integer.parseInt(args.get("X-Amz-Expires".toLowerCase())); expiry = reqDate.withZoneSameInstant(effectiveTimeZone).toLocalDateTime().plusSeconds(expSeconds); System.out.printf("Expiry DateTime (Local): %s%n", expiry); } catch (DateTimeParseException pe) { log.error("%s is not parsable!%n", ts); throw pe; } } else { log.error("Could not identify expected date parameters in request: {}", flattenMap(args)); throw new IllegalArgumentException( String.format("Could not parse presigned URL - missing expected expiry date parameters")); } return expiry; }</code><technical_language>Constant</technical_language>

Target:
LocalDateTime extractExpiryDate(Map<String, String> args, ZoneId effectiveTimeZone) { LocalDateTime expiry = null; if (args.containsKey(HttpHeaders.EXPIRES.toLowerCase())) { val ts = args.get(HttpHeaders.EXPIRES.toLowerCase()); val explicit = Instant.ofEpochMilli(Long.parseLong(ts) * 1000); expiry = LocalDateTime.ofInstant(explicit, effectiveTimeZone); } else if (args.containsKey(SignerConstants.X_AMZ_EXPIRES.toLowerCase()) && (args.containsKey(SignerConstants.X_AMZ_DATE.toLowerCase()))) { String ts = ""; try { ts = args.get(SignerConstants.X_AMZ_DATE.toLowerCase()); val reqDate = ZonedDateTime.parse(ts, formatter); log.trace("Request DateTime (Zoned): %s%n", reqDate); val expSeconds = Integer.parseInt(args.get(SignerConstants.X_AMZ_EXPIRES.toLowerCase())); expiry = reqDate.withZoneSameInstant(effectiveTimeZone).toLocalDateTime().plusSeconds(expSeconds); System.out.printf("Expiry DateTime (Local): %s%n", expiry); } catch (DateTimeParseException pe) { log.error("%s is not parsable!%n", ts); throw pe; } } else { log.error("Could not identify expected date parameters in request: {}", flattenMap(args)); throw new IllegalArgumentException( String.format("Could not parse presigned URL - missing expected expiry date parameters")); } return expiry; }
Source:
<code>public void getEvents(EventConsumer c, BinlogPosition endPosition) throws Exception { int max_tries = 10; while ( true ) { MaxwellAbstractRowsEvent e = getEvent(); if (e == null) { if (max_tries > 0) { max_tries--; continue; } else { <START> System.out.println("maxwell didn't reach the position requested."); <END> return; } } c.consume(e); if ( eventBinlogPosition(e).newerThan(endPosition) ) return; } }</code><technical_language>LOGGER.error LOGGER.warn</technical_language>

Target:
public void getEvents(EventConsumer c, BinlogPosition endPosition) throws Exception { int max_tries = 10; while ( true ) { MaxwellAbstractRowsEvent e = getEvent(); if (e == null) { if (max_tries > 0) { max_tries--; continue; } else { LOGGER.error("maxwell didn't reach the position requested."); return; } } c.consume(e); if ( eventBinlogPosition(e).newerThan(endPosition) ) return; } }
Source:
<code>private boolean validatePassword(String password, String repeatedPassword) { if (password == null || password.trim().equals("")) { log(""); log(" * Error *\nThe password should not be empty"); return false; } if (repeatedPassword == null || repeatedPassword.trim().equals("")) { log(""); log(" * Error *\nThe repeated password should not be empty"); return false; } if (!password.equals(repeatedPassword)) { log(""); log(" * Error *\nThe passwords you introduced do not match each other. Please write them again."); return false; } if (!password.matches(".*\\d+.*")) { log(""); log(" * Error *\nThe passwords should include numbers."); return false; } if (password.length() < 8) { log(""); <START> log(" * Error *\nThe lengh of the password should be at least of 8 characters."); <END> return false; } return true; }</code><technical_language>Typo - "length"</technical_language>

Target:
private boolean validatePassword(String password, String repeatedPassword) { if (password == null || password.trim().equals("")) { log(""); log(" * Error *\nThe password should not be empty"); return false; } if (repeatedPassword == null || repeatedPassword.trim().equals("")) { log(""); log(" * Error *\nThe repeated password should not be empty"); return false; } if (!password.equals(repeatedPassword)) { log(""); log(" * Error *\nThe passwords you introduced do not match each other. Please write them again."); return false; } if (!password.matches(".*\\d+.*")) { log(""); log(" * Error *\nThe passwords should include numbers."); return false; } if (password.length() < 8) { log(""); log(" * Error *\nThe length of the password should be at least of 8 characters."); return false; } return true; }
Source:
<code>private HashMap<String, Geofence> getGeofencesFromCursor(Cursor cursor, int limit) { HashMap<String, Geofence> result = new HashMap<>(limit); Geofence geofence; int i = 0; while (cursor.moveToNext()) { i++; if (i <= HIGH) { <START> String fence = cursor.getString(0); <END> geofence = buildGeofence(fence); if (geofence != null) { result.put(fence, geofence); } } else { Logger.log.geofenceError("Over " + HIGH + " found in cursor", null); break; } } return result; }</code><technical_language>I insist cursor.getString(cursor.getColumnIndex(TG_FENCE)); considering this table is 1 column this SDK version is dying soon. OK, I felt mention :)</technical_language>

Target:
private HashMap<String, Geofence> getGeofencesFromCursor(Cursor cursor, int limit) { HashMap<String, Geofence> result = new HashMap<>(limit); Geofence geofence; int i = 0; while (cursor.moveToNext()) { i++; if (i <= HIGH) { String fence = cursor.getString(cursor.getColumnIndex(DBHelper.TG_FENCE)); geofence = buildGeofence(fence); if (geofence != null) { result.put(fence, geofence); } } else { Logger.log.geofenceError("Over " + HIGH + " found in cursor", null); break; } } return result; }
Source:
<code>public CoreMessage putCharProperty(String key, char value) { messageChanged(); <START> getOrCreateProperties().putCharProperty(key(key), value); <END> return this; }</code><technical_language>delegated as: putCharProperty(key(key), value)</technical_language>

Target:
public CoreMessage putCharProperty(String key, char value) { return putCharProperty(key(key), value); }
Source:
<code>private StreamApplicationDescriptorImpl getTestJoinStreamGraph(TestJoinFunction joinFn) throws IOException { Map<String, String> mapConfig = new HashMap<>(); mapConfig.put("job.name", "jobName"); mapConfig.put("job.id", "jobId"); StreamTestUtils.addStreamConfigs(mapConfig, "inStream", "insystem", "instream"); StreamTestUtils.addStreamConfigs(mapConfig, "inStream2", "insystem", "instream2"); Config config = new MapConfig(mapConfig); return new StreamApplicationDescriptorImpl(appDesc -> { IntegerSerde integerSerde = new IntegerSerde(); KVSerde<Integer, Integer> kvSerde = KVSerde.of(integerSerde, integerSerde); GenericSystemDescriptor sd = new GenericSystemDescriptor("insystem", "mockFactoryClassName"); GenericInputDescriptor<KV<Integer, Integer>> inputDescriptor1 = sd.getInputDescriptor("inStream", kvSerde); GenericInputDescriptor<KV<Integer, Integer>> inputDescriptor2 = sd.getInputDescriptor("inStream2", kvSerde); MessageStream<KV<Integer, Integer>> inStream = appDesc.getInputStream(inputDescriptor1); MessageStream<KV<Integer, Integer>> inStream2 = appDesc.getInputStream(inputDescriptor2); inStream .join(inStream2, joinFn, integerSerde, kvSerde, kvSerde, JOIN_TTL, "j1") .sink((message, messageCollector, taskCoordinator) -> { SystemStream outputSystemStream = new SystemStream("outputSystem", "outputStream"); messageCollector.send(new OutgoingMessageEnvelope(outputSystemStream, message)); <START> return message; <END> }); }, config); }</code><technical_language>do need return message</technical_language>

Target:
private StreamApplicationDescriptorImpl getTestJoinStreamGraph(TestJoinFunction joinFn) throws IOException { Map<String, String> mapConfig = new HashMap<>(); mapConfig.put("job.name", "jobName"); mapConfig.put("job.id", "jobId"); StreamTestUtils.addStreamConfigs(mapConfig, "inStream", "insystem", "instream"); StreamTestUtils.addStreamConfigs(mapConfig, "inStream2", "insystem", "instream2"); Config config = new MapConfig(mapConfig); return new StreamApplicationDescriptorImpl(appDesc -> { IntegerSerde integerSerde = new IntegerSerde(); KVSerde<Integer, Integer> kvSerde = KVSerde.of(integerSerde, integerSerde); GenericSystemDescriptor sd = new GenericSystemDescriptor("insystem", "mockFactoryClassName"); GenericInputDescriptor<KV<Integer, Integer>> inputDescriptor1 = sd.getInputDescriptor("inStream", kvSerde); GenericInputDescriptor<KV<Integer, Integer>> inputDescriptor2 = sd.getInputDescriptor("inStream2", kvSerde); MessageStream<KV<Integer, Integer>> inStream = appDesc.getInputStream(inputDescriptor1); MessageStream<KV<Integer, Integer>> inStream2 = appDesc.getInputStream(inputDescriptor2); inStream .join(inStream2, joinFn, integerSerde, kvSerde, kvSerde, JOIN_TTL, "j1") .sink((message, messageCollector, taskCoordinator) -> { SystemStream outputSystemStream = new SystemStream("outputSystem", "outputStream"); messageCollector.send(new OutgoingMessageEnvelope(outputSystemStream, message)); }); }, config); }
Source:
<code>public static String toFriendlyMessage(@Code int code) { switch (code) { case UNKNOWN_ERROR: return "Unknown error"; case NO_NETWORK: return "No internet connection"; case PLAY_SERVICES_UPDATE_CANCELLED: return "Play Services update cancelled"; case DEVELOPER_ERROR: return "Developer error"; case PROVIDER_ERROR: return "Provider error"; case ANONYMOUS_UPGRADE_MERGE_CONFLICT: <START> return "Merge conflict"; <END> default: throw new IllegalArgumentException("Unknown code: " + code); } }</code><technical_language>This a slightly more user friendly message User account conflict</technical_language>

Target:
public static String toFriendlyMessage(@Code int code) { switch (code) { case UNKNOWN_ERROR: return "Unknown error"; case NO_NETWORK: return "No internet connection"; case PLAY_SERVICES_UPDATE_CANCELLED: return "Play Services update cancelled"; case DEVELOPER_ERROR: return "Developer error"; case PROVIDER_ERROR: return "Provider error"; case ANONYMOUS_UPGRADE_MERGE_CONFLICT: return "User account merge conflict"; case EMAIL_MISMATCH_ERROR: return "You are are attempting to sign in a different email than previously " + "provided"; default: throw new IllegalArgumentException("Unknown code: " + code); } }
Source:
<code>public void analyzerOverride_queryOnlyAnalyzer() { StubMappingSearchScope scope = indexManager.createSearchScope(); String absoluteFieldPath = indexMapping.whitespaceLowercaseAnalyzedField.relativeFieldName; IndexSearchQuery<DocumentReference> query = scope.query() .asReference() .predicate( f -> f.match().onField( absoluteFieldPath ).matching( "worldofwordcraft" ) <START> .analyzer( OverrideAnalysisDefinitions.ANALYZER_NGRAM.name ) ) <END> .toQuery(); assertThat( query ) .hasDocRefHitsAnyOrder( INDEX_NAME, DOCUMENT_1, DOCUMENT_2, DOCUMENT_3 ); }</code><technical_language>Ok, a weird usage of ngram analyzer, if works :man_shrugging:</technical_language>

Target:
public void analyzerOverride_queryOnlyAnalyzer() { StubMappingSearchScope scope = indexManager.createSearchScope(); String absoluteFieldPath = indexMapping.whitespaceLowercaseAnalyzedField.relativeFieldName; IndexSearchQuery<DocumentReference> query = scope.query() .asReference() .predicate( f -> f.match().onField( absoluteFieldPath ).matching( "worldofwordcraft" ) ) .toQuery(); assertThat( query ).hasNoHits(); query = scope.query() .asReference() .predicate( f -> f.match().onField( absoluteFieldPath ).matching( "worldofwordcraft" ) .analyzer( OverrideAnalysisDefinitions.ANALYZER_NGRAM.name ) ) .toQuery(); assertThat( query ) .hasDocRefHitsAnyOrder( INDEX_NAME, DOCUMENT_1, DOCUMENT_2, DOCUMENT_3 ); }
Source:
<code>public Optional<WorldProperties> getDefaultWorld() { <START> final Optional<WorldServer> optWorldServer = DimensionManager.getWorldByDimensionId(0); <END> if (optWorldServer.isPresent()) { return Optional.of(((World) optWorldServer.get()).getProperties()); } return Optional.empty(); }</code><technical_language>neat DimensionManager.getWorldById(0).transform here, automatically handles "if present" check</technical_language>

Target:
public Optional<WorldProperties> getDefaultWorld() { return DimensionManager.getWorldByDimensionId(0).map(worldServer -> ((World) worldServer).getProperties()); }
Source:
<code>public void append(byte[] nameBuf, int namePos, int nameLen, FileMode mode, AnyObjectId id, boolean allowEmptyName) { <START> if (nameLen == 0 && !allowEmptyName) throw new IllegalArgumentException("Can't append a tree entry with zero-length name"); <END> if (fmtBuf(nameBuf, namePos, nameLen, mode)) { id.copyRawTo(buf, ptr); ptr += OBJECT_ID_LENGTH; } else { try { fmtOverflowBuffer(nameBuf, namePos, nameLen, mode); id.copyRawTo(overflowBuffer); } catch (IOException badBuffer) { throw new RuntimeException(badBuffer); } } }</code><technical_language>if-block braces - error message externalized</technical_language>

Target:
public void append(byte[] nameBuf, int namePos, int nameLen, FileMode mode, AnyObjectId id, boolean allowEmptyName) { if (nameLen == 0 && !allowEmptyName) { throw new IllegalArgumentException( JGitText.get().invalidTreeZeroLengthName); } if (fmtBuf(nameBuf, namePos, nameLen, mode)) { id.copyRawTo(buf, ptr); ptr += OBJECT_ID_LENGTH; } else { try { fmtOverflowBuffer(nameBuf, namePos, nameLen, mode); id.copyRawTo(overflowBuffer); } catch (IOException badBuffer) { throw new RuntimeException(badBuffer); } } }
Source:
<code>public void testInsertAnnotated() throws Exception { <START> SqlSession sqlSession = sqlSessionFactory.openSession(); <END> try { InsertMapper mapper = sqlSession.getMapper(InsertMapper.class); Name name = new Name(); name.setFirstName("Fred"); name.setLastName("Flintstone"); int rows = mapper.insertNameAnnotated(name); assertNotNull(name.getId()); assertEquals(1, rows); } finally { sqlSession.close(); } }</code><technical_language>I prefer try-with-resources follow: java try(SqlSession sqlSession = sqlSessionFactory.openSession()) { InsertMapper mapper = sqlSession.getMapper(InsertMapper.class); Name name = new Name(); name.setFirstName("Fred"); name.setLastName("Flintstone"); int rows = mapper.insertNameAnnotated(name); assertNotNull(name.getId()); assertEquals(1, rows); }</technical_language>

Target:
public void testInsertAnnotated() throws Exception { try (SqlSession sqlSession = sqlSessionFactory.openSession()) { InsertMapper mapper = sqlSession.getMapper(InsertMapper.class); Name name = new Name(); name.setFirstName("Fred"); name.setLastName("Flintstone"); int rows = mapper.insertNameAnnotated(name); assertNotNull(name.getId()); assertEquals(1, rows); } }
Source:
<code>public void visitMethodDeclaration(MethodDeclarationTree tree) { <START> if (!isNested) { <END> add(tree.name()); excludeLastReturn(tree.body().statements()); isNested = true; super.visitMethodDeclaration(tree); isNested = false; } }</code><technical_language>@ivandalbosco is refactor 6 lines</technical_language>

Target:
public void visitMethodDeclaration(MethodDeclarationTree tree) { if (mustAnalyse()) { add(tree.name()); excludeLastReturn(tree.body().statements()); isInsideFunction = true; super.visitMethodDeclaration(tree); isInsideFunction = false; } }
Source:
<code>public void executeCallback() { if(!highlighter_.getCallbackProcessed(index_)) { highlighter_.setCallbackProcessed(index_, true); highlighter_.getServer().executeRCode(callback_, new ServerRequestCallback<String>(){ @Override public void onResponseReceived(String results) { highlighter_.clearEvents(); } @Override public void onError(ServerError error) { <START> Debug.logError(error); <END> } }); } }</code><technical_language>clear highlight error well</technical_language>

Target:
public void executeCallback() { if(!highlighter_.getCallbackProcessed(index_)) { highlighter_.setCallbackProcessed(index_, true); highlighter_.getServer().executeRCode(callback_, new ServerRequestCallback<String>(){ @Override public void onResponseReceived(String results) { highlighter_.clearEvents(); } @Override public void onError(ServerError error) { highlighter_.clearEvents(); Debug.logError(error); } }); } }
Source:
<code>public void visitNode(Tree tree) { if (!hasSemantic()) { return; } MethodTree methodTree = (MethodTree) tree; Symbol.MethodSymbol methodSymbol = methodTree.symbol(); if (!methodSymbol.isPublic() || BooleanUtils.isNotFalse(((MethodTreeImpl) methodTree).isOverriding()) || isOverloaded(methodSymbol)) { return; } List<Symbol> parameters = methodTree.parameters().stream() .map(VariableTree::symbol) <START> .collect(Collectors.toList()); <END> for (Symbol param : parameters) { if (param.type().isClass() && !param.type().symbol().isEnum() && !param.type().is("java.lang.String")) { handleParameter(param); } } }</code><technical_language>need collect: filter foreach enough</technical_language>

Target:
public void visitNode(Tree tree) { if (!hasSemantic()) { return; } MethodTree methodTree = (MethodTree) tree; Symbol.MethodSymbol methodSymbol = methodTree.symbol(); if (!methodSymbol.isPublic() || BooleanUtils.isNotFalse(((MethodTreeImpl) methodTree).isOverriding()) || isOverloaded(methodSymbol)) { return; } methodTree.parameters().stream() .map(VariableTree::symbol) .filter(p -> p.type().isClass() && !p.type().symbol().isEnum() && !p.type().is("java.lang.String")) .forEach(this::handleParameter); }
Source:
<code>private String loadJsonFromAsset(String filename) { <START> String json; <END> try { InputStream is = getAssets().open(filename); int size = is.available(); byte[] buffer = new byte[size]; is.read(buffer); is.close(); json = new String(buffer, "UTF-8"); } catch (IOException ex) { ex.printStackTrace(); return null; } return json; }</code><technical_language>Unneeded temporary variable. return early return</technical_language>

Target:
private String loadJsonFromAsset(String filename) { try { InputStream is = getAssets().open(filename); int size = is.available(); byte[] buffer = new byte[size]; is.read(buffer); is.close(); return new String(buffer, "UTF-8"); } catch (IOException ex) { ex.printStackTrace(); return null; } }
Source:
<code>protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (getParameters().getClusterId() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CLUSTER_IS_NOT_VALID); return false; } <START> if (getParameters().getConfigParams() == null || getParameters().getConfigParams().size() == 0) { <END> addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_SNAPSHOT_CONFIG_PARAMS_IS_EMPTY); return false; } for (GlusterVolumeSnapshotConfig param : getParameters().getConfigParams()) { if (param.getParamValue() == null || param.getParamValue().equals("")) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_SNAPSHOT_CONFIG_PARAM_VALUE_IS_EMPTY); return false; } } return true; }</code><technical_language>isEmpty, size() == 0</technical_language>

Target:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (getParameters().getClusterId() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CLUSTER_IS_NOT_VALID); return false; } if (getParameters().getConfigParams() == null || getParameters().getConfigParams().isEmpty()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_SNAPSHOT_CONFIG_PARAMS_IS_EMPTY); return false; } for (GlusterVolumeSnapshotConfig param : getParameters().getConfigParams()) { if (param.getParamValue() == null || param.getParamValue().equals("")) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_SNAPSHOT_CONFIG_PARAM_VALUE_IS_EMPTY); return false; } } return true; }
Source:
<code>public void selectFromList(String locator, String... items) { String itemList = items.length != 0 ? String.format("option(s) [ %s ]", Python.join(" | ", items)) : "all options"; logging.info(String.format("Selecting %s from list '%s'.", itemList, locator)); Select select = getSelectList(locator); if (items.length == 0) { for (int i = 0; i < select.getOptions().size(); i++) { select.selectByIndex(i); } return; } boolean lastItemFound = false; List<String> nonExistingItems = new ArrayList<>(); for (String item : items) { lastItemFound = true; try { select.selectByValue(item); } catch (NoSuchElementException e1) { try { select.selectByVisibleText(item); } catch (NoSuchElementException e2) { nonExistingItems.add(item); lastItemFound = false; <START> } <END> } } if (nonExistingItems.size() != 0) { if (select.isMultiple()) { throw new SeleniumLibraryNonFatalException(String.format("Options '%s' not in list '%s'.", Python.join(", ", nonExistingItems), locator)); } logging.warn(String.format("Option%s '%s' not found within list '%s'.", nonExistingItems.size() == 0 ? "" : "s", Python.join(", ", nonExistingItems), locator)); if (!lastItemFound) { throw new SeleniumLibraryNonFatalException(String.format("Option '%s' not in list '%s'.", nonExistingItems.get(nonExistingItems.size() - 1), locator)); } } }</code><technical_language>it. IMHO</technical_language>

Target:
public void selectFromList(String locator, String... items) { String itemList = items.length != 0 ? String.format("option(s) [ %s ]", Python.join(" | ", items)) : "all options"; logging.info(String.format("Selecting %s from list '%s'.", itemList, locator)); Select select = getSelectList(locator); if (items.length == 0) { for (int i = 0; i < select.getOptions().size(); i++) { select.selectByIndex(i); } return; } boolean lastItemFound = false; List<String> nonExistingItems = new ArrayList<>(); for (String item : items) { lastItemFound = true; try { select.selectByValue(item); } catch (NoSuchElementException e1) { try { select.selectByVisibleText(item); } catch (NoSuchElementException e2) { nonExistingItems.add(item); lastItemFound = false; continue; } } } if (nonExistingItems.size() != 0) { if (select.isMultiple()) { throw new SeleniumLibraryNonFatalException(String.format("Options '%s' not in list '%s'.", Python.join(", ", nonExistingItems), locator)); } logging.warn(String.format("Option%s '%s' not found within list '%s'.", nonExistingItems.size() == 0 ? "" : "s", Python.join(", ", nonExistingItems), locator)); if (!lastItemFound) { throw new SeleniumLibraryNonFatalException(String.format("Option '%s' not in list '%s'.", nonExistingItems.get(nonExistingItems.size() - 1), locator)); } } }
Source:
<code>public void testAddMenusWithExperimentalPerspective() { when(authzManager.authorize(any(MenuItem.class), any())).thenReturn(true); List<MenuItem> items = new ArrayList<>(); items.add(MenuFactory.newSimpleItem(NAME).perspective(PERSPECTIVE_ID).endMenu().build().getItems().get(0)); items.add(MenuFactory.newSimpleItem(NAME).perspective(SECOND_PERSPECTIVE_ID).endMenu().build().getItems().get(0)); items.add(MenuFactory.newSimpleItem(NAME).perspective(THIRD_PERSPECTIVE_ID).endMenu().build().getItems().get(0)); final Menus menus = MenuFactory.newSimpleItem(NAME).withItems(items).endMenu().build(); when(experimentalActivitiesAuthorizationManager.authorizeActivityId(anyString())) .thenAnswer((Answer<Boolean>) invocationOnMock -> !SECOND_PERSPECTIVE_ID.equals(invocationOnMock.getArguments()[0])); presenter.addMenus(menus); verify(experimentalActivitiesAuthorizationManager, times(3)).authorizeActivityId(anyString()); verify(view, times(2)).setMenuItemVisible(anyString(), eq(true)); <START> verify(view, times(1)).setMenuItemVisible(anyString(), eq(false)); <END> }</code><technical_language>more times(1)</technical_language>

Target:
public void testAddMenusWithExperimentalPerspective() { when(authzManager.authorize(any(MenuItem.class), any())).thenReturn(true); List<MenuItem> items = new ArrayList<>(); items.add(MenuFactory.newSimpleItem(NAME).perspective(PERSPECTIVE_ID).endMenu().build().getItems().get(0)); items.add(MenuFactory.newSimpleItem(NAME).perspective(SECOND_PERSPECTIVE_ID).endMenu().build().getItems().get(0)); items.add(MenuFactory.newSimpleItem(NAME).perspective(THIRD_PERSPECTIVE_ID).endMenu().build().getItems().get(0)); final Menus menus = MenuFactory.newSimpleItem(NAME).withItems(items).endMenu().build(); when(experimentalActivitiesAuthorizationManager.authorizeActivityId(anyString())) .thenAnswer((Answer<Boolean>) invocationOnMock -> !SECOND_PERSPECTIVE_ID.equals(invocationOnMock.getArguments()[0])); presenter.addMenus(menus); verify(experimentalActivitiesAuthorizationManager, times(3)).authorizeActivityId(anyString()); verify(view, times(2)).setMenuItemVisible(anyString(), eq(true)); verify(view).setMenuItemVisible(anyString(), eq(false)); }
Source:
<code>public Subscription subscribe() { return storIOSQLite .observeChangesInTable(UserTableMeta.TABLE) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) <START> .subscribe(new Observer<Changes>() { <END> @Override public void onError(Throwable e) { fail("Error occurred: " + e); } @Override public void onNext(Changes changes) { onNextObtained(changes); } @Override public void onCompleted() { } }); }</code><technical_language>java .subscribe(new Action1<ResultType> { });</technical_language>

Target:
public Subscription subscribe() { return storIOSQLite .observeChangesInTable(UserTableMeta.TABLE) .subscribeOn(Schedulers.io()) .subscribe(new Action1<Changes>() { @Override public void call(Changes changes) { onNextObtained(changes); } }); }
Source:
<code>private RexNode simplifyMinus(RexCall e) { int zeroIndex = findLiteralIndex(e.operands, 0L); if (zeroIndex == 1) { RexNode leftOperand = e.getOperands().get(0); <START> return leftOperand.getType().equals(e.getType()) <END> ? leftOperand : rexBuilder.makeCast(e.getType(), leftOperand); } return simplifyGenericNode(e); }</code><technical_language>a - a simplified 0 if a is nullable</technical_language>

Target:
private RexNode simplifyMinus(RexCall e) { final int zeroIndex = findLiteralIndex(e.operands, BigDecimal.ZERO); if (zeroIndex == 1) { RexNode leftOperand = e.getOperands().get(0); return leftOperand.getType().equals(e.getType()) ? leftOperand : rexBuilder.makeCast(e.getType(), leftOperand); } return simplifyGenericNode(e); }
Source:
<code>public HttpCallRequestBuilder request(final URI url, final RequestMethod method) { try { Assert.requireNonNull(url, "url"); Assert.requireNonNull(method, "method"); final HttpClientConnection clientConnection = new HttpClientConnection(httpURLConnectionFactory, url, method); return new HttpCallRequestBuilderImpl(clientConnection, gson, requestHandlers, responseHandlers, configuration); <START> } catch (IOException e) { <END> throw new DolphinRuntimeException("HTTP error", e); } }</code><technical_language>Add final keyword</technical_language>

Target:
public HttpCallRequestBuilder request(final URI url, final RequestMethod method) { try { Assert.requireNonNull(url, "url"); Assert.requireNonNull(method, "method"); final HttpClientConnection clientConnection = new HttpClientConnection(httpURLConnectionFactory, url, method); return new HttpCallRequestBuilderImpl(clientConnection, gson, requestHandlers, responseHandlers, configuration); } catch (final IOException e) { throw new DolphinRuntimeException("HTTP error", e); } }
Source:
<code>public static SafeLoggableData fromTableMetadata(Map<TableReference, byte[]> tableRefToMetadata) { ImmutableSafeLoggableData.Builder builder = ImmutableSafeLoggableData.builder(); tableRefToMetadata.forEach( (ref, metadataBytes) -> { try { TableMetadata tableMetadata = TableMetadata.BYTES_HYDRATOR.hydrateFromBytes(metadataBytes); addLoggableNamesToBuilder(builder, ref, tableMetadata); } catch (Exception e) { log.warn("Exception thrown hydrating table metadata for table {}. {}", <START> UnsafeArg.of("tableName", ref), UnsafeArg.of("exception", e)); <END> } }); return builder.build(); }</code><technical_language>leave exception end needing wrap in Arg. This get stack trace (which is considered safe), (possibly unsafe) message is redacted</technical_language>

Target:
public static SafeLoggableData fromTableMetadata(Map<TableReference, byte[]> tableRefToMetadata) { ImmutableSafeLoggableData.Builder builder = ImmutableSafeLoggableData.builder(); tableRefToMetadata.forEach( (ref, metadataBytes) -> { try { TableMetadata tableMetadata = TableMetadata.BYTES_HYDRATOR.hydrateFromBytes(metadataBytes); addLoggableNamesToBuilder(builder, ref, tableMetadata); } catch (Exception e) { log.warn("Exception thrown hydrating table metadata for table {}.", UnsafeArg.of("tableName", ref), e); } }); return builder.build(); }
Source:
<code>static Participant getLeader(CuratorFramework client, Collection<String> participantNodes) throws Exception { Participant result = null; if ( participantNodes.size() > 0 ) { Iterator<String> iter = participantNodes.iterator(); while ( iter.hasNext() ) { try { <START> result = participantForPath(client, iter.next(), true); <END> } catch( KeeperException.NoNodeException e ) { } if ( result != null ) { break; } } } if( result == null ) { result = new Participant(); } return result; }</code><technical_language>return right</technical_language>

Target:
static Participant getLeader(CuratorFramework client, Collection<String> participantNodes) throws Exception { Participant result = null; if ( participantNodes.size() > 0 ) { Iterator<String> iter = participantNodes.iterator(); while ( iter.hasNext() ) { result = participantForPath(client, iter.next(), true); if ( result != null ) { break; } } } if( result == null ) { result = new Participant(); } return result; }