auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected HttpWebRequest prepareHttpPoolingWebRequestForUrl(URI url, boolean acceptGzipEncoding, boolean allowAutoRedirect) throws ServiceLocalException, URISyntaxException { String scheme = url.getScheme(); if (!scheme.equalsIgnoreCase(EWSConstants.HTTP_SCHEME) && !scheme.equalsIgnoreCase(EWSConstants.HTTPS_SCHEME)) { String strErr = String.format("Protocol %s isn't supported for service request.", scheme); throw new ServiceLocalException(strErr); } <START> if (httpPoolingClient == null) <END> initializeHttpPoolingClient(); HttpClientWebRequest request = new HttpClientWebRequest(httpPoolingClient, httpContext); prepareHttpWebRequestForUrl(url, acceptGzipEncoding, allowAutoRedirect, request); return request; }</code><technical_language>I google-style suggests braces possible</technical_language>

Target:
protected HttpWebRequest prepareHttpPoolingWebRequestForUrl(URI url, boolean acceptGzipEncoding, boolean allowAutoRedirect) throws ServiceLocalException, URISyntaxException { String scheme = url.getScheme(); if (!scheme.equalsIgnoreCase(EWSConstants.HTTP_SCHEME) && !scheme.equalsIgnoreCase(EWSConstants.HTTPS_SCHEME)) { String strErr = String.format("Protocol %s isn't supported for service request.", scheme); throw new ServiceLocalException(strErr); } if (httpPoolingClient == null) { initializeHttpPoolingClient(); } HttpClientWebRequest request = new HttpClientWebRequest(httpPoolingClient, httpContext); prepareHttpWebRequestForUrl(url, acceptGzipEncoding, allowAutoRedirect, request); return request; }
Source:
<code>public Map<String, String> getSettings() { return ImmutableMap.of( <START> Constants.SUPPORTED_ENVIRONMENTS, <END> Joiner.on(",").join(workspaceManager.getSupportedRecipes())); }</code><technical_language>change constant -> supportedRecipes</technical_language>

Target:
public Map<String, String> getSettings() { return ImmutableMap.of( Constants.SUPPORTED_RECIPE_TYPES, Joiner.on(",").join(workspaceManager.getSupportedRecipes())); }
Source:
<code>public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } AbbreviationViewModel that = (AbbreviationViewModel) o; <START> return getName().equals(that.getName()) && <END> isPseudoAbbreviation() == that.isPseudoAbbreviation(); }</code><technical_language>Objects.equals(...) more consistent other implementations</technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } AbbreviationViewModel that = (AbbreviationViewModel) o; return Objects.equals(getName(), that.getName()) && isPseudoAbbreviation() == that.isPseudoAbbreviation(); }
Source:
<code>public static String rawType(String type) { int openIndex = type.indexOf('<'); if (openIndex != -1) { <START> int closeIndex = type.indexOf('>', openIndex); <END> if (closeIndex != -1) { return type.substring(0, openIndex) + type.substring(closeIndex + 1); } } return type; }</code><technical_language>This work for more complicated generic parameters. For example: Foo<A extends Foo<A, B>, B> pretty if a < chop rest of type completely</technical_language>

Target:
public static String rawType(String type) { int lessThanIndex = type.indexOf('<'); if (lessThanIndex != -1) { return type.substring(0, lessThanIndex); } return type; }
Source:
<code>public void recognizeCustomFormUrlUnlabeledData(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormRecognizerAsyncClient(httpClient, serviceVersion); urlDataRunner(fileUrl -> beginTrainingUnlabeledRunner((trainingFilesUrl, useTrainingLabels) -> { SyncPoller<OperationResult, CustomFormModel> trainingPoller = getFormTrainingAsyncClient(httpClient, serviceVersion).beginTraining(trainingFilesUrl, useTrainingLabels).getSyncPoller(); trainingPoller.waitForCompletion(); SyncPoller<OperationResult, List<RecognizedForm>> syncPoller = client.beginRecognizeCustomForms( new RecognizeCustomFormsOptions(fileUrl, trainingPoller.getFinalResult().getModelId()) <START> .setIncludeTextContent(false)).getSyncPoller(); <END> syncPoller.waitForCompletion(); validateRecognizedResult(syncPoller.getFinalResult(), false, false); }), FORM_JPG); }</code><technical_language>here, need set false. false default</technical_language>

Target:
public void recognizeCustomFormUrlUnlabeledData(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormRecognizerAsyncClient(httpClient, serviceVersion); urlRunner(fileUrl -> beginTrainingUnlabeledRunner((trainingFilesUrl, useTrainingLabels) -> { SyncPoller<OperationResult, CustomFormModel> trainingPoller = getFormTrainingAsyncClient(httpClient, serviceVersion).beginTraining(trainingFilesUrl, useTrainingLabels, null, durationTestMode).getSyncPoller(); trainingPoller.waitForCompletion(); SyncPoller<OperationResult, List<RecognizedForm>> syncPoller = client.beginRecognizeCustomForms( new RecognizeCustomFormsOptions(fileUrl, trainingPoller.getFinalResult().getModelId()) .setPollInterval(durationTestMode)).getSyncPoller(); syncPoller.waitForCompletion(); validateRecognizedResult(syncPoller.getFinalResult(), false, false); }), FORM_JPG); }
Source:
<code><START> void findFormTypes1099FromFormCodeEmptyString() { <END> try { FormTypes1099.findFormTypes1099FromFormCode(StringUtils.EMPTY); fail("Should have an illegal argument exception"); } catch (Exception e) { assertEquals(IllegalArgumentException.class, e.getClass()); } }</code><technical_language>want a test case for a search is non-blank invalid</technical_language>

Target:
void findFormTypes1099FromFormCodeEmptyString() { try { FormTypes1099.findFormTypes1099FromFormCode(StringUtils.EMPTY); fail(SHOULD_HAVE_AN_ILLEGAL_ARGUMENT_EXCEPTION); } catch (Exception e) { assertEquals(IllegalArgumentException.class, e.getClass()); } }
Source:
<code>private void checkPipelineExists(Request request, Response response) { if (isPipelineRequest(request)) { <START> if (null == pipelineConfigService.getPipelineConfig(request.queryParams("pipeline_name"))) { <END> throw halt(404, format("Cannot generate analytics. Pipeline with name:'%s' not found.", request.queryParams("pipeline_name"))); } } }</code><technical_language>GoConfigService#pipelineConfigByName - optimized for faster lookups, instead of iterating pipelines in config</technical_language>

Target:
private void checkPipelineExists(Request request, Response response) { if (isPipelineRequest(request)) { if (null == pipelineConfigService.pipelineConfigNamed(request.queryParams("pipeline_name"))) { throw halt(404, format("Cannot generate analytics. Pipeline with name: '%s' not found.", request.queryParams("pipeline_name"))); } } }
Source:
<code>private String getExoManifest() { String mainManifest = getMainManifest(); if (mainManifest != null) { <START> String exoManifest = mainManifest.replace("main", "exo"); <END> if (getProject().file(exoManifest).exists()) { return exoManifest; } else { return mainManifest; } } return null; }</code><technical_language>purpose of string replace. This is specific works if folks name exo variant 'exo'. hardcore names here</technical_language>

Target:
private String getExoManifest() { String mainManifest = getMainManifest(); List<String> secondaryManifests = getSecondaryManifests(); if (secondaryManifests != null) { Optional<String> optionalExoManifest = secondaryManifests.stream().filter(manifest -> manifest.contains(getName())).findAny(); return optionalExoManifest.orElse(mainManifest); } return mainManifest; }
Source:
<code>public Model makeModel(String id) { Model m = SAMPFactory.get(Model.class); m.setName(type.name().toLowerCase() + "." + id); String[] parNames = makeArray(this.getParnames(), String.class); Double[] parVals = makeArray(this.getParvals(), Double.class); Double[] parMins = makeArray(this.getParmins(), Double.class); Double[] parMaxs = makeArray(this.getParmaxs(), Double.class); Boolean[] parFrozens = makeArray(this.getParfrozen(), Boolean.class); for (int i=0; i<parNames.length; i++) { try { Parameter p = SAMPFactory.get(Parameter.class); p.setName(parNames[i]); p.setVal(parVals[i]); p.setMin(parMins[i]); p.setMax(parMaxs[i]); p.setFrozen(parFrozens[i] ? 1 : 0); m.addPar(p); <START> } catch(IndexOutOfBoundsException ex) { <END> throw new IllegalStateException("Array Shapes Mismatch", ex); } } return m; }</code><technical_language>Check this condition starting loop. ifs try/catch</technical_language>

Target:
public Model makeModel(String id) { Model m = SAMPFactory.get(Model.class); m.setName(composeType(type, id)); String[] parNames = makeArray(this.getParnames(), String.class); Double[] parVals = makeArray(this.getParvals(), Double.class); Double[] parMins = makeArray(this.getParmins(), Double.class); Double[] parMaxs = makeArray(this.getParmaxs(), Double.class); Boolean[] parFrozens = makeArray(this.getParfrozen(), Boolean.class); for (int i=0; i<parNames.length; i++) { try { Parameter p = SAMPFactory.get(Parameter.class); p.setName(compose(id,parNames[i])); p.setVal(parVals[i]); p.setMin(parMins[i]); p.setMax(parMaxs[i]); p.setFrozen(parFrozens[i] ? 1 : 0); m.addPar(p); } catch(IndexOutOfBoundsException ex) { throw new IllegalStateException("Array Shapes Mismatch", ex); } } return m; }
Source:
<code>private final AnnotatedTypeMirror fromMember(Tree tree) { if (!(tree instanceof MethodTree || tree instanceof VariableTree)) { throw new BugInCF( "AnnotatedTypeFactory.fromMember: not a method or variable declaration: " + tree); } if (shouldCache && fromMemberTreeCache.containsKey(tree)) { return fromMemberTreeCache.get(tree).deepCopy(); } AnnotatedTypeMirror result = TypeFromTree.fromMember(this, tree); <START> if (checker.hasOption("mergeStubsWithSource")) { <END> Element elt = TreeUtils.elementFromTree(tree); AnnotatedTypeMirror stubType = stubTypes.getAnnotatedTypeMirror(elt); if (stubType != null) { if (result == null) { result = stubType; } else { AnnotatedTypeMerger.merge(stubType, result); } } } if (shouldCache) { fromMemberTreeCache.put(tree, result.deepCopy()); } return result; }</code><technical_language>This is practically identical diff hunk above. abstracting out</technical_language>

Target:
private final AnnotatedTypeMirror fromMember(Tree tree) { if (!(tree instanceof MethodTree || tree instanceof VariableTree)) { throw new BugInCF( "AnnotatedTypeFactory.fromMember: not a method or variable declaration: " + tree); } if (shouldCache && fromMemberTreeCache.containsKey(tree)) { return fromMemberTreeCache.get(tree).deepCopy(); } AnnotatedTypeMirror result = TypeFromTree.fromMember(this, tree); if (checker.hasOption("mergeStubsWithSource")) { result = mergeStubsIntoType(result, tree); } if (shouldCache) { fromMemberTreeCache.put(tree, result.deepCopy()); } return result; }
Source:
<code>private boolean deleteSegment() { try { TableConfig tableConfig = JsonUtils.fileToObject(new File(_tableConfigFileName), TableConfig.class); _tableName = tableConfig.getTableName(); ControllerTest.sendDeleteRequest(ControllerRequestURLBuilder.baseUrl(ClusterDescriptor.CONTROLLER_URL) .forSegmentDelete(_tableName, _segmentName)); long startTime = System.currentTimeMillis(); <START> while (getOnlineSegmentCount() > 0) { <END> if ((System.currentTimeMillis() - startTime) > DEFAULT_MAX_SLEEP_TIME_MS) { LOGGER.error("Delete segment verification failed, count is greater than zero after max wait time ms.", DEFAULT_MAX_SLEEP_TIME_MS); return false; } LOGGER .warn("Delete segment verification count greater than zero, will retry after ms.", DEFAULT_WAIT_TIME_MS); Thread.sleep(DEFAULT_WAIT_TIME_MS); } } catch (Exception e) { LOGGER.error("Request to delete the segment for the table failed.", _segmentName, _tableName, e); return false; } LOGGER.info("Successfully delete the segment for the table {}.", _segmentName, _tableName); return true; }</code><technical_language>assume this is segment deleted. call a method called verifySegmentdeleted(), method fetch externalView segment is in it</technical_language>

Target:
private boolean deleteSegment() { try { TableConfig tableConfig = JsonUtils.fileToObject(new File(_tableConfigFileName), TableConfig.class); _tableName = tableConfig.getTableName(); ControllerTest.sendDeleteRequest(ControllerRequestURLBuilder.baseUrl(ClusterDescriptor.CONTROLLER_URL) .forSegmentDelete(_tableName, _segmentName)); return verifySegmentDeleted(); } catch (Exception e) { LOGGER.error("Request to delete the segment for the table failed.", _segmentName, _tableName, e); return false; } }
Source:
<code>public void dispose() { <START> stereotypeItemProviderDecorators.clear(); <END> super.dispose(); }</code><technical_language>This is enough. method DecoratorAdapterFactory#dispose(). iterate values of map dispose propery</technical_language>

Target:
public void dispose() { for (Object object : stereotypeItemProviderDecorators.values()) { if (object instanceof IDisposable) { ((IDisposable)object).dispose(); } } super.dispose(); }
Source:
<code>protected Pair<Double, ServerHolder> chooseBestServer( final DataSegment proposalSegment, final Iterable<ServerHolder> serverHolders, final boolean includeCurrentServer ) { Pair<Double, ServerHolder> bestServer = Pair.of(Double.POSITIVE_INFINITY, null); List<ListenableFuture<Pair<Double, ServerHolder>>> futures = Lists.newArrayList(); for (final ServerHolder server : serverHolders) { futures.add( exec.submit( new Callable<Pair<Double, ServerHolder>>() { @Override public Pair<Double, ServerHolder> call() throws Exception { return Pair.of(computeCost(proposalSegment, server, includeCurrentServer), server); } } ) ); } final ListenableFuture<List<Pair<Double, ServerHolder>>> resultsFuture = Futures.allAsList(futures); final List<Pair<Double, ServerHolder>> bestServers = new ArrayList<>(); try { for (Pair<Double, ServerHolder> server : resultsFuture.get()) { if (server.lhs < bestServer.lhs) { bestServer = server; } } <START> for (Pair<Double, ServerHolder> server : resultsFuture.get()) { <END> if (server.lhs == bestServer.lhs) { bestServers.add(server); } } bestServer = (bestServers.size() > 0) ? bestServers.get((int)Math.random()*bestServers.size()): bestServer; } catch (Exception e) { log.makeAlert(e, "Cost Balancer Multithread strategy wasn't able to complete cost computation.").emit(); } return bestServer; }</code><technical_language>loops combined, need iterate servers twice</technical_language>

Target:
protected Pair<Double, ServerHolder> chooseBestServer( final DataSegment proposalSegment, final Iterable<ServerHolder> serverHolders, final boolean includeCurrentServer ) { Pair<Double, ServerHolder> bestServer = Pair.of(Double.POSITIVE_INFINITY, null); List<ListenableFuture<Pair<Double, ServerHolder>>> futures = Lists.newArrayList(); for (final ServerHolder server : serverHolders) { futures.add( exec.submit( new Callable<Pair<Double, ServerHolder>>() { @Override public Pair<Double, ServerHolder> call() throws Exception { return Pair.of(computeCost(proposalSegment, server, includeCurrentServer), server); } } ) ); } final ListenableFuture<List<Pair<Double, ServerHolder>>> resultsFuture = Futures.allAsList(futures); final List<Pair<Double, ServerHolder>> bestServers = new ArrayList<>(); bestServers.add(bestServer); try { for (Pair<Double, ServerHolder> server : resultsFuture.get()) { if (server.lhs <= bestServers.get(0).lhs) { if (server.lhs < bestServers.get(0).lhs) { bestServers.clear(); } bestServers.add(server); } } bestServer = bestServers.get((int) Math.random() * bestServers.size()); } catch (Exception e) { log.makeAlert(e, "Cost Balancer Multithread strategy wasn't able to complete cost computation.").emit(); } return bestServer; }
Source:
<code>private CamusWrapper getWrappedRecord(String topicName, byte[] payload) throws IOException { CamusWrapper r = null; try { r = decoder.decode(payload); } catch (SchemaNotFoundException e) { <START> mapperContext.getCounter(MSG_SKIPPED.SCHEMA_NOT_FOUND).increment(1); <END> if (!skipSchemaErrors) { throw new IOException(e); } } catch (Exception e) { mapperContext.getCounter(MSG_SKIPPED.OTHER).increment(1); if (!skipSchemaErrors) { throw new IOException(e); } } return r; }</code><technical_language>do counter values later? I of requirement is fail job skip percentage is threshold</technical_language>

Target:
private CamusWrapper getWrappedRecord(String topicName, byte[] payload) throws IOException { CamusWrapper r = null; try { r = decoder.decode(payload); mapperContext.getCounter(KAFKA_MSG.DECODE_SUCCESSFUL).increment(1); } catch (SchemaNotFoundException e) { mapperContext.getCounter(KAFKA_MSG.SKIPPED_SCHEMA_NOT_FOUND).increment(1); if (!skipSchemaErrors) { throw new IOException(e); } } catch (Exception e) { mapperContext.getCounter(KAFKA_MSG.SKIPPED_OTHER).increment(1); if (!skipSchemaErrors) { throw new IOException(e); } } return r; }
Source:
<code>public List<Long> getQuantiles(List<Double> quantiles) { List<Long> accumulator = new ArrayList<Long>(quantiles.size()); <START> for (Double q : quantiles) { <END> accumulator.add(getQuantile(q)); } return accumulator; }</code><technical_language>this double q</technical_language>

Target:
public List<Long> getQuantiles(List<Double> quantiles) { List<Long> accumulator = new ArrayList<Long>(quantiles.size()); for (double q : quantiles) { accumulator.add(getQuantile(q)); } return accumulator; }
Source:
<code>private void finishTimelineUpdate(final String eventTypeName) throws TimelineException { try { timelineSync.finishTimelineUpdate(eventTypeName); } catch (final InterruptedException ie) { Thread.currentThread().interrupt(); throw new TimelineException("Timeline update was interrupted for:" + eventTypeName); } catch (final RuntimeException re) { <START> throw new TimelineException("Timeline update was interrupted for:" + eventTypeName, re); <END> } }</code><technical_language>message for Interrupted exception. Is ok</technical_language>

Target:
private void finishTimelineUpdate(final String eventTypeName) throws TimelineException { try { timelineSync.finishTimelineUpdate(eventTypeName); } catch (final InterruptedException ie) { Thread.currentThread().interrupt(); throw new TimelineException("Timeline update was interrupted for:" + eventTypeName); } catch (final RuntimeException re) { throw new TimelineException("Failed to finish timeline update for:" + eventTypeName, re); } }
Source:
<code>public void checkAttributeValidity(XAttributeType attribute) { String min = attribute.getMin(); int minOccurrences = 0; if (!Strings.isEmpty(min)) { minOccurrences = Integer.parseInt(min); if (minOccurrences > 0 && Strings.isEmpty(attribute.getDefaultValue())) { error("Default value cannot be empty if min greater than 0", attribute, OseeDslPackage.Literals.XATTRIBUTE_TYPE__DEFAULT_VALUE); } } if (minOccurrences < 0) { error("min cannot be less than 0", attribute, OseeDslPackage.Literals.XATTRIBUTE_TYPE__MIN); } String max = attribute.getMax(); int maxOccurrences = 0; if (!Strings.isEmpty(max)) { maxOccurrences = Integer.parseInt(max); } if (minOccurrences > maxOccurrences) { <START> error("max must be greater than min", attribute, OseeDslPackage.Literals.XATTRIBUTE_TYPE__MAX); <END> } }</code><technical_language>error "max greater equal min" or, "min greater max" - works for me</technical_language>

Target:
public void checkAttributeValidity(XAttributeType attribute) { String min = attribute.getMin(); int minOccurrences = 0; if (!Strings.isEmpty(min)) { minOccurrences = Integer.parseInt(min); if (minOccurrences > 0 && Strings.isEmpty(attribute.getDefaultValue())) { error("Default value cannot be empty if min greater than 0", attribute, OseeDslPackage.Literals.XATTRIBUTE_TYPE__DEFAULT_VALUE); } } if (minOccurrences < 0) { error("min cannot be less than 0", attribute, OseeDslPackage.Literals.XATTRIBUTE_TYPE__MIN); } String max = attribute.getMax(); int maxOccurrences = 0; if (!Strings.isEmpty(max)) { maxOccurrences = Integer.parseInt(max); } if (minOccurrences > maxOccurrences) { error("min must not be greater than max", attribute, OseeDslPackage.Literals.XATTRIBUTE_TYPE__MAX); } }
Source:
<code>private String getTablePath(String columnPath) { <START> int columnDelim = columnPath.lastIndexOf('.'); <END> final String tablePath; if (columnDelim == -1) { tablePath = _metadata.getDatastoreName(); } else { tablePath = columnPath.substring(0, columnDelim); } return tablePath; }</code><technical_language>Final</technical_language>

Target:
private String getTablePath(String columnPath) { final int columnDelim = columnPath.lastIndexOf('.'); final String tablePath; if (columnDelim == -1) { tablePath = _metadata.getDatastoreName(); } else { tablePath = columnPath.substring(0, columnDelim); } return tablePath; }
Source:
<code>private boolean checkFilesFieldForNull() { <START> boolean valid = files != null; <END> LOGGER.assertLog(valid, LOG_FILES_IS_NULL); return valid; }</code><technical_language>Tiny style thing, put brackets boolean expressions this e.g. boolean valid = (files != null);</technical_language>

Target:
private boolean checkFilesFieldForNull() { boolean valid = (files != null); LOGGER.assertLog(valid, LOG_FILES_IS_NULL); return valid; }
Source:
<code>private CheckAndSetResult<ValueAndBound<T>> extractRelevantValues(T targetValue, long newBound, CheckAndSetResult<SequenceAndBound> casResult) { if (casResult.successful()) { return CheckAndSetResult.of(true, ImmutableList.of(ValueAndBound.of(Optional.of(targetValue), newBound))); } return CheckAndSetResult.of( <START> casResult.successful(), <END> casResult.existingValues() .stream() .map(value -> ValueAndBound.of(getValue(value.sequence()), value.bound())) .collect(Collectors.toList())); }</code><technical_language>nit: This reads weirdly, I assumed this enum marking CAS successful. branched casResult.successful above, this is clearer false</technical_language>

Target:
private CheckAndSetResult<ValueAndBound<T>> extractRelevantValues(T targetValue, long newBound, CheckAndSetResult<SequenceAndBound> casResult) { if (casResult.successful()) { return CheckAndSetResult.of(true, ImmutableList.of(ValueAndBound.of(Optional.of(targetValue), newBound))); } return CheckAndSetResult.of( false, casResult.existingValues() .stream() .map(value -> ValueAndBound.of(getValue(value.sequence()), value.bound())) .collect(Collectors.toList())); }
Source:
<code>public void open(final D diagram, final DiagramViewer.DiagramViewerCallback<D> callback) { onOpen(diagram); callback.onOpen(diagram); final String definitionSetId = diagram.getMetadata().getDefinitionSetId(); <START> StunnerPreferences preferences = getPreferencesRegistry().get(definitionSetId); <END> final StunnerDiagramEditorPreferences editorPreferences = preferences.getDiagramEditorPreferences(); boolean isHiDPIEnabled = false; if (editorPreferences!=null) { isHiDPIEnabled = editorPreferences.isHiDPIEnabled(); } final int[] ds = getDiagramSize(diagram); final CanvasSettings settings = new CanvasSettings(ds[0], ds[1], isHiDPIEnabled); openCanvas(getCanvas(), settings); callback.afterCanvasInitialized(); getHandler().draw(diagram, new ParameterizedCommand<CommandResult<?>>() { @Override public void execute(CommandResult<?> result) { if (!CommandUtils.isError(result)) { callback.onSuccess(); } else { callback.onError(new ClientRuntimeError("An error occurred while drawing the diagram " + "[result=" + result + "]")); } } }); }</code><technical_language>minor issue - final</technical_language>

Target:
public void open(final D diagram, final DiagramViewer.DiagramViewerCallback<D> callback) { onOpen(diagram); callback.onOpen(diagram); final String definitionSetId = diagram.getMetadata().getDefinitionSetId(); final StunnerPreferences preferences = getPreferencesRegistry().get(definitionSetId); final StunnerDiagramEditorPreferences editorPreferences = preferences.getDiagramEditorPreferences(); final boolean isHiDPIEnabled = editorPreferences != null && editorPreferences.isHiDPIEnabled(); final int[] ds = getDiagramSize(diagram); final CanvasSettings settings = new CanvasSettings(ds[0], ds[1], isHiDPIEnabled); openCanvas(getCanvas(), settings); callback.afterCanvasInitialized(); getHandler().draw(diagram, new ParameterizedCommand<CommandResult<?>>() { @Override public void execute(CommandResult<?> result) { if (!CommandUtils.isError(result)) { callback.onSuccess(); } else { callback.onError(new ClientRuntimeError("An error occurred while drawing the diagram " + "[result=" + result + "]")); } } }); }
Source:
<code>public Project getProject() { Finder<Long, ? extends Model> finder = null; Resource resource = null; switch(resourceType) { case ISSUE_POST: resource = Issue.finder.byId(resourceId).asResource(); break; case ISSUE_ASSIGNEE: return Assignee.finder.byId(resourceId).project; case ISSUE_COMMENT: resource = IssueComment.find.byId(resourceId).asResource(); break; case NONISSUE_COMMENT: resource = PostingComment.find.byId(resourceId).asResource(); break; case LABEL: resource = Label.find.byId(resourceId).asResource(); break; case BOARD_POST: resource = Posting.finder.byId(resourceId).asResource(); break; case USER: resource = null; break; case PROJECT: resource = Project.find.byId(resourceId).asResource(); break; case ATTACHMENT: resource = Attachment.find.byId(resourceId).asResource(); break; case MILESTONE: resource = Milestone.find.byId(resourceId).asResource(); break; default: if (EnumSet.allOf(ResourceType.class).contains(resourceType)) { play.Logger.warn("Unsupported resource type " + resourceType); } else { play.Logger.warn("Unknown resource type " + resourceType); } <START> return null; <END> } if (resource != null) { return resource.getProject(); } else { return null; } }</code><technical_language>throws(x) throw (o)</technical_language>

Target:
public Project getProject() { switch(resourceType) { case ISSUE_ASSIGNEE: return Assignee.finder.byId(resourceId).project; default: Resource resource = getResource(); if (resource != null) { return resource.getProject(); } else { return null; } } }
Source:
<code><START> public void showStatusComplete() { <END> progressBar.getStyle().setColor( "WHITE" ); progressBar.getStyle().setBackgroundColor( "GREEN" ); progressBar.setInnerHTML( AnalysisConstants.INSTANCE.AnalysisComplete() ); }</code><technical_language>worth ensuring colours in keeping [PatternFly](<LINK_0> PatternFly/BS3 "alerts"</technical_language>

Target:
public void showStatusComplete() { progressPanel.getStyle().setColor( "WHITE" ); progressPanel.getStyle().setBackgroundColor( "GREEN" ); progressPanel.setInnerHTML( AnalysisConstants.INSTANCE.AnalysisComplete() ); }
Source:
<code>public MethodOutcome updateLocation(@ResourceParam Location location, @IdParam IdType theId) { MethodOutcome retVal = new MethodOutcome(); OperationOutcome outcome = new OperationOutcome(); locationResource.updateLocation(theId.getIdPart(), location); CodeableConcept concept = new CodeableConcept(); Coding coding = concept.addCoding(); <START> coding.setDisplay("Location successfully updated"); <END> outcome.addIssue().setDetails(concept); retVal.setOperationOutcome(outcome); return retVal; }</code><technical_language>move a constant. shpuld include Id well</technical_language>

Target:
public MethodOutcome updateLocation(@ResourceParam Location location, @IdParam IdType theId) { MethodOutcome retVal = new MethodOutcome(); OperationOutcome outcome = new OperationOutcome(); locationResource.updateLocation(theId.getIdPart(), location); CodeableConcept concept = new CodeableConcept(); Coding coding = concept.addCoding(); coding.setDisplay("Location successfully updated" + theId.getId()); outcome.addIssue().setDetails(concept); retVal.setOperationOutcome(outcome); return retVal; }
Source:
<code>public void hardDeleteTest() throws InterruptedException, IOException, StoreException { properties.put("store.deleted.message.retention.days", Integer.toString(1)); properties.put("store.hard.delete.bytes.per.sec", Integer.toString(Integer.MAX_VALUE / 10)); reloadIndex(false); index.hardDeleter.running.set(true); assertFalse("Hard delete did work even though no message is past retention time", index.hardDeleter.hardDelete()); advanceTime(SystemTime.getInstance().milliseconds() + 2 * Time.MsPerSec * Time.SecsPerDay); assertTrue("Hard delete did not do any work", index.hardDeleter.hardDelete()); long expectedProgress = log.getDifference(logOrder.lastKey(), new Offset(log.getFirstSegment().getName(), 0)); <START> waitUntilExpectedProgress(expectedProgress, 1000); <END> verifyEntriesForHardDeletes(deletedKeys, true); }</code><technical_language>is this required here? is thread work in this case index.hardDeleter.hardDelete() explicitly called line 490</technical_language>

Target:
public void hardDeleteTest() throws InterruptedException, IOException, StoreException { properties.put("store.deleted.message.retention.days", Integer.toString(1)); properties.put("store.hard.delete.bytes.per.sec", Integer.toString(Integer.MAX_VALUE / 10)); reloadIndex(false); index.hardDeleter.enabled.set(true); assertFalse("Hard delete did work even though no message is past retention time", index.hardDeleter.hardDelete()); advanceTime(SystemTime.getInstance().milliseconds() + 2 * Time.MsPerSec * Time.SecsPerDay); assertTrue("Hard delete did not do any work", index.hardDeleter.hardDelete()); long expectedProgress = log.getDifference(logOrder.lastKey(), new Offset(log.getFirstSegment().getName(), 0)); assertEquals("Hard delete did not make expected progress", expectedProgress, index.hardDeleter.getProgress()); verifyEntriesForHardDeletes(deletedKeys); }
Source:
<code><START> CompiledScript get() { <END> return script.get(); }</code><technical_language>Is this of @VisibleForTesting things? unnecessary</technical_language>

Target:
protected CompiledScript get() { return script.get(); }
Source:
<code>public SLDConfig(String jspPath, String units, String style, int strokeWidth, String[] attrs, float[] thresholds, String[] colors, List<Map<String,Object>> bins) { <START> this(jspPath, units, style, strokeWidth, SLDGenerator.STROKE_OPACITY_DEFAULT, attrs, thresholds, colors, bins, SLDGenerator.DOMAIN_DEFAULT); <END> }</code><technical_language>number of args is large for constructor. Is a container object passed instead of repeatedly widening signature</technical_language>

Target:
public SLDConfig(String jspPath, String units, String style, int strokeWidth, String[] attrs, float[] thresholds, String[] colors, List<Map<String,Object>> bins) { this(jspPath, units, style, strokeWidth, SLDGenerator.STROKE_OPACITY_DEFAULT, attrs, thresholds, colors, bins, SLDGenerator.LEGEND_TYPE_DEFAULT); }
Source:
<code>@Override public T convert(ResponseBody value) throws IOException { try { <START> return MessageNano.mergeFrom(instance, value.bytes()); <END> } catch (InvalidProtocolBufferNanoException e) { throw new RuntimeException(e); } finally { value.close(); } }</code><technical_language>this update instance return a new copy? if a new instance needs created for invocation of this method. create converters call times</technical_language>

Target:
@Override public T convert(ResponseBody value) throws IOException { try { return MessageNano.mergeFrom(getNanoProtoInstance(), value.bytes()); } catch (InvalidProtocolBufferNanoException e) { throw new RuntimeException(e); } finally { value.close(); } }
Source:
<code>public Conference(Videobridge videobridge, String id, String conferenceName, boolean enableLogging, long gid) { this.videobridge = Objects.requireNonNull(videobridge, "videobridge"); Level minLevel = enableLogging ? Level.ALL : Level.WARNING; Map<String, String> context = JMap.ofEntries( entry("confId", id) ); <START> context.put("gid", String.valueOf(gid)); <END> if (conferenceName != null) { context.put("conf_name", conferenceName); } logger = new LoggerImpl(Conference.class.getName(), minLevel, new LogContext(context)); this.shim = new ConferenceShim(this, logger); this.id = Objects.requireNonNull(id, "id"); this.gid = gid; this.eventAdmin = enableLogging ? videobridge.getEventAdmin() : null; this.includeInStatistics = enableLogging; this.conferenceName = conferenceName; speechActivity = new ConferenceSpeechActivity(this); audioLevelListener = (sourceSsrc, level) -> speechActivity.levelChanged(sourceSsrc, (int) level); expireableImpl = new ExpireableImpl(logger, this::expire); if (enableLogging) { eventAdmin.sendEvent(EventFactory.conferenceCreated(this)); Videobridge.Statistics videobridgeStatistics = videobridge.getStatistics(); videobridgeStatistics.totalConferencesCreated.incrementAndGet(); } }</code><technical_language>movie this JMap.ofEntries chunk</technical_language>

Target:
public Conference(Videobridge videobridge, String id, String conferenceName, boolean enableLogging, long gid) { if (gid != GID_NOT_SET && (gid < 0 || gid > 0xffff_ffffL)) { throw new IllegalArgumentException("Invalid GID:" + gid); } this.videobridge = Objects.requireNonNull(videobridge, "videobridge"); Level minLevel = enableLogging ? Level.ALL : Level.WARNING; Map<String, String> context = JMap.ofEntries( entry("confId", id), entry("gid", String.valueOf(gid)) ); if (conferenceName != null) { context.put("conf_name", conferenceName); } logger = new LoggerImpl(Conference.class.getName(), minLevel, new LogContext(context)); this.shim = new ConferenceShim(this, logger); this.id = Objects.requireNonNull(id, "id"); this.gid = gid; this.eventAdmin = enableLogging ? videobridge.getEventAdmin() : null; this.includeInStatistics = enableLogging; this.conferenceName = conferenceName; speechActivity = new ConferenceSpeechActivity(this); audioLevelListener = (sourceSsrc, level) -> speechActivity.levelChanged(sourceSsrc, (int) level); expireableImpl = new ExpireableImpl(logger, this::expire); if (enableLogging) { eventAdmin.sendEvent(EventFactory.conferenceCreated(this)); Videobridge.Statistics videobridgeStatistics = videobridge.getStatistics(); videobridgeStatistics.totalConferencesCreated.incrementAndGet(); } }
Source:
<code>public void testForValueUndefined() { final AdministrativeStatusType administrativeStatusType = AdministrativeStatusType.UNDEFINED; final AdministrativeStatusTypeDto administrativeStatusTypeDto = this.configurationMapper.map( administrativeStatusType, AdministrativeStatusTypeDto.class); <START> assertNotNull(administrativeStatusType); <END> assertNotNull(administrativeStatusTypeDto); assertEquals(administrativeStatusType.value(), administrativeStatusTypeDto.value()); }</code><technical_language>useless check for administrativeStatusType null, assigned line 30</technical_language>

Target:
public void testForValueUndefined() { final AdministrativeStatusType administrativeStatusType = AdministrativeStatusType.UNDEFINED; final AdministrativeStatusTypeDto administrativeStatusTypeDto = this.configurationMapper.map( administrativeStatusType, AdministrativeStatusTypeDto.class); assertNotNull(administrativeStatusTypeDto); assertEquals(administrativeStatusType.value(), administrativeStatusTypeDto.value()); }
Source:
<code>public void working_directory() throws IOException { Path workDir = Files.createTempDirectory("workDir"); <START> TestRule check = new TestRule() { <END> @Override public void initialize(SubscriptionCheck.Context context) { context.registerSyntaxNodeConsumer(Tree.Kind.FILE_INPUT, ctx -> assertThat(ctx.workingDirectory()).isEqualTo(workDir.toFile())); } }; File tmpFile = Files.createTempFile("foo", "py").toFile(); PythonVisitorContext context = TestPythonVisitorRunner.createContext(tmpFile, workDir.toFile()); assertThat(context.workingDirectory()).isEqualTo(workDir.toFile()); assertThat(context.pythonFile().uri()).isEqualTo(tmpFile.toURI()); check.scanFile(context); SubscriptionVisitor.analyze(Collections.singletonList(check), context); }</code><technical_language>PythonSubscriptionCheck check = new PythonSubscriptionCheck() {</technical_language>

Target:
public void working_directory() throws IOException { Path workDir = Files.createTempDirectory("workDir"); PythonSubscriptionCheck check = new PythonSubscriptionCheck() { @Override public void initialize(SubscriptionCheck.Context context) { context.registerSyntaxNodeConsumer(Tree.Kind.FILE_INPUT, ctx -> assertThat(ctx.workingDirectory()).isEqualTo(workDir.toFile())); } }; File tmpFile = Files.createTempFile("foo", "py").toFile(); PythonVisitorContext context = TestPythonVisitorRunner.createContext(tmpFile, workDir.toFile()); assertThat(context.workingDirectory()).isEqualTo(workDir.toFile()); assertThat(context.pythonFile().uri()).isEqualTo(tmpFile.toURI()); check.scanFile(context); SubscriptionVisitor.analyze(Collections.singletonList(check), context); }
Source:
<code>private CommandCall duplicateCommandForDifferentElement(CommandCall commandCall, Element element) { String expression = commandCall.getExpression(); <START> if (expression.equals("")) { <END> expression = element.getText(); } return new CommandCall(null, commandCall.getCommand(), element, expression, commandCall.getResource()); }</code><technical_language>clean this up? needed for example commands, hard check command is wrapped in decorators</technical_language>

Target:
private CommandCall duplicateCommandForDifferentElement(CommandCall commandCall, Element element) { return new CommandCall( null, commandCall.getCommand(), element, commandCall.getExpression(), commandCall.getResource()); }
Source:
<code>private int getVisibility(int memberIndex) throws CoreException { int visibilityBitOffset = memberIndex % VISIBILITY_VALUES_PER_BYTE; long visibilityOffset = record + MEMBER_VISIBILITIES + memberIndex / VISIBILITY_VALUES_PER_BYTE; int visibility = getDB().getByte(visibilityOffset); <START> visibility &= VISIBILITY_MASK << visibilityBitOffset * VISIBILITY_BITS; <END> visibility >>>= visibilityBitOffset * VISIBILITY_BITS; return visibility; }</code><technical_language>Simpler apply mask shift</technical_language>

Target:
private int getVisibility(int memberIndex) throws CoreException { int visibilityBitOffset = memberIndex % VISIBILITY_VALUES_PER_BYTE; long visibilityOffset = record + MEMBER_VISIBILITIES + memberIndex / VISIBILITY_VALUES_PER_BYTE; int visibility = getDB().getByte(visibilityOffset); visibility >>>= visibilityBitOffset * VISIBILITY_BITS; visibility &= VISIBILITY_MASK; return visibility; }
Source:
<code>private void handleRemove() { ISelection selection = filterView.getSelection(); IStructuredSelection structuredSelection = null; if (selection instanceof IStructuredSelection) { structuredSelection = ((IStructuredSelection) selection); Iterator it = structuredSelection.iterator(); while (it.hasNext()) { Object element = it.next(); if (element instanceof FilterCopy) { FilterCopy filter = (FilterCopy) element; filter.getParent().removeChild(filter); } else { int mask = element.equals(includeOnlyGroup) ? IResourceFilterDescription.INCLUDE_ONLY: IResourceFilterDescription.EXCLUDE_ALL; <START> FilterCopy[] children = filters.getChildren(); <END> for (FilterCopy filterCopy : children) { if ((filterCopy.getType() & mask) != 0) filters.removeChild(filterCopy); } } } filterView.refresh(); } }</code><technical_language>inline</technical_language>

Target:
private void handleRemove() { ISelection selection = filterView.getSelection(); IStructuredSelection structuredSelection = null; if (selection instanceof IStructuredSelection) { structuredSelection = ((IStructuredSelection) selection); Iterator it = structuredSelection.iterator(); while (it.hasNext()) { Object element = it.next(); if (element instanceof FilterCopy) { FilterCopy filter = (FilterCopy) element; filter.getParent().removeChild(filter); } else { int mask = element.equals(includeOnlyGroup) ? IResourceFilterDescription.INCLUDE_ONLY: IResourceFilterDescription.EXCLUDE_ALL; for (FilterCopy filterCopy : filters.getChildren()) { if ((filterCopy.getType() & mask) != 0) filters.removeChild(filterCopy); } } } filterView.refresh(); } }
Source:
<code>public boolean select(Viewer viewer, Object parentElement, Object element) { if (element instanceof IJavaProject) { element = ((IJavaProject) element).getProject(); } return !Optional.ofNullable(element) .filter(IProject.class::isInstance) .map(IProject.class::cast) <START> .filter(Objects::nonNull) <END> .filter(p -> TemporaryProject.PROJECT_NAME.equals(p.getName())) .isPresent(); }</code><technical_language>do need non-null filter? Class.isInstance filter out null values</technical_language>

Target:
public boolean select(Viewer viewer, Object parentElement, Object element) { if (element instanceof IJavaProject) { element = ((IJavaProject) element).getProject(); } return !Optional.ofNullable(element) .filter(IProject.class::isInstance) .map(IProject.class::cast) .filter(p -> TemporaryProject.PROJECT_NAME.equals(p.getName())) .isPresent(); }
Source:
<code><T> Mono<DigitalTwinsResponse<T>> getRelationshipWithResponse(String digitalTwinId, String relationshipId, Class<T> clazz, GetRelationshipOptions options, Context context) { return protocolLayer .getDigitalTwins() <START> .getRelationshipByIdWithResponseAsync(digitalTwinId, relationshipId, options != null ? options.toProtocolLayerOptions() : null, context) <END> .flatMap(response -> { T genericResponse; try { genericResponse = DeserializationHelpers.deserializeObject(mapper, response.getValue(), clazz, this.serializer); } catch (JsonProcessingException e) { logger.error("JsonProcessingException occurred while deserializing the get relationship response: ", e); return Mono.error(e); } DigitalTwinsResponseHeaders twinHeaders = mapper.convertValue(response.getDeserializedHeaders(), DigitalTwinsResponseHeaders.class); return Mono.just(new DigitalTwinsResponse<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), genericResponse, twinHeaders)); }); }</code><technical_language>nit: I break this for readability, especially is a conditional statement involved</technical_language>

Target:
<T> Mono<DigitalTwinsResponse<T>> getRelationshipWithResponse(String digitalTwinId, String relationshipId, Class<T> clazz, GetRelationshipOptions options, Context context) { return protocolLayer .getDigitalTwins() .getRelationshipByIdWithResponseAsync(digitalTwinId, relationshipId, OptionsConverter.toProtocolLayerOptions(options), context) .flatMap(response -> { T genericResponse; try { genericResponse = DeserializationHelpers.deserializeObject(mapper, response.getValue(), clazz, this.serializer); } catch (JsonProcessingException e) { logger.error("JsonProcessingException occurred while deserializing the get relationship response: ", e); return Mono.error(e); } DigitalTwinsResponseHeaders twinHeaders = mapper.convertValue(response.getDeserializedHeaders(), DigitalTwinsResponseHeaders.class); return Mono.just(new DigitalTwinsResponse<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), genericResponse, twinHeaders)); }); }
Source:
<code>public void reallocate(TaxonConcept element, Taxonomy taxonomy) { taxonomy.report(IssueType.NOTE, "taxonConcept.reallocated", element, this); taxonomy.count("count.reallocate.taxonConcept"); TaxonConceptInstance representative = this.getRepresentative(); if (representative == null || this.resolution == null) <START> throw new IndexBuilderException("Unable to reallocate " + element + " to " + this + " without representative or resolution"); <END> element.resolution = new TaxonResolution(); for (TaxonConceptInstance tci: element.instances) { tci.setContainer(this); this.instances.add(tci); this.resolution.addExternal(tci, representative, taxonomy); element.resolution.addExternal(tci, representative, taxonomy); } element.instances.clear(); }</code><technical_language>Change message "representative resolution", required move on</technical_language>

Target:
public void reallocate(TaxonConcept element, Taxonomy taxonomy) { taxonomy.report(IssueType.NOTE, "taxonConcept.reallocated", element, this); taxonomy.count("count.reallocate.taxonConcept"); TaxonConceptInstance representative = this.getRepresentative(); if (representative == null || this.resolution == null) throw new IndexBuilderException("Unable to reallocate " + element + " to " + this + " without representative and resolution"); element.resolution = new TaxonResolution(); for (TaxonConceptInstance tci: element.instances) { tci.setContainer(this); this.instances.add(tci); this.resolution.addExternal(tci, representative, taxonomy); element.resolution.addExternal(tci, representative, taxonomy); } element.instances.clear(); }
Source:
<code>public Boolean call() throws Exception { mergeabilityCheckQueue.updatingMergeabilityFlag(change, force); RequestContext context = new RequestContext() { @Override public CurrentUser getCurrentUser() { return identifiedUserFactory.create(change.getOwner()); } @Override public Provider<ReviewDb> getReviewDbProvider() { return new Provider<ReviewDb>() { @Override public ReviewDb get() { if (reviewDb == null) { try { reviewDb = schemaFactory.open(); } catch (OrmException e) { throw new ProvisionException("Cannot open ReviewDb", e); } } return reviewDb; } }; } }; RequestContext old = tl.setContext(context); ReviewDb db = context.getReviewDbProvider().get(); try { PatchSet ps = db.patchSets().get(change.currentPatchSetId()); Mergeable m = mergeable.get(); m.setForce(force); ChangeControl control = changeControlFactory.controlFor(change.getId(), context.getCurrentUser()); MergeableInfo info = m.apply( new RevisionResource(new ChangeResource(control), ps)); <START> return Boolean.valueOf(change.isMergeable()) != info.mergeable; <END> } catch (ResourceConflictException e) { return false; } catch (Exception e) { String msg = "Failed to update mergeability flags for project " + change.getDest().getParentKey() + " on update of " + change.getDest().get(); log.error(msg, e); throw e; } finally { tl.setContext(old); if (reviewDb != null) { reviewDb.close(); reviewDb = null; } } }</code><technical_language>this .equals() Objects.equal() instead? reader worry info.mergeable created expression 'new Boolean(true)'</technical_language>

Target:
public Boolean call() throws Exception { mergeabilityCheckQueue.updatingMergeabilityFlag(change, force); RequestContext context = new RequestContext() { @Override public CurrentUser getCurrentUser() { return identifiedUserFactory.create(change.getOwner()); } @Override public Provider<ReviewDb> getReviewDbProvider() { return new Provider<ReviewDb>() { @Override public ReviewDb get() { if (reviewDb == null) { try { reviewDb = schemaFactory.open(); } catch (OrmException e) { throw new ProvisionException("Cannot open ReviewDb", e); } } return reviewDb; } }; } }; RequestContext old = tl.setContext(context); ReviewDb db = context.getReviewDbProvider().get(); try { PatchSet ps = db.patchSets().get(change.currentPatchSetId()); Mergeable m = mergeable.get(); m.setForce(force); ChangeControl control = changeControlFactory.controlFor(change.getId(), context.getCurrentUser()); MergeableInfo info = m.apply( new RevisionResource(new ChangeResource(control), ps)); return change.isMergeable() != info.mergeable; } catch (ResourceConflictException e) { return false; } catch (Exception e) { String msg = "Failed to update mergeability flags for project " + change.getDest().getParentKey() + " on update of " + change.getDest().get(); log.error(msg, e); throw e; } finally { tl.setContext(old); if (reviewDb != null) { reviewDb.close(); reviewDb = null; } } }
Source:
<code>void deactivate() { if (nativeVideo != null) { <START> nativeVideo.deactivate(); <END> nativeVideo = null; } }</code><technical_language>add nativeVideo.unregisterInteractionViews()</technical_language>

Target:
void deactivate() { if (nativeVideo != null) { nativeVideo.unregisterInteractionViews(); nativeVideo.deactivate(); nativeVideo = null; } }