auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public DbTaskRunner(R66Session session, DbRule rule, long id, String requester, String requested) throws WaarpDatabaseException { super(); TransferDAO transferAccess = null; try { transferAccess = DAOFactory.getInstance().getTransferDAO(); transfer = transferAccess.select(id, requester, requested, Configuration.configuration.getHOST_ID()); } catch (DAOException e) { throw new WaarpDatabaseException(e); } finally { if (transferAccess != null) { transferAccess.close(); } } <START> if (transfer == null) { <END> throw new WaarpDatabaseNoDataException("Transfer not found"); } this.rule = new DbRule(getRuleId()); if (rule != null) { if (!transfer.getRule().equals(rule.getIdRule())) { throw new WaarpDatabaseNoDataException( "Rule does not correspond"); } } }</code><technical_language>resolved</technical_language>

Target:
public DbTaskRunner(R66Session session, DbRule rule, long id, String requester, String requested) throws WaarpDatabaseException { super(); this.session = session; TransferDAO transferAccess = null; try { transferAccess = DAOFactory.getInstance().getTransferDAO(); transfer = transferAccess.select(id, requester, requested, Configuration.configuration.getHOST_ID()); } catch (DAOException e) { throw new WaarpDatabaseException(e); } finally { if (transferAccess != null) { transferAccess.close(); } } if (transfer == null) { throw new WaarpDatabaseNoDataException("Transfer not found"); } this.rule = new DbRule(getRuleId()); if (rule != null) { if (!transfer.getRule().equals(rule.getIdRule())) { throw new WaarpDatabaseNoDataException( "Rule does not correspond"); } } }
Source:
<code>private Group renderWall() { Group result = new Group(); for (int h = 0; h < 2; h++) { for (int i = 0; i < 100; i++) { for (int j = 0; j < 3; j++) { double random = Math.random(); final Box wallPiece = new Box(0, 1, 1); wallPiece.setTranslateY(j - 3); wallPiece.setTranslateZ(i); wallPiece.setTranslateX(h * 3 - 1.5); if (random < 0.5) { wallPiece.setMaterial(Style.BRICK); <START> } else if (random > 0.5 && random < 0.75) { <END> wallPiece.setMaterial(Style.CRACK); } else { wallPiece.setMaterial(Style.MOSS); } wallPiece.setCache(true); wallPiece.setCacheHint(CacheHint.SPEED); result.getChildren().add(wallPiece); } } } return result; }</code><technical_language>In this part of code magic numbers. I suggest replacing for-loop boundaries Track.LENGTH Track.WIDTH, for other numbers create constants. <layout,logic</technical_language>

Target:
private Group renderWall() { Group result = new Group(); final int offset = 3; final double correction = 1.5; for (int h = 0; h < 2; h++) { for (int i = 0; i < (int) Track.LENGTH; i++) { for (int j = 0; j < Track.WIDTH; j++) { final Box wallPiece = new Box(0, 1, 1); wallPiece.setTranslateY(j - offset); wallPiece.setTranslateZ(i); wallPiece.setTranslateX(h * offset - correction); wallPiece.setMaterial(chooseMaterial()); wallPiece.setCache(true); wallPiece.setCacheHint(CacheHint.SPEED); result.getChildren().add(wallPiece); } } } return result; }
Source:
<code>public void onAttach(@NotNull Context context) { super.onAttach(context); if (context instanceof RankingListener) { listener = (RankingListener) context; } <START> viewModel = ViewModelProviders.of(this, new RankingViewModel.Factory(items, formIndex)).get(RankingViewModel.class); <END> if (viewModel.getItems() == null) { dismiss(); } }</code><technical_language>this is deprecated, I in new code sense ViewModelProvider constructor - new ViewModelProvider(this, new RankingViewModel.Factory(items, formIndex)).get(RankingViewModel.class)</technical_language>

Target:
public void onAttach(@NotNull Context context) { super.onAttach(context); if (context instanceof RankingListener) { listener = (RankingListener) context; } viewModel = new ViewModelProvider(this, new RankingViewModel.Factory(items, formIndex)).get(RankingViewModel.class); if (viewModel.getItems() == null) { dismiss(); } }
Source:
<code>default <K, V> Map<K, V> toMap( Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends V> valueMapper, BiFunction<? super V, ? super V, ? extends V> merge) { Objects.requireNonNull(keyMapper, "keyMapper is null"); Objects.requireNonNull(valueMapper, "valueMapper is null"); Objects.requireNonNull(merge, "merge is null"); <START> return toMap(t -> Tuple.of(keyMapper.apply(t), valueMapper.apply(t)), merge); <END> }</code><technical_language>java return map(f) .groupBy(keyMapper) .mapValues(s -> s.map(valueMapper).reduce(merge));</technical_language>

Target:
default <K, V> Map<K, V> toMap( Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends V> valueMapper, BiFunction<? super V, ? super V, ? extends V> merge) { Objects.requireNonNull(keyMapper, "keyMapper is null"); Objects.requireNonNull(valueMapper, "valueMapper is null"); Objects.requireNonNull(merge, "merge is null"); return this.<K>groupBy(keyMapper) .mapValues(s -> s.<V>map(valueMapper).reduce(merge)); }
Source:
<code>public Object addNodeEntity(Object entity, Long id) { if (nodeEntityRegister.add(id, entity)) { entity = nodeEntityRegister.get(id); addType(entity.getClass(), entity, id); } remember(entity, false); <START> return entity; <END> }</code><technical_language>of false un-intuitive, in update set hash - for new objects. Is this rely id null in cases in order detect is dirty? In case I needs some tests it</technical_language>

Target:
public Object addNodeEntity(Object entity, Long id) { if (nodeEntityRegister.add(id, entity)) { entity = nodeEntityRegister.get(id); addType(entity.getClass(), entity, id); remember(entity); collectLabelHistory(entity); } return entity; }
Source:
<code>public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) { PsiElement element = descriptor.getPsiElement(); if (element != null && element.isValid() && element instanceof GoUnaryExpr) { GoUnaryExpr unaryExpr = (GoUnaryExpr)element; <START> if (unaryExpr.getBitAnd() != null && unaryExpr.getExpression() != null && unaryExpr.getExpression() instanceof GoCompositeLit) { <END> GoCompositeLit compositeLit = (GoCompositeLit)unaryExpr.getExpression(); if (compositeLit.getLiteralValue() != null) { unaryExpr.replace(compositeLit.getLiteralValue()); } } } }</code><technical_language>extract unary.getExpression(), invoke times</technical_language>

Target:
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) { PsiElement element = descriptor.getPsiElement(); if (element != null && element.isValid() && element instanceof GoUnaryExpr) { GoUnaryExpr unaryExpr = (GoUnaryExpr)element; GoExpression expr = unaryExpr.getExpression(); if (unaryExpr.getBitAnd() != null && expr instanceof GoCompositeLit) { GoCompositeLit compositeLit = (GoCompositeLit)expr; if (compositeLit.getLiteralValue() != null) { unaryExpr.replace(compositeLit.getLiteralValue()); } } } }
Source:
<code>public static Optional<File> saveTable(JFrame frame, String dialogTitle, FileType format, Campaign campaign) { String fileName = String.format( campaign.getName() + campaign.getShortDateAsString() + "." + format.getRecommendedExtension() ); <START> <END> return GUI.fileDialogSave( frame, dialogTitle, new File(".", fileName), format ); }</code><technical_language>Calling String.format 1 parameter is a no-op</technical_language>

Target:
public static Optional<File> saveTable(JFrame frame, String dialogTitle, FileType format, Campaign campaign) { String fileName = campaign.getName() + campaign.getShortDateAsString() + "." + format.getRecommendedExtension(); return GUI.fileDialogSave( frame, dialogTitle, new File(".", fileName), format ); }
Source:
<code>public void getCauseOfDeathGlobalID() { patientRepository.getCauseOfDeathGlobalID(new VisitsResponseCallback() { @Override public void onSuccess(@Nullable String response) { <START> if (response.length() == 36) { <END> getConceptCauseOfDeath(response); } else { mPatientInfoView.cannotMarkDeceased(R.string.mark_patient_deceased_invalid_uuid); } } @Override public void onFailure(@Nullable String errorMessage) { mPatientInfoView.cannotMarkDeceased(errorMessage); } }); }</code><technical_language>is fine, add this 36 in constants file. Rest i run this studio if works finr, merge</technical_language>

Target:
public void getCauseOfDeathGlobalID() { patientRepository.getCauseOfDeathGlobalID(new VisitsResponseCallback() { @Override public void onSuccess(@Nullable String response) { if (response.length() == ApplicationConstants.UUID_LENGTH) { getConceptCauseOfDeath(response); } else { mPatientInfoView.cannotMarkDeceased(R.string.mark_patient_deceased_invalid_uuid); } } @Override public void onFailure(@Nullable String errorMessage) { mPatientInfoView.cannotMarkDeceased(errorMessage); } }); }
Source:
<code>protected void createNameControl(Composite parent, FormToolkit toolkit) { createLabel(parent, toolkit, Messages.NamedElementEditorPage_NameLabel); nameText = createWrappedText(parent, toolkit, element.getName(), 2); nameText.setBackground(null); <START> if (model instanceof IContext) { <END> nameText.setEnabled(!((IContext)model).isDefault()); } nameDecoration = new ControlDecoration(nameText, SWT.TOP | SWT.LEFT); FieldDecoration errorFieldIndicator = FieldDecorationRegistry .getDefault().getFieldDecoration( FieldDecorationRegistry.DEC_ERROR); nameDecoration.setImage(errorFieldIndicator.getImage()); nameDecoration.setMarginWidth(2); nameDecoration.setShowHover(true); nameDecoration.hide(); }</code><technical_language>This necessary</technical_language>

Target:
protected void createNameControl(Composite parent, FormToolkit toolkit) { createLabel(parent, toolkit, Messages.NamedElementEditorPage_NameLabel); nameText = createWrappedText(parent, toolkit, element.getName(), 2); nameText.setBackground(null); nameDecoration = new ControlDecoration(nameText, SWT.TOP | SWT.LEFT); FieldDecoration errorFieldIndicator = FieldDecorationRegistry .getDefault().getFieldDecoration( FieldDecorationRegistry.DEC_ERROR); nameDecoration.setImage(errorFieldIndicator.getImage()); nameDecoration.setMarginWidth(2); nameDecoration.setShowHover(true); nameDecoration.hide(); }
Source:
<code><START> public static Supplier<Delay> constant(int delay, TimeUnit timeUnit) { <END> LettuceAssert.isTrue(delay >= 0, "Delay must be greater or equal to 0"); final Delay statelessDelay = new ConstantDelay(delay, timeUnit); return () -> statelessDelay; }</code><technical_language>stateless delays OK stay Delay</technical_language>

Target:
public static Delay constant(int delay, TimeUnit timeUnit) { LettuceAssert.isTrue(delay >= 0, "Delay must be greater or equal to 0"); return new ConstantDelay(delay, timeUnit); }
Source:
<code><START> public static IConsole[] findConsole(IRemoteConnection connection) { <END> return new TerminalConsoleFactory().findConsole(connection); }</code><technical_language>arrays, List<IConsole> instead</technical_language>

Target:
public static List<IConsole> findConsole(IRemoteConnection connection) { return new TerminalConsoleFactory().findConsole(connection); }
Source:
<code>public void removeAllAttributes(PerunSession sess, Member member, Group group) throws InternalErrorException, WrongAttributeAssignmentException, WrongAttributeValueException, WrongReferenceAttributeValueException { List<Attribute> attributes = getAttributes(sess, member, group); getAttributesManagerImpl().removeAllAttributes(sess, member, group); getPerunBl().getAuditer().log(sess, "All attributes removed for and {}", member, group); for(Attribute attribute : attributes) attribute.setValue(null); try { checkAttributesValue(sess, member, group, attributes); <START> checkAttributesValue(sess, member, group, attributes); <END> } catch(WrongAttributeAssignmentException ex) { throw new ConsistencyErrorException(ex); } for(Attribute attribute: attributes) { try { getAttributesManagerImpl().changedAttributeHook(sess, member, group, new Attribute(attribute)); } catch (WrongAttributeValueException ex) { throw new InternalErrorException(ex); } catch (WrongReferenceAttributeValueException ex) { throw new InternalErrorException(ex); } } }</code><technical_language>row</technical_language>

Target:
public void removeAllAttributes(PerunSession sess, Member member, Group group) throws InternalErrorException, WrongAttributeAssignmentException, WrongAttributeValueException, WrongReferenceAttributeValueException { List<Attribute> attributes = getAttributes(sess, member, group); getAttributesManagerImpl().removeAllAttributes(sess, member, group); getPerunBl().getAuditer().log(sess, "All attributes removed for and {}", member, group); for(Attribute attribute : attributes) attribute.setValue(null); try { checkAttributesValue(sess, member, group, attributes); } catch(WrongAttributeAssignmentException ex) { throw new ConsistencyErrorException(ex); } for(Attribute attribute: attributes) { try { getAttributesManagerImpl().changedAttributeHook(sess, member, group, new Attribute(attribute)); } catch (WrongAttributeValueException ex) { throw new InternalErrorException(ex); } catch (WrongReferenceAttributeValueException ex) { throw new InternalErrorException(ex); } } }
Source:
<code>public static String stringWithoutTrailingZero(String value) { if (value.contains(".") && value.matches("[0-9.-]+")) { String[] splitter = value.split("\\."); <START> String splitter1 = splitter[1]; <END> for (int i = 0; i < splitter1.length(); i++) { if (splitter1.endsWith("0")) { splitter1 = splitter1.replaceFirst("0*$", ""); } else { break; } } if (splitter1.isEmpty()) { value = splitter[0]; } else { value = splitter[0].concat(".").concat(splitter1); } } return value; }</code><technical_language>please rename splitter1 "decimalPlaces"</technical_language>

Target:
public static String stringWithoutTrailingZero(String value) { if (value.contains(".") && value.matches("[0-9.-]+")) { value = !value.contains(".") ? value : value.replaceAll("0*$", "").replaceAll("\\.$", ""); } return value; }
Source:
<code>public String getMessage() { <START> return ("done".equalsIgnoreCase(_message.toLowerCase())) ? "" : _message; <END> }</code><technical_language>related change, some enum instead of hardcoded "done"</technical_language>

Target:
public String getMessage() { return ("done".equalsIgnoreCase(_message)) ? "" : _message; }
Source:
<code>public boolean addSyncUrl() { SyncUrl syncUrl = new SyncUrl(); syncUrl.setKeywords(keywords.getText().toString()); <START> syncUrl.setSecret(Util.removeWhitespaces(this.secret.getText().toString())); <END> syncUrl.setTitle(title.getText().toString()); syncUrl.setUrl(url.getText().toString()); syncUrl.setStatus(0); syncUrl.setSyncScheme(new SyncScheme()); return syncUrl.save(); }</code><technical_language>call Util.removeWhitespace(...) in SyncUrl model. in [setSecret(...)](<LINK_0> method avoid repetition trim white spaces</technical_language>

Target:
public boolean addSyncUrl() { SyncUrl syncUrl = new SyncUrl(); syncUrl.setKeywords(keywords.getText().toString()); syncUrl.setSecret(secret.getText().toString()); syncUrl.setTitle(title.getText().toString()); syncUrl.setUrl(url.getText().toString()); syncUrl.setStatus(0); syncUrl.setSyncScheme(new SyncScheme()); return syncUrl.save(); }
Source:
<code>protected void manageCollectionProperty(ScenarioSimulationContext context, ScenarioGridColumn selectedColumn, String className, int columnIndex, List<String> fullPropertyPathElements) { final SortedMap<String, FactModelTree> dataObjectFieldsMap = context.getDataObjectFieldsMap(); if (className.contains(".")) { className = className.substring(className.lastIndexOf('.') + 1); } final FactModelTree factModelTree = dataObjectFieldsMap.get(className); <START> final Optional<AbstractScesimModel> selectedScenarioGridModel = context.getSelectedScenarioGridModel().getAbstractScesimModel(); if (!selectedScenarioGridModel.isPresent()) { throw new IllegalArgumentException(); } final FactMapping factMapping = selectedScenarioGridModel.get().getSimulationDescriptor().getFactMappingByIndex(columnIndex); <END> selectedColumn.setFactory(context.getCollectionEditorSingletonDOMElementFactory()); if (factModelTree.isSimple()) { factMapping.setGenericTypes(factModelTree.getGenericTypeInfo(ConstantHolder.VALUE)); } else { final FactModelTree nestedFactModelTree = navigateComplexObject(factModelTree, fullPropertyPathElements, dataObjectFieldsMap); factMapping.setGenericTypes(nestedFactModelTree.getGenericTypeInfo(fullPropertyPathElements.get(fullPropertyPathElements.size() - 1))); } }</code><technical_language>replace this explicit throw Optional.map? selectedScenarioGridModel.map(elem -> elem.getSimulationDescriptor().getFactMappingByIndex(columnIndex)).orElseThrow(....)</technical_language>

Target:
protected void manageCollectionProperty(ScenarioSimulationContext context, ScenarioGridColumn selectedColumn, String className, int columnIndex, List<String> fullPropertyPathElements) { final SortedMap<String, FactModelTree> dataObjectFieldsMap = context.getDataObjectFieldsMap(); if (className.contains(".")) { className = className.substring(className.lastIndexOf('.') + 1); } final FactModelTree factModelTree = dataObjectFieldsMap.get(className); final Optional<AbstractScesimModel> selectedScenarioGridModel = context.getSelectedScenarioGridModel().getAbstractScesimModel(); if (!selectedScenarioGridModel.isPresent()) { throw new IllegalArgumentException("SelectedGrid not found"); } final FactMapping factMapping = selectedScenarioGridModel.get().getScesimModelDescriptor().getFactMappingByIndex(columnIndex); selectedColumn.setFactory(context.getCollectionEditorSingletonDOMElementFactory()); if (factModelTree.isSimple()) { factMapping.setGenericTypes(factModelTree.getGenericTypeInfo(ConstantHolder.VALUE)); } else { final FactModelTree nestedFactModelTree = navigateComplexObject(factModelTree, fullPropertyPathElements, dataObjectFieldsMap); factMapping.setGenericTypes(nestedFactModelTree.getGenericTypeInfo(fullPropertyPathElements.get(fullPropertyPathElements.size() - 1))); } }
Source:
<code>public boolean matches(RelOptRuleCall call) { FlinkLogicalOverAggregate logicWindow = call.rel(0); List<AggregateCall> aggCalls = logicWindow.groups.get(0).getAggregateCalls(logicWindow); boolean existGeneralPythonFunction = aggCalls.stream().anyMatch(x -> PythonUtil.isPythonAggregate(x, PythonFunctionKind.GENERAL)); boolean existPandasFunction = aggCalls.stream().anyMatch(x -> PythonUtil.isPythonAggregate(x, PythonFunctionKind.PANDAS)); boolean existJavaFunction = aggCalls.stream().anyMatch(x -> !PythonUtil.isPythonAggregate(x, null)); if (existPandasFunction || existGeneralPythonFunction) { if (existGeneralPythonFunction) { <START> throw new TableException("non-Pandas UDAFs are not supported in stream mode currently."); <END> } if (existJavaFunction) { throw new TableException("Python UDAF and Java/Scala UDAF cannot be used together."); } return true; } else { return false; } }</code><technical_language>suggestion throw new TableException("Non-Pandas Python UDAFs supported in stream mode currently.");</technical_language>

Target:
public boolean matches(RelOptRuleCall call) { FlinkLogicalOverAggregate logicWindow = call.rel(0); List<AggregateCall> aggCalls = logicWindow.groups.get(0).getAggregateCalls(logicWindow); boolean existGeneralPythonFunction = aggCalls.stream().anyMatch(x -> PythonUtil.isPythonAggregate(x, PythonFunctionKind.GENERAL)); boolean existPandasFunction = aggCalls.stream().anyMatch(x -> PythonUtil.isPythonAggregate(x, PythonFunctionKind.PANDAS)); boolean existJavaFunction = aggCalls.stream().anyMatch(x -> !PythonUtil.isPythonAggregate(x, null)); if (existPandasFunction || existGeneralPythonFunction) { if (existGeneralPythonFunction) { throw new TableException("Non-Pandas Python UDAFs are not supported in stream mode currently."); } if (existJavaFunction) { throw new TableException("Python UDAF and Java/Scala UDAF cannot be used together."); } return true; } else { return false; } }
Source:
<code>private boolean isBindingChange(FieldDefinition oldField, FieldDefinition fieldCopy) { if (oldField.getBinding() == null) { <START> return fieldCopy.getBinding() != null && !fieldCopy.getBinding().equals(""); <END> } return !oldField.getBinding().equals(fieldCopy.getBinding()) || !oldField.getId().equals(fieldCopy.getId()) || (oldField.getBinding().equals(fieldCopy.getBinding()) && oldField.getId().equals(fieldCopy.getId())); }</code><technical_language>@alessioscalici this case is covered in tests</technical_language>

Target:
protected boolean isBindingChange(FieldDefinition oldField, FieldDefinition fieldCopy) { if (oldField.getBinding() == null || oldField.getBinding().equals("")) { return fieldCopy.getBinding() != null && !fieldCopy.getBinding().equals(""); } return true; }
Source:
<code>public Map<Errors, Integer> errorCounts() { Map<Errors, Integer> counts = new HashMap<>(); <START> Errors topLevelErr = Errors.forCode(data.errorCode()); <END> updateErrorCounts(counts, topLevelErr); data.responses().forEach(topicResponse -> topicResponse.partitions().forEach(partitionResponse -> updateErrorCounts(counts, Errors.forCode(partitionResponse.errorCode())) )); return counts; }</code><technical_language>inline</technical_language>

Target:
public Map<Errors, Integer> errorCounts() { Map<Errors, Integer> counts = new HashMap<>(); updateErrorCounts(counts, Errors.forCode(data.errorCode())); data.responses().forEach(topicResponse -> topicResponse.partitions().forEach(partitionResponse -> updateErrorCounts(counts, Errors.forCode(partitionResponse.errorCode())) )); return counts; }
Source:
<code>private boolean anyDiffInIndex() throws IOException { Repository repo = getRepository(); TreeWalk treeWalk = new TreeWalk(repo); treeWalk.setRecursive(true); final ObjectId rev = repo.resolve("HEAD"); if (rev!=null) <START> treeWalk.addTree(new RevWalk(repo).parseTree(rev)); <END> treeWalk.addTree(new DirCacheIterator(repo.readDirCache())); treeWalk.setFilter(TreeFilter.ANY_DIFF); return treeWalk.next(); }</code><technical_language>If rev is null, happen. bail point? Also, brackets needed</technical_language>

Target:
private boolean anyDiffInIndex() throws IOException { final Repository repo = getRepository(); final TreeWalk treeWalk = new TreeWalk(repo); treeWalk.setRecursive(true); final ObjectId rev = repo.resolve("HEAD"); if (rev != null) { treeWalk.addTree(new RevWalk(repo).parseTree(rev)); } treeWalk.addTree(new DirCacheIterator(repo.readDirCache())); treeWalk.setFilter(TreeFilter.ANY_DIFF); return treeWalk.next(); }
Source:
<code>public Iterable<VMImage> listImages() { final List<VMImage> osImages = Lists.newArrayList(); final List<String> locationIds = Lists.newArrayList(); for (Location location : listLocations()){ locationIds.add(location.name()); osImages.addAll(listImagesByLocation(location.name())); } checkAndSetImageAvailability(osImages, Sets.newHashSet(locationIds)); <START> String offer = ""; <END> List<StorageService> storages = api.getStorageAccountApi(azureGroup).list(); for (StorageService storage : storages) { String name = storage.name(); String key = api.getStorageAccountApi(azureGroup).getKeys(name).key1(); offer = "custom"; List<VMImage> images = BlobHelper.getImages("jclouds", azureGroup, storage.name(), key, offer, storage.location()); osImages.addAll(images); } return osImages; }</code><technical_language>need for this variable, pass "custom" BlobHelper call</technical_language>

Target:
public Iterable<VMImage> listImages() { final List<VMImage> osImages = Lists.newArrayList(); final List<String> locationIds = Lists.newArrayList(); for (Location location : listLocations()){ locationIds.add(location.name()); osImages.addAll(listImagesByLocation(location.name())); } checkAndSetImageAvailability(osImages, Sets.newHashSet(locationIds)); List<StorageService> storages = api.getStorageAccountApi(azureGroup).list(); for (StorageService storage : storages) { String name = storage.name(); String key = api.getStorageAccountApi(azureGroup).getKeys(name).key1(); List<VMImage> images = BlobHelper.getImages("jclouds", azureGroup, storage.name(), key, "custom", storage.location()); osImages.addAll(images); } return osImages; }
Source:
<code>public void writeData(ObjectDataOutput out) throws IOException { out.writeUTF(name); out.writeInt(durability); out.writeInt(capacity); out.writeInt(poolSize); out.writeUTF(splitBrainProtectionName); out.writeObject(mergePolicyConfig); <START> out.writeInt(capacityPolicy.ordinal()); <END> }</code><technical_language>stable is ordinal? assign byte IDs enum more stable (see WanPublisherState#getId WanPublisherState#getByType)</technical_language>

Target:
public void writeData(ObjectDataOutput out) throws IOException { out.writeUTF(name); out.writeInt(durability); out.writeInt(capacity); out.writeInt(poolSize); out.writeUTF(splitBrainProtectionName); out.writeObject(mergePolicyConfig); out.writeByte(capacityPolicy.getId()); }
Source:
<code>protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException { TaggedValuePointable tvp1 = args[0]; if (!((tvp1.getTag() == ValueTag.OBJECT_TAG) || (tvp1.getTag() == ValueTag.ARRAY_TAG))) { throw new SystemException(ErrorCode.FORG0006); } if (tvp1.getTag() == ValueTag.OBJECT_TAG) { try { tvp1.getValue(op); op.getKeys(result); } catch (IOException e) { throw new SystemException(ErrorCode.SYSE0001, e); } } else if (tvp1.getTag() == ValueTag.ARRAY_TAG) { abvs.reset(); sb.reset(abvs); <START> TaggedValuePointable tempTvp = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable(); <END> tvp1.getValue(ap); tvp1.getValue(sp); int size = sp.getEntryCount(); for (int i = 0; i < size; i++) { sp.getEntry(i, tempTvp); try { sb.addItem(tempTvp); } catch (IOException e) { throw new SystemException(ErrorCode.SYSE0001, e); } } try { sb.finish(); } catch (IOException e) { throw new SystemException(ErrorCode.SYSE0001, e); } result.set(abvs); } }</code><technical_language>Reuse pointable for evaluation call</technical_language>

Target:
protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException { TaggedValuePointable tvp1 = args[0]; if (!((tvp1.getTag() == ValueTag.OBJECT_TAG) || (tvp1.getTag() == ValueTag.ARRAY_TAG))) { throw new SystemException(ErrorCode.FORG0006); } if (tvp1.getTag() == ValueTag.OBJECT_TAG) { try { tvp1.getValue(op); op.getKeys(result); } catch (IOException e) { throw new SystemException(ErrorCode.SYSE0001, e); } } else if (tvp1.getTag() == ValueTag.ARRAY_TAG) { abvs.reset(); sb.reset(abvs); tvp1.getValue(ap); tvp1.getValue(sp); int size = sp.getEntryCount(); for (int i = 0; i < size; i++) { sp.getEntry(i, tempTvp); try { sb.addItem(tempTvp); } catch (IOException e) { throw new SystemException(ErrorCode.SYSE0001, e); } } try { sb.finish(); } catch (IOException e) { throw new SystemException(ErrorCode.SYSE0001, e); } result.set(abvs); } }
Source:
<code>public static Results analyze(final WebDriver webDriver, final WebElement context, final AxeBuilderOptions axeBuilderOptions) throws OperationNotSupportedException, IOException { if (webDriver == null) { throw new NullPointerException("the web Driver is null"); } if (context == null) { <START> throw new NullPointerException("the web Element is null"); <END> } AxeBuilder axeBuilder = new AxeBuilder(axeBuilderOptions); return axeBuilder.analyze(webDriver, context); }</code><technical_language>this "the web Element" "the context"</technical_language>

Target:
public static Results analyze(final WebDriver webDriver, final WebElement context, final AxeBuilderOptions axeBuilderOptions) throws OperationNotSupportedException, IOException { if (webDriver == null) { throw new NullPointerException("the web Driver is null"); } if (context == null) { throw new NullPointerException("the context is null"); } AxeBuilder axeBuilder = new AxeBuilder(axeBuilderOptions); return axeBuilder.analyze(webDriver, context); }
Source:
<code>public void sparse() { Random r = new Random(); LinkedList<Instance> trainSparseVectors = new LinkedList(); LinkedList<Instance> trainDenseVectors = new LinkedList(); for (int instance = 0; instance < 1000; instance++) { HashMapAttributes sparseInstanceHmAttributes = new HashMapAttributes(); HashMapAttributes denseInstanceHmAttributes = new HashMapAttributes(); for (int feat = 0; feat < 1000; feat++) { String key = ((Integer)feat).toString(); if(feat == instance){ <START> denseInstanceHmAttributes.put(key, 1.0); <END> denseInstanceHmAttributes.put(key, 1.0); } else denseInstanceHmAttributes.put(key, 0); } final Serializable label = r.nextBoolean(); trainSparseVectors.add(sparseInstanceHmAttributes.classification(label.toString())); trainDenseVectors.add(denseInstanceHmAttributes.classification(label.toString())); } { TreeBuilder treeBuilder = new TreeBuilder(); long start = System.currentTimeMillis(); Tree tree = treeBuilder.buildPredictiveModel(trainSparseVectors); System.out.println("Training with sparse vectors took: " + (System.currentTimeMillis()-start) + " milliseconds"); tree.node.dump(System.out); } { TreeBuilder treeBuilder = new TreeBuilder(); long start = System.currentTimeMillis(); Tree tree = treeBuilder.buildPredictiveModel(trainDenseVectors); System.out.println("Training with dense vectors took: " + (System.currentTimeMillis()-start) + " milliseconds"); tree.node.dump(System.out); } System.exit(0); }</code><technical_language>of lines sparseInstanceHmAttributes, putting data dense attributes</technical_language>

Target:
public void sparse() { Random r = new Random(); LinkedList<Instance> trainSparseVectors = new LinkedList(); LinkedList<Instance> trainDenseVectors = new LinkedList(); for (int instance = 0; instance < 1000; instance++) { HashMapAttributes sparseInstanceHmAttributes = new HashMapAttributes(); HashMapAttributes denseInstanceHmAttributes = new HashMapAttributes(); for (int feat = 0; feat < 1000; feat++) { String key = ((Integer)feat).toString(); if(feat == instance){ denseInstanceHmAttributes.put(key, 1.0); sparseInstanceHmAttributes.put(key, 1.0); } else denseInstanceHmAttributes.put(key, 0); } final Serializable label = r.nextBoolean(); trainSparseVectors.add(sparseInstanceHmAttributes.classification(label.toString())); trainDenseVectors.add(denseInstanceHmAttributes.classification(label.toString())); } { TreeBuilder treeBuilder = new TreeBuilder(); long start = System.currentTimeMillis(); Tree tree = treeBuilder.buildPredictiveModel(trainSparseVectors); System.out.println("Training with sparse vectors took: " + (System.currentTimeMillis()-start) + " milliseconds"); tree.node.dump(System.out); } { TreeBuilder treeBuilder = new TreeBuilder(); long start = System.currentTimeMillis(); Tree tree = treeBuilder.buildPredictiveModel(trainDenseVectors); System.out.println("Training with dense vectors took: " + (System.currentTimeMillis()-start) + " milliseconds"); tree.node.dump(System.out); } System.exit(0); }
Source:
<code>public Receive createReceive() { return new ReceiveBuilder() .matchEquals(FETCH_METRIC, work -> _metricsDiscovery.tell(MetricFetch.getInstance(), getSelf())) .match(String.class, this::fetchMetricTags) .match(TagNamesMessage.class, this::handleTagNamesMessage) .match(LastDataPointMessage.class, this::handleLastDataPointMessage) <START> .match(FinishRollupMessage.class, this::handleFinishRollupMessage) <END> .match(NoMoreMetrics.class, noMore -> timers().startSingleTimer("sleepTimer", FETCH_METRIC, _fetchBackoff)) .build(); }</code><technical_language>This a bit surprising</technical_language>

Target:
public Receive createReceive() { return new ReceiveBuilder() .matchEquals(FETCH_METRIC, this::handleFetchMetrics) .match(String.class, this::fetchMetricTags) .match(TagNamesMessage.class, this::handleTagNamesMessage) .match(LastDataPointMessage.class, this::handleLastDataPointMessage) .match(FinishRollupMessage.class, this::handleFinishRollupMessage) .match(NoMoreMetrics.class, this::handleNoMoreMetricsMessage) .build(); }
Source:
<code>private RuntimeException closeRestoring(final boolean isZombie, final StreamTask task, final List<TopicPartition> closedTaskChangelogs) { removeTaskFromRestoring(task); <START> closedTaskChangelogs.addAll(task.changelogPartitions()); <END> try { final boolean clean = !isZombie; task.closeStateManager(clean); } catch (final RuntimeException e) { log.error("Failed to close restoring task due to the following error:", task.id(), e); return e; } return null; }</code><technical_language>clarify, is ordering requirement operations? removeTaskFromRestoring(task); closedTaskChangelogs.addAll(task.changelogPartitions());</technical_language>

Target:
private RuntimeException closeRestoring(final boolean isZombie, final StreamTask task, final List<TopicPartition> closedTaskChangelogs) { removeTaskFromRestoring(task); closedTaskChangelogs.addAll(task.changelogPartitions()); try { final boolean clean = !isZombie; task.closeStateManager(clean); } catch (final RuntimeException e) { log.error("Failed to close the restoring stream task due to the following error:", task.id(), e); return e; } return null; }
Source:
<code>public void testExtendingDiskWithQuota() { Guid quotaId = Guid.newGuid(); DiskImage oldDiskImage = createDiskImage(); oldDiskImage.setQuotaId(quotaId); oldDiskImage.setSize(getBytesByGB(3)); DiskImage newDiskImage = createDiskImage(); newDiskImage.setQuotaId(quotaId); newDiskImage.setSize(getBytesByGB(5)); UpdateVmDiskParameters parameters = new UpdateVmDiskParameters(vmId, diskImageGuid, newDiskImage); long diskExtendingDiffInGB = newDiskImage.getSizeInGigabytes() - oldDiskImage.getSizeInGigabytes(); when(diskDao.get(diskImageGuid)).thenReturn(oldDiskImage); initializeCommand(parameters); QuotaStorageConsumptionParameter consumptionParameter = (QuotaStorageConsumptionParameter) command.getQuotaStorageConsumptionParameters().get(0); <START> assertTrue(consumptionParameter.getRequestedStorageGB() == diskExtendingDiffInGB); <END> }</code><technical_language>assertEquals instead</technical_language>

Target:
public void testExtendingDiskWithQuota() { Guid quotaId = Guid.newGuid(); DiskImage oldDiskImage = createDiskImage(); oldDiskImage.setQuotaId(quotaId); oldDiskImage.setSize(SizeConverter.convert(3, SizeConverter.SizeUnit.GB, SizeConverter.SizeUnit.BYTES).longValue()); DiskImage newDiskImage = createDiskImage(); newDiskImage.setQuotaId(quotaId); newDiskImage.setSize(SizeConverter.convert(5, SizeConverter.SizeUnit.GB, SizeConverter.SizeUnit.BYTES).longValue()); UpdateVmDiskParameters parameters = new UpdateVmDiskParameters(vmId, diskImageGuid, newDiskImage); long diskExtendingDiffInGB = newDiskImage.getSizeInGigabytes() - oldDiskImage.getSizeInGigabytes(); when(diskDao.get(diskImageGuid)).thenReturn(oldDiskImage); initializeCommand(parameters); QuotaStorageConsumptionParameter consumptionParameter = (QuotaStorageConsumptionParameter) command.getQuotaStorageConsumptionParameters().get(0); assertEquals(consumptionParameter.getRequestedStorageGB().longValue(), diskExtendingDiffInGB); }
Source:
<code>public static INDArray forceCorrectShape(INDArray source) { <START> long[] shape = source.shape(); if (shape[0] == 1) { return source; } long[] newShape = new long[shape.length + 1]; newShape[0] = 1; System.arraycopy(shape, 0, newShape, 1, shape.length); return source.reshape(newShape); <END> }</code><technical_language>[Nd4j.expandDims](<LINK_0></technical_language>

Target:
public static INDArray forceCorrectShape(INDArray source) { return source.shape()[0] == 1 ? source : Nd4j.expandDims(source, 0); }
Source:
<code>public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; GatewayAccount that = (GatewayAccount) o; <START> return new EqualsBuilder() <END> .append(id, that.id) .append(gatewayName, that.gatewayName) .append(credentials, that.credentials) .isEquals(); }</code><technical_language>Objects.equals( ) basically is part of standard library</technical_language>

Target:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; GatewayAccount that = (GatewayAccount) o; return Objects.equals(id, that.id) && Objects.equals(gatewayName, that.gatewayName) && Objects.equals(credentials, that.credentials); }
Source:
<code><START> protected MessageBus getMessageBus() throws Exception { <END> throw new IllegalStateException("Subclasses must override getMessageBus()"); }</code><technical_language>this abstract method</technical_language>

Target:
protected abstract MessageBus getMessageBus() throws Exception; @After public void cleanup() { if (testMessageBus != null) { testMessageBus.cleanup(); } }
Source:
<code>public static List<Region> parseRegions(String regionsString) { List<Region> regions = null; if (regionsString != null && !regionsString.equals("")) { String[] regionItems = regionsString.split(","); regions = new ArrayList<>(regionItems.length); String[] fields; for (String regionString : regionItems) { if (regionString.indexOf(':') != -1) { fields = regionString.split("[:-]", -1); if (fields.length == 3) { regions.add(new Region(fields[0], Integer.parseInt(fields[1]), Integer.parseInt(fields[2]))); } else { regions.add(null); } } else { <START> regions.add(new Region(regionString, 0, Integer.MAX_VALUE)); <END> } } } return regions; }</code><technical_language>single arg constructor</technical_language>

Target:
public static List<Region> parseRegions(String regionsString) { List<Region> regions = null; if (regionsString != null && !regionsString.equals("")) { String[] regionItems = regionsString.split(","); regions = new ArrayList<>(regionItems.length); String[] fields; for (String regionString : regionItems) { if (regionString.indexOf(':') != -1) { fields = regionString.split("[:-]", -1); if (fields.length == 3) { regions.add(new Region(fields[0], Integer.parseInt(fields[1]), Integer.parseInt(fields[2]))); } else { regions.add(null); } } else { regions.add(new Region(regionString)); } } } return regions; }
Source:
<code>public String toString() { StringBuilder stringRepresentation = new StringBuilder(); getSingleYear().ifPresent(singleYear -> stringRepresentation.append(singleYear).append(" ")); getFromYear().ifPresent(fromYear -> stringRepresentation.append(fromYear).append(" ")); getToYear().ifPresent(toYear -> stringRepresentation.append(toYear).append(" ")); getJournal().ifPresent(journal -> stringRepresentation.append(journal).append(" ")); stringRepresentation.append(String.join(" ", getTitlePhrases())) .append(String.join(" ", getDefaultFieldPhrases())) <START> .append(String.join(" ", getAuthors())) <END> .append(String.join(" ", getAbstractPhrases())); return stringRepresentation.toString(); }</code><technical_language>While it, please switch [StringJoiner](<LINK_0> java StringJoiner stringJoiner = new StringJoiner(" "); getSingleYear().ifPresent(singleYear -> stringJoiner.append(singleYear)); ..</technical_language>

Target:
public String toString() { StringJoiner stringJoiner = new StringJoiner(" "); getSingleYear().ifPresent(singleYear -> stringJoiner.add(singleYear.toString())); getFromYear().ifPresent(fromYear -> stringJoiner.add(fromYear.toString())); getToYear().ifPresent(toYear -> stringJoiner.add(toYear.toString())); getJournal().ifPresent(stringJoiner::add); stringJoiner.add(String.join(" ", getTitlePhrases())) .add(String.join(" ", getDefaultFieldPhrases())) .add(String.join(" ", getAuthors())) .add(String.join(" ", getAbstractPhrases())); return stringJoiner.toString(); }
Source:
<code>public GlusterServersListReturnForXmlRpc(Map<String, Object> innerMap) { super(innerMap); <START> List<GlusterServerInfo> glusterServers = new ArrayList<GlusterServerInfo>(); <END> if (mStatus.mCode != 0) { Object[] serversArr = (Object[]) innerMap.get(GLUSTER_HOSTS); if (serversArr != null) { for (int i = 0; i < serversArr.length; i++) { glusterServers.add(prepareServerInfo((Map<String, Object>) serversArr[i])); } } } this.servers = glusterServers; }</code><technical_language>Local variable required. populate class level variable this.servers</technical_language>

Target:
public GlusterServersListReturnForXmlRpc(Map<String, Object> innerMap) { super(innerMap); if (mStatus.mCode != 0) { return; } Object[] serversArr = (Object[]) innerMap.get(GLUSTER_HOSTS); if (serversArr != null) { for (int i = 0; i < serversArr.length; i++) { this.servers.add(prepareServerInfo((Map<String, Object>) serversArr[i])); } } }
Source:
<code>public static int byteArrayToInt(byte[] b) { <START> byte[] values = b; <END> if (b.length < 4) { values = new byte[4]; int diff = 4 - b.length; for (int i = 0; i < diff; i++) values[i] = 0; for (int i = diff; i < 4; i++) values[i] = b[i - diff]; } return ((values[0] & 0xFF) << 24) | ((values[1] & 0xFF) << 16) | ((values[2] & 0xFF) << 8) | (values[3] & 0xFF); }</code><technical_language>Check if byte[] b is null</technical_language>

Target:
public static int byteArrayToInt(byte[] b) { if (b == null) throw new NullPointerException("Byte array cannot be null."); byte[] values = b; if (b.length < 4) { values = new byte[4]; int diff = 4 - b.length; for (int i = 0; i < diff; i++) values[i] = 0; for (int i = diff; i < 4; i++) values[i] = b[i - diff]; } return ((values[0] & 0xFF) << 24) | ((values[1] & 0xFF) << 16) | ((values[2] & 0xFF) << 8) | (values[3] & 0xFF); }
Source:
<code>public void setMinWriteDelay(int minWriteDelay) { if (minWriteDelay < 0) { throw new IllegalArgumentException("Minimum write delay seconds cannot be less than 0"); } else if (minWriteDelay > maxWriteDelay) { <START> throw new IllegalArgumentException("Minimum write delay must be smaller than maximum write delay"); <END> } this.minWriteDelay = minWriteDelay; }</code><technical_language>smaller equal (and include values?)</technical_language>

Target:
public void setMinWriteDelay(int minWriteDelay) { if (minWriteDelay < 0) { throw new IllegalArgumentException("Minimum write delay seconds cannot be less than 0"); } else if (minWriteDelay > maxWriteDelay) { throw new IllegalArgumentException("Minimum write delay (" + minWriteDelay + ") must be smaller than or equal to maximum write delay (" + maxWriteDelay + ")"); } this.minWriteDelay = minWriteDelay; }
Source:
<code>public AttestationResult validateHostIsTrusted(VDS vds) { log.debug("begin to validate " + vds.getName()); AttestationResult result = AttestationResult.UNKNOWN; String key = vds.gethost_name(); if (AttestationCacheManager.exists(key)){ if (!AttestationCacheManager.isExpired(key)){ AttestationValue value = AttestationCacheManager.getValueFromCache(key); return value.getTrustLevel(); } else{ for (AttestationValue value : attestHosts(AttestationCacheManager.getAllKeys())){ AttestationCacheManager.updateCache(value); <START> } <END> return AttestationCacheManager.getValueFromCache(key).getTrustLevel(); } } return result; }</code><technical_language>time host is expired refresh of hosts? a. this a long time (can call host in parallel?) b. do expiration for AttestationValue</technical_language>

Target:
public AttestationResultEnum validateHostIsTrusted(VDS vds) { log.debug("begin to validate " + vds.getName()); AttestationResultEnum result = AttestationResultEnum.UNKNOWN; AttestationCacheManager cacheManager = AttestationCacheManager.getInstance(); String key = vds.gethost_name(); if (cacheManager.exists(key)) { if (!cacheManager.isExpired(key)) { AttestationValue value = cacheManager.getValueFromCache(key); return value.getTrustLevel(); } else { for (AttestationValue value : attestHosts(cacheManager.getAllKeys())) { cacheManager.updateCache(value); } return cacheManager.getValueFromCache(key).getTrustLevel(); } } return result; }
Source:
<code>public void verifyFacebookWindow() { CommonFunctions.waitForWindow("", ""); Object[] windows = driver.getWindowHandles().toArray(); driver.switchTo().window(windows[1].toString()); <START> waitForStringInURL("facebook.com"); <END> driver.close(); driver.switchTo().window(windows[0].toString()); PageObjectLogging.log("verifyFacebookWindow", "Verify that the FB window URL is correct", true, driver); }</code><technical_language>external url's stored in ContentPatterns.URLsContent class</technical_language>

Target:
public void verifyFacebookWindow() { CommonFunctions.waitForWindow("", ""); Object[] windows = driver.getWindowHandles().toArray(); driver.switchTo().window(windows[1].toString()); waitForStringInURL(URLsContent.facebookDomain); driver.close(); driver.switchTo().window(windows[0].toString()); PageObjectLogging.log("verifyFacebookWindow", "Verify that the FB window URL is correct", true, driver); }
Source:
<code>protected void configureServlets() { bind(KeycloakAuthenticationFilter.class).in(Singleton.class); filterRegex( "^(?!.*(/docs/))(?!.*(/settings/?|/api/oauth/callback/?)$).*") .through(KeycloakAuthenticationFilter.class); filterRegex( <START> "^(?!.*(/docs/))(?!.*(/settings/?|/api/oauth/callback/?)$).*") <END> .through(KeycloakEnvironmentInitalizationFilter.class); }</code><technical_language>settings - > keycalok/settings</technical_language>

Target:
protected void configureServlets() { bind(KeycloakAuthenticationFilter.class).in(Singleton.class); filterRegex("^(?!.*(/docs/))(?!.*(/keycloak/settings/?|/api/oauth/callback/?)$).*") .through(KeycloakAuthenticationFilter.class); filterRegex("^(?!.*(/docs/))(?!.*(/keycloak/settings/?|/api/oauth/callback/?)$).*") .through(KeycloakEnvironmentInitalizationFilter.class); }
Source:
<code>private void initializeDbTable() { try{ metricStore.deleteTrustedExtensionMetadata(TRUSTED_EXTENSION); List<String> extensions = getExtensions(); for (String extension : extensions) { String extensionType = AbstractExtension.isExtensionTrusted(extension) ? TRUSTED_EXTENSION : CUSTOM_EXTENSION; String description = getShortDescription(extension); <START> String recipeName = extension; <END> String location = storePath.toString() + '/' + extension; metricStore.storeExtensionMetadataBean(recipeName, location, extensionType, description); } } catch (FalconException e){ LOG.error("Exception in ExtensionStore:", e); throw new RuntimeException(e); } }</code><technical_language>extensionName lines</technical_language>

Target:
private void initializeDbTable() { try{ metaStore.deleteExtensionsOfType(ExtensionType.TRUSTED); List<String> extensions = getExtensions(); for (String extension : extensions) { ExtensionType extensionType = AbstractExtension.isExtensionTrusted(extension) ? ExtensionType.TRUSTED : ExtensionType.CUSTOM; String description = getShortDescription(extension); String recipeName = extension; String location = storePath.toString() + '/' + extension; metaStore.storeExtensionMetadataBean(recipeName, location, extensionType, description); } } catch (FalconException e){ LOG.error("Exception in ExtensionStore:", e); throw new RuntimeException(e); } }
Source:
<code>public static <C extends ColumnType> Builder<C> newBuilder(ColumnTypeRegistry<C> src) { final Builder<C> builder = new Builder<>(); <START> builder.columnTypeMap.putAll(src.columnTypeMap); <END> return builder; }</code><technical_language>Builder.put calls instead reuse validation. if validation code is expanded some more sophisticated checks, okay</technical_language>

Target:
public static <C extends ColumnType> Builder<C> newBuilder(ColumnTypeRegistry<C> src) { final Builder<C> builder = newBuilder(); for (Map.Entry<Class, C> typeMapping : src.columnTypeMap.entrySet()) { builder.put(typeMapping.getKey(), typeMapping.getValue()); } return builder; }