auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public ExternalConditionEval(ExternalCondition condition, Event event) { super(Type.EXTERNAL, condition.match(event.getText()), event.getCtime(), event.getContext()); this.condition = condition; this.event = event; <START> this.typeValue = TypeValue.DATA; <END> }</code><technical_language>If typeValue field I this EVENT. I above, I need it</technical_language>

Target:
public ExternalConditionEval(ExternalCondition condition, Event event) { super(Type.EXTERNAL, condition.match(event.getText()), event.getCtime(), event.getContext()); this.condition = condition; this.event = event; }
Source:
<code>private InteractiveUIContent(Composite parent, boolean hasDescription, boolean hasConfiguration) { super(); Composite contentComposite = new Composite(parent, SWT.NONE); <START> contentComposite.setLayout(new GridLayout(hasConfiguration ? 2 : 1, true)); <END> contentComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); this.viewerCompsite = new Composite(contentComposite, SWT.NONE); viewerCompsite.setLayout(new GridLayout(1, true)); viewerCompsite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); if (hasConfiguration) { this.configurationComposite = createConfigComposite(contentComposite); defaultComposite = new Composite(configurationComposite, SWT.NONE); defaultComposite.setLayout(new GridLayout(1, true)); Label text = new Label(defaultComposite, SWT.WRAP); text.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1)); text.setText(EMFCompareRCPUIMessages .getString("InteractiveUIContent.DEFAULT_CONFIGURATION_LABEL")); } else { this.configurationComposite = null; this.defaultComposite = null; } if (hasDescription) { this.descriptionText = createDescriptionComposite(parent); } else { this.descriptionText = null; } }</code><technical_language>of ternary operator is forbidden compare. if/else set variable 2 1... name of variable explicit</technical_language>

Target:
private InteractiveUIContent(Composite parent, boolean hasDescription, boolean hasConfiguration) { super(); Composite contentComposite = new Composite(parent, SWT.NONE); final int numberOfColumns; if (hasConfiguration) { numberOfColumns = 2; } else { numberOfColumns = 1; } contentComposite.setLayout(new GridLayout(numberOfColumns, true)); contentComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); this.viewerCompsite = new Composite(contentComposite, SWT.NONE); viewerCompsite.setLayout(new GridLayout(1, true)); viewerCompsite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); if (hasConfiguration) { this.configurationComposite = createConfigComposite(contentComposite); defaultComposite = new Composite(configurationComposite, SWT.NONE); defaultComposite.setLayout(new GridLayout(1, true)); Label text = new Label(defaultComposite, SWT.WRAP); text.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1)); text.setText(EMFCompareRCPUIMessages .getString("InteractiveUIContent.DEFAULT_CONFIGURATION_LABEL")); } else { this.configurationComposite = null; this.defaultComposite = null; } if (hasDescription) { this.descriptionText = createDescriptionComposite(parent); } else { this.descriptionText = null; } }
Source:
<code>public void refreshHost(VDS vds) { try { <START> refreshCapabilities(null, new <END> AtomicBoolean(), vds); } finally { if (vds != null) { updateDynamicData(vds.getDynamicData()); updateNumaData(vds); monitoringStrategy.processHardwareCapabilities(vds); resourceManager.getEventListener().handleVdsVersion(vds.getId()); } } }</code><technical_language>do want set null for hostMonitoringCallback</technical_language>

Target:
public void refreshHost(VDS vds) { refreshCapabilities(new RefreshCapabilitiesCallback(vds), new AtomicBoolean(), vds); }
Source:
<code>protected String createPayload(Nic.Request.UpdatePayload payload) { checkNotNull(payload, "payload"); checkNotNull(payload.dataCenterId(), "dataCenterId"); checkNotNull(payload.serverId(), "serverId"); checkNotNull(payload.id(), "id"); dataCenterId = payload.dataCenterId(); serverId = payload.serverId(); nicId = payload.id(); requestBuilder.put("lan", payload.lan()); if (payload.name() != null) requestBuilder.put("name", payload.name()); if (payload.ips() != null && !payload.ips().isEmpty()) requestBuilder.put("ips", payload.ips()); if (payload.dhcp() != null) requestBuilder.put("dhcp", payload.dhcp()); <START> return (new Gson()).toJson(requestBuilder); <END> }</code><technical_language>here; injected one</technical_language>

Target:
protected String createPayload(Nic.Request.UpdatePayload payload) { checkNotNull(payload, "payload"); checkNotNull(payload.dataCenterId(), "dataCenterId"); checkNotNull(payload.serverId(), "serverId"); checkNotNull(payload.id(), "id"); dataCenterId = payload.dataCenterId(); serverId = payload.serverId(); nicId = payload.id(); requestBuilder.put("lan", payload.lan()); if (payload.name() != null) requestBuilder.put("name", payload.name()); if (payload.ips() != null && !payload.ips().isEmpty()) requestBuilder.put("ips", payload.ips()); if (payload.dhcp() != null) requestBuilder.put("dhcp", payload.dhcp()); return jsonBinder.toJson(requestBuilder); }
Source:
<code>private void checkIfEventsLogPluginSupported() { <START> GerritServer server = PluginImpl.getInstance().getServer(serverName); <END> if (server != null && server.getConfig() != null) { isSupported = GerritPluginChecker.isPluginEnabled( server.getConfig(), EVENTS_LOG_PLUGIN_NAME); } }</code><technical_language>CheckForNull</technical_language>

Target:
private void checkIfEventsLogPluginSupported() { GerritServer server = PluginImpl.getServer_(serverName); if (server != null && server.getConfig() != null) { isSupported = GerritPluginChecker.isPluginEnabled( server.getConfig(), EVENTS_LOG_PLUGIN_NAME); } }
Source:
<code>private IPattern doFindByNegatedFactPattern(final List<IPattern> patterns, final Pattern52 find) { final String factType = find.getFactType(); for (IPattern ifp : patterns) { if (ifp instanceof FactPattern) { FactPattern fp = (FactPattern) ifp; if (fp.isNegated()) { if (fp.getFactType().equals(factType)) { return fp; } } } else if (ifp instanceof FromEntryPointFactPattern) { FromEntryPointFactPattern fefp = (FromEntryPointFactPattern) ifp; FactPattern fp = fefp.getFactPattern(); <START> if (fp.isNegated()) { <END> if (fp.getFactType().equals(factType)) { return fp; } } } } return null; }</code><technical_language>@manstis I is nice opportunity single method for blocks starting lines 812 820. WDYT</technical_language>

Target:
private IPattern doFindByNegatedFactPattern(final List<IPattern> patterns, final Pattern52 find) { final String factType = find.getFactType(); for (IPattern ifp : patterns) { if (ifp instanceof FactPattern) { final FactPattern fp = (FactPattern) ifp; final Optional<IPattern> match = checkNegatedFactPattern(fp, factType); if (match.isPresent()) { return match.get(); } } else if (ifp instanceof FromEntryPointFactPattern) { final FromEntryPointFactPattern fefp = (FromEntryPointFactPattern) ifp; final FactPattern fp = fefp.getFactPattern(); final Optional<IPattern> match = checkNegatedFactPattern(fp, factType); if (match.isPresent()) { return match.get(); } } } return null; }
Source:
<code>public Integer defineRoadsQuantityToBuild(GameUserBean gameUser, GameBean game) throws PlayException { List<EdgeBean> availableEdges = new ArrayList<EdgeBean>(game.fetchEdgesAccessibleForBuildingRoad(gameUser)); <START> switch (availableEdges.size()) { <END> case 0: log.debug("There are no available edges build road for current player"); throw new PlayException(ROAD_CANNOT_BE_BUILT_ERROR); case 1: Set<EdgeBean> edgesNextToAvailable = availableEdges.get(0).fetchNeighborEdgesAccessibleForBuildingRoad(gameUser); if (edgesNextToAvailable.size() > 0) { return 2; } else { return 1; } default: return 2; } }</code><technical_language>I simplify this logic pretty if-else statment switch-case</technical_language>

Target:
public Integer defineRoadsQuantityToBuild(GameUserBean gameUser, GameBean game) throws PlayException { List<EdgeBean> availableEdges = new ArrayList<EdgeBean>(game.fetchEdgesAccessibleForBuildingRoad(gameUser)); if (availableEdges.isEmpty()) { log.debug("There are no available edges build road for current player"); throw new PlayException(ROAD_CANNOT_BE_BUILT_ERROR); } if (availableEdges.size() == 1 && availableEdges.get(0).fetchNeighborEdgesAccessibleForBuildingRoad(gameUser).size() == 0) { return 1; } return 2; }
Source:
<code><START> public SeekablePathStream(final Path path) throws IOException { <END> this.path = path; this.sbc = Files.newByteChannel(path); this.length = sbc.size(); allInstances.add(this); }</code><technical_language>Ensure path is non-null</technical_language>

Target:
public SeekablePathStream(final Path path) throws IOException { this.path = path; this.sbc = Files.newByteChannel(path); ALL_INSTANCES.add(this); }
Source:
<code>public static String decompressJSONString(byte[] compressed) throws IOException { ByteArrayInputStream bis = new ByteArrayInputStream(compressed); GZIPInputStream gis = new GZIPInputStream(bis); BufferedReader br = new BufferedReader(new InputStreamReader(gis, "UTF-8")); StringBuilder sb = new StringBuilder(); String line; <START> while((line = br.readLine()) != null) { <END> sb.append(line); } br.close(); gis.close(); bis.close(); return sb.toString(); }</code><technical_language>faster a StringWriter parse content</technical_language>

Target:
public static String decompressJSONString(byte[] compressed) throws IOException { ByteArrayOutputStream result = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; try (ByteArrayInputStream bis = new ByteArrayInputStream(compressed); GZIPInputStream gis = new GZIPInputStream(bis)) { int length; while ((length = gis.read(buffer)) != -1) { result.write(buffer, 0, length); } } catch (IOException e) { throw e; } return result.toString("UTF-8"); }
Source:
<code>public void update(float deltaTime) { <START> if (sort) { <END> entities.sort(comparator); sort = false; } for (int i = 0; i < entities.size; ++i) { processEntity(entities.get(i), deltaTime); } }</code><technical_language>This block of code is duplicated in getEntities(). please factor out a private method called sortEntities()</technical_language>

Target:
public void update(float deltaTime) { sort(); for (int i = 0; i < sortedEntities.size; ++i) { processEntity(sortedEntities.get(i), deltaTime); } }
Source:
<code>public Response addParser(@FormDataParam("parserJar") final InputStream inputStream, @FormDataParam("parserJar") final FormDataContentDisposition contentDispositionHeader, @FormDataParam("parserInfo") final String parserInfoStr, @FormDataParam("schemaFromParserJar") boolean schemaFromParserJar) { LOG.debug("schemaFromParser {}", schemaFromParserJar); File file = null; try { String name = ""; if (contentDispositionHeader != null && contentDispositionHeader.getFileName() != null) { name = contentDispositionHeader.getFileName(); this.jarStorage.uploadJar(inputStream, name); inputStream.close(); } ParserInfo parserInfo = objectMapper.readValue(parserInfoStr, ParserInfo.class); parserInfo.setJarStoragePath(name); Schema schema = loadSchemaFromParserJar(name, parserInfo.getClassName()); if (schema == null) { throw new RuntimeException("Cannot load parser class from uploaded Jar: " + parserInfo.getClassName()); } if (parserInfo.getParserSchema() == null && schemaFromParserJar) { <START> parserInfo.setParserSchema(loadSchemaFromParserJar(name, parserInfo.getClassName())); <END> } catalogService.addParserInfo(parserInfo); return WSUtils.respond(CREATED, SUCCESS, parserInfo); } catch (Exception ex) { return WSUtils.respond(INTERNAL_SERVER_ERROR, EXCEPTION, ex.getMessage()); } }</code><technical_language>change parserInfo.setParserSchema(schema)</technical_language>

Target:
public Response addParser(@FormDataParam("parserJar") final InputStream inputStream, @FormDataParam("parserJar") final FormDataContentDisposition contentDispositionHeader, @FormDataParam("parserInfo") final String parserInfoStr, @FormDataParam("schemaFromParserJar") boolean schemaFromParserJar) { LOG.debug("schemaFromParser {}", schemaFromParserJar); File file = null; try { String name = ""; if (contentDispositionHeader != null && contentDispositionHeader.getFileName() != null) { name = contentDispositionHeader.getFileName(); this.jarStorage.uploadJar(inputStream, name); inputStream.close(); } ParserInfo parserInfo = objectMapper.readValue(parserInfoStr, ParserInfo.class); parserInfo.setJarStoragePath(name); Schema schema = loadSchemaFromParserJar(name, parserInfo.getClassName()); if (schema == null) { throw new RuntimeException("Cannot load parser class from uploaded Jar: " + parserInfo.getClassName()); } if (parserInfo.getParserSchema() == null && schemaFromParserJar) { parserInfo.setParserSchema(schema); } catalogService.addParserInfo(parserInfo); return WSUtils.respond(CREATED, SUCCESS, parserInfo); } catch (Exception ex) { return WSUtils.respond(INTERNAL_SERVER_ERROR, EXCEPTION, ex.getMessage()); } }
Source:
<code>private DatasourceInputSplit toDataSourceSplit( List<WindowedDataSegment> segments, org.apache.hadoop.mapred.InputFormat fio, JobConf conf ) { String[] locations = null; try { locations = getFrequentLocations(segments, fio, conf); } catch (Exception e) { <START> e.printStackTrace(); <END> } return new DatasourceInputSplit(segments, locations); }</code><technical_language>log.error(..) instead</technical_language>

Target:
private DatasourceInputSplit toDataSourceSplit( List<WindowedDataSegment> segments, org.apache.hadoop.mapred.InputFormat fio, JobConf conf ) { String[] locations = null; try { locations = getFrequentLocations(segments, fio, conf); } catch (Exception e) { logger.error("Exception thrown finding location of splits", e); } return new DatasourceInputSplit(segments, locations); }
Source:
<code>private void sendEvent(E e) { String message = _layout.doLayout(e); if (message == null) { throw new IllegalArgumentException(String.format( "The logback layout %s is probably incorrect, " + "and fails to format the message.", _layout.toString())); } <START> this.sender.send( <END> "", message, "", "", null, null, "" ); }</code><technical_language>This a bit odd passing in empty args. Is a of this</technical_language>

Target:
private void sendEvent(E e) { String message = _layout.doLayout(e); if (message == null) { throw new IllegalArgumentException(String.format( "The logback layout %s is probably incorrect, " + "and fails to format the message.", _layout.toString())); } this.sender.send(message); }
Source:
<code>public S3InputSource( @JacksonInject ServerSideEncryptingAmazonS3 s3Client, @JsonProperty("uris") @Nullable List<URI> uris, @JsonProperty("prefixes") @Nullable List<URI> prefixes, @JsonProperty("objects") @Nullable List<CloudObjectLocation> objects ) { this.s3Client = Preconditions.checkNotNull(s3Client, "s3Client"); this.uris = uris == null ? new ArrayList<>() : uris; this.prefixes = prefixes == null ? new ArrayList<>() : prefixes; if (objects != null) { this.objects = objects; if (!this.uris.isEmpty()) { throw new IAE("uris cannot be used with object"); } if (!this.prefixes.isEmpty()) { throw new IAE("prefixes cannot be used with object"); } } else { this.objects = null; <START> if (!this.uris.isEmpty() && !this.prefixes.isEmpty()) { throw new IAE("uris and prefixes cannot be used together"); } if (this.uris.isEmpty() && this.prefixes.isEmpty()) { throw new IAE("uris or prefixes must be specified"); } <END> for (final URI inputURI : this.uris) { Preconditions.checkArgument("s3".equals(inputURI.getScheme()), "input uri scheme == s3 (%s)", inputURI); } for (final URI inputURI : this.prefixes) { Preconditions.checkArgument("s3".equals(inputURI.getScheme()), "input uri scheme == s3 (%s)", inputURI); } } }</code><technical_language>Optionally, simplify to: java if (this.uris.isEmpty() == this.prefixes.isEmpty()) { throw new IAE("exactly of uris prefixes specified) }</technical_language>

Target:
public S3InputSource( @JacksonInject ServerSideEncryptingAmazonS3 s3Client, @JsonProperty("uris") @Nullable List<URI> uris, @JsonProperty("prefixes") @Nullable List<URI> prefixes, @JsonProperty("objects") @Nullable List<CloudObjectLocation> objects ) { this.s3Client = Preconditions.checkNotNull(s3Client, "s3Client"); this.uris = uris; this.prefixes = prefixes; this.objects = objects; if (!CollectionUtils.isNullOrEmpty(objects)) { throwIfIllegalArgs(!CollectionUtils.isNullOrEmpty(uris) || !CollectionUtils.isNullOrEmpty(prefixes)); } else if (!CollectionUtils.isNullOrEmpty(uris)) { throwIfIllegalArgs(!CollectionUtils.isNullOrEmpty(prefixes)); uris.forEach(S3Utils::checkURI); } else if (!CollectionUtils.isNullOrEmpty(prefixes)) { prefixes.forEach(S3Utils::checkURI); } else { throwIfIllegalArgs(true); } }
Source:
<code>public Object execute(ExecutionEvent event) throws ExecutionException { final IEditorPart editorWindow = HandlerUtil.getActiveEditor(event); if (editorWindow instanceof TestSuiteEditor) { final TestSuiteEditor testSuiteEditorWindow = (TestSuiteEditor) editorWindow; final Variables variablesEditorWindow = (Variables) testSuiteEditorWindow.getSelectedPage(); <START> variablesEditorWindow.removeAction(); <END> } return null; }</code><technical_language>change method name removeSelectedNodes()</technical_language>

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { final IEditorPart editorWindow = HandlerUtil.getActiveEditor(event); if (editorWindow instanceof TestSuiteEditor) { final TestSuiteEditor testSuiteEditorWindow = (TestSuiteEditor) editorWindow; final Variables variablesEditorWindow = (Variables) testSuiteEditorWindow.getSelectedPage(); variablesEditorWindow.removeSelectedNodes(); } return null; }
Source:
<code>DeferredImageViewRequest(Picasso picasso, Uri uri, int resourceId, ImageView imageView, PicassoBitmapOptions options, List<Transformation> transformations, boolean skipCache, boolean noFade, int errorResId, Drawable errorDrawable, String key, Callback callback) { super(picasso, uri, resourceId, imageView, options, transformations, skipCache, noFade, errorResId, errorDrawable, key, callback); ViewTreeObserver observer = imageView.getViewTreeObserver(); <START> if (observer.isAlive()) { <END> observer.addOnGlobalLayoutListener(this); } }</code><technical_language>Do care if this is false</technical_language>

Target:
DeferredImageViewRequest(Picasso picasso, Uri uri, int resourceId, ImageView imageView, PicassoBitmapOptions options, List<Transformation> transformations, boolean skipCache, boolean noFade, int errorResId, Drawable errorDrawable, String key, Callback callback) { super(picasso, uri, resourceId, imageView, options, transformations, skipCache, noFade, errorResId, errorDrawable, key, callback); ViewTreeObserver observer = imageView.getViewTreeObserver(); observer.addOnGlobalLayoutListener(this); }
Source:
<code>public static Gson getDefaultGsonParser() { GsonBuilder gsonBuilder = new GsonBuilder(); gsonBuilder.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES); gsonBuilder.registerTypeAdapter(Date.class, new JsonDeserializer<Date>() { <START> DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX"); <END> @Override public Date deserialize(final JsonElement json, final Type typeOfT, final JsonDeserializationContext context) throws JsonParseException { if(json == null || StringUtils.isBlank(json.getAsString())) { return null; } try { return df.parse(json.getAsString()); } catch(ParseException e) { LOG.error("error parsing date from Canvas: " + json.getAsString()); throw new JsonParseException(e); } } }); return gsonBuilder.create(); }</code><technical_language>If gson calls deserialize in a multi threaded context a bad time simpleDateFormat is thread safe</technical_language>

Target:
public static Gson getDefaultGsonParser() { GsonBuilder gsonBuilder = new GsonBuilder(); gsonBuilder.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES); gsonBuilder.registerTypeAdapter(Date.class, new JsonDeserializer<Date>() { FastDateFormat df = FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ssXXX"); @Override public Date deserialize(final JsonElement json, final Type typeOfT, final JsonDeserializationContext context) throws JsonParseException { if(json == null || StringUtils.isBlank(json.getAsString())) { return null; } try { return df.parse(json.getAsString()); } catch(ParseException e) { LOG.error("error parsing date from Canvas: " + json.getAsString()); throw new JsonParseException(e); } } }); return gsonBuilder.create(); }
Source:
<code>public void clear() { oldGenerator = null; <START> getJsonTextArea().setText(""); <END> numberOfPayloadsSpinner.setValue(1); }</code><technical_language>validate content is valid JSON, fail "silently" create it</technical_language>

Target:
public void clear() { oldGenerator = null; getJsonTextArea().setText(""); jsonTextArea.discardAllEdits(); numberOfPayloadsSpinner.setValue(1); }
Source:
<code><START> public long getNumberOfRestarts() { <END> return executionFailureHandler.getNumberOfRestarts(); }</code><technical_language>query this JobManagerMetricGroup I wondering JobManagerMetricGroup registration/query code belongs scheduler a separate e.g. SchedulingMetrics component</technical_language>

Target:
protected long getNumberOfRestarts() { return executionFailureHandler.getNumberOfRestarts(); }
Source:
<code>public void applyParameters(Material program) { super.applyParameters(program); <START> FBO scene = CoreRegistry.get(DynamicFBOsManager.class).get(DefaultDynamicFBOs.READ_ONLY_GBUFFER.getName()); END> if (scene != null) { GL13.glActiveTexture(GL13.GL_TEXTURE0); scene.bindDepthTexture(); program.setInt("texDepth", 0); program.setFloat("texelWidth", 1.0f / scene.width()); program.setFloat("texelHeight", 1.0f / scene.height()); } program.setFloat("pixelOffsetX", pixelOffsetX); program.setFloat("pixelOffsetY", pixelOffsetY); }</code><technical_language>FBO directly</technical_language>

Target:
public void applyParameters(Material program) { super.applyParameters(program); FBO scene = CoreRegistry.get(DisplayResolutionDependentFBOs.class).get(DefaultDynamicFBOs.READ_ONLY_GBUFFER.getName()); if (scene != null) { GL13.glActiveTexture(GL13.GL_TEXTURE0); scene.bindDepthTexture(); program.setInt("texDepth", 0); program.setFloat("texelWidth", 1.0f / scene.width()); program.setFloat("texelHeight", 1.0f / scene.height()); } program.setFloat("pixelOffsetX", pixelOffsetX); program.setFloat("pixelOffsetY", pixelOffsetY); }
Source:
<code>public Builder withQuestions(final QuestionResponseReadDAO questionResponseReadDAO) { this.surveyOneQuestions = Lists.newArrayList(); this.surveyOneQuestionIds = Lists.newArrayList(); final List<Question> allQuestions = questionResponseReadDAO.getAllQuestions(); for (final Question question : allQuestions) { <START> if (question.category != QuestionCategory.SURVEY_ONE) { <END> continue; } this.surveyOneQuestions.add(question); this.surveyOneQuestionIds.add(question.id); } return this; }</code><technical_language>!= for string comparison. java if(question.category.equals(QuestionCategory.SURVEY_ONE) do want, test it</technical_language>

Target:
public Builder withQuestions(final QuestionResponseReadDAO questionResponseReadDAO) { this.surveyQuestions = Lists.newArrayList(); final List<Question> allQuestions = questionResponseReadDAO.getAllQuestions(); for (final Question question : allQuestions) { if (question.category != QuestionCategory.SURVEY) { continue; } this.surveyQuestions.add(question); } return this; }
Source:
<code>public void updateWatchdogItems(Set<VmWatchdogType> vmWatchdogTypes) { List<String> watchDogModelsStrings = new ArrayList<String>(); final UIConstants constants = ConstantsManager.getInstance().getConstants(); for (VmWatchdogType vmWatchdogType : vmWatchdogTypes) { watchDogModelsStrings.add(vmWatchdogType.toString()); } <START> watchDogModelsStrings.add(0, constants.NoWatchdog()); <END> getWatchdogModelEditor().setItems(watchDogModelsStrings); String old_watchdog_selected_string = getWatchdogModelEditor().getSelectedItem(); if (watchDogModelsStrings.contains(old_watchdog_selected_string)) { getWatchdogModelEditor().setSelectedItem(old_watchdog_selected_string); } }</code><technical_language>'add(0, null)'</technical_language>

Target:
public void updateWatchdogItems(Set<VmWatchdogType> vmWatchdogTypes) { List<String> watchDogModelsStrings = new ArrayList<String>(); final UIConstants constants = ConstantsManager.getInstance().getConstants(); for (VmWatchdogType vmWatchdogType : vmWatchdogTypes) { watchDogModelsStrings.add(vmWatchdogType.toString()); } watchDogModelsStrings.add(0, constants.NoWatchdog()); getWatchdogModel().setItems(watchDogModelsStrings); String old_watchdog_selected_string = getWatchdogModel().getSelectedItem(); if (watchDogModelsStrings.contains(old_watchdog_selected_string)) { getWatchdogModel().setSelectedItem(old_watchdog_selected_string); } }
Source:
<code>public IBuildPlan parseJob(HudsonModelJob job) throws HudsonException { IBuildPlan plan = createBuildPlan(); String jobUrl = job.getUrl(); if (this.hudsonUrlUtil.isNestedJob(jobUrl)) { plan.setId(jobUrl); } else { plan.setId(job.getName()); } <START> plan.setName(job.getDisplayName()); <END> plan.setDescription(job.getDescription()); plan.setUrl(jobUrl); updateStateAndStatus(job, plan); updateHealth(job, plan); if (job.getLastBuild() != null) { IBuild build = parseBuild(job, job.getLastBuild()); plan.setLastBuild(build); } parseJobActions(plan.getParameterDefinitions(), job.getAction()); if (job instanceof HudsonMatrixMatrixProject) { List<HudsonMatrixMatrixConfiguration> childConfigs = ((HudsonMatrixMatrixProject) job) .getActiveConfiguration(); if (childConfigs != null) { for (HudsonMatrixMatrixConfiguration config : childConfigs) { IBuildPlan newPlan = parseJob(config); newPlan.setName(config.getDisplayName()); newPlan.setParent(plan); newPlan.setId(newPlan.getParent().getId() + newPlan.getId()); plan.getChildren().add(newPlan); } } } return plan; }</code><technical_language>hudsonUrlUtil. introduced handle jobs in folders. If need some behavioural change update HudsonUrlUtil</technical_language>

Target:
public IBuildPlan parseJob(HudsonModelJob job) throws HudsonException { IBuildPlan plan = createBuildPlan(); String jobUrl = job.getUrl(); if (this.hudsonUrlUtil.isNestedJob(jobUrl)) { plan.setId(jobUrl); } else { plan.setId(job.getName()); } plan.setName(this.hudsonUrlUtil.getDisplayName(jobUrl)); plan.setDescription(job.getDescription()); plan.setUrl(jobUrl); updateStateAndStatus(job, plan); updateHealth(job, plan); if (job.getLastBuild() != null) { IBuild build = parseBuild(job, job.getLastBuild()); plan.setLastBuild(build); } parseJobActions(plan.getParameterDefinitions(), job.getAction()); if (job instanceof HudsonMatrixMatrixProject) { List<HudsonMatrixMatrixConfiguration> childConfigs = ((HudsonMatrixMatrixProject) job) .getActiveConfiguration(); if (childConfigs != null) { for (HudsonMatrixMatrixConfiguration config : childConfigs) { IBuildPlan newPlan = parseJob(config); newPlan.setName(config.getDisplayName()); newPlan.setParent(plan); newPlan.setId(newPlan.getParent().getId() + newPlan.getId()); plan.getChildren().add(newPlan); } } } return plan; }
Source:
<code>public ValidationResult validate(URI fileUri, FileType fileType) { KitodoOutputHandler result = new KitodoOutputHandler(); try { JhoveBase jhoveBase = new JhoveBase(); <START> jhoveBase.init(Config.getParameter(PARAMETER_JHOVE_CONF, "src/main/resources/jhove.conf"), <END> JhoveBase.getSaxClassFromProperties()); jhoveBase.dispatch(App.newAppWithName("Jhove"), jhoveBase.getModule(determineModuleName(fileType)), null, result, null, new String[] {fileUri.getPath() }); } catch (Exception e) { result.treatException(e); } return result.toValidationResult(); }</code><technical_language>here: this adjusted #1623 is merged</technical_language>

Target:
public ValidationResult validate(URI fileUri, FileType fileType) { KitodoOutputHandler result = new KitodoOutputHandler(); try { KitodoJhoveBase jhoveBase = new KitodoJhoveBase(MODULES); jhoveBase.validate(fileUri.getPath(), MODULE_NAMES.get(fileType), result); } catch (Exception e) { result.treatException(e); } return result.toValidationResult(); }
Source:
<code>public Condition parse() throws ParseException { parseReturnSentence(); functionName = parseFunctionName(); <START> functionName = functionName.substring(KIE_FUNCTIONS.length(), functionName.length()); <END> List<FunctionDef> functionDefs = FunctionsRegistry.getInstance().getFunctions(functionName); if (functionDefs.isEmpty()) { throw new ParseException(errorMessage(FUNCTION_NAME_NOT_RECOGNIZED_ERROR, functionName), parseIndex); } ParseException lastTryException = null; for (FunctionDef functionDef : functionDefs) { try { reset(); return parse(functionDef); } catch (ParseException e) { lastTryException = e; } } throw lastTryException; }</code><technical_language>functionName.length() invocation is redundant here</technical_language>

Target:
public Condition parse() throws ParseException { parseReturnSentence(); functionName = parseFunctionName(); functionName = functionName.substring(KIE_FUNCTIONS.length()); List<FunctionDef> functionDefs = FunctionsRegistry.getInstance().getFunctions(functionName); if (functionDefs.isEmpty()) { throw new ParseException(errorMessage(FUNCTION_NAME_NOT_RECOGNIZED_ERROR, functionName), parseIndex); } ParseException lastTryException = null; for (FunctionDef functionDef : functionDefs) { try { reset(); return parse(functionDef); } catch (ParseException e) { lastTryException = e; } } throw lastTryException; }
Source:
<code>public static List<String> removePrefixUri(List<String> uris) { <START> for (int i = 0; i < uris.size(); i++) { <END> uris.set(i, removePrefixUri(uris.get(i))); } return uris; }</code><technical_language>return a new copy of list. obvious for caller this method modifies list is passed in. Allocating a new List is a cheap operation. "Premature optimization is root of evil"</technical_language>

Target:
public static List<String> removePrefixUri(List<String> uris) { return uris.stream().map(LanguageServiceUtils::removePrefixUri).collect(Collectors.toList()); }
Source:
<code>public void validate() { for (Frequency frequency: feed.frequencies) frequenciesById.put(frequency.trip_id, frequency); for (String tripId : frequenciesById.keySet()) { List<Frequency> frequencies = frequenciesById.get(tripId); <START> if (frequencies.size() < 1) { <END> return; } for (int i = 0; i < frequencies.size(); i++) { Frequency frequency = frequencies.get(i); for (int j = 0; j < frequencies.size(); j++) { if (i == j) continue; Frequency prevFrequency = frequencies.get(j); if ( frequency.end_time <= prevFrequency.end_time && frequency.start_time >= prevFrequency.start_time || frequency.start_time >= prevFrequency.start_time && frequency.start_time < prevFrequency.end_time || frequency.end_time > prevFrequency.start_time && frequency.end_time <= prevFrequency.end_time ) { registerError(frequency, NewGTFSErrorType.FREQUENCY_PERIOD_OVERLAP); } } } } }</code><technical_language>this <= 1</technical_language>

Target:
public void validate() { for (Frequency frequency: feed.frequencies) frequenciesById.put(frequency.trip_id, frequency); for (String tripId : frequenciesById.keySet()) { List<Frequency> frequencies = frequenciesById.get(tripId); if (frequencies.size() <= 1) { return; } for (int i = 0; i < frequencies.size() - 1; i++) { Frequency a = frequencies.get(i); for (int j = i + 1; j < frequencies.size(); j++) { Frequency b = frequencies.get(j); if ( b.start_time >= a.start_time && b.end_time <= a.end_time || a.start_time >= b.start_time && a.end_time <= b.end_time || a.start_time >= b.start_time && a.start_time < b.end_time || a.end_time > b.start_time && a.end_time <= b.end_time ) { registerError(a, NewGTFSErrorType.FREQUENCY_PERIOD_OVERLAP); } } } } }
Source:
<code>public Optional<Block> compute() { if (specialBlockProjectionOutput.isPresent()) { try { Optional<Block> output = specialBlockProjectionOutput.get().compute(); if (output.isPresent()) { lastOutputDictionary = output; } else { return Optional.empty(); } } catch (Exception ignored) { specialBlockProjectionOutput = emptySpecialBlockProjection(); } } if (block instanceof DictionaryBlock) { lastDictionaryUsageCount += selectedPositions.size(); } if (lastOutputDictionary.isPresent()) { if (block instanceof RunLengthEncodedBlock) { return Optional.of(new RunLengthEncodedBlock(lastOutputDictionary.get(), selectedPositions.size())); } if (block instanceof DictionaryBlock) { DictionaryBlock dictionaryBlock = (DictionaryBlock) block; lastDictionaryUsageCount += selectedPositions.size(); int[] outputIds = filterDictionaryIds(dictionaryBlock, selectedPositions); return Optional.of(new DictionaryBlock(selectedPositions.size(), lastOutputDictionary.get(), outputIds, false, sourceIdFunction.apply(dictionaryBlock))); } <START> verify(false, "unexpected block type " + block.getClass()); <END> } verify(!specialBlockProjectionOutput.isPresent()); return genericBlockProjectionOutput.compute(); }</code><technical_language>throw new UnsupportedOperationException(...)</technical_language>

Target:
public Optional<Block> compute() { if (fallbackProcessingProjectionOutput.isPresent()) { return fallbackProcessingProjectionOutput.get().compute(); } Optional<Block> dictionaryOutput = Optional.empty(); if (dictionaryProcessingProjectionOutput.isPresent()) { try { dictionaryOutput = dictionaryProcessingProjectionOutput.get().compute(); if (!dictionaryOutput.isPresent()) { return Optional.empty(); } lastOutputDictionary = dictionaryOutput; } catch (Exception ignored) { lastOutputDictionary = Optional.empty(); dictionaryProcessingProjectionOutput = Optional.empty(); } } if (block instanceof DictionaryBlock) { lastDictionaryUsageCount += selectedPositions.size(); } if (dictionaryOutput.isPresent()) { if (block instanceof RunLengthEncodedBlock) { return Optional.of(new RunLengthEncodedBlock(dictionaryOutput.get(), selectedPositions.size())); } if (block instanceof DictionaryBlock) { DictionaryBlock dictionaryBlock = (DictionaryBlock) block; int[] outputIds = filterDictionaryIds(dictionaryBlock, selectedPositions); return Optional.of(new DictionaryBlock(selectedPositions.size(), dictionaryOutput.get(), outputIds, false, sourceIdFunction.apply(dictionaryBlock))); } throw new UnsupportedOperationException("unexpected block type " + block.getClass()); } verify(!dictionaryProcessingProjectionOutput.isPresent()); verify(!fallbackProcessingProjectionOutput.isPresent()); fallbackProcessingProjectionOutput = Optional.of(projection.project(session, yieldSignal, new Page(block), selectedPositions)); return fallbackProcessingProjectionOutput.get().compute(); }
Source:
<code>private Set<InferenceVariable> getInferenceVariables(ParameterizedTypeBinding parameterizedType) { final Set<InferenceVariable> inferenceVariables = new LinkedHashSet<>(); <START> for(int <END> i=0;i<parameterizedType.arguments.length;i++) { final TypeBinding argument = parameterizedType.arguments[i]; argument.collectInferenceVariables(inferenceVariables); } return inferenceVariables; }</code><technical_language>For loop</technical_language>

Target:
private Set<InferenceVariable> getInferenceVariables(ParameterizedTypeBinding parameterizedType) { final Set<InferenceVariable> inferenceVariables = new LinkedHashSet<>(); for(final TypeBinding argument: parameterizedType.arguments) { argument.collectInferenceVariables(inferenceVariables); } return inferenceVariables; }
Source:
<code>public VersionTypeValidation validateToolSet(Set<SourceFile> sourcefiles, String primaryDescriptorFilePath) { List<DescriptorLanguage.FileType> fileTypes = new ArrayList<>(Collections.singletonList(DescriptorLanguage.FileType.DOCKSTORE_CWL)); Set<SourceFile> filteredSourceFiles = filterSourcefiles(sourcefiles, fileTypes); Optional<SourceFile> mainDescriptor = filteredSourceFiles.stream().filter((sourceFile -> Objects.equals(sourceFile.getPath(), primaryDescriptorFilePath))).findFirst(); boolean isValid = true; String validationMessage = null; Map<String, String> validationMessageObject = new HashMap<>(); if (mainDescriptor.isPresent()) { Yaml yaml = new Yaml(); String content = mainDescriptor.get().getContent(); if (content == null || content.isEmpty()) { isValid = false; validationMessage = "Primary CWL descriptor is empty."; } else if (!content.contains("class: CommandLineTool") && !content.contains("class: ExpressionTool")) { isValid = false; validationMessage = "A CWL tool requires class: CommandLineTool or ExpressionTool."; if (content.contains("class: Workflow")) { <START> validationMessage += " This file contains class: Workflow. Did you mean to register a workflow?"; <END> } } else if (!this.isValidCwl(content, yaml)) { isValid = false; validationMessage = "Invalid CWL version."; } } else { isValid = false; validationMessage = "Primary CWL descriptor is not present."; } validationMessageObject.put(primaryDescriptorFilePath, validationMessage); return new VersionTypeValidation(isValid, validationMessageObject); }</code><technical_language>single quotes actual code</technical_language>

Target:
public VersionTypeValidation validateToolSet(Set<SourceFile> sourcefiles, String primaryDescriptorFilePath) { List<DescriptorLanguage.FileType> fileTypes = new ArrayList<>(Collections.singletonList(DescriptorLanguage.FileType.DOCKSTORE_CWL)); Set<SourceFile> filteredSourceFiles = filterSourcefiles(sourcefiles, fileTypes); Optional<SourceFile> mainDescriptor = filteredSourceFiles.stream().filter((sourceFile -> Objects.equals(sourceFile.getPath(), primaryDescriptorFilePath))).findFirst(); boolean isValid = true; String validationMessage = null; Map<String, String> validationMessageObject = new HashMap<>(); if (mainDescriptor.isPresent()) { Yaml yaml = new Yaml(); String content = mainDescriptor.get().getContent(); if (content == null || content.isEmpty()) { isValid = false; validationMessage = "Primary CWL descriptor is empty."; } else if (!content.contains("class: CommandLineTool") && !content.contains("class: ExpressionTool")) { isValid = false; validationMessage = "A CWL tool requires 'class: CommandLineTool' or 'class: ExpressionTool'."; if (content.contains("class: Workflow")) { validationMessage += " This file contains 'class: Workflow'. Did you mean to register a workflow?"; } } else if (!this.isValidCwl(content, yaml)) { isValid = false; validationMessage = "Invalid CWL version."; } } else { isValid = false; validationMessage = "Primary CWL descriptor is not present."; } validationMessageObject.put(primaryDescriptorFilePath, validationMessage); return new VersionTypeValidation(isValid, validationMessageObject); }
Source:
<code>public Map<String, Map<String, String>> previewNewNote(long mid, String[] flds) { <START> Uri newNoteUri = addNoteInternal(mid, 1, flds, Collections.singleton(TEST_TAG)); <END> Map<String, Map<String, String>> cards = new HashMap<>(); Uri cardsUri = Uri.withAppendedPath(newNoteUri, "cards"); final Cursor cardsCursor = mResolver.query(cardsUri, null, null, null, null); try { while (cardsCursor.moveToNext()) { final String n = cardsCursor.getString(cardsCursor.getColumnIndex(FlashCardsContract.Card.CARD_NAME)); final String q = cardsCursor.getString(cardsCursor.getColumnIndex(FlashCardsContract.Card.QUESTION)); final String a = cardsCursor.getString(cardsCursor.getColumnIndex(FlashCardsContract.Card.ANSWER)); Map<String, String> html = new HashMap<>(); html.put("q", q); html.put("a", a); cards.put(n, html); } } finally { cardsCursor.close(); } mResolver.delete(newNoteUri, null, null); return cards; }</code><technical_language>Sure, add a private static final int DEFAULT_DECK_ID = 1;</technical_language>

Target:
public Map<String, Map<String, String>> previewNewNote(long mid, String[] flds) { Uri newNoteUri = addNoteInternal(mid, DEFAULT_DECK_ID, flds, Collections.singleton(TEST_TAG)); Map<String, Map<String, String>> cards = new HashMap<>(); Uri cardsUri = Uri.withAppendedPath(newNoteUri, "cards"); final Cursor cardsCursor = mResolver.query(cardsUri, null, null, null, null); try { while (cardsCursor.moveToNext()) { final String n = cardsCursor.getString(cardsCursor.getColumnIndex(FlashCardsContract.Card.CARD_NAME)); final String q = cardsCursor.getString(cardsCursor.getColumnIndex(FlashCardsContract.Card.QUESTION)); final String a = cardsCursor.getString(cardsCursor.getColumnIndex(FlashCardsContract.Card.ANSWER)); Map<String, String> html = new HashMap<>(); html.put("q", q); html.put("a", a); cards.put(n, html); } } finally { cardsCursor.close(); } mResolver.delete(newNoteUri, null, null); return cards; }
Source:
<code>public int execute() { try { Hive hiveDb = getHive(); Path dumpBaseDir = new Path(conf.getVar(HiveConf.ConfVars.REPLDIR), getNextDumpDir()); Path hiveDumpRoot = new Path(dumpBaseDir, ReplUtils.REPL_HIVE_BASE_DIR); DumpMetaData dmd = new DumpMetaData(hiveDumpRoot, conf); ReplChangeManager.getInstance(conf); Path cmRoot = new Path(conf.getVar(HiveConf.ConfVars.REPLCMDIR)); Long lastReplId; if (work.isBootStrapDump()) { lastReplId = bootStrapDump(hiveDumpRoot, dmd, cmRoot, hiveDb); } else { lastReplId = incrementalDump(hiveDumpRoot, dmd, cmRoot, hiveDb); } prepareReturnValues(Arrays.asList(dumpBaseDir.toUri().toString(), String.valueOf(lastReplId))); } catch (Exception e) { <START> LOG.error("failed", e); <END> setException(e); return ErrorMsg.getErrorMsg(e.getMessage()).getErrorCode(); } return 0; }</code><technical_language>keeping cm</technical_language>

Target:
public int execute() { try { Hive hiveDb = getHive(); Path dumpRoot = new Path(conf.getVar(HiveConf.ConfVars.REPLDIR), Base64.getEncoder().encodeToString(work.dbNameOrPattern.toLowerCase() .getBytes(StandardCharsets.UTF_8.name()))); Path currentDumpPath = new Path(dumpRoot, getNextDumpDir()); DumpMetaData dmd = new DumpMetaData(currentDumpPath, conf); ReplChangeManager.getInstance(conf); Path cmRoot = new Path(conf.getVar(HiveConf.ConfVars.REPLCMDIR)); Long lastReplId; if (!dumpRoot.getFileSystem(conf).exists(dumpRoot) || dumpRoot.getFileSystem(conf).listStatus(dumpRoot).length == 0) { lastReplId = bootStrapDump(currentDumpPath, dmd, cmRoot, hiveDb); } else { work.setEventFrom(getEventFromPreviousDumpMetadata(dumpRoot)); lastReplId = incrementalDump(currentDumpPath, dmd, cmRoot, hiveDb); } prepareReturnValues(Arrays.asList(currentDumpPath.toUri().toString(), String.valueOf(lastReplId))); } catch (Exception e) { LOG.error("failed", e); setException(e); return ErrorMsg.getErrorMsg(e.getMessage()).getErrorCode(); } return 0; }
Source:
<code>private void startNextFetch() { final CommCareSession session = CommCareApplication._().getCurrentSession(); String needed = session.getNeededData(); <START> StackFrameStep lastPopped = session.getPoppedStep(); <END> if (needed == null) { readyToProceed(session); } else if (needed.equals(SessionFrame.STATE_COMMAND_ID)) { handleGetCommand(session); } else if (needed.equals(SessionFrame.STATE_DATUM_VAL)) { handleGetDatum(session, lastPopped); } else if (needed.equals(SessionFrame.STATE_DATUM_COMPUTED)) { handleCompute(session); } }</code><technical_language>move this variable assignment handleGetDatum depends session</technical_language>

Target:
private void startNextFetch() { final CommCareSession session = CommCareApplication._().getCurrentSession(); String needed = session.getNeededData(); if (needed == null) { readyToProceed(session); } else if (needed.equals(SessionFrame.STATE_COMMAND_ID)) { handleGetCommand(session); } else if (needed.equals(SessionFrame.STATE_DATUM_VAL)) { handleGetDatum(session); } else if (needed.equals(SessionFrame.STATE_DATUM_COMPUTED)) { handleCompute(session); } }
Source:
<code>public NextAction start(@SuppressWarnings("unused") StateExecution execution) throws InterruptedException { sleep(100); <START> return counter++ < 100 ? moveToState(State.start, "loop") : moveToState(State.done, "done"); <END> }</code><technical_language>test fail if looping more 20 times, wait delay failure for 80 iterations that</technical_language>

Target:
public NextAction start(@SuppressWarnings("unused") StateExecution execution) throws InterruptedException { sleep(100); return moveToState(State.start, "loop"); }
Source:
<code>public String selector() { return EnvStackConfigUpdatesHandlerSelectors.STACK_CONFIG_UPDATES_HANDLER_EVENT <START> .name(); <END> }</code><technical_language>event() is</technical_language>

Target:
public String selector() { return EnvStackConfigUpdatesHandlerSelectors.STACK_CONFIG_UPDATES_HANDLER_EVENT.event(); }
Source:
<code>public int hashCode() { int result = dataLinks.hashCode(); result = 31 * result + paymentExternalId.hashCode(); result = 31 * result + amount.hashCode(); result = 31 * result + paymentProvider.hashCode(); result = 31 * result + description.hashCode(); result = 31 * result + reference.hashCode(); result = 31 * result + createdDate.hashCode(); result = 31 * result + state.hashCode(); <START> return result; <END> }</code><technical_language>this code is generated IDE I public int hashCode() { return HashCodeBuilder.reflectionHashCode(this); } <LINK_0> code cluttered. I leave though, this is a suggestion</technical_language>

Target:
public int hashCode() { return Objects.hash(paymentExternalId, amount, paymentProvider, description, reference, createdDate, state); }
Source:
<code>public int getLocationQuark(ITmfEvent event, int startQuark) { int quark = startQuark; for (TmfXmlStateAttribute attrib : fPath) { <START> quark = attrib.getAttributeQuark(event, quark); <END> } return quark; }</code><technical_language>throw error</technical_language>

Target:
public int getLocationQuark(ITmfEvent event, int startQuark) { int quark = startQuark; for (TmfXmlStateAttribute attrib : fPath) { quark = attrib.getAttributeQuark(event, quark); if (quark == -1) { break; } } return quark; }
Source:
<code>public MongoDBCacheStoreConfig(String host, int port, int timeout, String username, String password, String database, String collection, int acknowledgment) { if (port < 1 || port > 65535) { <START> log.mongoPortIllegalValue(String.valueOf(port)); <END> } this.host = host; this.port = port; this.username = username; this.password = password; this.database = database; this.collection = collection; this.timeout = timeout; if (acknowledgment <= -1) { this.acknowledgment = -1; } else if (this.acknowledgment >= 2) { this.acknowledgment = 2; } else { this.acknowledgment = acknowledgment; } }</code><technical_language>throw exception here</technical_language>

Target:
public MongoDBCacheStoreConfig(String host, int port, int timeout, String username, String password, String database, String collection, int acknowledgment) { if (port < 1 || port > 65535) { log.mongoPortIllegalValue(port); } this.host = host; this.port = port; this.username = username; this.password = password; this.database = database; this.collection = collection; this.timeout = timeout; if (acknowledgment <= -1) { this.acknowledgment = -1; } else if (this.acknowledgment >= 2) { this.acknowledgment = 2; } else { this.acknowledgment = acknowledgment; } }