auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static List<FeedbackParticipantType> getParticipantListFromCommaSeparatedValues( String commaSeparatedValues) { List<FeedbackParticipantType> participantList = new ArrayList<FeedbackParticipantType>(); if (commaSeparatedValues == null <START> || commaSeparatedValues.isEmpty()) { <END> return participantList; } String[] splitString = commaSeparatedValues.split(","); for (String str : splitString) { participantList.add(FeedbackParticipantType.valueOf(str)); } return participantList; }</code><technical_language>Nit: this previous line</technical_language>

Target:
public static List<FeedbackParticipantType> getParticipantListFromCommaSeparatedValues( String commaSeparatedValues) { List<FeedbackParticipantType> participantList = new ArrayList<FeedbackParticipantType>(); if (commaSeparatedValues == null || commaSeparatedValues.isEmpty()) { return participantList; } for (String str : commaSeparatedValues.split(",")) { participantList.add(FeedbackParticipantType.valueOf(str)); } return participantList; }
Source:
<code>public Optional<String> resolveUpstreamDNS(String address) { try { if (address.contains(":")) { HostAndPort hostAndPort = HostAndPort.fromString(address); try { InetAddresses.forString(hostAndPort.getHost()); return Optional.of(address); } catch (IllegalArgumentException e) { } String cached = resolveCache.getIfPresent(hostAndPort.getHost()); String ip; int port = hostAndPort.getPort(); if (cached != null) { ip = cached; } else { ip = InetAddress.getByName(hostAndPort.getHost()).getHostAddress(); resolveCache.put(hostAndPort.getHost(), ip); } return Optional.of(String.format("%s:%d", ip, port)); } else { try { <START> InetAddresses.forString(address); <END> return Optional.of(address); } catch (IllegalArgumentException e) { } return Optional.of(InetAddress.getByName(address).getHostAddress()); } } catch (UnknownHostException uhe) { return Optional.absent(); } }</code><technical_language>is a reason try cache if a :</technical_language>

Target:
public Optional<String> resolveUpstreamDNS(String address) { String host; Optional<Integer> port = Optional.absent(); if (address.contains(":")) { HostAndPort hostAndPort = HostAndPort.fromString(address); host = hostAndPort.getHost(); port = Optional.of(hostAndPort.getPort()); } else { host = address; } try { InetAddresses.forString(host); return Optional.of(address); } catch (IllegalArgumentException e) { } try { String cached = resolveCache.getIfPresent(host); String ip; if (cached != null) { ip = cached; } else { ip = InetAddress.getByName(host).getHostAddress(); resolveCache.put(host, ip); } if (port.isPresent()) { return Optional.of(String.format("%s:%d", ip, port.get())); } else { return Optional.of(String.format("%s", ip)); } } catch (UnknownHostException uhe) { return Optional.absent(); } }
Source:
<code>public String call() { ByteArrayOutputStream bos = new ByteArrayOutputStream(); try { getRootCAList(bos); <START> return bos.toString("utf-8"); <END> } catch (UnsupportedEncodingException e) { return bos.toString(); } }</code><technical_language>Uh, a StringWriter save encoding hassles</technical_language>

Target:
public String call() { StringWriter writer = new StringWriter(); getRootCAList(writer); return writer.toString(); }
Source:
<code>public static String unescape(StringElement stringElement) { String lowerCasePrefix = stringElement.prefix().toLowerCase(Locale.ROOT); String valueWithoutQuotes = stringElement.trimmedQuotesValue(); boolean isEscaped = lowerCasePrefix.indexOf('r') == -1; boolean isBytesLiteral = lowerCasePrefix.indexOf('b') != -1; if (isEscaped) { boolean support16Bits = !isBytesLiteral; valueWithoutQuotes = unescapeString(valueWithoutQuotes, support16Bits); <START> } <END> return valueWithoutQuotes; }</code><technical_language>good add a http link language reference</technical_language>

Target:
public static String unescape(StringElement stringElement) { String lowerCasePrefix = stringElement.prefix().toLowerCase(Locale.ROOT); String valueWithoutQuotes = stringElement.trimmedQuotesValue(); boolean isEscaped = lowerCasePrefix.indexOf('r') == -1; boolean isBytesLiteral = lowerCasePrefix.indexOf('b') != -1; if (isEscaped) { valueWithoutQuotes = unescapeString(valueWithoutQuotes, isBytesLiteral); } return valueWithoutQuotes; }
Source:
<code><START> ResultModel buildResultModelFromFunctionResults(RestoreRedundancyResults results, <END> boolean isStatusCommand) { if (results.getRegionResults().size() == 0 && results.getIncludedRegionsWithNoMembers().size() == 0) { return createNoMembersResultModel(); } if (!results.getSuccess()) { return createErrorResultModel(results.getStatusMessage()); } ResultModel result = new ResultModel(); if (results.getIncludedRegionsWithNoMembers().size() > 0) { addRegionsWithNoMembersSection(results.getIncludedRegionsWithNoMembers(), result); } addSummarySection(result, results); addZeroRedundancySection(result, results); addUnderRedundancySection(result, results); addSatisfiedRedundancySection(result, results); if (!isStatusCommand) { addPrimariesSection(result, results); if (results.getRegionOperationStatus().equals(RestoreRedundancyResults.Status.FAILURE)) { result.setStatus(Result.Status.ERROR); } } return result; }</code><technical_language>buildResultModelFromFunctionResults private class needs reference it</technical_language>

Target:
ResultModel buildResultModelFromFunctionResults(RestoreRedundancyResults results, boolean isStatusCommand) { if (results.getRegionResults().isEmpty() && results.getIncludedRegionsWithNoMembers().isEmpty()) { return createNoMembersResultModel(); } if (!results.getSuccess()) { return createErrorResultModel(results.getStatusMessage()); } ResultModel result = new ResultModel(); if (!results.getIncludedRegionsWithNoMembers().isEmpty()) { addRegionsWithNoMembersSection(results.getIncludedRegionsWithNoMembers(), result); } addSummarySection(result, results); addZeroRedundancySection(result, results); addUnderRedundancySection(result, results); addSatisfiedRedundancySection(result, results); if (!isStatusCommand) { addPrimariesSection(result, results); if (results.getRegionOperationStatus() == RestoreRedundancyResults.Status.FAILURE) { result.setStatus(Result.Status.ERROR); } } return result; }
Source:
<code>public ExternalCompressor getCompressorForMethod( final BlockCompressionMethod compressionMethod, final int compressorSpecificArg) { switch (compressionMethod) { <START> case RAW: <END> ValidationUtils.validateArg( compressorSpecificArg == ExternalCompressor.NO_COMPRESSION_ARG, String.format(argErrorMessage, compressorSpecificArg, compressionMethod)); return getCachedCompressorForMethod(compressionMethod, compressorSpecificArg); case GZIP: return getCachedCompressorForMethod(compressionMethod, compressorSpecificArg); case LZMA: ValidationUtils.validateArg( compressorSpecificArg == ExternalCompressor.NO_COMPRESSION_ARG, String.format(argErrorMessage, compressorSpecificArg, compressionMethod)); return getCachedCompressorForMethod(compressionMethod, compressorSpecificArg); case RANS: final int ransArg = compressorSpecificArg == ExternalCompressor.NO_COMPRESSION_ARG ? RANS.ORDER.ZERO.ordinal() : compressorSpecificArg; final Tuple<BlockCompressionMethod, Integer> compressorTuple = new Tuple<>( BlockCompressionMethod.RANS, ransArg); if (!compressorCache.containsKey(compressorTuple)) { if (sharedRANS == null) { sharedRANS = new RANS(); } compressorCache.put( new Tuple(BlockCompressionMethod.RANS, ransArg), new RANSExternalCompressor(ransArg, sharedRANS) ); } return getCachedCompressorForMethod(compressorTuple.a, compressorTuple.b); case BZIP2: ValidationUtils.validateArg( compressorSpecificArg == ExternalCompressor.NO_COMPRESSION_ARG, String.format(argErrorMessage, compressorSpecificArg, compressionMethod)); return getCachedCompressorForMethod(compressionMethod, compressorSpecificArg); default: throw new IllegalArgumentException(String.format("Unknown compression method %s", compressionMethod)); } }</code><technical_language>collapse RAQ, LZMA, BGZIP cases a single case</technical_language>

Target:
public ExternalCompressor getCompressorForMethod( final BlockCompressionMethod compressionMethod, final int compressorSpecificArg) { switch (compressionMethod) { case GZIP: return getCachedCompressorForMethod(compressionMethod, compressorSpecificArg); case BZIP2: case RAW: case LZMA: ValidationUtils.validateArg( compressorSpecificArg == ExternalCompressor.NO_COMPRESSION_ARG, String.format(argErrorMessage, compressorSpecificArg, compressionMethod)); return getCachedCompressorForMethod(compressionMethod, compressorSpecificArg); case RANS: final int ransArg = compressorSpecificArg == ExternalCompressor.NO_COMPRESSION_ARG ? RANS.ORDER.ZERO.ordinal() : compressorSpecificArg; final Tuple<BlockCompressionMethod, Integer> compressorTuple = new Tuple<>( BlockCompressionMethod.RANS, ransArg); if (!compressorCache.containsKey(compressorTuple)) { if (sharedRANS == null) { sharedRANS = new RANS(); } compressorCache.put( new Tuple(BlockCompressionMethod.RANS, ransArg), new RANSExternalCompressor(ransArg, sharedRANS) ); } return getCachedCompressorForMethod(compressorTuple.a, compressorTuple.b); default: throw new IllegalArgumentException(String.format("Unknown compression method %s", compressionMethod)); } }
Source:
<code>public static String computeXoauth(String username, String authToken) throws UnsupportedEncodingException { return new String(Base64.encodeBase64( ("user="+username+"\001auth=Bearer "+authToken+"\001\001").getBytes() <START> ),US_ASCII); <END> }</code><technical_language>code style</technical_language>

Target:
public static String computeXoauth(String username, String authToken) throws UnsupportedEncodingException { return new String( Base64.encodeBase64(String.format(XOAUTH_FORMAT, username, authToken).getBytes()), US_ASCII); }
Source:
<code>private Set<InetSocketAddress> refreshLocalHosts(List<TokenRange> tokenRanges) { Set<InetSocketAddress> localHosts = Sets.newHashSet(); if (myLocation.isPresent()) { for (TokenRange tokenRange : tokenRanges) { for (EndpointDetails details : tokenRange.getEndpoint_details()) { <START> if (details.isSetDatacenter() && details.isSetRack() && details.isSetHost() && <END> myLocation.get().equals(HostLocation.of(details.getDatacenter(), details.getRack()))) { localHosts.add(getAddressForHostThrowUnchecked(details.getHost())); } } } } return localHosts; }</code><technical_language>this condition is long, extract out a helper method describes is checking</technical_language>

Target:
private Set<InetSocketAddress> refreshLocalHosts(List<TokenRange> tokenRanges) { Optional<HostLocation> myLocation = myLocationSupplier.get(); if (!myLocation.isPresent()) { return ImmutableSet.of(); } Set<InetSocketAddress> newLocalHosts = tokenRanges.stream() .map(TokenRange::getEndpoint_details) .flatMap(Collection::stream) .filter(details -> isHostLocal(details, myLocation.get())) .map(EndpointDetails::getHost) .map(this::getAddressForHostThrowUnchecked) .collect(Collectors.toSet()); if (newLocalHosts.isEmpty()) { log.warn("No local hosts found"); } return newLocalHosts; }
Source:
<code>public static CounterConfiguration parsedConfigToConfig(AbstractCounterConfiguration configuration) { if (configuration instanceof StrongCounterConfiguration) { <START> if (((StrongCounterConfiguration) configuration).isBound()) { <END> return CounterConfiguration.builder(CounterType.BOUNDED_STRONG).initialValue(configuration.initialValue()) .lowerBound(((StrongCounterConfiguration) configuration).lowerBound()) .upperBound(((StrongCounterConfiguration) configuration).upperBound()) .storage(configuration.storage()).build(); } else { return CounterConfiguration.builder(CounterType.UNBOUNDED_STRONG).initialValue(configuration.initialValue()) .storage(configuration.storage()).build(); } } else if (configuration instanceof WeakCounterConfiguration) { return CounterConfiguration.builder(CounterType.WEAK).initialValue(configuration.initialValue()) .storage(configuration.storage()) .concurrencyLevel(((WeakCounterConfiguration) configuration).concurrencyLevel()).build(); } throw new IllegalStateException( "[should never happen] unknown CounterConfiguration class: " + configuration.getClass()); }</code><technical_language>I prefer 3 methods casting public static CounterConfiguration parsedConfigToConfig(AbstractCounterConfiguration configuration) { if (configuration instanceof StrongCounterConfiguration) { return parsedConfigToConfig((StrongCounterConfiguration) configuration); } else if (configuration instanceof WeakCounterConfiguration) { return parsedConfigToConfig((WeakCounterConfiguration) configuration); } throw new IllegalStateException( "[should happen] unknown CounterConfiguration class: " + configuration.getClass()); }</technical_language>

Target:
public static CounterConfiguration parsedConfigToConfig(AbstractCounterConfiguration configuration) { if (configuration instanceof StrongCounterConfiguration) { return parsedConfigToConfig((StrongCounterConfiguration) configuration); } else if (configuration instanceof WeakCounterConfiguration) { return parsedConfigToConfig((WeakCounterConfiguration) configuration); } throw new IllegalStateException( "[should never happen] unknown CounterConfiguration class: " + configuration.getClass()); }
Source:
<code>private void generateUpdateSignature(Method method) { generateDoc(method); Parameter mainParameter = JaxrsGeneratorUtils.getMainUpdateParameter(method); if (mainParameter == null) { System.err.println("Method \"" + method + "\" doesn't have any struct parameter"); return; } Type mainType = mainParameter.getType(); JavaTypeReference mainTypeReference = schemaNames.getXjcTypeReference(mainType); String methodName = concatenateName(method, method.getBase().getName()); javaBuffer.addLine( <START> "default %s " + methodName + "(%s %s) {", <END> mainTypeReference.getText(), mainTypeReference.getText(), javaNames.getJavaMemberStyleName(mainParameter.getName())); javaBuffer.addLine("throw new UnsupportedOperationException();"); javaBuffer.addLine("}"); }</code><technical_language>Try avoid mixing format specifiers (%s) string contatenation: "default %s %s(%s %s) {", mainTypeReference.getText(), methodName, ... Remember indent 4 spaces</technical_language>

Target:
private void generateUpdateSignature(Method method) { generateDoc(method); Parameter mainParameter = jaxrsGeneratorUtils.getMainUpdateParameter(method); if (mainParameter == null) { throw new IllegalStateException("Method \"" + method + "\" doesn't have any struct parameter"); } Type mainType = mainParameter.getType(); JavaTypeReference mainTypeReference = schemaNames.getXjcTypeReference(mainType); String methodName = javaNames.getJavaMemberStyleName(names.concatenate(method.getBase().getName(), method.getName())); javaBuffer.addLine( "default %s " + methodName + "(%s %s) {", mainTypeReference.getText(), mainTypeReference.getText(), javaNames.getJavaMemberStyleName(mainParameter.getName())); javaBuffer.addLine("throw new UnsupportedOperationException();"); javaBuffer.addLine("}"); }
Source:
<code>public Query getNamedSQLQuery(String queryName) { errorIfClosed(); NamedSQLQueryDefinition nsqlqd = findNamedNativeQuery( queryName ); Query query = new NoSQLQuery( nsqlqd, this, NO_PARAMETERS ); <START> query.setComment( "named native SQL query " + queryName ); <END> return query; }</code><technical_language>Is "SQL query"</technical_language>

Target:
public Query getNamedSQLQuery(String queryName) { errorIfClosed(); NamedSQLQueryDefinition nsqlqd = findNamedNativeQuery( queryName ); Query query = new NoSQLQuery( nsqlqd, this, NO_PARAMETERS ); query.setComment( "named native query " + queryName ); return query; }
Source:
<code>public void getContainerLogWithRestart() throws Exception { story.addStep(new Statement() { @Override public void evaluate() throws Throwable { configureCloud(); story.j.jenkins.addNode(new DumbSlave("slave", "dummy", tmp.newFolder("remoteFS").getPath(), "1", Node.Mode.NORMAL, "", new JNLPLauncher(), RetentionStrategy.NOOP, Collections.<NodeProperty<?>>emptyList())); WorkflowJob p = story.j.jenkins.createProject(WorkflowJob.class, "p"); p.setDefinition(new CpsFlowDefinition(loadPipelineScript("getContainerLogWithRestart.groovy") , true)); WorkflowRun b = p.scheduleBuild2(0).waitForStart(); SemaphoreStep.waitForStart("wait/1", b); SemaphoreStep.success("wait/1", false); Thread.sleep(1000); } }); story.addStep(new Statement() { <START> @SuppressWarnings("SleepWhileInLoop") <END> @Override public void evaluate() throws Throwable { WorkflowRun b = story.j.jenkins.getItemByFullName("p", WorkflowJob.class).getBuildByNumber(1); story.j.assertBuildStatusSuccess(story.j.waitForCompletion(b)); story.j.assertLogContains("INFO: Handshaking", b); story.j.assertLogContains("INFO: Connected", b); } }); }</code><technical_language>sleep AFAICT</technical_language>

Target:
public void getContainerLogWithRestart() throws Exception { story.then(r -> { configureCloud(); r.jenkins.addNode(new DumbSlave("slave", "dummy", tmp.newFolder("remoteFS").getPath(), "1", Node.Mode.NORMAL, "", new JNLPLauncher(), RetentionStrategy.NOOP, Collections.<NodeProperty<?>>emptyList())); WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p"); p.setDefinition(new CpsFlowDefinition(loadPipelineScript("getContainerLogWithRestart.groovy") , true)); WorkflowRun b = p.scheduleBuild2(0).waitForStart(); r.waitForMessage("+ sleep 5", b); }); story.then(r -> { WorkflowRun b = r.jenkins.getItemByFullName("p", WorkflowJob.class).getBuildByNumber(1); r.assertBuildStatusSuccess(r.waitForCompletion(b)); r.assertLogContains("INFO: Handshaking", b); r.assertLogContains("INFO: Connected", b); }); }
Source:
<code><START> public void createHttpMessage() throws IOException { <END> msg = new org.parosproxy.paros.network.HttpMessage(); msg.setRequestHeader("GET " + URI + " HTTP/1.1"); }</code><technical_language>moved beginning</technical_language>

Target:
public void createHttpMessage() throws IOException { msg = new HttpMessage(); msg.setRequestHeader("GET " + URI + " HTTP/1.1"); }
Source:
<code>protected boolean attachUserToSession() { <START> Date validTo = null; <END> if (!StringUtils.isEmpty(getParameters().getSessionId())) { validTo = SessionDataContainer.getInstance() .getValidTo(getParameters().getSessionId()); if (validTo.compareTo(new Date(System.currentTimeMillis())) < 0) { SessionDataContainer.getInstance().removeSession(getParameters().getSessionId()); return failCanDoAction(VdcBllMessages.USER_CANNOT_LOGIN_SESSION_MISSING); } SessionDataContainer.getInstance().setUser(getParameters().getSessionId(), getCurrentUser()); } else { if (!SessionDataContainer.getInstance().setUser(getCurrentUser())) { return failCanDoAction(VdcBllMessages.USER_CANNOT_LOGIN_SESSION_MISSING); } validTo = DateUtils.addMinutes(new Date(), Config.<Integer> getValue(ConfigValues.UserSessionTimeOutInterval)); try { Date fromExtension = new SimpleDateFormat("yyyy-MM-dd HH:mm:ssZ").parse(authRecord.<String> get(AuthRecord.VALID_TO)); validTo = validTo.compareTo(fromExtension) < 0 ? validTo : fromExtension; } catch (ParseException e) { log.warn("Error parsing AuthRecord.VALID_TO . Default VALID_TO value will be set on session"); } SessionDataContainer.getInstance().setValidTo(validTo); } return true; }</code><technical_language>do need validTo temp var here</technical_language>

Target:
protected boolean attachUserToSession() { if (!StringUtils.isEmpty(getParameters().getSessionId())) { SessionDataContainer.getInstance().setUser(getParameters().getSessionId(), getCurrentUser()); } else if (!SessionDataContainer.getInstance().setUser(getCurrentUser())) { return failCanDoAction(VdcBllMessages.USER_CANNOT_LOGIN_SESSION_MISSING); } return true; }
Source:
<code>public void updateParticipantWithMismatchedIdsUsesURL() throws Exception { <START> TestUtils.mockPlay().withJsonBody(createJson(createJson("{'id':'id2'}"))).mock(); <END> Result result = controller.updateParticipant("id1"); assertResult(result, 200, "Participant updated."); verify(mockParticipantService).updateParticipant(eq(study), participantCaptor.capture()); StudyParticipant persisted = participantCaptor.getValue(); assertEquals("id1", persisted.getId()); }</code><technical_language>Minor: call createJson() twice. Is this intentional</technical_language>

Target:
public void updateParticipantWithMismatchedIdsUsesURL() throws Exception { TestUtils.mockPlay().withJsonBody(createJson("{'id':'id2'}")).mock(); Result result = controller.updateParticipant("id1"); assertResult(result, 200, "Participant updated."); verify(mockParticipantService).updateParticipant(eq(study), participantCaptor.capture()); StudyParticipant persisted = participantCaptor.getValue(); assertEquals("id1", persisted.getId()); }
Source:
<code>@Override public void sendResponse(Exchange exchange, Response response) { <START> if (null == response.getType()) response.setType(Type.CON); <END> top.sendResponse(exchange, response); response.setAcknowledged(true); }</code><technical_language>please put statement a new line in curly braces</technical_language>

Target:
@Override public void sendResponse(Exchange exchange, Response response) { if (null == response.getType()) { response.setType(Type.CON); } top.sendResponse(exchange, response); response.setAcknowledged(true); }
Source:
<code>public boolean processLine(String line, ErrorParserManager epManager) { Matcher m = fixit.matcher(line); if (m.matches()) { IFile f = epManager.findFileName(m.group(1)); try { IMarker[] markers = f.findMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, true, IResource.DEPTH_ONE); if (markers.length > 0) { IMarker lastMarker = markers[markers.length - 1]; FixitManager.getInstance().addMarker(lastMarker, m.group(2), m.group(3)); } <START> } catch (CoreException e) { <END> CCorePlugin.log(e); } return true; } return super.processLine(line, epManager); }</code><technical_language>catch a NumberFormatException thrown Integer.valueOf() calls in Fixit constructor (called addMarker() in try block)</technical_language>

Target:
public boolean processLine(String line, ErrorParserManager epManager) { Matcher m = fixit.matcher(line); if (m.matches()) { IProject project = null; IFile f = epManager.findFileName(m.group(1)); if (f != null) { project = f.getProject(); try { ProblemMarkerInfo info = ProblemMarkerFilterManager.getInstance().getLastProblemMarker(f); String externalLocation = null; if (info.externalPath != null && !info.externalPath.isEmpty()) { externalLocation = info.externalPath.toOSString(); } IMarker[] markers = f.findMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, true, IResource.DEPTH_ONE); for (IMarker marker : markers) { int lineNumber = marker.getAttribute(IMarker.LINE_NUMBER, -1); int sev = marker.getAttribute(IMarker.SEVERITY, -1); String msg = (String) marker.getAttribute(IMarker.MESSAGE); if (lineNumber == info.lineNumber && sev == info.severity && msg.equals(info.description)) { String extloc = (String) marker.getAttribute(ICModelMarker.C_MODEL_MARKER_EXTERNAL_LOCATION); if (extloc == null || extloc.equals(externalLocation)) { if (project == null || project.equals(info.file.getProject())) { FixitManager.getInstance().addMarker(marker, m.group(2), m.group(3)); return true; } String source = (String) marker.getAttribute(IMarker.SOURCE_ID); if (project.getName().equals(source)) { FixitManager.getInstance().addMarker(marker, m.group(2), m.group(3)); return true; } } } } } catch (CoreException | NumberFormatException e) { CCorePlugin.log(e); } return true; } } return super.processLine(line, epManager); }
Source:
<code>public void update(final float tpf) { final double numHalf = 0.5; <START> final int numFour = 4; <END> time += tpf; if (time > numFour) { time = 0; if (moveRight) { moveRight = false; } else { moveRight = true; } } if (moveRight) { final Vector3f vec = spatial.getLocalTranslation(); final Vector3f loc = new Vector3f((float) (vec.getX() - numHalf), vec.getY(), vec.getZ()); spatial.setLocalTranslation(loc); this.setPhysicsLocation(loc); } else { final Vector3f vec = spatial.getLocalTranslation(); final Vector3f loc = new Vector3f((float) (vec.getX() + numHalf), vec.getY(), vec.getZ()); spatial.setLocalTranslation(loc); this.setPhysicsLocation(loc); } }</code><technical_language>Define this start of file</technical_language>

Target:
public void update(final float tpf) { time += tpf; if (time > TIME_TO_MOVE_IN_ONE_DIRECTION) { time = 0; if (moveRight) { moveRight = false; } else { moveRight = true; } } if (moveRight) { final Vector3f vec = spatial.getLocalTranslation(); final Vector3f loc = new Vector3f((float) (vec.getX() - STEP_SIZE), vec.getY(), vec.getZ()); spatial.setLocalTranslation(loc); this.setPhysicsLocation(loc); } else { final Vector3f vec = spatial.getLocalTranslation(); final Vector3f loc = new Vector3f((float) (vec.getX() + STEP_SIZE), vec.getY(), vec.getZ()); spatial.setLocalTranslation(loc); this.setPhysicsLocation(loc); } }
Source:
<code>private Throwable unwrap(Object error) { try { return ((ErrorResponse) error).getCause(); <START> } catch (Exception e) { <END> return (Throwable) error; } }</code><technical_language>a bit confused exception catching here. getCause fail.. error is null, ErrorResponse; cases handled a check</technical_language>

Target:
private Throwable unwrap(Object error) { if (error instanceof ErrorResponse) { return ((ErrorResponse) error).getCause(); } return (Throwable) error; }
Source:
<code><START> public Set<String> getUntrackedFolders() { <END> if (indexDiffFilter == null) { return Collections.<String> emptySet(); } else { HashSet<String> retVal = new HashSet<String>(indexDiffFilter.getUntrackedFolders()); retVal.removeAll(submodules); return retVal; } }</code><technical_language>Hmm, this is a change in public API. reporting untracked submodules in getUntracked I change API in a minor release. Other projects rely submodules in getUntracked. GITLINKS (submodule) objects tricky in this context: GITLINKS stored in index in trees leaves in object hierarchy. children of GITLINK objects index trees. persistence in filesystem trees. sense report untracked GITLINKS (untracked means exist in filesystem) directories, I agree. this change behaviour I suggest do fix this in CleanCommand. If getUntracked reports a folder check a GITLINK act accordingly</technical_language>

Target:
public Set<String> getUntrackedFolders() { return ((indexDiffFilter == null) ? Collections.<String> emptySet() : new HashSet<String>(indexDiffFilter.getUntrackedFolders())); }
Source:
<code>public boolean evaluateUnaryExpression(Object rawExpression, Object resultValue, Class<?> resultClass) { if (!(rawExpression instanceof String)) { String rawClass = rawExpression == null ? null : rawExpression.getClass().getCanonicalName(); throw new IllegalArgumentException("Raw value should be a String and not a '" + rawClass + "'"); } Map<String, Object> params = new HashMap<>(); params.put(ACTUAL_VALUE_IDENTIFIER, resultValue); Object expressionResult = compileAndExecute((String) rawExpression, params); if (!(expressionResult instanceof Boolean)) { return BaseExpressionOperator.EQUALS.eval(expressionResult, resultValue, resultClass, classLoader); } <START> return (boolean) expressionResult; <END> }</code><technical_language>Suggestion: exit point well</technical_language>

Target:
public boolean evaluateUnaryExpression(Object rawExpression, Object resultValue, Class<?> resultClass) { if (!(rawExpression instanceof String)) { String rawClass = rawExpression == null ? null : rawExpression.getClass().getCanonicalName(); throw new IllegalArgumentException("Raw expression should be a String and not a '" + rawClass + "'"); } Map<String, Object> params = new HashMap<>(); params.put(ACTUAL_VALUE_IDENTIFIER, resultValue); Object expressionResult = compileAndExecute((String) rawExpression, params); if (!(expressionResult instanceof Boolean)) { return BaseExpressionOperator.EQUALS.eval(expressionResult, resultValue, resultClass, classLoader); } return (boolean) expressionResult; }
Source:
<code>public SimpMessageType getMessageType() { <START> return (simpMessageType != null) ? simpMessageType : SimpMessageType.OTHER; <END> }</code><technical_language>Instead of checking for null here, pass SimpMessageType.OTHER instead of null constructors</technical_language>

Target:
public SimpMessageType getMessageType() { return simpMessageType; }
Source:
<code>public Map<String, String> paramsAsMap() { <START> Map<String, String> returnableMap = new HashMap<>(); <END> returnableMap.put("display_size", String.valueOf(this.getDisplaySize())); returnableMap.put("page", String.valueOf(this.getPage())); this.getBankStatementReference().ifPresent(bankStatementReference -> returnableMap.put("bank_statement_reference", bankStatementReference)); this.getEmail().ifPresent(email -> returnableMap.put("email", email)); this.getName().ifPresent(name -> returnableMap.put("name", name)); this.getFromDate().ifPresent(fromDate -> returnableMap.put("from_date", String.valueOf(fromDate))); this.getToDate().ifPresent(toDate -> returnableMap.put("to_date", String.valueOf(toDate))); this.getReference().ifPresent(reference -> returnableMap.put("reference", reference)); this.getState().ifPresent(state -> returnableMap.put("state", state)); return Collections.unmodifiableMap(returnableMap); }</code><technical_language>call this params, is. declare this var params = new HashMap<String, String>();</technical_language>

Target:
public Map<String, String> paramsAsMap() { var params = new HashMap<String, String>(); params.put("display_size", String.valueOf(this.getDisplaySize())); params.put("page", String.valueOf(this.getPage())); this.getBankStatementReference().ifPresent(bankStatementReference -> params.put("bank_statement_reference", bankStatementReference)); this.getEmail().ifPresent(email -> params.put("email", email)); this.getName().ifPresent(name -> params.put("name", name)); this.getFromDate().ifPresent(fromDate -> params.put("from_date", String.valueOf(fromDate))); this.getToDate().ifPresent(toDate -> params.put("to_date", String.valueOf(toDate))); this.getReference().ifPresent(reference -> params.put("reference", reference)); this.getState().ifPresent(state -> params.put("state", state)); return Collections.unmodifiableMap(params); }
Source:
<code>public void testExecutableAttributes() throws Exception { FS fs = FS.DETECTED; assumeTrue(fs.getClass().equals(FS_POSIX_Java7.class)); File f = new File(trash, "bla"); assertTrue(f.createNewFile()); assertFalse(fs.canExecute(f)); String umask = readUmask(); if (umask == null) return; char others = umask.charAt(umask.length() - 1); boolean badUmask; if (others != '0' && others != '2' && others != '4' && others != '6') { badUmask = true; } else { badUmask = false; } Set<PosixFilePermission> permissions = readPermissions(f); assertTrue(!permissions.contains(PosixFilePermission.OTHERS_EXECUTE)); assertTrue(!permissions.contains(PosixFilePermission.GROUP_EXECUTE)); assertTrue(!permissions.contains(PosixFilePermission.OWNER_EXECUTE)); fs.setExecute(f, true); <START> RepositoryTestCase.fsTick(f); <END> permissions = readPermissions(f); assertTrue("'owner' execute permission not set", permissions.contains(PosixFilePermission.OWNER_EXECUTE)); assertTrue("'group' execute permission not set", permissions.contains(PosixFilePermission.GROUP_EXECUTE)); if (badUmask) { assertFalse("'others' execute permission set", permissions.contains(PosixFilePermission.OTHERS_EXECUTE)); System.err.println("WARNING: your system's umask: \"" + umask + "\" doesn't allow FSJava7Test to test if setting posix" + " permissions for \"others\" works properly"); assumeFalse(badUmask); } else { assertTrue("'others' execute permission not set", permissions.contains(PosixFilePermission.OTHERS_EXECUTE)); } }</code><technical_language>this fsTick() call? waits long enough next filesystem modification lead a lastmodification timestamp younger modification timestamp of f. Means: a file modified fstick call a younger modification timestamp f. is this needed here</technical_language>

Target:
public void testExecutableAttributes() throws Exception { FS fs = FS.DETECTED; org.junit.Assume.assumeTrue(fs.getClass().equals(FS_POSIX_Java7.class)); File f = new File(trash, "bla"); assertTrue(f.createNewFile()); assertFalse(fs.canExecute(f)); String umask = readUmask(); if (umask == null) { return; } char others = umask.charAt(umask.length() - 1); boolean badUmask; if (others != '0' && others != '2' && others != '4' && others != '6') { badUmask = true; } else { badUmask = false; } Set<PosixFilePermission> permissions = readPermissions(f); assertTrue(!permissions.contains(PosixFilePermission.OTHERS_EXECUTE)); assertTrue(!permissions.contains(PosixFilePermission.GROUP_EXECUTE)); assertTrue(!permissions.contains(PosixFilePermission.OWNER_EXECUTE)); fs.setExecute(f, true); permissions = readPermissions(f); assertTrue("'owner' execute permission not set", permissions.contains(PosixFilePermission.OWNER_EXECUTE)); assertTrue("'group' execute permission not set", permissions.contains(PosixFilePermission.GROUP_EXECUTE)); if (badUmask) { assertFalse("'others' execute permission set", permissions.contains(PosixFilePermission.OTHERS_EXECUTE)); fail("Unexpected umask during test execution: " + umask); } else { assertTrue("'others' execute permission not set", permissions.contains(PosixFilePermission.OTHERS_EXECUTE)); } }
Source:
<code>public static DataWord of(long num) { <START> return of(ByteBuffer.allocate(8).putLong(num).array()); <END> }</code><technical_language>this already: org.ethereum.util.ByteUtil.longToBytes</technical_language>

Target:
public static DataWord of(long num) { return of(ByteBuffer.allocate(Long.BYTES).putLong(num).array()); }
Source:
<code>protected void setASTLevel(int level, boolean doRefresh) { int oldLevel= fCurrentASTLevel; fCurrentASTLevel= level; fDialogSettings.put(SETTINGS_JLS, fCurrentASTLevel); if (doRefresh && fTypeRoot != null && oldLevel != fCurrentASTLevel) { try { refreshAST(); } catch (CoreException e) { showAndLogError("Could not set AST to new level.", e); fCurrentASTLevel= oldLevel; } } for (ASTView.ASTLevelToggle <START> curr : <END> fASTVersionToggleActions) { curr.setChecked(curr.getLevel() == fCurrentASTLevel); } }</code><technical_language>rename action</technical_language>

Target:
protected void setASTLevel(int level, boolean doRefresh) { int oldLevel= fCurrentASTLevel; fCurrentASTLevel= level; fDialogSettings.put(SETTINGS_JLS, fCurrentASTLevel); if (doRefresh && fTypeRoot != null && oldLevel != fCurrentASTLevel) { try { refreshAST(); } catch (CoreException e) { showAndLogError("Could not set AST to new level.", e); fCurrentASTLevel= oldLevel; } } for (ASTView.ASTLevelToggle action : fASTVersionToggleActions) { action.setChecked(action.getLevel() == fCurrentASTLevel); } }
Source:
<code>public void receiveCaptureMessages() throws QueueException { List<QueueMessage> captureMessages = sqsQueueService.receiveMessages(this.captureQueueUrl, CAPTURE_MESSAGE_ATTRIBUTE_NAME); for (QueueMessage message: captureMessages) { try { <START> cardCaptureMessageProcess.runCapture(message); <END> sqsQueueService.deleteMessage(this.captureQueueUrl, message); } catch (Exception e) { logger.warn("Error capturing charge from SQS message [{}]", e); } } }</code><technical_language>I discussed this, this method name - I expect caller of receiveCaptureMessages messages do</technical_language>

Target:
public List<QueueMessage> receiveCaptureMessages() throws QueueException { return sqsQueueService.receiveMessages(this.captureQueueUrl, CAPTURE_MESSAGE_ATTRIBUTE_NAME); }
Source:
<code>protected void createNewClientId() throws Exception { String uri = BASE_PROFILE + uriEncode(_profileName) + "/" + BASE_CLIENTS; <START> System.out.println("Request Url :"+ uri); <END> try { JSONObject response = new JSONObject(doPost(uri, null)); System.out.println("Response is :"+ response.toString()); _clientId = response.getJSONObject("client").getString("uuid"); toggleProfile(true); } catch (Exception e) { e.printStackTrace(); throw new Exception("Could not create a proxy client"); } }</code><technical_language>remove print statement Logger instead</technical_language>

Target:
protected void createNewClientId() throws Exception { String uri = BASE_PROFILE + uriEncode(_profileName) + "/" + BASE_CLIENTS; try { JSONObject response = new JSONObject(doPost(uri, null)); _clientId = response.getJSONObject("client").getString("uuid"); toggleProfile(true); } catch (Exception e) { e.printStackTrace(); throw new Exception("Could not create a proxy client"); } }
Source:
<code>public void testFindWorkingVersionTemplate() throws Exception{ Template template=new Template(); template.setTitle("TEST TEMPLATE VERSIONABLE"); template.setBody("<html><body> I'm mostly empty </body></html>"); <START> template=APILocator.getTemplateAPI().saveTemplate(template, host, user, false); <END> Versionable verAPI = APILocator.getVersionableAPI().findWorkingVersion(template.getIdentifier(), user, false); assertEquals(verAPI.getTitle(),template.getTitle()); assertEquals(verAPI.getInode(),template.getInode()); APILocator.getTemplateAPI().delete(template, user, false); }</code><technical_language>above: Template template = new TemplateDataGen().nextPersisted();</technical_language>

Target:
public void testFindWorkingVersionTemplate() throws Exception{ Template template = new TemplateDataGen().nextPersisted(); Versionable verAPI = APILocator.getVersionableAPI().findWorkingVersion(template.getIdentifier(), user, false); assertEquals(verAPI.getTitle(),template.getTitle()); assertEquals(verAPI.getInode(),template.getInode()); APILocator.getTemplateAPI().delete(template, user, false); }
Source:
<code>public String docs() { return "void {eventName, eventObject, [serverWide]} Manually triggers bound events." + " The event object passed to this function is sent directly as-is to the bound events." + " Check the documentation for each event to see what is required." + " No checks will be done on the data here," + " but it is not recommended to fail to send all parameters required." + " If serverWide is true, the event is triggered directly in the server," + " unless it is a CommandHelper specific event, in which case, serverWide is irrelevant." + " Defaults to false, which means that only CommandHelper code will receive the event." + " Throws a CastException when eventObject is not an array and not null." + " Throws a BindException when " + getName() + "() is not yet supported by the given event." <START> + " Throws a CREIllegalArgumentException exception, if the event does not exist."; <END> }</code><technical_language>End users do a CREIllegalArgumentException is, is IllegalArgumentException</technical_language>

Target:
public String docs() { return "void {eventName, eventObject, [serverWide]} Manually triggers bound events." + " The event object passed to this function is sent directly as-is to the bound events." + " Check the documentation for each event to see what is required." + " No checks will be done on the data here," + " but it is not recommended to fail to send all parameters required." + " If serverWide is true, the event is triggered directly in the server," + " unless it is a CommandHelper specific event, in which case, serverWide is irrelevant." + " Defaults to false, which means that only CommandHelper code will receive the event." + " Throws a CastException when eventObject is not an array and not null." + " Throws a BindException when " + getName() + "() is not yet supported by the given event." + " Throws a IllegalArgumentException exception, if the event does not exist."; }
Source:
<code>public <T> T encodeAndTransform( ServiceMessage message, BiFunction<ByteBuf, ByteBuf, T> transformer) throws MessageCodecException { ByteBuf dataBuffer = Unpooled.EMPTY_BUFFER; ByteBuf headersBuffer = Unpooled.EMPTY_BUFFER; if (message.hasData(ByteBuf.class)) { dataBuffer = message.data(); } else if (message.hasData()) { dataBuffer = ByteBufAllocator.DEFAULT.buffer(); try { DataCodec dataCodec = getDataCodecByContentType(message.dataFormatOrDefault()); dataCodec.encode(new ByteBufOutputStream(dataBuffer), message.data()); } catch (Throwable ex) { ReferenceCountUtil.safestRelease(dataBuffer); <START> LOGGER.error("Failed to encode data on: {}, cause: {}", message, ex); <END> throw new MessageCodecException( "Failed to encode data on message q=" + message.qualifier(), ex); } } if (!message.headers().isEmpty()) { headersBuffer = ByteBufAllocator.DEFAULT.buffer(); try { headersCodec.encode(new ByteBufOutputStream(headersBuffer), message.headers()); } catch (Throwable ex) { ReferenceCountUtil.safestRelease(headersBuffer); ReferenceCountUtil.safestRelease(dataBuffer); LOGGER.error("Failed to encode headers on: {}, cause: {}", message, ex); throw new MessageCodecException( "Failed to encode headers on message q=" + message.qualifier(), ex); } } return transformer.apply(dataBuffer, headersBuffer); }</code><technical_language>print empty curly braces (cause: {})</technical_language>

Target:
public <T> T encodeAndTransform( ServiceMessage message, BiFunction<ByteBuf, ByteBuf, T> transformer) throws MessageCodecException { ByteBuf dataBuffer = Unpooled.EMPTY_BUFFER; ByteBuf headersBuffer = Unpooled.EMPTY_BUFFER; if (message.hasData(ByteBuf.class)) { dataBuffer = message.data(); } else if (message.hasData()) { dataBuffer = ByteBufAllocator.DEFAULT.buffer(); try { DataCodec dataCodec = getDataCodec(message.dataFormatOrDefault()); dataCodec.encode(new ByteBufOutputStream(dataBuffer), message.data()); } catch (Throwable ex) { ReferenceCountUtil.safestRelease(dataBuffer); LOGGER.error("Failed to encode data on: {}, cause: {}", message, ex.toString()); throw new MessageCodecException( "Failed to encode data on message q=" + message.qualifier(), ex); } } if (!message.headers().isEmpty()) { headersBuffer = ByteBufAllocator.DEFAULT.buffer(); try { headersCodec.encode(new ByteBufOutputStream(headersBuffer), message.headers()); } catch (Throwable ex) { ReferenceCountUtil.safestRelease(headersBuffer); ReferenceCountUtil.safestRelease(dataBuffer); LOGGER.error("Failed to encode headers on: {}, cause: {}", message, ex.toString()); throw new MessageCodecException( "Failed to encode headers on message q=" + message.qualifier(), ex); } } return transformer.apply(dataBuffer, headersBuffer); }
Source:
<code>public void GIICompletesSuccessfullyWhenRunningDuringClearWithPersistentRegion() { if (regionShortcut == RegionShortcut.PARTITION) { regionShortcut = RegionShortcut.PARTITION_PERSISTENT; } else if (regionShortcut == RegionShortcut.REPLICATE) { regionShortcut = RegionShortcut.REPLICATE_PERSISTENT; } initDataStores(NUM_SERVERS); configureServers(regionShortcut); verifyRegionSizes(DATA_SIZE); <START> dataStores[1].invoke(new SerializableRunnable() { <END> @Override public void run() { PauseDuringGIICallback myAfterReceivedImageReply = new PauseDuringGIICallback( InitialImageOperation.GIITestHookType.AfterReceivedRequestImage, "_B__testPR_9"); InitialImageOperation.setGIITestHook(myAfterReceivedImageReply); } }); cluster.stop(2); createDelta(50); restartServerOnVM(2); AsyncInvocation async = createRegionAsync(dataStores[1]); invokeClear(dataStores[0]); dataStores[1].invoke(() -> InitialImageOperation.resetGIITestHook( InitialImageOperation.GIITestHookType.AfterReceivedRequestImage, true)); try { async.getResult(30000); } catch (InterruptedException ex) { Assert.fail("Async create interupted" + ex.getMessage()); } verifyRegionSizes(0); }</code><technical_language>lamda</technical_language>

Target:
public void GIICompletesSuccessfullyWhenRunningDuringClearWithPersistentRegion() { if (regionShortcut == RegionShortcut.PARTITION) { regionShortcut = RegionShortcut.PARTITION_PERSISTENT; } else if (regionShortcut == RegionShortcut.REPLICATE) { regionShortcut = RegionShortcut.REPLICATE_PERSISTENT; } startServers(NUM_SERVERS); verifyRegionSizes(DATA_SIZE); serverVMs[1].invoke(() -> { PauseDuringGIICallback myAfterReceivedImageReply = new PauseDuringGIICallback( InitialImageOperation.GIITestHookType.AfterReceivedRequestImage, "_B__testPR_9"); InitialImageOperation.setGIITestHook(myAfterReceivedImageReply); }); cluster.stop(2); createDelta(50); restartServerOnVM(2); AsyncInvocation async = createRegionAsync(serverVMs[1]); invokeClear(serverVMs[0]); serverVMs[1].invoke(() -> InitialImageOperation.resetGIITestHook( InitialImageOperation.GIITestHookType.AfterReceivedRequestImage, true)); try { async.getResult(30000); } catch (InterruptedException ex) { Assert.fail("Async create interupted" + ex.getMessage()); } verifyRegionSizes(0); }
Source:
<code>public void run() { StringBuilder err = new StringBuilder(); try (InputStream is = p.getErrorStream()) { int ch; while ((ch = is.read()) != -1) { err.append((char) ch); } } catch (IOException e) { final boolean <START> processExited = <END> waitForProcessCompletion(); if (!processExited) { setError(e, String.format("Command '%s' closed stderr stream but didn't exit within timeout %s seconds", desc, PROCESS_EXIT_TIMEOUT), -1); fail.set(true); } else if (p.exitValue() != 0) { setError(e, e.getMessage(), p.exitValue()); fail.set(true); } else { } } finally { final boolean processExited = waitForProcessCompletion(); if (!processExited) { setError(null, String.format("Command '%s' closed stderr stream but didn't exit within timeout %s seconds", desc, PROCESS_EXIT_TIMEOUT), -1); fail.set(true); } else if (err.length() > 0) { setError(null, err.toString(), p.exitValue()); if (p.exitValue() != 0) { fail.set(true); } } } }</code><technical_language>unnecessary variable inlined</technical_language>

Target:
public void run() { StringBuilder err = new StringBuilder(); try (InputStream is = p.getErrorStream()) { int ch; while ((ch = is.read()) != -1) { err.append((char) ch); } } catch (IOException e) { if (waitForProcessCompletion(e) && p.exitValue() != 0) { setError(e, e.getMessage(), p.exitValue()); fail.set(true); } else { } } finally { if (waitForProcessCompletion(null) && err.length() > 0) { setError(null, err.toString(), p.exitValue()); if (p.exitValue() != 0) { fail.set(true); } } } }