auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void getFCStorageTypeForLun() throws Exception { LUNs lun = new LUNs(); ArrayList<storage_server_connections> connections = new ArrayList<storage_server_connections>(); lun.setLunConnections(connections); <START> StorageType storageType = command.getLUNStorageType(lun); <END> assertEquals("Lun disk should be of FC storage type since it does not had connections", storageType, storageType.FCP); }</code><technical_language>please switch assert values, expected second.. /s/disk/storage type /s/had/have</technical_language>

Target:
public void getFCStorageTypeForLun() throws Exception { LUNs lun = new LUNs(); ArrayList<storage_server_connections> connections = new ArrayList<storage_server_connections>(); lun.setLunConnections(connections); StorageType storageType = command.getLUNStorageType(lun); assertEquals("Lun disk should be of FC storage type since it does not had connections", StorageType.FCP, storageType); }
Source:
<code>private void createBinaryOnlyDataSet() { realm.beginTransaction(); <START> realm.delete(BinaryOnly.class); <END> for (byte[] binary : binaries) { BinaryOnly binaryOnly = realm.createObject(BinaryOnly.class); binaryOnly.setBinary(binary); } realm.commitTransaction(); }</code><technical_language>This is needed. TestRealmConfigurationFactory ensure test starts a empty Realm</technical_language>

Target:
private void createBinaryOnlyDataSet() { realm.beginTransaction(); for (int i = 0; i < binaries.length; i++) { AllJavaTypes binaryOnly = new AllJavaTypes((long) i); binaryOnly.setFieldBinary(binaries[i]); realm.copyToRealm(binaryOnly); } realm.commitTransaction(); }
Source:
<code>public String asString() { StringBuilder sb = new StringBuilder(); for (Entry<String, String> entry : this.arguments.entrySet()) { <START> sb.append(entry.getKey()).append("=").append(entry.getValue()); <END> } return "@" + this.type.getId() + "[" + sb.toString() + "]"; }</code><technical_language>This insert commas required</technical_language>

Target:
public String asString() { StringBuilder sb = new StringBuilder(); for (Entry<String, String> entry : this.arguments.entrySet()) { sb.append(entry.getKey()).append("=").append(entry.getValue()).append(","); } return "@" + this.type.getId() + "[" + sb.deleteCharAt(sb.length()-1).toString() + "]"; }
Source:
<code>public String locate(String name, StatementContext ctx) { final Object cache_key; boolean isSqlObjectMethod = false; if (ctx.getSqlObjectType() != null) { <START> if (ctx.getSqlObjectMethod() != null) { <END> isSqlObjectMethod = true; cache_key = ctx.getSqlObjectMethod(); } else { cache_key = '/' + mungify(ctx.getSqlObjectType().getName() + '.' + name) + ".sql"; } } else { cache_key = name; } String cached = found.get(cache_key); if (cached != null) { return cached; } if (looksLikeSql(name)) { if (isSqlObjectMethod) { found.put(cache_key, name); } return name; } final ClassLoader loader = selectClassLoader(); InputStream in_stream = null; try { in_stream = loader.getResourceAsStream(name); if (in_stream == null) { in_stream = loader.getResourceAsStream(name + ".sql"); } if (in_stream == null && ctx.getSqlObjectType() != null) { String filename = '/' + mungify(ctx.getSqlObjectType().getName() + '.' + name) + ".sql"; in_stream = loader.getResourceAsStream(filename); if (in_stream == null) { in_stream = ctx.getSqlObjectType().getResourceAsStream(filename); } } if (in_stream == null) { found.put(cache_key, name == cache_key ? new String(name) : name); return name; } String sql; try { sql = SQL_SCRIPT_PARSER.parse(new ANTLRInputStream(in_stream)); } catch (IOException e) { throw new UnableToCreateStatementException(e.getMessage(), e, ctx); } found.put(cache_key, sql); return sql; } finally { try { if (in_stream != null) { in_stream.close(); } } catch (IOException e) { } } }</code><technical_language>Is a case sqlObjectType is set, sqlObjectMethod is not</technical_language>

Target:
public String locate(String name, StatementContext ctx) { final CacheKey cache_key = new CacheKey(name, ctx.getSqlObjectType(), ctx.getSqlObjectMethod()); boolean isSqlObjectMethod = ctx.getSqlObjectType() != null && ctx.getSqlObjectMethod() != null; String cached = found.get(cache_key); if (cached != null) { return cached; } if (looksLikeSql(name)) { if (isSqlObjectMethod) { found.put(cache_key, name); } return name; } final ClassLoader loader = selectClassLoader(); InputStream in_stream = null; try { in_stream = loader.getResourceAsStream(name); if (in_stream == null) { in_stream = loader.getResourceAsStream(name + ".sql"); } if (in_stream == null && ctx.getSqlObjectType() != null) { String filename = '/' + mungify(ctx.getSqlObjectType().getName() + '.' + name) + ".sql"; in_stream = loader.getResourceAsStream(filename); if (in_stream == null) { in_stream = ctx.getSqlObjectType().getResourceAsStream(filename); } } if (in_stream == null) { found.put(cache_key, isSqlObjectMethod ? name : new String(name)); return name; } String sql; try { sql = SQL_SCRIPT_PARSER.parse(new ANTLRInputStream(in_stream)); } catch (IOException e) { throw new UnableToCreateStatementException(e.getMessage(), e, ctx); } found.put(cache_key, sql); return sql; } finally { try { if (in_stream != null) { in_stream.close(); } } catch (IOException e) { } } }
Source:
<code>public void onShow(final Map<String, Object> data) { roleForPlayers.clear(); factionGrid .getChildren() .removeIf( node -> { final Integer row = GridPane.getRowIndex(node); return row != null && row > 0; }); gameData = (GameData) Optional.ofNullable(data.get(SELECTED_MAP_KEY)) .orElseThrow( () -> new IllegalStateException("Missing GameData when calling screen")); final List<String> availablePlayers = List.of(PlayerType.playerTypes()); for (final GamePlayer playerId : gameData.getPlayerList()) { <START> final var name = new Label(playerId.getName()); <END> final ComboBox<String> controllingPlayer = new ComboBox<>(FXCollections.observableArrayList(availablePlayers)); controllingPlayer.getSelectionModel().select(0); if (playerId.getCanBeDisabled()) { controllingPlayer.getItems().add(DISABLE_TEXT); } roleForPlayers.put(playerId, controllingPlayer); final Collection<String> playerAlliances = gameData.getAllianceTracker().getAlliancesPlayerIsIn(playerId); final var faction = new Button(playerAlliances.toString()); faction.setOnAction( e -> { final int targetIndex = controllingPlayer.getSelectionModel().getSelectedIndex(); playerAlliances.stream() .map(gameData.getAllianceTracker()::getPlayersInAlliance) .flatMap(Collection::stream) .map(roleForPlayers::get) .filter(stringComboBox -> stringComboBox.getItems().size() > targetIndex) .map(ComboBox::getSelectionModel) .forEach(selectionModel -> selectionModel.select(targetIndex)); }); final var income = new Spinner<Integer>(0, 100, 100); income.setDisable(true); incomeForPlayers.put(playerId, income); final var pus = new Spinner<Integer>(0, 100, 0); pus.setDisable(true); pusForPlayers.put(playerId, pus); factionGrid.addRow(factionGrid.getRowCount(), name, controllingPlayer, faction, income, pus); } }</code><technical_language>Method onShow 45 lines of code (exceeds 25 allowed). Consider refactoring</technical_language>

Target:
public void onShow(final Map<String, Object> data) { roleForPlayers.clear(); incomeForPlayers.clear(); pusForPlayers.clear(); factionGrid .getChildren() .removeIf( node -> { final Integer row = GridPane.getRowIndex(node); return row != null && row > 0; }); gameData = (GameData) Optional.ofNullable(data.get(SELECTED_MAP_KEY)) .orElseThrow( () -> new IllegalStateException("Missing GameData when calling screen")); final List<String> availablePlayers = List.of(PlayerType.playerTypes()); for (final GamePlayer gamePlayer : gameData.getPlayerList()) { setupPlayerControl(availablePlayers, gamePlayer); } }
Source:
<code>public PrettyPrinterConfiguration setTabWidth(int tabWidth) { <START> if (tabWidth <= 0) { <END> throw new IllegalArgumentException("Tab width must be > 0"); } this.tabWidth = tabWidth; return this; }</code><technical_language>Yep, time create assertPositive mentioned</technical_language>

Target:
public PrettyPrinterConfiguration setTabWidth(int tabWidth) { this.tabWidth = assertPositive(tabWidth); return this; }
Source:
<code>public void save() { <START> if (driver.getCurrentUrl().contains("configure")) { <END> clickButton("Save"); } else { clickButton("OK"); } assertThat(driver, not(hasContent("This page expects a form submission"))); }</code><technical_language>protected static ConfigurablePageObject getPageObject(Jenkins jenkins) { return jenkins.getVersion().isOlderThan(new VersionNumber("2")) ? new JenkinsConfig(jenkins) : new GlobalToolConfig(jenkins); } ConfigurablePageObject configPage = getPageObject(jenkins); boolean onConfigPage = jenkins.getCurrentUrl().equals(configPage.getConfigUrl());</technical_language>

Target:
public void save() { if (this.onDomainConfigurationPage()) { clickButton("Save"); } else { clickButton("OK"); } assertThat(driver, not(hasContent("This page expects a form submission"))); }
Source:
<code>public void onExpandVariable(Variable variable) { Debugger debugger = debuggerManager.getActiveDebugger(); if (debugger != null && debugger.isSuspended()) { Promise<? extends SimpleValue> promise = debugger.getValue(variable, view.getSelectedThreadId(), view.getSelectedFrameIndex()); promise .then( value -> { MutableVariable updatedVariable = new MutableVariableImpl(variable); updatedVariable.setValue(value); view.expandVariable(updatedVariable); }) .catchError( error -> { <START> Log.error(DebuggerPresenter.class, error.getCause()); <END> }); } }</code><technical_language>I check if variable is mutable already</technical_language>

Target:
public void onExpandVariable(Variable variable) { Debugger debugger = debuggerManager.getActiveDebugger(); if (debugger != null && debugger.isSuspended()) { Promise<? extends SimpleValue> promise = debugger.getValue(variable, view.getSelectedThreadId(), view.getSelectedFrameIndex()); promise .then( value -> { MutableVariable updatedVariable = variable instanceof MutableVariable ? ((MutableVariable) variable) : new MutableVariableImpl(variable); updatedVariable.setValue(value); view.expandVariable(updatedVariable); }) .catchError( error -> { Log.error(DebuggerPresenter.class, error.getCause()); }); } }
Source:
<code>public boolean testDouble(double value) { if (Double.isNaN(value)) { return nanAllowed; } for (TupleDomainFilter filter : filters) { <START> if ((nanAllowed && Double.isNaN(value)) || filter.testDouble(value)) { <END> return true; } } return false; }</code><technical_language>@bhhari - nanAllowed && Double.isNaN(value) filter is redundant; NaN checked - ditto testFloat</technical_language>

Target:
public boolean testDouble(double value) { if (Double.isNaN(value)) { return nanAllowed; } for (TupleDomainFilter filter : filters) { if (filter.testDouble(value)) { return true; } } return false; }
Source:
<code>void verifyBlankLinesAroundFunction(FunctionDeclarationContext ctx) { DeclarationContext declCtx = (DeclarationContext) ctx.getParent(); ParseTree left = ParseTreeUtil.getLeftNode(declCtx); if (left != null) { Token start = declCtx.getStart(); List<Token> tokens = tokenStream.getHiddenTokensToLeft(start.getTokenIndex()); long numberOfNewlineChars = 0; if (tokens != null) { numberOfNewlineChars = tokens.stream().filter(token -> token.getText().equals("\n")).count(); } if (numberOfNewlineChars < 2) { printer.error(Messages.FUNCTION + Messages.BLANK_LINE_BEFORE, ListenerUtil.getTokenLocation(start)); } } ParseTree right = ParseTreeUtil.getRightNode(declCtx); if (right != null) { if (right.getText().equals("<EOF>")) { return; } Token end = declCtx.getStop(); long numberOfNewlineChars = 0; List<Token> tokens = tokenStream.getHiddenTokensToRight(end.getTokenIndex()); if (tokens != null) { numberOfNewlineChars = tokens.stream().filter(token -> token.getText().equals("\n")).count(); } if (numberOfNewlineChars < 2) { <START> printer.error(Messages.FUNCTION + Messages.BLANK_LINE_AFTER, ListenerUtil.getTokenEndLocation(end)); <END> } } }</code><technical_language>Logic line 611 617 extracted a separate method reused</technical_language>

Target:
void verifyBlankLinesAroundFunction(FunctionDeclarationContext ctx) { DeclarationContext declCtx = (DeclarationContext) ctx.getParent(); ParseTree left = ParseTreeUtil.getLeftNode(declCtx); if (left != null) { Token start = declCtx.getStart(); List<Token> tokens = tokenStream.getHiddenTokensToLeft(start.getTokenIndex()); if (getNumberOfBlankLines(tokens) < 1) { printer.error(Messages.FUNCTION + Messages.BLANK_LINE_BEFORE, ListenerUtil.getTokenLocation(start)); } } ParseTree right = ParseTreeUtil.getRightNode(declCtx); if (right != null) { if (right.getText().equals("<EOF>")) { return; } Token end = declCtx.getStop(); List<Token> tokens = tokenStream.getHiddenTokensToRight(end.getTokenIndex()); if (getNumberOfBlankLines(tokens) < 1) { printer.error(Messages.FUNCTION + Messages.BLANK_LINE_AFTER, ListenerUtil.getTokenEndLocation(end)); } } }
Source:
<code>public List<Map<String, Object>> getAlerts() { List<Map<String, Object>> alerts = new ArrayList<>(); try { List<Map<String, Object>> results = persistentStore.get("alerts", activeAlertQuery); if (!results.isEmpty()) { for (Map<String, Object> item : results) { item = PersistentItem.stripSuffixes(item); if (item.get(SystemNotice.SYSTEM_NOTICE_DETAILS_KEY) instanceof String) { item.put( SystemNotice.SYSTEM_NOTICE_DETAILS_KEY, Collections.singleton(item.get(SystemNotice.SYSTEM_NOTICE_DETAILS_KEY))); } escapeStrings(item); alerts.add(item); } } } catch (PersistenceException pe) { LOGGER.debug("Error retrieving system alert.", pe); <START> return Collections.singletonList( <END> new Alert( "solr", NoticePriority.CRITICAL, "Persistent Storage Not Responding. Could Not Retrieve Alerts.", Collections.singleton( "Critical alerts may be present, but not displayed because the persistent storage is not responding.")) .getProperties()); } alerts.sort( (map1, map2) -> new Alert(map1).getPriority().value() >= new Alert(map2).getPriority().value() ? -1 : 1); return alerts; }</code><technical_language>provide admins more information possibly debug issue, checking logs/lock files? I this is fine is, wondering if this more helpful</technical_language>

Target:
public List<Map<String, Object>> getAlerts() { List<Map<String, Object>> alerts = new ArrayList<>(); try { List<Map<String, Object>> results = persistentStore.get("alerts", activeAlertQuery); if (!results.isEmpty()) { for (Map<String, Object> item : results) { item = PersistentItem.stripSuffixes(item); if (item.get(SystemNotice.SYSTEM_NOTICE_DETAILS_KEY) instanceof String) { item.put( SystemNotice.SYSTEM_NOTICE_DETAILS_KEY, Collections.singleton(item.get(SystemNotice.SYSTEM_NOTICE_DETAILS_KEY))); } escapeStrings(item); alerts.add(item); } } } catch (PersistenceException pe) { LOGGER.debug("Error retrieving system alert.", pe); return Collections.singletonList( new Alert( "unable_to_retrieve_alerts", NoticePriority.CRITICAL, "Persistent Storage Not Responding. Could Not Retrieve Alerts.", Collections.singleton( "Critical alerts may be present, but not displayed because the persistent storage is not responding.")) .getProperties()); } alerts.sort( (map1, map2) -> new Alert(map1).getPriority().value() >= new Alert(map2).getPriority().value() ? -1 : 1); return alerts; }
Source:
<code>public GroupList call() throws Exception { final IdentifiedUser user = identifiedUser.get(); final List<AccountGroup> list; if (user.getCapabilities().canAdministrateServer()) { <START> list = new LinkedList<AccountGroup>(); <END> for (final AccountGroup group : groupCache.all()) { list.add(group); } } else { list = new ArrayList<AccountGroup>(); for(final AccountGroup group : groupCache.all()) { final GroupControl c = groupControlFactory.controlFor(group); if (c.isVisible()) { list.add(c.getAccountGroup()); } } } List<GroupDetail> l = new ArrayList<GroupDetail>(); for(AccountGroup group : list) { l.add(groupDetailFactory.create(group.getId()).call()); } GroupList res = new GroupList(); res.setGroups(l); res.setCanCreateGroup(user.getCapabilities().canCreateGroup()); return res; }</code><technical_language>LinkedList vs. ArrayList here</technical_language>

Target:
public GroupList call() throws Exception { final IdentifiedUser user = identifiedUser.get(); final List<AccountGroup> list = new ArrayList<AccountGroup>(); if (user.getCapabilities().canAdministrateServer()) { CollectionUtils.addAll(list, groupCache.all().iterator()); } else { for(final AccountGroup group : groupCache.all()) { final GroupControl c = groupControlFactory.controlFor(group); if (c.isVisible()) { list.add(c.getAccountGroup()); } } } List<GroupDetail> l = new ArrayList<GroupDetail>(); for(AccountGroup group : list) { l.add(groupDetailFactory.create(group.getId()).call()); } return new GroupList(l, user.getCapabilities().canCreateGroup()); }
Source:
<code>CheckedFuture<PatchSet.Id, InsertException> insertPatchSet() throws IOException { rp.getRevWalk().parseBody(newCommit); final Thread caller = Thread.currentThread(); ListenableFuture<PatchSet.Id> future = changeUpdateExector.submit( requestScopePropagator.wrap(new Callable<PatchSet.Id>() { @Override public PatchSet.Id call() throws OrmException, IOException, NoSuchChangeException { try { if (caller == <START> Thread.currentThread() || magicBranch.edit) { <END> return magicBranch.edit ? upsertEdit() : insertPatchSet(db); } else { ReviewDb db = schemaFactory.open(); try { return insertPatchSet(db); } finally { db.close(); } } } finally { synchronized (replaceProgress) { replaceProgress.update(1); } } } })); return Futures.makeChecked(future, INSERT_EXCEPTION); }</code><technical_language>is this needed</technical_language>

Target:
CheckedFuture<PatchSet.Id, InsertException> insertPatchSet() throws IOException { rp.getRevWalk().parseBody(newCommit); final Thread caller = Thread.currentThread(); ListenableFuture<PatchSet.Id> future = changeUpdateExector.submit( requestScopePropagator.wrap(new Callable<PatchSet.Id>() { @Override public PatchSet.Id call() throws OrmException, IOException, NoSuchChangeException { try { if (caller == Thread.currentThread()) { return magicBranch.edit ? upsertEdit() : insertPatchSet(db); } else { ReviewDb db = schemaFactory.open(); try { return magicBranch.edit ? upsertEdit() : insertPatchSet(db); } finally { db.close(); } } } finally { synchronized (replaceProgress) { replaceProgress.update(1); } } } })); return Futures.makeChecked(future, INSERT_EXCEPTION); }
Source:
<code>private GrpcChannelKey(AlluxioConfiguration conf) { try { mLocalHostName = NetworkAddressUtils .getLocalHostName((int) conf.getMs(PropertyKey.NETWORK_HOST_RESOLUTION_TIMEOUT_MS)); } catch (Exception e) { <START> mLocalHostName = "<UNKNOWN>"; <END> } }</code><technical_language>this a constant</technical_language>

Target:
private GrpcChannelKey(AlluxioConfiguration conf) { String localHostName; try { localHostName = NetworkAddressUtils .getLocalHostName((int) conf.getMs(PropertyKey.NETWORK_HOST_RESOLUTION_TIMEOUT_MS)); } catch (Exception e) { localHostName = NetworkAddressUtils.UNKNOWN_HOSTNAME; } mLocalHostName = localHostName; }
Source:
<code>public FluoConfiguration setOraclePort(int oraclePort) { <START> setProperty(ORACLE_PORT_PROP, verifyPositive(ORACLE_PORT_PROP, oraclePort)); <END> return this; }</code><technical_language>a more strict check for ports</technical_language>

Target:
public FluoConfiguration setOraclePort(int oraclePort) { return setPort(ORACLE_PORT_PROP, oraclePort); }
Source:
<code>public Result adaptResponse(Row response) { if (response == null) { return new Result(); } List<org.apache.hadoop.hbase.Cell> hbaseCells = new ArrayList<>(); Set<Long> cellTimestamps = new HashSet<>(); byte[] rowKey = response.getKey().toByteArray(); for (Family family : response.getFamiliesList()) { byte[] familyNameBytes = Bytes.toBytes(family.getName()); for (Column column : family.getColumnsList()) { byte[] columnQualifier = column.getQualifier().toByteArray(); cellTimestamps.clear(); for (Cell cell : column.getCellsList()) { if (cell.getLabelsCount() > 0) { continue; } Long cellTimestamp = cell.getTimestampMicros(); <START> if (!cellTimestamps.contains(cellTimestamp)) { <END> cellTimestamps.add(cellTimestamp); long hbaseTimestamp = BigtableConstants.HBASE_TIMEUNIT.convert( cellTimestamp, BigtableConstants.BIGTABLE_TIMEUNIT); KeyValue keyValue = new KeyValue( rowKey, familyNameBytes, columnQualifier, hbaseTimestamp, cell.getValue().toByteArray()); hbaseCells.add(keyValue); } } } } Collections.sort(hbaseCells, KeyValue.COMPARATOR); return Result.create(hbaseCells); }</code><technical_language>guaranteed columns ordered correctly</technical_language>

Target:
public Result adaptResponse(Row response) { if (response == null) { return new Result(); } SortedSet<org.apache.hadoop.hbase.Cell> hbaseCells = new TreeSet<>(KeyValue.COMPARATOR); byte[] rowKey = response.getKey().toByteArray(); for (Family family : response.getFamiliesList()) { byte[] familyNameBytes = Bytes.toBytes(family.getName()); for (Column column : family.getColumnsList()) { byte[] columnQualifier = column.getQualifier().toByteArray(); for (Cell cell : column.getCellsList()) { if (cell.getLabelsCount() > 0) { continue; } long hbaseTimestamp = BigtableConstants.HBASE_TIMEUNIT.convert( cell.getTimestampMicros(), BigtableConstants.BIGTABLE_TIMEUNIT); KeyValue keyValue = new KeyValue( rowKey, familyNameBytes, columnQualifier, hbaseTimestamp, cell.getValue().toByteArray()); hbaseCells.add(keyValue); } } } return Result.create(hbaseCells.toArray(new org.apache.hadoop.hbase.Cell[hbaseCells.size()])); }
Source:
<code>public void validate(T values) { for (int i = 0; i < expressions.size(); i++) { expressions.get(i).setNextRow(values); } for (int i = 0; i < inputs.size(); i++) { Object val = inputs.get(i).value(); if (val == null) { throw new IllegalArgumentException("\"" + notNullColumns.get(i) + "\" must not be null"); } } for (int i = 0; i < checkConstraints.size(); i++) { Tuple<? extends Input<?>, CheckConstraint<Symbol>> checkEntry = checkConstraints.get(i); Input<?> checkInput = checkEntry.v1(); <START> Boolean value = (Boolean) checkInput.value(); <END> if (value == null) { continue; } if (!value.booleanValue()) { CheckConstraint<Symbol> chk = checkEntry.v2(); throw new IllegalArgumentException(String.format( Locale.ENGLISH, "Failed CONSTRAINT %s CHECK (%s) and values %s", chk.name(), chk.expressionStr(), values)); } } }</code><technical_language>worth adding assertion ensure a boolean? Is this ensured else? throw exception here</technical_language>

Target:
public void validate(T values) { for (int i = 0; i < expressions.size(); i++) { expressions.get(i).setNextRow(values); } for (int i = 0; i < inputs.size(); i++) { Object val = inputs.get(i).value(); if (val == null) { throw new IllegalArgumentException("\"" + notNullColumns.get(i) + "\" must not be null"); } } for (int i = 0; i < checkConstraints.size(); i++) { Tuple<? extends Input<?>, CheckConstraint<Symbol>> checkEntry = checkConstraints.get(i); Input<?> checkInput = checkEntry.v1(); Object value = checkInput.value(); if (value == null) { continue; } assert value instanceof Boolean : "expected a boolean value"; if (!((Boolean) value).booleanValue()) { CheckConstraint<Symbol> chk = checkEntry.v2(); throw new IllegalArgumentException(String.format( Locale.ENGLISH, "Failed CONSTRAINT %s CHECK (%s) and values %s", chk.name(), chk.expressionStr(), values)); } } }
Source:
<code>public static String[] getFileExtensions( IDLTKLanguageToolkit languageToolkit) { <START> if (languageToolkit == null) { <END> return null; } final IContentType type = Platform.getContentTypeManager() .getContentType(languageToolkit.getLanguageContentType()); if (type != null) { return type.getFileSpecs(IContentType.FILE_EXTENSION_SPEC); } else { return null; } }</code><technical_language>this check caller? purpose of this function is related a toolkit, a toolkit treated error</technical_language>

Target:
public static String[] getFileExtensions( IDLTKLanguageToolkit languageToolkit) { final IContentType type = Platform.getContentTypeManager() .getContentType(languageToolkit.getLanguageContentType()); if (type != null) { return type.getFileSpecs(IContentType.FILE_EXTENSION_SPEC); } else { return null; } }
Source:
<code>public RefreshPlan computePlan(CreatedOutput container) { RefreshPlan post = new RefreshPlan(signatureProvider); Collection<? extends Mapping> childMappings = container.getChildMappings(); pre.computeStatus(container, childMappings); post.addPreviousStatus(pre.getExistingOutputs()); Iterable<? extends Mapping> mappingsCreatingElements = Iterables.filter(childMappings, new Predicate<Mapping>() { @Override public boolean apply(Mapping input) { return input.getCreator().some(); } }); Iterable<Collection<MappingHiearchy>> transformedHiearchy = Iterables.transform(mappingsCreatingElements, toHierarchy); Iterable<MappingHiearchy> childHiearchies = Sets.newLinkedHashSet(Iterables.concat(transformedHiearchy)); for (MappingHiearchy nodeHiearch : childHiearchies) { Iterator<Mapping> it = nodeHiearch.fromMostSpecificToMostGeneral(); while (it.hasNext()) { Mapping cur = it.next(); if (cur.isEnabled() && cur.getCreator().some()) { Option<EvaluatedSemanticPartition> par = invalidator.hasFastResult(container.getDescriptor().getSourceElement(), cur.getSemanticPartition()); if (!par.some()) { <START> cur.getSemanticPartition().setTreeElementVariables(container); <END> par = Options.newSome(cur.getSemanticPartition().evaluate(container.getDescriptor().getSourceElement())); cur.getSemanticPartition().unSetTreeElementVariables(); } Collection<? extends OutputDescriptor> allCandidateDescriptors = cur.getCreator().get().computeDescriptors(container, par.get().elements()); post.appendOutputDescritorsKeepingTheMostSpecific(allCandidateDescriptors); } } } return post; }</code><technical_language>API modification synchronizer is dialect agnostic depend Sirius element. impact in this patch set</technical_language>

Target:
public RefreshPlan computePlan(CreatedOutput container) { RefreshPlan post = new RefreshPlan(signatureProvider); Collection<? extends Mapping> childMappings = container.getChildMappings(); pre.computeStatus(container, childMappings); post.addPreviousStatus(pre.getExistingOutputs()); Iterable<? extends Mapping> mappingsCreatingElements = Iterables.filter(childMappings, new Predicate<Mapping>() { @Override public boolean apply(Mapping input) { return input.getCreator().some(); } }); Iterable<Collection<MappingHiearchy>> transformedHiearchy = Iterables.transform(mappingsCreatingElements, toHierarchy); Iterable<MappingHiearchy> childHiearchies = Sets.newLinkedHashSet(Iterables.concat(transformedHiearchy)); for (MappingHiearchy nodeHiearch : childHiearchies) { Iterator<Mapping> it = nodeHiearch.fromMostSpecificToMostGeneral(); while (it.hasNext()) { Mapping cur = it.next(); if (cur.isEnabled() && cur.getCreator().some()) { Option<EvaluatedSemanticPartition> par = invalidator.hasFastResult(container.getDescriptor().getSourceElement(), cur.getSemanticPartition()); if (!par.some()) { par = Options.newSome(cur.getSemanticPartition().evaluate(container.getDescriptor().getSourceElement(), container)); } Collection<? extends OutputDescriptor> allCandidateDescriptors = cur.getCreator().get().computeDescriptors(container, par.get().elements()); post.appendOutputDescritorsKeepingTheMostSpecific(allCandidateDescriptors); } } } return post; }
Source:
<code>public void testList() { List<MonitoringCenter> result = monitoringCenterApi().list(); <START> assertNotNull(result); <END> }</code><technical_language>Verify returns element</technical_language>

Target:
public void testList() { List<MonitoringCenter> result = monitoringCenterApi().list(); assertNotNull(result); Assert.assertTrue(result.size() >= 1); }
Source:
<code>public GHCompare getCompare(GHBranch id1, GHBranch id2) throws IOException { String fqid1 = id1.getName(); String fqid2 = id2.getName(); try { String owner1 = id1.getOwner().getOwnerName(); String owner2 = id2.getOwner().getOwnerName(); if (!owner1.equals(owner2)) { fqid1 = String.format("%s:%s",owner1,id1.getName()); fqid2 = String.format("%s:%s",owner2,id2.getName()); } <START> } <END> catch (RuntimeException e) { } return getCompare(fqid1,fqid2); }</code><technical_language>catch } -> } catch {</technical_language>

Target:
public GHCompare getCompare(GHBranch id1, GHBranch id2) throws IOException { GHRepository owner1 = id1.getOwner(); GHRepository owner2 = id2.getOwner(); if (owner1!=null && owner2!=null) { String ownerName1 = owner1.getOwnerName(); String ownerName2 = owner2.getOwnerName(); if (!StringUtils.equals(ownerName1, ownerName2)) { String qualifiedName1 = String.format("%s:%s", ownerName1, id1.getName()); String qualifiedName2 = String.format("%s:%s", ownerName2, id2.getName()); return getCompare(qualifiedName1, qualifiedName2); } } return getCompare(id1.getName(), id2.getName()); }
Source:
<code>public void traceSelected(TmfTraceSelectedSignal signal) { <START> ITmfTrace trace = getTrace(); <END> if (signal.getTrace() == trace) { for (IAnalysisParameterProvider provider : fParameterProviders) { provider.registerModule(this); } } }</code><technical_language>Unnecessary</technical_language>

Target:
public void traceSelected(TmfTraceSelectedSignal signal) { if (signal.getTrace() == fTrace) { for (IAnalysisParameterProvider provider : fParameterProviders) { provider.registerModule(this); } } }
Source:
<code>public void findAllUnloadedOnViewDistanceDecrease(long playerAddress, int oldHorizontalViewDistance, int newHorizontalViewDistance, int oldVerticalViewDistance, int newVerticalViewDistance, TLongSet cubesToUnload, TLongSet columnsToUnload) { int playerCubeX = AddressTools.getX(playerAddress); int playerCubeY = AddressTools.getY(playerAddress); int playerCubeZ = AddressTools.getZ(playerAddress); for (int cubeX = playerCubeX - oldHorizontalViewDistance; cubeX <= playerCubeX + oldHorizontalViewDistance; cubeX++) { for (int cubeZ = playerCubeZ - oldHorizontalViewDistance; cubeZ <= playerCubeZ + oldHorizontalViewDistance; cubeZ++) { if (!isPointWithinCubeVolume(playerCubeX, 0, playerCubeZ, cubeX, 0, cubeZ, newHorizontalViewDistance, newVerticalViewDistance)) { columnsToUnload.add(getAddress(cubeX, cubeZ)); } for (int cubeY = playerCubeY - oldVerticalViewDistance; cubeY <= playerCubeY + oldVerticalViewDistance; cubeY++) { <START> if (!isPointWithinCubeVolume(playerCubeX, playerCubeY, playerCubeZ, cubeX, cubeY, cubeZ, newVerticalViewDistance, newVerticalViewDistance)) { <END> cubesToUnload.add(getAddress(cubeX, cubeY, cubeZ)); } } } } }</code><technical_language>Ooops? vertical view distance</technical_language>

Target:
public void findAllUnloadedOnViewDistanceDecrease(long playerAddress, int oldHorizontalViewDistance, int newHorizontalViewDistance, int oldVerticalViewDistance, int newVerticalViewDistance, TLongSet cubesToUnload, TLongSet columnsToUnload) { int playerCubeX = AddressTools.getX(playerAddress); int playerCubeY = AddressTools.getY(playerAddress); int playerCubeZ = AddressTools.getZ(playerAddress); for (int cubeX = playerCubeX - oldHorizontalViewDistance; cubeX <= playerCubeX + oldHorizontalViewDistance; cubeX++) { for (int cubeZ = playerCubeZ - oldHorizontalViewDistance; cubeZ <= playerCubeZ + oldHorizontalViewDistance; cubeZ++) { if (!isPointWithinCubeVolume(playerCubeX, 0, playerCubeZ, cubeX, 0, cubeZ, newHorizontalViewDistance, newVerticalViewDistance)) { columnsToUnload.add(getAddress(cubeX, cubeZ)); } for (int cubeY = playerCubeY - oldVerticalViewDistance; cubeY <= playerCubeY + oldVerticalViewDistance; cubeY++) { if (!isPointWithinCubeVolume(playerCubeX, playerCubeY, playerCubeZ, cubeX, cubeY, cubeZ, newHorizontalViewDistance, newVerticalViewDistance)) { cubesToUnload.add(getAddress(cubeX, cubeY, cubeZ)); } } } } }
Source:
<code>protected IWorkbenchPart getBootstrapPart() { IWorkbenchPage page = getSite().getPage(); if (page == null) { return null; } ISelection originalSel = page.getSelection(); IWorkbenchPart activePart = page.getActivePart(); if (activePart != null && activePart != this) { bootstrapSelection = originalSel; return activePart; } if (originalSel == null || originalSel.isEmpty()) { return null; } IEditorPart activeEditor = page.getActiveEditor(); if (activeEditor != null && isImportant(activeEditor)) { ISelection selection = <START> activeEditor.getSite().getSelectionProvider().getSelection(); <END> if (originalSel.equals(selection)) { bootstrapSelection = originalSel; return activeEditor; } } IViewReference[] viewrefs = page.getViewReferences(); for (IViewReference ref : viewrefs) { IWorkbenchPart part = ref.getPart(false); if (part == null || part == this || !page.isPartVisible(part)) { continue; } if (!isImportant(part) || part.getSite().getSelectionProvider() == null) { continue; } ISelection selection = part.getSite().getSelectionProvider().getSelection(); if (originalSel.equals(selection)) { bootstrapSelection = originalSel; return part; } } return null; }</code><technical_language>This place fixed - I push updated patch? Sorry, introduced me</technical_language>

Target:
protected IWorkbenchPart getBootstrapPart() { IWorkbenchPage page = getSite().getPage(); if (page == null) { return null; } ISelection originalSel = page.getSelection(); IWorkbenchPart activePart = page.getActivePart(); if (activePart != null && activePart != this) { bootstrapSelection = originalSel; return activePart; } if (originalSel == null || originalSel.isEmpty()) { return null; } IEditorPart activeEditor = page.getActiveEditor(); if (activeEditor != null && isImportant(activeEditor)) { if (activeEditor.getSite().getSelectionProvider() != null) { ISelection selection = activeEditor.getSite().getSelectionProvider().getSelection(); if (originalSel.equals(selection)) { bootstrapSelection = originalSel; return activeEditor; } } } IViewReference[] viewrefs = page.getViewReferences(); for (IViewReference ref : viewrefs) { IWorkbenchPart part = ref.getPart(false); if (part == null || part == this || !page.isPartVisible(part)) { continue; } if (!isImportant(part) || part.getSite().getSelectionProvider() == null) { continue; } ISelection selection = part.getSite().getSelectionProvider().getSelection(); if (originalSel.equals(selection)) { bootstrapSelection = originalSel; return part; } } return null; }
Source:
<code><START> public static InstanceDiscoveryMetadata getCachedInstanceDiscoveryMetadata(final URL authorityUrl) { <END> return sAadAuthorityHostMetadata.get(authorityUrl.getHost().toLowerCase(Locale.US)); }</code><technical_language>This class public methods are...</technical_language>

Target:
static InstanceDiscoveryMetadata getCachedInstanceDiscoveryMetadata(final URL authorityUrl) { return sAadAuthorityHostMetadata.get(authorityUrl.getHost().toLowerCase(Locale.US)); }
Source:
<code>public void variousFormatReaderTest(final String inputFile) { final File input = new File(TEST_DATA_DIR, inputFile); <START> final SamReader reader = SamReaderFactory.makeDefault().open(input); <END> for (final SAMRecord rec : reader) { } CloserUtil.close(reader); }</code><technical_language>try-with-resources</technical_language>

Target:
public void variousFormatReaderTest(final String inputFile) throws IOException { final File input = new File(TEST_DATA_DIR, inputFile); try(final SamReader reader = SamReaderFactory.makeDefault().open(input)) { for (final SAMRecord rec : reader) { } } }
Source:
<code>protected void done() { super.done(); progress.finish(); try { String markup = get(); if (markup != null) { setPanelText(markup, true); } else { setPanelText("", false); } } catch (InterruptedException | ExecutionException ex) { logger.log(Level.SEVERE, "Error getting marked up text", ex); <START> setPanelText(NbBundle.getMessage(ExtractedContentViewer.class, "ExtractedContentPanel.getText.error.msg"), true); <END> } catch (java.util.concurrent.CancellationException ex) { } updateControls(source); scrollToCurrentHit(source); }</code><technical_language>ExtractedContentPanel.getText.error.msg appears undefined. previously noted, this means unchecked runtime exception if this code is executed. Please correct error generated method for messages instead of NbBundle.getMessage, moves errors this runtime compile time. *** While in this code, nice group catch for InterruptedException CancellationException, amount (even do support cancellation of this task this time)</technical_language>

Target:
protected void done() { super.done(); progress.finish(); try { String markup = get(); if (markup != null) { setPanelText(markup, true); } else { setPanelText("", false); } } catch (InterruptedException | CancellationException | ExecutionException ex) { logger.log(Level.SEVERE, "Error getting marked up text", ex); setPanelText(Bundle.IndexedText_errorMessage_errorGettingText(), true); } updateControls(source); scrollToCurrentHit(source); }
Source:
<code>private Pair<Map<String, Object>, Map<String, Object>> readSettingsFile(File src) throws IOException, ClassNotFoundException { ObjectInputStream input = null; try { input = new ObjectInputStream(new FileInputStream(src)); Map<String, Object> generalEntries = (Map<String, Object>) input.readObject(); Map<String, Object> adminEntries = (Map<String, Object>) input.readObject(); return new Pair<>(generalEntries, adminEntries); } finally { try { if (input != null) { input.close(); } } catch (IOException ex) { <START> Timber.e(ex, "Exception thrown while closing an input stream due to: %s ", ex.getMessage()); <END> } } }</code><technical_language>While here, consider changing this a try-with-resources easier read Timber.e call</technical_language>

Target:
private Pair<Map<String, Object>, Map<String, Object>> readSettingsFile(File src) throws IOException, ClassNotFoundException { try (ObjectInputStream input = new ObjectInputStream(new FileInputStream(src))) { Map<String, Object> generalEntries = (Map<String, Object>) input.readObject(); Map<String, Object> adminEntries = (Map<String, Object>) input.readObject(); return new Pair<>(generalEntries, adminEntries); } }
Source:
<code>public void testGetNonVariantOverlapsPredicate() { long start = 1000L; Variant overlapStart = Variant.newBuilder().setReferenceBases("T").addAlternateBases("A").setStart(900L).build(); Variant overlapStartNonVariant = Variant.newBuilder().setReferenceBases("T").setStart(900L).setEnd(1005L).build(); <START> Predicate<Variant> shardPredicate = ShardBoundary.getNonVariantOverlapsPredicate(start, null); <END> assertFalse(shardPredicate.apply(overlapStart)); assertTrue(shardPredicate.apply(overlapStartNonVariant)); }</code><technical_language>This is good, is test fields provided non-null argument. function is statement based this predicate true if for fields start is bound matches VARIANT_FIELD_PATTERN: Java return Predicates.or(VariantUtils.IS_NON_VARIANT_SEGMENT, getStrictVariantPredicate(start, fields));</technical_language>

Target:
public void testGetNonVariantOverlapsPredicate() { long start = 1000L; Variant overlapStart = Variant.newBuilder().setReferenceBases("T").addAlternateBases("A").setStart(900L).build(); Variant overlapStartNonVariant = Variant.newBuilder().setReferenceBases("T").setStart(900L).setEnd(1005L).build(); Variant overlapStartGatkNonVariant = Variant.newBuilder().setReferenceBases("T") .addAlternateBases("A").addAlternateBases(VariantUtils.GATK_NON_VARIANT_SEGMENT_ALT) .setStart(900L).setEnd(1005L).build(); Predicate<Variant> shardPredicate = ShardBoundary.getNonVariantOverlapsPredicate(start, null); assertFalse(shardPredicate.apply(overlapStart)); assertTrue(shardPredicate.apply(overlapStartNonVariant)); assertTrue(shardPredicate.apply(overlapStartGatkNonVariant)); }
Source:
<code>public final void dispose() { withContextClassLoader(null, () -> { <START> log(miniSplash(format("Disposing %s '%s'", artifactType, getArtifactName()))); <END> }); ClassLoader originalClassLoader = currentThread().getContextClassLoader(); try { ClassLoader artifactCL = null; if (getArtifactClassLoader() != null) { artifactCL = getArtifactClassLoader().getClassLoader(); } if (artifactCL != null) { currentThread().setContextClassLoader(artifactCL); } doDispose(); if (artifactCL != null) { if (isRegionClassLoaderMember(artifactCL)) { ((DisposableClassLoader) artifactCL.getParent()).dispose(); } else if (artifactCL instanceof DisposableClassLoader) { ((DisposableClassLoader) artifactCL).dispose(); } } } finally { currentThread().setContextClassLoader(originalClassLoader); deploymentClassLoader = null; } }</code><technical_language>sonar</technical_language>

Target:
public final void dispose() { withContextClassLoader(null, () -> log(miniSplash(format("Disposing %s '%s'", artifactType, getArtifactName())))); ClassLoader originalClassLoader = currentThread().getContextClassLoader(); try { ClassLoader artifactCL = null; if (getArtifactClassLoader() != null) { artifactCL = getArtifactClassLoader().getClassLoader(); } if (artifactCL != null) { currentThread().setContextClassLoader(artifactCL); } doDispose(); if (artifactCL != null) { if (isRegionClassLoaderMember(artifactCL)) { ((DisposableClassLoader) artifactCL.getParent()).dispose(); } else if (artifactCL instanceof DisposableClassLoader) { ((DisposableClassLoader) artifactCL).dispose(); } } } finally { currentThread().setContextClassLoader(originalClassLoader); deploymentClassLoader = null; } }
Source:
<code>public void auditRequestMessage(T request, AssertionType assertion, NhinTargetSystemType target, String direction, String _interface, Boolean isRequesting, Properties webContextProperties, String serviceName) { LOG.trace("--- Before auditing of request message ---"); if (getAuditLogger() != null) { getAuditLogger().auditRequestMessage(request, assertion, target, direction, _interface, isRequesting, webContextProperties, serviceName, getAuditTransforms()); <START> } else { <END> LOG.error("Error looking into EJB JNDI Object"); } LOG.trace("--- After auditing of request message ---"); }</code><technical_language>log error if JNDI lookup fails, part of getAuditLogger() -- do need this else statement</technical_language>

Target:
public void auditRequestMessage(T request, AssertionType assertion, NhinTargetSystemType target, String direction, String _interface, Boolean isRequesting, Properties webContextProperties, String serviceName) { LOG.trace("--- Before auditing of request message ---"); if (getAuditLogger() != null) { getAuditLogger().auditRequestMessage(request, assertion, target, direction, _interface, isRequesting, webContextProperties, serviceName, getAuditTransforms()); } LOG.trace("--- After auditing of request message ---"); }
Source:
<code>private LockInfo() { <START> record = new ZNRecord("LOCK"); <END> setLockInfoFields(DEFAULT_OWNER_TEXT, DEFAULT_MESSAGE_TEXT, DEFAULT_TIMEOUT_LONG); }</code><technical_language>"LOCK" a constant instead of hard coding here</technical_language>

Target:
private LockInfo() { _record = new ZNRecord(ZNODE_ID); setLockInfoFields(DEFAULT_OWNER_TEXT, DEFAULT_MESSAGE_TEXT, DEFAULT_TIMEOUT_LONG); }
Source:
<code>private static Set<IResource> collectResources(ResourceMapping[] mappings) throws CoreException { final Set<IResource> resources = new HashSet<IResource>(); ResourceMappingContext context = ResourceMappingContext.LOCAL_CONTEXT; for (ResourceMapping mapping : mappings) { ResourceTraversal[] traversals = mapping.getTraversals(context, new NullProgressMonitor()); <START> for (ResourceTraversal traversal : traversals) <END> resources.addAll(Arrays.asList(traversal.getResources())); } return resources; }</code><technical_language>style nit: missing braces</technical_language>

Target:
private static Set<IResource> collectResources(ResourceMapping[] mappings) throws CoreException { final Set<IResource> resources = new HashSet<IResource>(); ResourceMappingContext context = ResourceMappingContext.LOCAL_CONTEXT; for (ResourceMapping mapping : mappings) { ResourceTraversal[] traversals = mapping.getTraversals(context, new NullProgressMonitor()); for (ResourceTraversal traversal : traversals) { resources.addAll(Arrays.asList(traversal.getResources())); } } return resources; }
Source:
<code>protected final List<Type> getColumnTypes(String tableName, String... columnNames) { checkArgument(session.getCatalog().isPresent(), "catalog not set"); <START> checkArgument(session.getSchema().isPresent(), "schema not set"); <END> Metadata metadata = localQueryRunner.getMetadata(); QualifiedObjectName qualifiedTableName = new QualifiedObjectName(session.getCatalog().get(), session.getSchema().get(), tableName); TableHandle tableHandle = metadata.getTableHandle(session, qualifiedTableName).orElse(null); checkArgument(tableHandle != null, "Table %s does not exist", qualifiedTableName); Map<String, ColumnHandle> allColumnHandles = metadata.getColumnHandles(session, tableHandle); return Arrays.stream(columnNames) .map(allColumnHandles::get) .map(columnHandle -> metadata.getColumnMetadata(session, tableHandle, columnHandle).getType()) .collect(toImmutableList()); }</code><technical_language>checkState</technical_language>

Target:
protected final List<Type> getColumnTypes(String tableName, String... columnNames) { checkState(session.getCatalog().isPresent(), "catalog not set"); checkState(session.getSchema().isPresent(), "schema not set"); Metadata metadata = localQueryRunner.getMetadata(); QualifiedObjectName qualifiedTableName = new QualifiedObjectName(session.getCatalog().get(), session.getSchema().get(), tableName); TableHandle tableHandle = metadata.getTableHandle(session, qualifiedTableName) .orElseThrow(() -> new IllegalArgumentException(format("Table %s does not exist", qualifiedTableName))); Map<String, ColumnHandle> allColumnHandles = metadata.getColumnHandles(session, tableHandle); return Arrays.stream(columnNames) .map(allColumnHandles::get) .map(columnHandle -> metadata.getColumnMetadata(session, tableHandle, columnHandle).getType()) .collect(toImmutableList()); }
Source:
<code>public IntegrationFlow tfrErrors() { return f -> f.enrichHeaders(Mail.headers() .subject("File split and transfer failed") .from("foo@bar") .toFunction(m -> new String[] {"bar@baz"})) .enrichHeaders(h -> h.header(EMAIL_SUCCESS_SUFFIX, ".failed") .headerExpression(FileHeaders.ORIGINAL_FILE, "payload.failedMessage.headers['" + FileHeaders.ORIGINAL_FILE + "']")) .<MessagingException, String>transform(p -> { StringBuilder builder = new StringBuilder(); builder.append(p.getFailedMessage().getPayload().toString()).append("\n") .append(getStackTraceAsString(p)); <START> return builder.toString(); <END> }) .channel("toMail.input"); }</code><technical_language>need StringBuilder. compiler converts simple string concatenation one</technical_language>

Target:
public IntegrationFlow tfrErrors() { return f -> f.enrichHeaders(Mail.headers() .subject("File split and transfer failed") .from("foo@bar") .toFunction(m -> new String[] {"bar@baz"})) .enrichHeaders(h -> h.header(EMAIL_SUCCESS_SUFFIX, ".failed") .headerExpression(FileHeaders.ORIGINAL_FILE, "payload.failedMessage.headers['" + FileHeaders.ORIGINAL_FILE + "']")) .<MessagingException, String>transform(p -> p.getFailedMessage().getPayload().toString() + "\n" + getStackTraceAsString(p)) .channel("toMail.input"); }