auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void setErrorDetailsForTaskExecution(DelegateExecution execution, String errorMessage, RESTResponse response) { if (httpStatusVariable != null && response != null) { execution.setVariable(httpStatusVariable.getValue(execution).toString(), response.getHttpStatus()); } <START> if (errorMessageVariable != null) { <END> execution.setVariable(errorMessageVariable.getValue(execution).toString(), errorMessage); } }</code><technical_language>in case if user set errorMessageVariable in BPMN, populate this error message default variable called ERROR_MESSAGE, ERROR_ACTIVITY_ID variables</technical_language>

Target:
private void setErrorDetailsForTaskExecution(DelegateExecution execution, String errorMessage, RESTResponse response) { if (httpStatusVariable != null && response != null) { execution.setVariable(httpStatusVariable.getValue(execution).toString(), response.getHttpStatus()); } else if (response != null) { execution.setVariable(REST_INVOKE_ERROR_CODE, response.getHttpStatus()); } if (errorMessageVariable != null) { execution.setVariable(errorMessageVariable.getValue(execution).toString(), errorMessage); } else { execution.setVariable(REST_INVOKE_ERROR_MESSAGE, errorMessage); } }
Source:
<code>protected void finalize() throws Throwable { <START> ((ClassDiagramPattern) comboSelection).setPatternConfiguration(false, false); <END> super.finalize(); }</code><technical_language>Do configure selected pattern here. If user clic finish, skeleton created default value. Another remark : a dangerous cast: combo selection is a IPatternPovider, enough time ClassDiagramPattern is expected friends</technical_language>

Target:
protected void finalize() throws Throwable { if (comboSelection instanceof ClassDiagramPattern) ((ClassDiagramPattern) comboSelection).setPatternConfiguration(false, false); super.finalize(); }
Source:
<code>public View getChildView(final int group, final int child, final boolean isLastChild, View convertView, final ViewGroup viewGroup) { final WeaponUnlock unlock = getChild(group, child).getUnlock(); final int completion = unlock.getCriteria().getCompletion(); while (convertView == null) { convertView = layoutInflater.inflate(R.layout.list_item_unlocks, viewGroup, false); } setText(convertView, R.id.title, WeaponStringSlugMap.get(unlock.getSlug())); setText(convertView, R.id.subtitle, resolveCriteriaLabel(unlock.getCriteria())); setProgress(convertView, R.id.progress, completion, 100); if (unlock.getCriteria().isCompleted()) { setText(convertView, R.id.completion, R.string.done); <START> convertView.setAlpha(0.5f); <END> } else { setText(convertView, R.id.completion, completion + "%"); convertView.setAlpha(1.0f); } return convertView; }</code><technical_language>I extract resources (including other usages)</technical_language>

Target:
public View getChildView(final int group, final int child, final boolean isLastChild, View convertView, final ViewGroup viewGroup) { final WeaponUnlock unlock = getChild(group, child).getUnlock(); final int completion = unlock.getCriteria().getCompletion(); while (convertView == null) { convertView = layoutInflater.inflate(R.layout.list_item_unlocks, viewGroup, false); } setText(convertView, R.id.title, WeaponStringSlugMap.get(unlock.getSlug())); setText(convertView, R.id.subtitle, resolveCriteriaLabel(unlock.getCriteria())); setProgress(convertView, R.id.progress, completion, 100); convertView.setAlpha(unlock.getCriteria().isCompleted() ? OPACITY_FADED : OPACITY_NORMAL); return convertView; }
Source:
<code>public void importFileStorageAddDomain(ArrayList<StorageDomain> domains) { StorageDomain sdToAdd = Linq.firstOrDefault(domains); StorageDomainStatic sdsToAdd = sdToAdd.getStorageStaticData(); StorageDomainManagementParameter params = new StorageDomainManagementParameter(sdsToAdd); params.setVdsId(hostId); Frontend.getInstance().runAction(VdcActionType.AddExistingFileStorageDomain, params, new IFrontendActionAsyncCallback() { @Override public void executed(FrontendActionAsyncResult result) { Object[] array = (Object[]) result.getState(); StorageListModel storageListModel = (StorageListModel) array[0]; StorageDomain sdToAdd1 = (StorageDomain) array[1]; VdcReturnValueBase returnVal = result.getReturnValue(); boolean success = returnVal != null && returnVal.getSucceeded(); if (success) { StorageModel model = (StorageModel) storageListModel.getWindow(); StoragePool dataCenter = model.getDataCenter().getSelectedItem(); if (!dataCenter.getId().equals(StorageModel.UnassignedDataCenterId)) { storageListModel.attachStorageToDataCenter(sdToAdd1.getId(), dataCenter.getId(), model.getActivateDomain().getEntity()); onFinish(storageListModel.context, true, storageListModel.storageModel, null); } else { postImportFileStorage(storageListModel.context, true, storageListModel.storageModel, null); } } else { postImportFileStorage(storageListModel.context, false, storageListModel.storageModel, ""); <START> storageListModel.cleanConnection(fileConnection, hostId); <END> } } }, new Object[] {this, sdToAdd}); }</code><technical_language>fine 'storageListModel.'</technical_language>

Target:
public void importFileStorageAddDomain(ArrayList<StorageDomain> domains) { StorageDomain sdToAdd = Linq.firstOrDefault(domains); StorageDomainStatic sdsToAdd = sdToAdd.getStorageStaticData(); StorageDomainManagementParameter params = new StorageDomainManagementParameter(sdsToAdd); params.setVdsId(hostId); Frontend.getInstance().runAction(VdcActionType.AddExistingFileStorageDomain, params, new IFrontendActionAsyncCallback() { @Override public void executed(FrontendActionAsyncResult result) { Object[] array = (Object[]) result.getState(); StorageListModel storageListModel = (StorageListModel) array[0]; StorageDomain sdToAdd1 = (StorageDomain) array[1]; VdcReturnValueBase returnVal = result.getReturnValue(); boolean success = returnVal != null && returnVal.getSucceeded(); if (success) { StorageModel model = (StorageModel) storageListModel.getWindow(); StoragePool dataCenter = model.getDataCenter().getSelectedItem(); if (!dataCenter.getId().equals(StorageModel.UnassignedDataCenterId)) { storageListModel.attachStorageToDataCenter(sdToAdd1.getId(), dataCenter.getId(), model.getActivateDomain().getEntity()); onFinish(storageListModel.context, true, storageListModel.storageModel, null); } else { postImportFileStorage(storageListModel.context, true, storageListModel.storageModel, null); } } else { postImportFileStorage(storageListModel.context, false, storageListModel.storageModel, ""); cleanConnection(fileConnection, hostId); } } }, new Object[] {this, sdToAdd}); }
Source:
<code><START> protected MessageDigest getMd5Digest(final HttpServletRequest request) <END> throws NoSuchAlgorithmException { MessageDigest digest = createMd5Digest(); for (MD5Attributes attribute: MD5Attributes.values()) { if (request.getAttribute(attribute.getAttributeKey()) != null) { digest.update(request.getAttribute(attribute.getAttributeKey()). toString().getBytes()); } } return digest; }</code><technical_language>Excellent change! +1</technical_language>

Target:
protected MessageDigest getMd5Digest(final HttpServletRequest request) throws NoSuchAlgorithmException { MessageDigest digest = createMd5Digest(); for (MD5Attributes attribute: MD5Attributes.values()) { if (request.getAttribute(attribute.getKey()) != null) { digest.update(request.getAttribute(attribute.getKey()). toString().getBytes()); } } return digest; }
Source:
<code>public Object visitCommand(InvocationContext ctx, VisitableCommand command) { if (ctx.isOriginLocal()) { <START> if ((command instanceof AbstractDataCommand) && ((AbstractDataCommand)command).getFlags().contains(Flag.SKIP_XSITE_BACKUP)) { <END> int count = backupSiteInvocationCount.incrementAndGet(); log.infof("Backup Hit %d for %s", count, command); } else { int count = localSiteInvocationCount.incrementAndGet(); log.infof("Local Hit %d for %s", count, command); } } return invokeNext(ctx, command); }</code><technical_language>suggestion if ((command instanceof AbstractDataCommand) && ((AbstractDataCommand)command).hasAnyFlag(FlagBitSets.SKIP_XSITE_BACKUP)) { (needs import well)</technical_language>

Target:
public Object visitCommand(InvocationContext ctx, VisitableCommand command) { if (ctx.isOriginLocal()) { if ((command instanceof AbstractDataCommand) && ((AbstractDataCommand)command).hasAnyFlag(FlagBitSets.SKIP_XSITE_BACKUP)) { int count = backupSiteInvocationCount.incrementAndGet(); log.infof("Backup Hit %d for %s", count, command); } else { int count = localSiteInvocationCount.incrementAndGet(); log.infof("Local Hit %d for %s", count, command); } } return invokeNext(ctx, command); }
Source:
<code>public void populatePossibleValuesForCategoricalVariates(List<MeasurementVariable> variates, String programUUID, OntologyDataManager ontologyDataManager) { for (MeasurementVariable measurementVariable : variates) { Integer standardVariableId = null; if (measurementVariable.getTermId() == 0) { standardVariableId = ontologyDataManager.getStandardVariableIdByPropertyScaleMethod(measurementVariable.getProperty(), measurementVariable.getScale(), measurementVariable.getMethod()); } else { standardVariableId = measurementVariable.getTermId(); } StandardVariable standardVariable = null; if (standardVariableId != null) { standardVariable = ontologyDataManager.getStandardVariable(standardVariableId, programUUID); } <START> if (standardVariable != null && standardVariable.getDataType().getId() == DataType.CATEGORICAL_VARIABLE.getId()) { <END> List<ValueReference> possibleValues = new ArrayList<>(); if (standardVariable.getEnumerations() != null && !standardVariable.getEnumerations().isEmpty()) { for (Enumeration enumeration : standardVariable.getEnumerations()) { possibleValues.add(new ValueReference(enumeration.getId(), enumeration.getName(), enumeration.getDescription())); } } measurementVariable.setPossibleValues(possibleValues); measurementVariable.setDataTypeId(standardVariable.getDataType().getId()); } } }</code><technical_language>remove null check</technical_language>

Target:
public void populatePossibleValuesForCategoricalVariates(List<MeasurementVariable> variates, String programUUID, OntologyDataManager ontologyDataManager) { for (MeasurementVariable measurementVariable : variates) { StandardVariable standardVariable = ontologyDataManager.findStandardVariableByTraitScaleMethodNames(measurementVariable.getProperty(), measurementVariable.getScale(), measurementVariable.getMethod(), programUUID); if (standardVariable != null && standardVariable.getDataType().getId() == DataType.CATEGORICAL_VARIABLE.getId()) { List<ValueReference> possibleValues = new ArrayList<>(); if (standardVariable.getEnumerations() != null && !standardVariable.getEnumerations().isEmpty()) { for (Enumeration enumeration : standardVariable.getEnumerations()) { possibleValues.add(new ValueReference(enumeration.getId(), enumeration.getName(), enumeration.getDescription())); } } measurementVariable.setPossibleValues(possibleValues); measurementVariable.setDataTypeId(standardVariable.getDataType().getId()); } } }
Source:
<code>public static Node layoutEvents(Model model, TurboIssue issue, List<TurboIssueEvent> events, List<Comment> comments) { VBox result = new VBox(); result.setSpacing(3); VBox.setMargin(result, new Insets(3, 0, 0, 0)); TurboIssueEvent.createLabelUpdateEventNodes( model, events.stream() .filter(e -> e.isLabelUpdateEvent()) .collect(Collectors.toList())) <START> .forEach(node -> result.getChildren().add(node));; <END> events.stream() .filter(e -> !e.isLabelUpdateEvent()) .map(e -> e.display(model, issue)) .forEach(e -> result.getChildren().add(e)); if (comments.size() > 0) { String names = comments.stream() .map(comment -> comment.getUser().getLogin()) .distinct() .collect(Collectors.joining(", ")); HBox commentDisplay = new HBox(); commentDisplay.getChildren().addAll( TurboIssueEvent.octicon(TurboIssueEvent.OCTICON_QUOTE), new javafx.scene.control.Label( String.format("%d comments since, involving %s.", comments.size(), names)) ); result.getChildren().add(commentDisplay); } return result; }</code><technical_language>This line indented more? Right aligned start. Is double semicolon intended</technical_language>

Target:
private static Node layoutEvents(Model model, TurboIssue issue, List<TurboIssueEvent> events, List<Comment> comments) { VBox result = new VBox(); result.setSpacing(3); VBox.setMargin(result, new Insets(3, 0, 0, 0)); List<TurboIssueEvent> labelUpdateEvents = events.stream() .filter(TurboIssueEvent::isLabelUpdateEvent) .collect(Collectors.toList()); List<Node> labelUpdateEventNodes = TurboIssueEvent.createLabelUpdateEventNodes(model, labelUpdateEvents); labelUpdateEventNodes.forEach(node -> result.getChildren().add(node)); events.stream() .filter(e -> !e.isLabelUpdateEvent()) .map(e -> e.display(model, issue)) .forEach(e -> result.getChildren().add(e)); if (comments.size() > 0) { String names = comments.stream() .map(comment -> comment.getUser().getLogin()) .distinct() .collect(Collectors.joining(", ")); HBox commentDisplay = new HBox(); commentDisplay.getChildren().addAll( TurboIssueEvent.octicon(TurboIssueEvent.OCTICON_QUOTE), new javafx.scene.control.Label( String.format("%d comments since, involving %s.", comments.size(), names)) ); result.getChildren().add(commentDisplay); } return result; }
Source:
<code>private Response getInvalidStatusResponse(String chargeId, ChargeStatus newChargeStatus) { <START> logger.warn("charge with id cannot be updated to the new status: {}", chargeId, newChargeStatus.getValue()); <END> return badRequestResponse("charge with id: " + chargeId + " cannot be updated to the new status: " + newChargeStatus.getValue()); }</code><technical_language>this happen routinely? cause</technical_language>

Target:
private Response getInvalidStatusResponse(String chargeId, ChargeStatus newChargeStatus) { return badRequestResponse("charge with id: " + chargeId + " cannot be updated to the new status: " + newChargeStatus.getValue()); }
Source:
<code>private synchronized boolean maybeCompleted() { if (!(receivers.isEmpty() && transfers.isEmpty())) return false; <START> if (!maybeCompleted.compareAndSet(false, true)) <END> return true; if (state == State.WAIT_COMPLETE) { if (!completeSent) { messageSender.sendMessage(new CompleteMessage()); completeSent = true; } closeSession(State.COMPLETE); } else { messageSender.sendMessage(new CompleteMessage()); completeSent = true; state(State.WAIT_COMPLETE); } return true; }</code><technical_language>maybCompleted is this synchroznized method is need AtomicBoolean</technical_language>

Target:
private synchronized boolean maybeCompleted() { if (!(receivers.isEmpty() && transfers.isEmpty())) return false; if (maybeCompleted) return true; maybeCompleted = true; if (!isFollower) { if (state == State.WAIT_COMPLETE) closeSession(State.COMPLETE); else state(State.WAIT_COMPLETE); } else { messageSender.sendMessage(new CompleteMessage()); closeSession(State.COMPLETE); } return true; }
Source:
<code>public Map<String, Map<String, Integer>> dumpHashTableStats(final Operator op) { <START> Map<String, Map<String, Integer>> ret = new HashMap<String, Map<String, Integer>>(); <END> for (Operator o : op.getChildren()) { ret.putAll(dumpHashTableStats(o)); } ret.putAll(op.dumpHashTableStats()); return ret; }</code><technical_language>I diamond operator</technical_language>

Target:
public Map<String, Map<String, Integer>> dumpHashTableStats(final Operator op) { Map<String, Map<String, Integer>> ret = new HashMap<>(); for (Operator o : op.getChildren()) { ret.putAll(dumpHashTableStats(o)); } ret.putAll(op.dumpHashTableStats()); return ret; }
Source:
<code>public void initialize(IProject inputProject1, IManagedBuildInfo info, IProgressMonitor newMonitor1) { this.project = inputProject1; try { this.projectResources = inputProject1.members(); } catch (CoreException e) { this.projectResources = null; } this.monitor = newMonitor1; this.buildTargetName = info.getBuildArtifactName(); this.buildTargetExt = info.getBuildArtifactExtension(); try { this.buildTargetExt = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(this.buildTargetExt, "", " ", IBuildMacroProvider.CONTEXT_CONFIGURATION, info.getDefaultConfiguration()); } catch (BuildMacroException e) { } try { String resolved = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(this.buildTargetName, "", " ", IBuildMacroProvider.CONTEXT_CONFIGURATION, info.getDefaultConfiguration()); resolved = resolved.trim(); <START> if (resolved != null && resolved.length() > 0) <END> this.buildTargetName = resolved; } catch (BuildMacroException e) { } if (this.buildTargetExt == null) { this.buildTargetExt = new String(); } this.config = info.getDefaultConfiguration(); this.builder = this.config.getEditableBuilder(); initToolInfos(); this.topBuildDir = inputProject1.getFolder(info.getConfigurationName()).getFullPath(); }</code><technical_language>This introduces error</technical_language>

Target:
public void initialize(IProject inputProject1, IManagedBuildInfo info, IProgressMonitor newMonitor1) { this.project = inputProject1; try { this.projectResources = inputProject1.members(); } catch (CoreException e) { this.projectResources = null; } this.monitor = newMonitor1; this.buildTargetName = info.getBuildArtifactName(); this.buildTargetExt = info.getBuildArtifactExtension(); try { this.buildTargetExt = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(this.buildTargetExt, "", " ", IBuildMacroProvider.CONTEXT_CONFIGURATION, info.getDefaultConfiguration()); } catch (BuildMacroException e) { } try { String resolved = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(this.buildTargetName, "", " ", IBuildMacroProvider.CONTEXT_CONFIGURATION, info.getDefaultConfiguration()); if (resolved != null && (resolved = resolved.trim()).length() > 0) this.buildTargetName = resolved; } catch (BuildMacroException e) { } if (this.buildTargetExt == null) { this.buildTargetExt = new String(); } this.config = info.getDefaultConfiguration(); this.builder = this.config.getEditableBuilder(); initToolInfos(); this.topBuildDir = inputProject1.getFolder(info.getConfigurationName()).getFullPath(); }
Source:
<code>protected void doGetText(HttpServletRequest req, HttpServletResponse res) throws IOException { GitilesView view = ViewFilter.getView(req); Repository repo = ServletUtils.getRepository(req); ObjectReader reader = repo.newObjectReader(); try (Writer writer = startRenderText(req, res); OutputStream out = BaseEncoding.base64().encodingStream(writer)) { ObjectLoader loader = reader.open(view.getRevision().getId()); <START> if (loader.getType() != OBJ_COMMIT) { <END> res.setStatus(SC_NOT_FOUND); } else { loader.copyTo(out); } } finally { reader.release(); } }</code><technical_language>This check moved try. I opening OutputStream response side effect of committing response, allowed change status code. (This implementation-defined in servlet container, I misremembering, short-circuit ASAP.) this means another level of try block, do</technical_language>

Target:
protected void doGetText(HttpServletRequest req, HttpServletResponse res) throws IOException { GitilesView view = ViewFilter.getView(req); Repository repo = ServletUtils.getRepository(req); ObjectReader reader = repo.newObjectReader(); try { ObjectLoader loader = reader.open(view.getRevision().getId()); if (loader.getType() != OBJ_COMMIT) { res.setStatus(SC_NOT_FOUND); } else { try (Writer writer = startRenderText(req, res); OutputStream out = BaseEncoding.base64().encodingStream(writer)) { loader.copyTo(out); } } } finally { reader.release(); } }
Source:
<code>public static void writeTelemetryData(JsonWriter json, TelemetryData statistics) { json.beginObject(); json.prop("id", statistics.getServerId()); <START> json.prop("version", statistics.getVersion()); <END> json.name("database"); json.beginObject(); json.prop("name", statistics.getDatabase().getName()); json.prop("version", statistics.getDatabase().getVersion()); json.endObject(); json.name("plugins"); json.beginArray(); statistics.getPlugins().forEach((plugin, version) -> { json.beginObject(); json.prop("name", plugin); json.prop("version", version); json.endObject(); }); json.endArray(); json.prop("userCount", statistics.getUserCount()); json.prop("projectCount", statistics.getProjectCount()); json.prop(LINES_KEY, statistics.getLines()); json.prop(NCLOC_KEY, statistics.getNcloc()); json.name("projectCountByLanguage"); json.beginArray(); statistics.getProjectCountByLanguage().forEach((language, count) -> { json.beginObject(); json.prop("language", language); json.prop("count", count); json.endObject(); }); json.endArray(); json.name("nclocByLanguage"); json.beginArray(); statistics.getNclocByLanguage().forEach((language, ncloc) -> { json.beginObject(); json.prop("language", language); json.prop("ncloc", ncloc); json.endObject(); }); json.endArray(); json.endObject(); }</code><technical_language>![CRITICAL](<LINK_0> 'Severity: CRITICAL') Define a constant instead of duplicating this literal "version" 3 times. [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
public static void writeTelemetryData(JsonWriter json, TelemetryData statistics) { json.beginObject(); json.prop("id", statistics.getServerId()); json.prop("version", statistics.getVersion()); json.name("database"); json.beginObject(); json.prop("name", statistics.getDatabase().getName()); json.prop("version", statistics.getDatabase().getVersion()); json.endObject(); json.name("plugins"); json.beginArray(); statistics.getPlugins().forEach((plugin, version) -> { json.beginObject(); json.prop("name", plugin); json.prop("version", version); json.endObject(); }); json.endArray(); json.prop("userCount", statistics.getUserCount()); json.prop("projectCount", statistics.getProjectCount()); json.prop("usingBranches", statistics.isUsingBranches()); json.prop(LINES_KEY, statistics.getLines()); json.prop(NCLOC_KEY, statistics.getNcloc()); json.name("projectCountByLanguage"); json.beginArray(); statistics.getProjectCountByLanguage().forEach((language, count) -> { json.beginObject(); json.prop("language", language); json.prop("count", count); json.endObject(); }); json.endArray(); json.name("nclocByLanguage"); json.beginArray(); statistics.getNclocByLanguage().forEach((language, ncloc) -> { json.beginObject(); json.prop("language", language); json.prop("ncloc", ncloc); json.endObject(); }); json.endArray(); json.endObject(); }
Source:
<code>public Response postUzytkownicy(Uzytkownicy uzytkownicy) { Statement statement; try { connection.establishConnection(); statement = connection.getConnection().createStatement(); statement.executeQuery("SELECT adduzytkownik('" + uzytkownicy.getNick() + "', '" + uzytkownicy.getEmail() + "', '" + uzytkownicy.getHaslo() + "')"); } catch (Exception ex) { System.err.println(ex); if (ex.toString().contains("(email)=") && ex.toString().contains("już istnieje")) { return Response.ok("Podany email jest juz zajety").build(); } else if (ex.toString().contains("(nick)=") && ex.toString().contains("już istnieje")) { return Response.ok("Podany nick jest juz zajety").build(); } else if (ex.toString().contains("Brak funkcji")) { return <START> Response.ok("Brakuje <END> odpowiedniej funkcji w bazie danych").build(); } connection.closeConnection(); return Response.ok("Wystapil nieznany blad").build(); } connection.closeConnection(); return Response.ok("OK").build(); }</code><technical_language>a nie powinno byc .serverError() albo .status ?</technical_language>

Target:
public Response postUzytkownicy(Uzytkownicy uzytkownicy) { Statement statement; try { connection.establishConnection(); statement = connection.getConnection().createStatement(); statement.executeQuery("SELECT adduzytkownik('" + uzytkownicy.getNick() + "', '" + uzytkownicy.getEmail() + "', '" + uzytkownicy.getHaslo() + "')"); } catch (Exception ex) { System.err.println(ex); if (ex.toString().contains("(email)=") && ex.toString().contains("już istnieje")) { return Response.serverError().entity("Podany email jest juz zajety").build(); } else if (ex.toString().contains("(nick)=") && ex.toString().contains("już istnieje")) { return Response.serverError().entity("Podany nick jest juz zajety").build(); } else if (ex.toString().contains("Brak funkcji")) { return Response.serverError().entity("Brakuje odpowiedniej funkcji w bazie danych").build(); } connection.closeConnection(); return Response.serverError().entity("Wystapil nieznany blad").build(); } connection.closeConnection(); return Response.ok("OK").build(); }
Source:
<code>public void setup() { <START> TimeZone.setDefault(TimeZone.getTimeZone("Europe/Helsinki")); END> baseConfig = MySQLTests.baseConfig(); execute(readResource("setup.sql")); }</code><technical_language>TravisCI gradle check command. gradle reads test settings configure time zone. setting work for you? <LINK_0></technical_language>

Target:
public void setup() { baseConfig = MySQLTests.baseConfig(); execute(readResource("setup.sql")); }
Source:
<code>public boolean supportsAggregatesMin() { <START> return false; <END> }</code><technical_language>Is this supposed true</technical_language>

Target:
public boolean supportsAggregatesMin() { return true; }
Source:
<code>public void deregisterPlugin(String pluginId) { pluginToConfigurationMap.remove(pluginId); pluginsThatSupportsWebBasedAuthentication.remove(pluginId); pluginsThatSupportsPasswordBasedAuthentication.remove(pluginId); <START> pluginsThatSupportsUserSearch.remove(pluginId); <END> }</code><technical_language>of internal lists maintained for supportsUserSearch, supportWebBasedAuth basic-auth etc. Firstly, I auth-plugins allow user search, I do a point in making optional end-point is concerned. Sure, if plugin want implement it, return empty list. pluginsThatSupportsWebBasedAuthentication picture for displaying login image for plugins login screen. a user driven action, sense cache info? I undecided pluginsThatSupportsPasswordBasedAuthentication list, I do realise performance making curl requests</technical_language>

Target:
public void deregisterPlugin(String pluginId) { pluginToConfigurationMap.remove(pluginId); pluginsThatSupportsWebBasedAuthentication.remove(pluginId); pluginsThatSupportsPasswordBasedAuthentication.remove(pluginId); }
Source:
<code>public static DatabaseDialect findBestFor( String jdbcUrl, AbstractConfig config ) throws ConnectException { final JdbcUrlInfo info = extractJdbcUrlInfo(jdbcUrl); LOG.debug("Finding best dialect for {}", info); <START> int bestScore = DatabaseDialectProvider.MINIMUM_MATCHING_SCORE - 1; <END> DatabaseDialectProvider bestMatch = null; for (DatabaseDialectProvider provider : REGISTRY.values()) { int score = provider.score(info); LOG.debug("Dialect scored against {}", provider, score, info); if (score > bestScore) { bestMatch = provider; bestScore = score; } } LOG.debug("Using dialect with score against {}", bestMatch, bestScore, info); return bestMatch.create(config); }</code><technical_language>suggest int bestScore = DatabaseDialectProvider.MINIMUM_MATCHING_SCORE; check for equality too. artificially considering a score minimum (paradox :) ) is ideal. happen 1 for min, if another min minimum integer, this work (underflow). important reason for that. Changing > comparison >= secure misinterpretations. a thought pretty generic code tested work elsewhere</technical_language>

Target:
public static DatabaseDialect findBestFor( String jdbcUrl, AbstractConfig config ) throws ConnectException { final JdbcUrlInfo info = extractJdbcUrlInfo(jdbcUrl); LOG.debug("Finding best dialect for {}", info); int bestScore = DatabaseDialectProvider.NO_MATCH_SCORE; DatabaseDialectProvider bestMatch = null; for (DatabaseDialectProvider provider : REGISTRY.values()) { int score = provider.score(info); LOG.debug("Dialect scored against {}", provider, score, info); if (score > bestScore) { bestMatch = provider; bestScore = score; } } LOG.debug("Using dialect with score against {}", bestMatch, bestScore, info); return bestMatch.create(config); }
Source:
<code>private X509CertificateHolder resolveIssuerCertificate(Certificate cert) throws OcspCheckerException { X500Name issuerName = cert.getIssuer(); String trustStorePath = AccessController.doPrivileged( (PrivilegedAction<String>) SecurityConstants::getTruststorePath); String trustStorePass = AccessController.doPrivileged( (PrivilegedAction<String>) SecurityConstants::getTruststorePassword); if (isBlank(trustStorePath) || isBlank(trustStorePass)) { throw new OcspCheckerException("Problem retrieving truststore properties."); } KeyStore truststore; try (InputStream truststoreInputStream = new FileInputStream(trustStorePath)) { truststore = SecurityConstants.newTruststore(); <START> truststore.load(truststoreInputStream, trustStorePass.toCharArray()); <END> } catch (CertificateException | IOException | KeyStoreException | NoSuchAlgorithmException e) { throw new OcspCheckerException( String.format("Problem loading truststore on path %s", trustStorePath)); } try { return getCertFromTruststoreWithX500Name(issuerName, truststore); } catch (OcspCheckerException e) { throw new OcspCheckerException("Problem finding issuer in truststore.", e); } }</code><technical_language>check @stustison if this is worth logging security audit log</technical_language>

Target:
private X509CertificateHolder resolveIssuerCertificate(Certificate cert) throws OcspCheckerException { X500Name issuerName = cert.getIssuer(); String trustStorePath = AccessController.doPrivileged( (PrivilegedAction<String>) SecurityConstants::getTruststorePath); String trustStorePass = AccessController.doPrivileged( (PrivilegedAction<String>) SecurityConstants::getTruststorePassword); if (isBlank(trustStorePath) || isBlank(trustStorePass)) { throw new OcspCheckerException( "Problem retrieving truststore properties." + NOT_VERIFIED_MSG); } KeyStore truststore; try (InputStream truststoreInputStream = new FileInputStream(trustStorePath)) { truststore = SecurityConstants.newTruststore(); truststore.load(truststoreInputStream, trustStorePass.toCharArray()); SecurityLogger.audit( "Truststore on path was read by {}.", trustStorePath, this.getClass().getSimpleName()); } catch (CertificateException | IOException | KeyStoreException | NoSuchAlgorithmException e) { throw new OcspCheckerException( String.format("Problem loading truststore on path %s", trustStorePath), e); } try { return getCertFromTruststoreWithX500Name(issuerName, truststore); } catch (OcspCheckerException e) { throw new OcspCheckerException( "Problem finding the certificate issuer in truststore." + NOT_VERIFIED_MSG, e); } }
Source:
<code>protected void init() { String id = api.statisticsApi().self().id(); assertNotNull(id); <START> selfID = id; <END> }</code><technical_language>Avoid intermediate variable assign selfID</technical_language>

Target:
protected void init() { selfID = api.statisticsApi().self().id(); assertNotNull(selfID); }
Source:
<code>public void tree() { String componentId = randomAlphanumeric(20); String componentKey = randomAlphanumeric(20); String strategy = randomAlphanumeric(20); int page = 17; int pageSize = 39; String query = randomAlphanumeric(20); underTest.tree(new TreeWsRequest() .setBaseComponentId(componentId) .setBaseComponentKey(componentKey) .setQualifiers(asList("q1", "q2")) .setStrategy(strategy) .setPage(page) .setPageSize(pageSize) .setQuery(query) .setSort(asList("sort1", "sort2"))); serviceTester.assertThat(serviceTester.getGetRequest()) .hasPath("tree") .hasParam("componentId", componentId) .hasParam("component", componentKey) .hasParam("qualifiers", "q1,q2") .hasParam("strategy", strategy) .hasParam("p", page) .hasParam("ps", pageSize) <START> .hasParam("q", query) <END> .hasParam("s", "sort1,sort2") .andNoOtherParam(); }</code><technical_language>Please add check parser</technical_language>

Target:
public void tree() { String componentId = randomAlphanumeric(20); String componentKey = randomAlphanumeric(20); String strategy = randomAlphanumeric(20); int page = 17; int pageSize = 39; String query = randomAlphanumeric(20); underTest.tree(new TreeWsRequest() .setBaseComponentId(componentId) .setBaseComponentKey(componentKey) .setQualifiers(asList("q1", "q2")) .setStrategy(strategy) .setPage(page) .setPageSize(pageSize) .setQuery(query) .setSort(asList("sort1", "sort2"))); assertThat(serviceTester.getGetParser()).isSameAs(WsComponents.TreeWsResponse.parser()); serviceTester.assertThat(serviceTester.getGetRequest()) .hasPath("tree") .hasParam("componentId", componentId) .hasParam("component", componentKey) .hasParam("qualifiers", "q1,q2") .hasParam("strategy", strategy) .hasParam("p", page) .hasParam("ps", pageSize) .hasParam("q", query) .hasParam("s", "sort1,sort2") .andNoOtherParam(); }
Source:
<code>private void setWaypoints(ViewConnector<? extends BPMNViewDefinition> connector) { BPMNEdge bpmnEdge = di.createBPMNEdge(); <START> bpmnEdge.setId("edge_"+source.getShape().getId()+"_to_"+target.getShape().getId()); <END> bpmnEdge.setBpmnElement(sequenceFlow); Point2D sourcePt = connector.getSourceConnection().get().getLocation(); Point2D targetPt = connector.getTargetConnection().get().getLocation(); org.eclipse.dd.dc.Point sourcePoint = dc.createPoint(); sourcePoint.setX( source.getShape().getBounds().getX() + (float) sourcePt.getX()); sourcePoint.setY( source.getShape().getBounds().getY() + (float) sourcePt.getY()); org.eclipse.dd.dc.Point targetPoint = dc.createPoint(); targetPoint.setX( target.getShape().getBounds().getX() + (float) targetPt.getX()); targetPoint.setY( target.getShape().getBounds().getY() + (float) targetPt.getY()); bpmnEdge.getWaypoint().add(sourcePoint); bpmnEdge.getWaypoint().add(targetPoint); this.bpmnEdge = bpmnEdge; }</code><technical_language>Minor thing, I this conform kiegroup codestyle</technical_language>

Target:
private void setWaypoints(ViewConnector<? extends BPMNViewDefinition> connector) { BPMNEdge bpmnEdge = di.createBPMNEdge(); bpmnEdge.setId(Ids.bpmnEdge(source.getShape().getId(), target.getShape().getId())); bpmnEdge.setBpmnElement(sequenceFlow); Point2D sourcePt = connector.getSourceConnection().get().getLocation(); Point2D targetPt = connector.getTargetConnection().get().getLocation(); org.eclipse.dd.dc.Point sourcePoint = dc.createPoint(); sourcePoint.setX( source.getShape().getBounds().getX() + (float) sourcePt.getX()); sourcePoint.setY( source.getShape().getBounds().getY() + (float) sourcePt.getY()); org.eclipse.dd.dc.Point targetPoint = dc.createPoint(); targetPoint.setX( target.getShape().getBounds().getX() + (float) targetPt.getX()); targetPoint.setY( target.getShape().getBounds().getY() + (float) targetPt.getY()); bpmnEdge.getWaypoint().add(sourcePoint); bpmnEdge.getWaypoint().add(targetPoint); this.bpmnEdge = bpmnEdge; }
Source:
<code>public boolean canHideLabel() { boolean canHideLabel = false; if (!isLabelEmpty()) { <START> if (element instanceof DEdge) { canHideLabel = true; } else if (element instanceof DNode) { canHideLabel = true; } else if (element instanceof DDiagramElementContainer) { canHideLabel = true; } <END> } return canHideLabel; }</code><technical_language>test element is a DNodeListElement</technical_language>

Target:
public boolean canHideLabel() { boolean canHideLabel = false; if (!isLabelEmpty()) { if (element instanceof DEdge || element instanceof DNode || element instanceof DDiagramElementContainer) { canHideLabel = true; } } return canHideLabel; }
Source:
<code>private static boolean isPipVersionGreaterEqual( <START> String pipVersion, <END> String pythonExecutable, Map<String, String> environmentVariables) throws IOException, InterruptedException { String[] commands = new String[] { pythonExecutable, "-c", CHECK_PIP_VERSION_SCRIPT, pipVersion }; String out = execute(commands, environmentVariables, false); return Boolean.parseBoolean(out.trim()); }</code><technical_language>throw InterruptedException more. check other places</technical_language>

Target:
private static boolean isPipVersionGreaterEqual( String pipVersion, String pythonExecutable, Map<String, String> environmentVariables) throws IOException { String[] commands = new String[] { pythonExecutable, "-c", CHECK_PIP_VERSION_SCRIPT, pipVersion }; String out = execute(commands, environmentVariables, false); return Boolean.parseBoolean(out.trim()); }
Source:
<code>public void init() { <START> lblTooltipValue.style.visibility = "hidden"; <END> }</code><technical_language>this done in html css</technical_language>

Target:
public void init() { mapTooltipContainer.style.visibility = "hidden"; }
Source:
<code>void testCrossrefAndInAuthorNames() throws Exception { BibDatabase database = new BibDatabase(); BibEntry entry1 = new BibEntry(); entry1.setField(StandardField.CROSSREF, "entry2"); BibEntry entry2 = new BibEntry(); entry2.setCiteKey("entry2"); entry2.setField(StandardField.AUTHOR, "Simon Holland"); database.insertEntry(entry1); database.insertEntry(entry2); assertEquals("Holland", BibtexKeyGenerator.cleanKey(BibtexKeyGenerator.generateKey(entry1, "auth", <START> database), "-`ʹ:!;?^+")); <END> }</code><technical_language>a good idea duplication of code magic strings. harder maintain in future</technical_language>

Target:
void testCrossrefAndInAuthorNames() throws Exception { BibDatabase database = new BibDatabase(); BibEntry entry1 = new BibEntry(); entry1.setField(StandardField.CROSSREF, "entry2"); BibEntry entry2 = new BibEntry(); entry2.setCiteKey("entry2"); entry2.setField(StandardField.AUTHOR, "Simon Holland"); database.insertEntry(entry1); database.insertEntry(entry2); assertEquals("Holland", BibtexKeyGenerator.cleanKey(BibtexKeyGenerator.generateKey(entry1, "auth", database), DEFAULT_UNWANTED_CHARACTERS)); }
Source:
<code>public BinaryContent buildSpreadSheet(List<Metacard> metacards) { Set<AttributeDescriptor> attributeDescriptors = metacards.get(0).getMetacardType().getAttributeDescriptors(); int rowIndex = 0; int cellIndex = 0; Workbook workbook = new XSSFWorkbook(); Sheet sheet = workbook.createSheet(); <START> Row row = sheet.createRow(rowIndex++); <END> CellStyle style = workbook.createCellStyle(); Font font = workbook.createFont(); font.setBold(true); style.setFont(font); for (AttributeDescriptor attributeDescriptor : attributeDescriptors) { String attributeName = attributeDescriptor.getName(); Cell cell = row.createCell(cellIndex++); cell.setCellValue(attributeName); cell.setCellStyle(style); } for (Metacard metacard : metacards) { List<String> values = getMetacardValues(attributeDescriptors, metacard); row = sheet.createRow(rowIndex++); cellIndex = 0; for (String value : values) { row.createCell(cellIndex++).setCellValue(value); } } return writeWorkbook(workbook); }</code><technical_language>This throw IndexOutOfBoundsException if list of metacards is empty. clients checking for this some other client wise</technical_language>

Target:
public static BinaryContent buildSpreadSheet(List<Metacard> metacards) { if (metacards.isEmpty()) { return null; } Set<AttributeDescriptor> attributeDescriptors = metacards.get(0).getMetacardType().getAttributeDescriptors(); int rowIndex = 0; int cellIndex = 0; Workbook workbook = new XSSFWorkbook(); Sheet sheet = workbook.createSheet(); Row row = sheet.createRow(rowIndex++); CellStyle style = workbook.createCellStyle(); Font font = workbook.createFont(); font.setBold(true); style.setFont(font); for (AttributeDescriptor attributeDescriptor : attributeDescriptors) { String attributeName = attributeDescriptor.getName(); Cell cell = row.createCell(cellIndex++); cell.setCellValue(attributeName); cell.setCellStyle(style); } for (Metacard metacard : metacards) { List<String> values = getMetacardValues(metacard); row = sheet.createRow(rowIndex++); cellIndex = 0; for (String value : values) { row.createCell(cellIndex++).setCellValue(value); } } return writeWorkbook(workbook); }
Source:
<code>private LinkedList<GraphNode> spawnChildren(GraphNode parent) { LinkedList<GraphNode> children = new LinkedList<GraphNode>(); for (int activityNumber = 0; activityNumber < activities.size(); activityNumber++) { Activity a = activities.get(activityNumber); double value = 0; if (!a.checkActivity()) continue; GraphNode newChild = new GraphNode(totalAdded, parent); totalSpawned++; SpawnStatus spawnStatus = SpawnStatus.NEW; if (a.applyMoment == Activity.ApplyMoment.before) value = a.calculateValue(); newChild.state = parent.state.copy(); newChild.state.deploy(); Rule executed = a.executeActivity(); newChild.activityInfo = new ActivityInfo(activityNumber, executed); if (a.applyMoment == Activity.ApplyMoment.after) value = a.calculateValue(); newChild.g = parent.g + value; newChild.h = evaluateBy.get(); add_child: { compare_tops: if (compareTops) { for (Collection<GraphNode> nodesList : Arrays.asList(nodesOpen, nodesClosed)) { <START> for (GraphNode open : nodesList) { <END> if (newChild.state.checkEqual(open.state)) { if (newChild.g < open.g) { nodesList.remove(open); spawnStatus = SpawnStatus.BETTER; break compare_tops; } else { spawnStatus = SpawnStatus.WORSE; break add_child; } } } } } children.add(newChild); totalAdded++; } serializeTops(newChild, spawnStatus, newChild.activityInfo, value); Simulator.getExecutionStateNotifier().notifySubscribers( ExecutionState.SEARCH_STEP); parent.state.deploy(); } return children; }</code><technical_language>java for (GraphNode node : nodesList) {</technical_language>

Target:
private LinkedList<GraphNode> spawnChildren(GraphNode parent) { LinkedList<GraphNode> children = new LinkedList<GraphNode>(); for (int activityNumber = 0; activityNumber < activities.size(); activityNumber++) { Activity a = activities.get(activityNumber); double value = 0; if (!a.checkActivity()) continue; GraphNode newChild = new GraphNode(totalAdded, parent); totalSpawned++; SpawnStatus spawnStatus = SpawnStatus.NEW; if (a.applyMoment == Activity.ApplyMoment.before) value = a.calculateValue(); newChild.state = parent.state.copy(); newChild.state.deploy(); Rule executed = a.executeActivity(); newChild.activityInfo = new ActivityInfo(activityNumber, executed); if (a.applyMoment == Activity.ApplyMoment.after) value = a.calculateValue(); newChild.g = parent.g + value; newChild.h = evaluateBy.get(); add_child: { compare_tops: if (compareTops) { for (Collection<GraphNode> nodesList : Arrays.asList(nodesOpen, nodesClosed)) { for (GraphNode node : nodesList) { if (newChild.state.checkEqual(node.state)) { if (newChild.g < node.g) { nodesList.remove(node); spawnStatus = SpawnStatus.BETTER; break compare_tops; } else { spawnStatus = SpawnStatus.WORSE; break add_child; } } } } } children.add(newChild); totalAdded++; } serializeTops(newChild, spawnStatus, newChild.activityInfo, value); Simulator.getExecutionStateNotifier().notifySubscribers( ExecutionState.SEARCH_STEP); parent.state.deploy(); } return children; }
Source:
<code>private void createOrUpdateIntercomCompany(final MetricOrganisation organisation) { if (organisation == null) { return; } final Company company = new Company(); final String companyID = organisation.id; final String name = organisation.name; company.setCompanyID(companyID); company.setName(name); try { Company.create(company); } catch (final Exception e) { <START> logger.warn("Error creating/updating a Intercom company - " + company + " - " + e.getLocalizedMessage()); <END> } }</code><technical_language>debug warn</technical_language>

Target:
private void createOrUpdateIntercomCompany(final MetricOrganisation organisation) { if (organisation == null) { return; } final Company company = new Company(); final String companyId = organisation.id; final String name = organisation.name; company.setCompanyID(companyId); company.setName(name); try { Company.create(company); } catch (final Exception e) { logger.debug("Error creating/updating a Intercom company: " + company + " - " + e.getMessage()); } }
Source:
<code>public void ovfUpdate_timer() { itemsCountPerUpdate = reloadConfigValue(); log.info("OvfDataUpdater: Attempting to update VMs/Templates Ovf."); List<storage_pool> storagePools = getStoragePoolDao().getAllByStatus(StoragePoolStatus.Up); for (storage_pool pool : storagePools) { try { log.infoFormat("OvfDataUpdater: Attempting to update VM OVFs in Data Center {0}", pool.getname()); initProccessedInfoLists(); updateOvfForVmsOfStoragePool(pool.getId()); log.infoFormat("OvfDataUpdater: Successfully updated VM OVFs in Data Center {0}", <START> pool.getname()); <END> log.infoFormat("OvfDataUpdater: Attempting to update template OVFs in Data Center {0}", pool.getname()); updateOvfForTemplatesOfStoragePool(pool.getId()); log.infoFormat("OvfDataUpdater: Succesfully updated templates OVFs in Data Center {0}", pool.getname()); log.infoFormat("OvfDataUpdater: Attempting to remove uneeded template/vm OVFs in Data Center {0}", pool.getname()); removeOvfForTemplatesAndVmsOfStoragePool(pool.getId()); log.infoFormat("OvfDataUpdater: Succesfully removed uneeded template/vm OVFs in Data Center {0}", pool.getname()); } catch (Exception ex) { addAuditLogError(pool.getname()); log.errorFormat("Exception while trying to update VMs/Templates ovf in Data Center {0}, the exception is {1}", pool.getname(), ex.getMessage()); log.debug(ex.getStackTrace()); } } proccessedIdsInfo = null; proccessedOvfGenerationsInfo = null; }</code><technical_language>"OvfDataUpdater:" is redundant here, conclude class name log printed</technical_language>

Target:
public void ovfUpdate_timer() { itemsCountPerUpdate = reloadConfigValue(); log.info("OvfDataUpdater: Attempting to update VMs/Templates Ovf."); List<storage_pool> storagePools = getStoragePoolDao().getAllByStatus(StoragePoolStatus.Up); for (storage_pool pool : storagePools) { try { log.infoFormat("Attempting to update VM OVFs in Data Center {0}", pool.getname()); initProccessedInfoLists(); updateOvfForVmsOfStoragePool(pool.getId()); log.infoFormat("Successfully updated VM OVFs in Data Center {0}", pool.getname()); log.infoFormat("Attempting to update template OVFs in Data Center {0}", pool.getname()); updateOvfForTemplatesOfStoragePool(pool.getId()); log.infoFormat("Succesfully updated templates OVFs in Data Center {0}", pool.getname()); log.infoFormat("Attempting to remove uneeded template/vm OVFs in Data Center {0}", pool.getname()); removeOvfForTemplatesAndVmsOfStoragePool(pool.getId()); log.infoFormat("Succesfully removed unneeded template/vm OVFs in Data Center {0}", pool.getname()); } catch (Exception ex) { addAuditLogError(pool.getname()); log.errorFormat("Exception while trying to update or remove VMs/Templates ovf in Data Center {0}, the exception is {1}", pool.getname(), ex.getMessage()); log.debug(ex.getStackTrace()); } } proccessedIdsInfo = null; proccessedOvfGenerationsInfo = null; }