auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static KHyperLogLog newInstance(Slice serialized) { requireNonNull(serialized, "serialized is null"); SliceInput input = serialized.getInput(); checkArgument(input.readByte() == UNCOMPRESSED_FORMAT, "Unexpected version"); int maxSize = input.readInt(); int hllBuckets = input.readInt(); int minhashSize = input.readInt(); Long2ObjectRBTreeMap<HyperLogLog> minhash = new Long2ObjectRBTreeMap<>(); SliceInput valuesInput = serialized.getInput(); valuesInput.setPosition(input.position() + minhashSize * SIZE_OF_LONG); int hllLength; Slice serializedHll; for (int i = 0; i < minhashSize; i++) { <START> hllLength = valuesInput.readInt(); <END> serializedHll = Slices.allocate(hllLength); valuesInput.readBytes(serializedHll, hllLength); minhash.put(input.readLong(), HyperLogLog.newInstance(serializedHll)); } return new KHyperLogLog(maxSize, hllBuckets, minhash); }</code><technical_language>For serialization format, I consider serializing total bytes for of HLLs, serializing minhashSize, serializing a vector of individual HLL lengths. allocate large Slice for entire block of memory of HLLs fitting contiguously, iterate vector of individual lengths create slices this slab of memory for individual HLL. speed of serialization/deserialization</technical_language>

Target:
public static KHyperLogLog newInstance(Slice serialized) { requireNonNull(serialized, "serialized is null"); SliceInput input = serialized.getInput(); checkArgument(input.readByte() == VERSION_BYTE, "Unexpected version"); Long2ObjectRBTreeMap<HyperLogLog> minhash = new Long2ObjectRBTreeMap<>(); int maxSize = input.readInt(); int hllBuckets = input.readInt(); int minhashSize = input.readInt(); int totalHllSize = input.readInt(); int[] hllSizes = new int[minhashSize]; long[] keys = new long[minhashSize]; input.readBytes(wrappedIntArray(hllSizes)); input.readBytes(wrappedLongArray(keys)); Slice allSerializedHlls = input.readSlice(totalHllSize); int hllLength; int index = 0; for (int i = 0; i < minhashSize; i++) { Slice serializedHll; hllLength = hllSizes[i]; serializedHll = allSerializedHlls.slice(index, hllLength); index += hllLength; minhash.put(keys[i], HyperLogLog.newInstance(serializedHll)); } return new KHyperLogLog(maxSize, hllBuckets, minhash); }
Source:
<code>public Item handle(Context context, HttpServletRequest request, List<String> uriList) throws SQLException, AuthorizeException { ExternalDataObject dataObject = getExternalDataObjectFromUriList(uriList); String owningCollectionUuid = request.getParameter("owningCollection"); Collection collection = null; Item item = null; try { collection = collectionService.find(context, UUID.fromString(owningCollectionUuid)); item = externalDataService.createItemFromExternalDataObject(context, dataObject, collection); } catch (AuthorizeException | SQLException e) { <START> log.error(e.getMessage(), e); <END> throw e; } return item; }</code><technical_language>Again, needs a more descriptive error message please. In this instance need log "Could create Item in Collection UUID=[uuid]"</technical_language>

Target:
public Item handle(Context context, HttpServletRequest request, List<String> uriList) throws SQLException, AuthorizeException { ExternalDataObject dataObject = getExternalDataObjectFromUriList(uriList); String owningCollectionUuid = request.getParameter("owningCollection"); Collection collection = null; Item item = null; try { collection = collectionService.find(context, UUID.fromString(owningCollectionUuid)); item = externalDataService.createItemFromExternalDataObject(context, dataObject, collection); } catch (AuthorizeException | SQLException e) { log.error("An error occured when trying to create item in collection with uuid: " + owningCollectionUuid, e); throw e; } return item; }
Source:
<code><START> public boolean equals(Object o) { <END> if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Service service = (Service) o; if (binary != null ? !binary.equals(service.binary) : service.binary != null) return false; if (host != null ? !host.equals(service.host) : service.host != null) return false; if (state != null ? !state.equals(service.state) : service.state != null) return false; if (status != null ? !status.equals(service.status) : service.status != null) return false; if (disabledReason != null ? !disabledReason.equals(service.disabledReason) : service.disabledReason != null) return false; if (updated != null ? !updated.equals(service.updated) : service.updated != null) return false; if (zone != null ? !zone.equals(service.zone) : service.zone != null) return false; if (id != null ? !id.equals(service.id) : service.id != null) return false; return true; }</code><technical_language>In general, prefer Objects.equals(...). is example in Nova [Network](<LINK_0> class</technical_language>

Target:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Service service = (Service) o; return Objects.equal(this.id, service.id) && Objects.equal(this.binary, service.binary) && Objects.equal(this.host, service.host) && Objects.equal(this.state, service.state) && Objects.equal(this.status, service.status) && Objects.equal(this.disabledReason, service.disabledReason) && Objects.equal(this.updated, service.updated) && Objects.equal(this.zone, service.zone); }
Source:
<code>public void compact(OutputStream out) throws IOException { MergedReftable mr = new MergedReftable(new ArrayList<>(tables)); mr.setIncludeDeletes(includeDeletes); <START> minUpdateIndex = Math.max(minUpdateIndex, 0); <END> writer.setMinUpdateIndex(minUpdateIndex); writer.setMaxUpdateIndex(maxUpdateIndex); writer.begin(out); mergeRefs(mr); mergeLogs(mr); writer.finish(); stats = writer.getStats(); }</code><technical_language>This affects state of ReftableCompactor. Intended? E.g. writer.setMinUpdateIndex(max(minUpdateIndex, 0)) produce stream side effects</technical_language>

Target:
public void compact(OutputStream out) throws IOException { MergedReftable mr = new MergedReftable(new ArrayList<>(tables)); mr.setIncludeDeletes(includeDeletes); writer.setMinUpdateIndex(Math.max(minUpdateIndex, 0)); writer.setMaxUpdateIndex(maxUpdateIndex); writer.begin(out); mergeRefs(mr); mergeLogs(mr); writer.finish(); stats = writer.getStats(); }
Source:
<code>public boolean performFinish() { final CreatePatchOperation operation = new CreatePatchOperation(db, commit); boolean useGitFormat = optionsPage.gitFormat.getSelection(); operation.useGitFormat(useGitFormat); operation.setContextLines(Integer.parseInt(optionsPage.contextLines.getText())); final File file = !locationPage.fsRadio.getSelection()? locationPage.getFile() : null; <START> if (!(file == null || validateFile(file))) { <END> return false; } try { getContainer().run(true, true, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException { try { operation.execute(monitor); String content = operation.getPatchContent(); if (file != null) { writeToFile(file, content); } else { copyToClipboard(content); } } catch (IOException e) { throw new InvocationTargetException(e); } catch (CoreException e) { throw new InvocationTargetException(e); } } }); } catch (InvocationTargetException e) { ((WizardPage) getContainer().getCurrentPage()).setErrorMessage(e .getMessage() == null ? e.getMessage() : UIText.GitCreatePatchWizard_InternalError); Activator.logError("Patch file was not written", e); return false; } catch (InterruptedException e) { Activator.logError("Patch file was not written", e); return false; } return true; }</code><technical_language>style-nit: curly brackets single line blocks</technical_language>

Target:
public boolean performFinish() { final CreatePatchOperation operation = new CreatePatchOperation(db, commit); boolean useGitFormat = optionsPage.gitFormat.getSelection(); operation.useGitFormat(useGitFormat); operation.setContextLines(Integer.parseInt(optionsPage.contextLines.getText())); final File file = !locationPage.fsRadio.getSelection() ? locationPage .getFile() : null; if (!(file == null || validateFile(file))) return false; try { getContainer().run(true, true, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException { try { operation.execute(monitor); String content = operation.getPatchContent(); if (file != null) { writeToFile(file, content); } else { copyToClipboard(content); } } catch (IOException e) { throw new InvocationTargetException(e); } catch (CoreException e) { throw new InvocationTargetException(e); } } }); } catch (InvocationTargetException e) { ((WizardPage) getContainer().getCurrentPage()).setErrorMessage(e .getMessage() == null ? e.getMessage() : UIText.GitCreatePatchWizard_InternalError); Activator.logError("Patch file was not written", e); return false; } catch (InterruptedException e) { Activator.logError("Patch file was not written", e); return false; } return true; }
Source:
<code>public MotionScoreAlgorithm(final Map<Long, List<AmplitudeData>> dataMatrix, final int dimensionCount, final int rowCount, final List<SleepDataScoringFunction> scoringFunctions){ super(null, 0); <START> checkNotNull(dataMatrix); <END> if(scoringFunctions.size() != dimensionCount){ throw new IllegalArgumentException("Number of scoring function must be the same with data dimension."); } this.scoringFunctions.addAll(scoringFunctions); this.dimensions = dataMatrix; this.dimensionCount = dimensionCount; this.rowCount = rowCount; }</code><technical_language>Add a parameter checkNotNull is null. checkNotNull(dataMatrix, "Data Matrix null")</technical_language>

Target:
public MotionScoreAlgorithm(final Map<Long, List<AmplitudeData>> dataMatrix, final int dimensionCount, final int rowCount, final List<SleepDataScoringFunction> scoringFunctions){ super(null, 0); checkNotNull(dataMatrix, "dataMatrix cannot be null"); if(scoringFunctions.size() != dimensionCount){ throw new IllegalArgumentException("Number of scoring function must be the same with data dimension."); } this.scoringFunctions.addAll(scoringFunctions); this.dimensions = dataMatrix; this.dimensionCount = dimensionCount; this.rowCount = rowCount; }
Source:
<code><START> private static Optional<List> validateQueryParams(List<Pair<String, Long>> nonNegativePairMap) { <END> Map<String, String> invalidQueryParams = new HashMap<>(); nonNegativePairMap.forEach(param -> { if (param.getRight() != null && param.getRight() < 1) { invalidQueryParams.put(param.getLeft(), "query param '%s' should be a non zero positive integer"); } }); if (!invalidQueryParams.isEmpty()) { List<String> invalidResponse = newArrayList(); invalidResponse.addAll(invalidQueryParams.keySet() .stream() .map(param -> String.format(invalidQueryParams.get(param), param)) .collect(Collectors.toList())); return Optional.of(invalidResponse); } return Optional.empty(); }</code><technical_language>In general, Optional<List> _never_ sense. If return a List of errors, list is empty (meaning error) full (meaning errors). need represent optional</technical_language>

Target:
private static List<String> validateQueryParams(List<Pair<String, Long>> nonNegativePairMap) { Map<String, String> invalidQueryParams = new HashMap<>(); List<String> invalidResponse = newArrayList(); nonNegativePairMap.forEach(param -> { if (param.getRight() != null && param.getRight() < 1) { invalidQueryParams.put(param.getLeft(), "query param '%s' should be a non zero positive integer"); } }); if (!invalidQueryParams.isEmpty()) { invalidResponse = invalidQueryParams.keySet().stream() .map(param -> String.format(invalidQueryParams.get(param), param)) .collect(Collectors.toList()); } return invalidResponse; }
Source:
<code>public CompletableFuture<CommitStatus> commit() { Set<TransactionParticipant<?>> participants = this.participants.stream() .filter(p -> !p.log().records().isEmpty()) .collect(Collectors.toSet()); Set<ParticipantInfo> participantInfo = participants.stream() .map(participant -> new ParticipantInfo( participant.name(), participant.type().name(), participant.protocol().type().name(), participant.protocol().group())) .collect(Collectors.toSet()); CompletableFuture<CommitStatus> status = transactionService.preparing(transactionId, participantInfo) .thenCompose(v -> prepare(participants)) .thenCompose(result -> result ? transactionService.committing(transactionId) .thenCompose(v -> commit(participants)) .thenApply(v -> CommitStatus.SUCCESS) : transactionService.aborting(transactionId) .thenCompose(v -> rollback(participants)) .thenApply(v -> CommitStatus.FAILURE)); return status.thenCompose(v -> transactionService.complete(transactionId) <START> .thenRun(() -> participants.forEach(TransactionParticipant::close)) <END> .thenApply(u -> v)); }</code><technical_language>is close thow exception fail future</technical_language>

Target:
public CompletableFuture<CommitStatus> commit() { Set<TransactionParticipant<?>> participants = this.participants.stream() .filter(p -> !p.log().records().isEmpty()) .collect(Collectors.toSet()); Set<ParticipantInfo> participantInfo = participants.stream() .map(participant -> new ParticipantInfo( participant.name(), participant.type().name(), participant.protocol().type().name(), participant.protocol().group())) .collect(Collectors.toSet()); CompletableFuture<CommitStatus> status = transactionService.preparing(transactionId, participantInfo) .thenCompose(v -> prepare(participants)) .thenCompose(result -> result ? transactionService.committing(transactionId) .thenCompose(v -> commit(participants)) .thenApply(v -> CommitStatus.SUCCESS) : transactionService.aborting(transactionId) .thenCompose(v -> rollback(participants)) .thenApply(v -> CommitStatus.FAILURE)); return status.thenCompose(v -> transactionService.complete(transactionId) .thenRun(() -> participants.forEach(p -> p.close().exceptionally(e -> null))) .thenApply(u -> v)); }
Source:
<code>public String toString() { <START> return "CoverageModelCopyRatioEmissionData{" + <END> "mu=" + mu + ", psi=" + psi + ", readCount=" + readCount + ", poissonAdditiveNoise=" + poissonAdditiveNoise + ", copyRatioCallingMetadata=" + copyRatioCallingMetadata + '}'; }</code><technical_language>String.format</technical_language>

Target:
public String toString() { return "CoverageModelCopyRatioEmissionData{" + "mu=" + mu + ", psi=" + psi + ", readCount=" + readCount + ", mappingErrorProbability=" + mappingErrorProbability + ", copyRatioCallingMetadata=" + copyRatioCallingMetadata + '}'; }
Source:
<code>private double calculateSegmentMeanBiasInCRSpace(final List<ACNVModeledSegment> segments) { Utils.nonNull(segments); final Percentile percentile = new Percentile(); final double modeInCRSpace = percentile.evaluate(segments.stream() <START> .filter(s -> Math.abs(s.getSegmentMeanInCRSpace() - 1) < 0.1) <END> .mapToDouble(s -> s.getSegmentMeanInCRSpace()).toArray(), 50); return modeInCRSpace - 1; }</code><technical_language>Switch order of filtering: java segments.stream().mapToDouble(ACNVModeledSegment::getSegmentMeanInCRSpace) .filter(x -> Math.abs(x - 1) < 0.1)</technical_language>

Target:
private double calculateSegmentMeanBiasInCRSpace(final List<ACNVModeledSegment> segments) { Utils.nonNull(segments); final double neutralCRApprox = 1; final double[] neutralSegmentMeans = segments.stream().mapToDouble(ACNVModeledSegment::getSegmentMeanInCRSpace) .filter(x -> Math.abs(x - neutralCRApprox) < CLOSE_ENOUGH_TO_COPY_NEUTRAL_IN_CR) .toArray(); return new Percentile().evaluate(neutralSegmentMeans) - 1; }
Source:
<code>public Mono<Lease> createLeaseIfNotExist(String leaseToken, String continuationToken) { <START> if (leaseToken == null) throw Exceptions.propagate(new IllegalArgumentException("leaseToken")); <END> String leaseDocId = this.getDocumentId(leaseToken); ServiceItemLease documentServiceLease = new ServiceItemLease() .withId(leaseDocId) .withLeaseToken(leaseToken) .withContinuationToken(continuationToken); return this.leaseDocumentClient.createItem(this.settings.getLeaseCollectionLink(), documentServiceLease, null, false) .onErrorResume( ex -> { if (ex instanceof CosmosClientException) { CosmosClientException e = (CosmosClientException) ex; if (e.statusCode() == ChangeFeedHelper.HTTP_STATUS_CODE_CONFLICT) { logger.info("Some other host created lease for {}.", leaseToken); return Mono.empty(); } } return Mono.error(ex); }) .map(documentResourceResponse -> { if (documentResourceResponse == null) return null; CosmosItemProperties document = documentResourceResponse.properties(); logger.info("Created lease for partition {}.", leaseToken); return documentServiceLease .withId(document.id()) .withEtag(document.etag()) .withTs(document.getString(Constants.Properties.LAST_MODIFIED)); }); }</code><technical_language>need Exception.propagate(.) here. Exception.propagate(.) wrap exception in runtime exception if is a runtime exception. In this case IllegalArgumentException is a runtime exception</technical_language>

Target:
public Mono<Lease> createLeaseIfNotExist(String leaseToken, String continuationToken) { if (leaseToken == null) { throw new IllegalArgumentException("leaseToken"); } String leaseDocId = this.getDocumentId(leaseToken); ServiceItemLease documentServiceLease = new ServiceItemLease() .withId(leaseDocId) .withLeaseToken(leaseToken) .withContinuationToken(continuationToken); return this.leaseDocumentClient.createItem(this.settings.getLeaseCollectionLink(), documentServiceLease, null, false) .onErrorResume( ex -> { if (ex instanceof CosmosClientException) { CosmosClientException e = (CosmosClientException) ex; if (e.statusCode() == ChangeFeedHelper.HTTP_STATUS_CODE_CONFLICT) { logger.info("Some other host created lease for {}.", leaseToken); return Mono.empty(); } } return Mono.error(ex); }) .map(documentResourceResponse -> { if (documentResourceResponse == null) { return null; } CosmosItemProperties document = documentResourceResponse.properties(); logger.info("Created lease for partition {}.", leaseToken); return documentServiceLease .withId(document.id()) .withEtag(document.etag()) .withTs(document.getString(Constants.Properties.LAST_MODIFIED)); }); }
Source:
<code>public <A> void assertHasAllNullFieldsOrPropertiesExcept(AssertionInfo info, A actual, String... propertiesOrFieldsToIgnore) { assertNotNull(info, actual); Set<Field> declaredFieldsIncludingInherited = getDeclaredFieldsIncludingInherited(actual.getClass()); Set<String> ignoredFields = newLinkedHashSet(propertiesOrFieldsToIgnore); List<String> notNullFieldNames = new LinkedList<>(); for (Field field : declaredFieldsIncludingInherited) { String fieldName = field.getName(); if (ignoredFields.contains(fieldName) || !canReadFieldValue(field, actual)) { continue; } Object actualFieldValue = getPropertyOrFieldValue(actual, fieldName); if (actualFieldValue != null) { notNullFieldNames.add(fieldName); } } if (!notNullFieldNames.isEmpty()) { throw failures.failure(info, shouldHaveAllNullFields( <START> actual, notNullFieldNames, newArrayList(propertiesOrFieldsToIgnore) <END> )); } }</code><technical_language>list in place of newArrayList</technical_language>

Target:
public <A> void assertHasAllNullFieldsOrPropertiesExcept(AssertionInfo info, A actual, String... propertiesOrFieldsToIgnore) { assertNotNull(info, actual); Set<Field> declaredFieldsIncludingInherited = getDeclaredFieldsIncludingInherited(actual.getClass()); Set<String> ignoredFields = newLinkedHashSet(propertiesOrFieldsToIgnore); List<String> notNullFieldNames = new LinkedList<>(); for (Field field : declaredFieldsIncludingInherited) { String fieldName = field.getName(); if (ignoredFields.contains(fieldName) || !canReadFieldValue(field, actual)) { continue; } Object actualFieldValue = getPropertyOrFieldValue(actual, fieldName); if (actualFieldValue != null) { notNullFieldNames.add(fieldName); } } if (!notNullFieldNames.isEmpty()) { throw failures.failure(info, shouldHaveAllNullFields( actual, notNullFieldNames, list(propertiesOrFieldsToIgnore) )); } }
Source:
<code>public List<String> getLocalesWithTranslation(final Resources resources) { String[] languageList = BuildConfig.TRANSLATION_ARRAY; Set<String> availableLanguagesSet = new HashSet<>(); <START> String[] translatedLanguages = resources.getStringArray(R.array.available_languages); <END> Set<String> translatedLanguageSet = new HashSet<>(); Collections.addAll(translatedLanguageSet, translatedLanguages); for (String language : languageList) { int isCountryCodeNeeded = 2; if (language.contains("-")) { isCountryCodeNeeded = 4; } if (translatedLanguageSet.contains(language.substring(0, isCountryCodeNeeded))) availableLanguagesSet.add(language); } List<String> availableLanguagesList = new ArrayList<>(availableLanguagesSet); Collections.sort(availableLanguagesList); return availableLanguagesList; }</code><technical_language>avoid this. means update this file manually time. point of this method pickup string check if is translated in language</technical_language>

Target:
public List<String> getLocalesWithTranslation(final Resources resources) { String[] languageList = BuildConfig.TRANSLATION_ARRAY; Set<String> availableLanguagesSet = new HashSet<>(); availableLanguagesSet.add("en"); String[] translatedLanguages = resources.getStringArray(R.array.available_languages); Set<String> translatedLanguageSet = new HashSet<>(); Collections.addAll(translatedLanguageSet, translatedLanguages); for (String language : languageList) { if (translatedLanguageSet.contains(language.substring(0, 5))) availableLanguagesSet.add(language); } List<String> availableLanguagesList = new ArrayList<>(availableLanguagesSet); Collections.sort(availableLanguagesList); return availableLanguagesList; }
Source:
<code>private ReplicaList filterForEachQuorum(Keyspace keyspace, ReplicaList liveReplicas) { NetworkTopologyStrategy strategy = (NetworkTopologyStrategy) keyspace.getReplicationStrategy(); Map<String, ReplicaList> dcsReplicas = new HashMap<>(); for (String dc: strategy.getDatacenters()) <START> dcsReplicas.put(dc, new ReplicaList()); <END> for (Replica replica : liveReplicas) { String dc = DatabaseDescriptor.getEndpointSnitch().getDatacenter(replica); dcsReplicas.get(dc).add(replica); } ReplicaList waitSet = new ReplicaList(); for (Map.Entry<String, ReplicaList> dcEndpoints : dcsReplicas.entrySet()) { ReplicaList dcEndpoint = dcEndpoints.getValue(); waitSet.addAll(dcEndpoint.subList(0, Math.min(localQuorumFor(keyspace, dcEndpoints.getKey()), dcEndpoint.size()))); } return waitSet; }</code><technical_language>Completely overkill unrelated, ArrayList allocate if liveReplicas is < size of default allocation of 10</technical_language>

Target:
private ReplicaList filterForEachQuorum(Keyspace keyspace, ReplicaList liveReplicas) { NetworkTopologyStrategy strategy = (NetworkTopologyStrategy) keyspace.getReplicationStrategy(); Map<String, ReplicaList> dcsReplicas = new HashMap<>(); for (String dc: strategy.getDatacenters()) dcsReplicas.put(dc, ReplicaList.withMaxSize(liveReplicas.size())); for (Replica replica : liveReplicas) { String dc = DatabaseDescriptor.getEndpointSnitch().getDatacenter(replica); dcsReplicas.get(dc).add(replica); } ReplicaList waitSet = new ReplicaList(ReplicaList.withMaxSize(liveReplicas.size())); for (Map.Entry<String, ReplicaList> dcEndpoints : dcsReplicas.entrySet()) { ReplicaList dcEndpoint = dcEndpoints.getValue(); waitSet.addAll(dcEndpoint.subList(0, Math.min(localQuorumFor(keyspace, dcEndpoints.getKey()), dcEndpoint.size()))); } return waitSet; }
Source:
<code>protected void handleComponentDetached(Component comp) { comp.addEventListener(10000, BinderImpl.ON_BIND_CLEAN, new EventListener<Event>() { public void onEvent(Event event) throws Exception { final Component comp = event.getTarget(); comp.removeAttribute(REMOVE_MARK); comp.removeEventListener(BinderImpl.ON_BIND_CLEAN, this); if (comp.hasAttribute(BinderImpl.VAR)) { Object ref = comp.getAttribute((String) comp.getAttribute(BinderImpl.VAR)); if (ref instanceof ReferenceBinding) { BinderUtil.markHandling(comp, ((ReferenceBinding) ref).getBinder()); } } removeBindings(comp); } }); if (((AbstractComponent) comp).getAnnotations("veiwModel") != null) { <START> Binder binder = BinderUtil.getBinder(comp, comp.hasAttribute(BinderCtrl.IS_TEMPLATE_MODEL_ENABLED_ATTR)); <END> binder.destroy(comp, binder.getViewModel(), null); } comp.setAttribute(REMOVE_MARK, Boolean.TRUE); if (comp.removeAttribute(BinderCtrl.CHILDREN_BINDING_RENDERED_COMPONENTS) != null) { ListModel<?> model = (ListModel<?>) comp.getAttribute(BinderCtrl.CHILDREN_BINDING_MODEL); ListDataListener listener = (ListDataListener) comp .removeAttribute(BinderCtrl.CHILDREN_BINDING_MODEL_LISTENER); if (model != null && listener != null) { model.removeListDataListener(listener); } } comp.setAttribute(SKIP_BIND_INIT, false); Events.postEvent(new Event(BinderImpl.ON_BIND_CLEAN, comp)); }</code><technical_language>Is comp.hasAttribute(BinderCtrl.IS_TEMPLATE_MODEL_ENABLED_ATTR) needed</technical_language>

Target:
protected void handleComponentDetached(Component comp) { comp.addEventListener(10000, BinderImpl.ON_BIND_CLEAN, new EventListener<Event>() { public void onEvent(Event event) throws Exception { final Component comp = event.getTarget(); comp.removeAttribute(REMOVE_MARK); comp.removeEventListener(BinderImpl.ON_BIND_CLEAN, this); if (comp.hasAttribute(BinderImpl.VAR)) { Object ref = comp.getAttribute((String) comp.getAttribute(BinderImpl.VAR)); if (ref instanceof ReferenceBinding) { BinderUtil.markHandling(comp, ((ReferenceBinding) ref).getBinder()); } } removeBindings(comp); } }); if (((AbstractComponent) comp).getAnnotations("viewModel") != null) { Binder binder = BinderUtil.getBinder(comp); binder.destroy(comp, binder.getViewModel()); } comp.setAttribute(REMOVE_MARK, Boolean.TRUE); if (comp.removeAttribute(BinderCtrl.CHILDREN_BINDING_RENDERED_COMPONENTS) != null) { ListModel<?> model = (ListModel<?>) comp.getAttribute(BinderCtrl.CHILDREN_BINDING_MODEL); ListDataListener listener = (ListDataListener) comp .removeAttribute(BinderCtrl.CHILDREN_BINDING_MODEL_LISTENER); if (model != null && listener != null) { model.removeListDataListener(listener); } } comp.setAttribute(SKIP_BIND_INIT, false); Events.postEvent(new Event(BinderImpl.ON_BIND_CLEAN, comp)); }
Source:
<code>public void testReelectionOfDispatcher() throws Exception { final CompletableFuture<JobSubmissionResult> submissionFuture = miniCluster.submitJob(jobGraph); submissionFuture.get(); <START> CommonTestUtils.waitUntilJobManagerIsInitialized(() -> miniCluster.getJobStatus(jobId).get()); <END> CompletableFuture<JobResult> jobResultFuture = miniCluster.requestJobResult(jobId); highAvailabilityServices.revokeDispatcherLeadership().get(); try { jobResultFuture.get(); fail("Expected JobNotFinishedException"); } catch (ExecutionException ee) { assertThat(ExceptionUtils.findThrowable(ee, JobNotFinishedException.class).isPresent(), is(true)); } highAvailabilityServices.grantDispatcherLeadership(); BlockingOperator.isBlocking = false; final CompletableFuture<JobSubmissionResult> submissionFuture2 = miniCluster.submitJob(jobGraph); submissionFuture2.get(); final CompletableFuture<JobResult> jobResultFuture2 = miniCluster.requestJobResult(jobId); JobResult jobResult = jobResultFuture2.get(); JobResultUtils.assertSuccess(jobResult); }</code><technical_language>is this required</technical_language>

Target:
public void testReelectionOfDispatcher() throws Exception { final CompletableFuture<JobSubmissionResult> submissionFuture = miniCluster.submitJob(jobGraph); submissionFuture.get(); CompletableFuture<JobResult> jobResultFuture = miniCluster.requestJobResult(jobId); highAvailabilityServices.revokeDispatcherLeadership().get(); try { jobResultFuture.get(); fail("Expected JobNotFinishedException"); } catch (ExecutionException ee) { assertThat(ExceptionUtils.findThrowable(ee, JobNotFinishedException.class).isPresent(), is(true)); } highAvailabilityServices.grantDispatcherLeadership(); BlockingOperator.isBlocking = false; final CompletableFuture<JobSubmissionResult> submissionFuture2 = miniCluster.submitJob(jobGraph); submissionFuture2.get(); final CompletableFuture<JobResult> jobResultFuture2 = miniCluster.requestJobResult(jobId); JobResult jobResult = jobResultFuture2.get(); JobResultUtils.assertSuccess(jobResult); }
Source:
<code>public void <START> createSignatures(JavaClass <END> javaClass, Service service, Method method) { for (JavaClass innerClass : javaClass.getNestedClasses()) { assert innerClass.isInterface(); Method childMethod = createMethod(innerClass, service); analyzeInputDetail(javaClass, method, service); childMethod.setBase(method); } }</code><technical_language>I "signature" name, explicit model concept. Introducing new concepts thins harder understand. Try find a name</technical_language>

Target:
public void createSignatures(JavaClass javaClass, Service service, Method method) { for (JavaClass innerClass : javaClass.getNestedClasses()) { assert innerClass.isInterface(); Method childMethod = createMethod(innerClass, service); copyParameters(childMethod, method); analyzeInputDetail(innerClass, childMethod, service); childMethod.setBase(method); service.addMethod(childMethod); } }
Source:
<code>public String getFormattedStartDate(Context context){ StringBuilder dateBuilder = new StringBuilder(); <START> SimpleDateFormat dateFormat = new SimpleDateFormat("MMMM dd"); <END> Date startDate = DateUtil.convertToDate(start); Date endDate = DateUtil.convertToDate(end); if (hasDefaultStartDate()) { dateBuilder.append(context.getString(R.string.assessment_empty_coming_soon).toUpperCase()); } else if (isEnded()) { if (endDate != null) { dateBuilder.append(context.getString(R.string.label_ended)); dateBuilder.append(" - "); dateBuilder.append(dateFormat.format(endDate)); } } else if (isStarted()) { if (endDate != null) { dateBuilder.append(context.getString(R.string.label_ending_on)); dateBuilder.append(" - "); dateBuilder.append(dateFormat.format(endDate)); } } else { if (startDate != null) { dateBuilder.append(context.getString(R.string.label_starting_from)); dateBuilder.append(" - "); dateBuilder.append(dateFormat.format(startDate)); } } return dateBuilder.toString().toUpperCase(); }</code><technical_language>Instead of suppressing SimpleDateFormat warning, pass current locale it</technical_language>

Target:
public CharSequence getFormattedStartDate(Context context) { if (isStarted()) { Date endDate = DateUtil.convertToDate(end); if (endDate == null) { return null; } else if (isEnded()) { return ResourceUtil.getFormattedString(context.getResources(), R.string.label_ended, "date", DateUtils.formatDateTime(context, endDate.getTime(), DateUtils .FORMAT_NO_YEAR)); } else { return ResourceUtil.getFormattedString(context.getResources(), R.string .label_ending, "date", DateUtils.formatDateTime(context, endDate.getTime(), DateUtils .FORMAT_NO_YEAR)); } } else { if (start_type == StartType.TIMESTAMP && !TextUtils.isEmpty(start)) { Date startDate = DateUtil.convertToDate(start); return ResourceUtil.getFormattedString(context.getResources(), R.string .label_starting, "date", DateUtils.formatDateTime(context, startDate.getTime(), DateUtils .FORMAT_NO_YEAR)); } else if (start_type == StartType.STRING && !TextUtils.isEmpty(start_display)) { return ResourceUtil.getFormattedString(context.getResources(), R.string .label_starting, "date", start_display); } else { return ResourceUtil.getFormattedString(context.getResources(), R.string .label_starting, "date", context.getString(R.string.assessment_soon)); } } }
Source:
<code>public void init(ArrayList<DiskImage> diskImages) { setDiskImages(diskImages); <START> AsyncDataProvider.getDataCenterList(new AsyncQuery(this, <END> new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { MoveOrCopyDiskModel model = (MoveOrCopyDiskModel) target; @SuppressWarnings("unchecked") List<StoragePool> dataCenters = (ArrayList<StoragePool>) returnValue; model.getDataCenter().setItems(dataCenters); if (getDataCenterId() != null) { model.getDataCenter().setIsChangable(false); for (StoragePool i : dataCenters) { if (getDataCenterId().equals(i.getId())) { model.getDataCenter().setSelectedItem(i); break; } } } initStorageDomains(); } })); AsyncDataProvider.getDiskList(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { MoveOrCopyDiskModel model = (MoveOrCopyDiskModel) target; @SuppressWarnings("unchecked") ArrayList<Disk> diskImages = (ArrayList<Disk>) returnValue; model.onInitAllDisks(diskImages); model.onInitDisks(); } })); }</code><technical_language>extract like: initDataCenters</technical_language>

Target:
public void init(ArrayList<DiskImage> diskImages) { setDiskImages(diskImages); initDataCenters(); AsyncDataProvider.getDiskList(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { MoveOrCopyDiskModel model = (MoveOrCopyDiskModel) target; @SuppressWarnings("unchecked") ArrayList<Disk> diskImages = (ArrayList<Disk>) returnValue; model.onInitAllDisks(diskImages); model.onInitDisks(); } })); }
Source:
<code>private void updateDiskSize(DiskImage diskImage) { long sizeToAddInGigabytes; try { sizeToAddInGigabytes = Long.parseLong(getSizeExtend().getEntity()); <START> } catch (NumberFormatException ignored) { <END> return; } if (sizeToAddInGigabytes > 0) { diskImage.setSizeInGigabytes(diskImage.getSizeInGigabytes() + sizeToAddInGigabytes); } }</code><technical_language>try LongValidation validation instead (in 'validate' method). for example 'EditQuotaClusterModel->validate'</technical_language>

Target:
private void updateDiskSize(DiskImage diskImage) { getSizeExtend().validateEntity(new IValidation[] { new NotEmptyValidation(), new NonNegativeLongNumberValidation(), }); if (getSizeExtend().getIsValid()) { long sizeToAddInGigabytes = Long.parseLong(getSizeExtend().getEntity()); if (sizeToAddInGigabytes > 0) { diskImage.setSizeInGigabytes(diskImage.getSizeInGigabytes() + sizeToAddInGigabytes); } } }
Source:
<code>public Void get(long timeout, TimeUnit unit) throws InterruptedException, TimeoutException, ExecutionException { if (!isDone()) { if <START> (reopenThread.waitForGeneration(gen, <END> (int) MILLISECONDS.convert(timeout, unit))) { set(null); } } return super.get(timeout, unit); }</code><technical_language>Apparently this method returns false wait time is exceeded. implementation buggy. completed future lied caller indexing done. new implementation avoids this, caller potentially wait 2x timeout. waitForGeneration returns false method throw TimeoutException</technical_language>

Target:
public Void get(long timeout, TimeUnit unit) throws InterruptedException, TimeoutException, ExecutionException { if (!isDone()) { if (reopenThread.waitForGeneration(gen, (int) MILLISECONDS.convert(timeout, unit))) { set(null); } else { throw new TimeoutException(); } } return super.get(timeout, unit); }
Source:
<code>public static Map<Integer, Collection<Tile>> readLaneTiles(final File illuminaRunDirectory, final ReadStructure readStructure) { final Collection<Tile> tiles; try { tiles = TileMetricsUtil.parseTileMetrics(TileMetricsUtil.renderTileMetricsFileFromBasecallingDirectory(illuminaRunDirectory), readStructure); } catch (final FileNotFoundException e) { throw new PicardException("Unable to open laneMetrics file.", e); } <START> Map<Integer,? extends Collection<Tile>> tilesByLane=tiles.stream().collect(Collectors.groupingBy(Tile::getLaneNumber)); <END> return (Map<Integer, Collection<Tile>>) tilesByLane; }</code><technical_language>final needed. Actually, merge a single line please - need a local variable</technical_language>

Target:
public static Map<Integer, ? extends Collection<Tile>> readLaneTiles(final File illuminaRunDirectory, final ReadStructure readStructure) { final Collection<Tile> tiles; try { tiles = TileMetricsUtil.parseTileMetrics(TileMetricsUtil.renderTileMetricsFileFromBasecallingDirectory(illuminaRunDirectory), readStructure); } catch (final FileNotFoundException e) { throw new PicardException("Unable to open laneMetrics file.", e); } return tiles.stream().collect(Collectors.groupingBy(Tile::getLaneNumber)); }
Source:
<code>public int getTeamSkillLevel() { <START> calculateSkillLevel(); <END> return teamSkillLevel; }</code><technical_language>is this call needed for skill level? team's skill level stored calculation necessary</technical_language>

Target:
public int getTeamSkillLevel() { return teamSkillLevel; }
Source:
<code>private Optional<TaskGroup> findTaskGroupForTask(final Task task) { giant.lock(); try { <START> final List<TaskGroup> maybeTaskGroup = Lists.newArrayList( <END> FunctionalIterable.create(findTaskGroupsForInterval(task.getDataSource(), task.getInterval())) .filter( new Predicate<TaskGroup>() { @Override public boolean apply(TaskGroup taskGroup) { return taskGroup.contains(task.getId()); } } ) ); if (maybeTaskGroup.size() == 1) { return Optional.of(maybeTaskGroup.get(0)); } else if (maybeTaskGroup.size() == 0) { return Optional.absent(); } else { throw new IllegalStateException(String.format("WTF?! Task %s is in multiple task groups!", task.getId())); } } finally { giant.unlock(); } }</code><technical_language>I want Iterators.tryFind()</technical_language>

Target:
private Optional<TaskGroup> findTaskGroupForTask(final Task task) { giant.lock(); try { final Iterator<TaskGroup> maybeTaskGroup = FunctionalIterable.create(findTaskGroupsForInterval(task.getDataSource(), task.getInterval())) .filter( new Predicate<TaskGroup>() { @Override public boolean apply(TaskGroup taskGroup) { return taskGroup.contains(task.getId()); } } ) .iterator(); if (!maybeTaskGroup.hasNext()) { return Optional.absent(); } else { return Optional.of(Iterators.getOnlyElement(maybeTaskGroup)); } } finally { giant.unlock(); } }
Source:
<code>public void stop(final BundleContext context) throws Exception { if (refreshHandle != null) { refreshHandle.remove(); refreshHandle = null; } if (focusListener != null) { if (PlatformUI.isWorkbenchRunning()) PlatformUI.getWorkbench().removeWindowListener(focusListener); focusListener = null; } if (GitTraceLocation.REPOSITORYCHANGESCANNER.isActive()) GitTraceLocation.getTrace().trace( GitTraceLocation.REPOSITORYCHANGESCANNER.getLocation(), "Trying to cancel " + rcs.getName() + " job"); <START> <END> rcs.setReschedule(false); rcs.cancel(); if (GitTraceLocation.REPOSITORYCHANGESCANNER.isActive()) GitTraceLocation.getTrace().trace( GitTraceLocation.REPOSITORYCHANGESCANNER.getLocation(), "Trying to cancel " + refreshJob.getName() + " job"); refreshJob.cancel(); rcs.join(); refreshJob.join(); if (GitTraceLocation.REPOSITORYCHANGESCANNER.isActive()) GitTraceLocation.getTrace().trace( GitTraceLocation.REPOSITORYCHANGESCANNER.getLocation(), "Jobs terminated"); if (resourceManager != null) { resourceManager.dispose(); resourceManager = null; } super.stop(context); plugin = null; }</code><technical_language>For completeness, remove listener: getPreferenceStore().removePropertyChangeListener(rcs);</technical_language>

Target:
public void stop(final BundleContext context) throws Exception { if (refreshHandle != null) { refreshHandle.remove(); refreshHandle = null; } if (focusListener != null) { if (PlatformUI.isWorkbenchRunning()) { PlatformUI.getWorkbench().removeWindowListener(focusListener); } focusListener = null; } if (GitTraceLocation.REPOSITORYCHANGESCANNER.isActive()) { GitTraceLocation.getTrace().trace( GitTraceLocation.REPOSITORYCHANGESCANNER.getLocation(), "Trying to cancel " + rcs.getName() + " job"); } getPreferenceStore().removePropertyChangeListener(rcs); rcs.setReschedule(false); rcs.cancel(); if (GitTraceLocation.REPOSITORYCHANGESCANNER.isActive()) { GitTraceLocation.getTrace().trace( GitTraceLocation.REPOSITORYCHANGESCANNER.getLocation(), "Trying to cancel " + refreshJob.getName() + " job"); } refreshJob.cancel(); rcs.join(); refreshJob.join(); if (GitTraceLocation.REPOSITORYCHANGESCANNER.isActive()) { GitTraceLocation.getTrace().trace( GitTraceLocation.REPOSITORYCHANGESCANNER.getLocation(), "Jobs terminated"); } if (resourceManager != null) { resourceManager.dispose(); resourceManager = null; } super.stop(context); plugin = null; }
Source:
<code>public ShiftedToday(String input) { _input = validateInput(input); <START> int[] counts = parseCounts(); <END> Calendar calendar = Calendar.getInstance(); calendar.setTime(new Date()); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); calendar.add(Calendar.DAY_OF_MONTH, counts[0]); calendar.add(Calendar.MONTH, counts[1]); calendar.add(Calendar.YEAR, counts[2]); setTime(calendar.getTime().getTime()); }</code><technical_language>Final</technical_language>

Target:
public ShiftedToday(String input) { _input = validateInput(input); final int[] counts = parseCounts(); final Calendar calendar = Calendar.getInstance(); calendar.setTime(new Date()); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); calendar.add(Calendar.DAY_OF_MONTH, counts[0]); calendar.add(Calendar.MONTH, counts[1]); calendar.add(Calendar.YEAR, counts[2]); setTime(calendar.getTime().getTime()); }
Source:
<code>public static void load() { <START> loadFrom(Paths.get("config")); <END> }</code><technical_language>this FMLPaths.CONFIGDIR instead game directory working directory</technical_language>

Target:
public static void load() { loadFrom(FMLPaths.CONFIGDIR.get()); }
Source:
<code>public boolean isNormalDependency() { <START> return scope == null || !scope.equals("import"); <END> }</code><technical_language>!"import".equals(scope) work ;)</technical_language>

Target:
public boolean isNormalDependency() { return !"import".equals(scope); }
Source:
<code>private Map<EventTypePartition, NakadiCursor> getBeforeFirstCursors(final Set<EventTypePartition> newAssignment) { return newAssignment.stream() .map(EventTypePartition::getEventType) .map(et -> { try { return getContext().getTimelineService().getActiveTimelinesOrdered(et).get(0); } catch (final NakadiException e) { throw new NakadiRuntimeException(e); } }) .collect(groupingBy(Timeline::getStorage)) .values() .stream() .flatMap(timelines -> { try { return getContext().getTimelineService().getTopicRepository(timelines.get(0)) .loadTopicStatistics(timelines).stream(); } catch (final ServiceUnavailableException e) { throw new NakadiRuntimeException(e); } }) .map(PartitionStatistics::getBeforeFirst) .collect(Collectors.toMap( <START> cursor -> new EventTypePartition(cursor.getEventType(), cursor.getPartition()), <END> cursor -> cursor)); }</code><technical_language>@rcillo please cursor::getEventTypePartition</technical_language>

Target:
private Map<EventTypePartition, NakadiCursor> getBeforeFirstCursors(final Set<EventTypePartition> newAssignment) { return newAssignment.stream() .map(EventTypePartition::getEventType) .map(et -> { try { return getContext().getTimelineService().getActiveTimelinesOrdered(et).get(0); } catch (final NakadiException e) { throw new NakadiRuntimeException(e); } }) .collect(groupingBy(Timeline::getStorage)) .values() .stream() .flatMap(timelines -> { try { return getContext().getTimelineService().getTopicRepository(timelines.get(0)) .loadTopicStatistics(timelines).stream(); } catch (final ServiceUnavailableException e) { throw new NakadiRuntimeException(e); } }) .map(PartitionStatistics::getBeforeFirst) .collect(Collectors.toMap(NakadiCursor::getEventTypePartition, cursor -> cursor)); }
Source:
<code>private void compressSegmentToFile(long nextSegment, File raw, File zip) throws IOException, IgniteCheckedException { int segmentSerializerVer; try (FileIO fileIO = ioFactory.create(raw)) { segmentSerializerVer = readSegmentHeader(new SegmentIO(nextSegment, fileIO), segmentFileInputFactory).getSerializerVersion(); } try (ZipOutputStream zos = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(zip)))) { zos.setLevel(dsCfg.getWalCompactionLevel()); <START> zos.putNextEntry(new ZipEntry(cctx.igniteInstanceName() + "-" + nextSegment + ".wal")); <END> ByteBuffer buf = ByteBuffer.allocate(HEADER_RECORD_SIZE); buf.order(ByteOrder.nativeOrder()); zos.write(prepareSerializerVersionBuffer(nextSegment, segmentSerializerVer, true, buf).array()); final CIX1<WALRecord> appendToZipC = new CIX1<WALRecord>() { @Override public void applyx(WALRecord record) throws IgniteCheckedException { final MarshalledRecord marshRec = (MarshalledRecord)record; try { zos.write(marshRec.buffer().array(), 0, marshRec.buffer().remaining()); } catch (IOException e) { throw new IgniteCheckedException(e); } } }; try (SingleSegmentLogicalRecordsIterator iter = new SingleSegmentLogicalRecordsIterator( log, cctx, ioFactory, BUF_SIZE, nextSegment, walArchiveDir, appendToZipC)) { while (iter.hasNextX()) iter.nextX(); } RecordSerializer ser = new RecordSerializerFactoryImpl(cctx).createSerializer(segmentSerializerVer); ByteBuffer heapBuf = prepareSwitchSegmentRecordBuffer(nextSegment, ser); zos.write(heapBuf.array()); } }</code><technical_language>zip .zip suffix, is commmon constract for single file archives</technical_language>

Target:
private void compressSegmentToFile(long nextSegment, File raw, File zip) throws IOException, IgniteCheckedException { int segmentSerializerVer; try (FileIO fileIO = ioFactory.create(raw)) { segmentSerializerVer = readSegmentHeader(new SegmentIO(nextSegment, fileIO), segmentFileInputFactory).getSerializerVersion(); } try (ZipOutputStream zos = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(zip)))) { zos.setLevel(dsCfg.getWalCompactionLevel()); zos.putNextEntry(new ZipEntry(nextSegment + ".wal")); ByteBuffer buf = ByteBuffer.allocate(HEADER_RECORD_SIZE); buf.order(ByteOrder.nativeOrder()); zos.write(prepareSerializerVersionBuffer(nextSegment, segmentSerializerVer, true, buf).array()); final CIX1<WALRecord> appendToZipC = new CIX1<WALRecord>() { @Override public void applyx(WALRecord record) throws IgniteCheckedException { final MarshalledRecord marshRec = (MarshalledRecord)record; try { zos.write(marshRec.buffer().array(), 0, marshRec.buffer().remaining()); } catch (IOException e) { throw new IgniteCheckedException(e); } } }; try (SingleSegmentLogicalRecordsIterator iter = new SingleSegmentLogicalRecordsIterator( log, cctx, ioFactory, BUF_SIZE, nextSegment, walArchiveDir, appendToZipC)) { while (iter.hasNextX()) iter.nextX(); } RecordSerializer ser = new RecordSerializerFactoryImpl(cctx).createSerializer(segmentSerializerVer); ByteBuffer heapBuf = prepareSwitchSegmentRecordBuffer(nextSegment, ser); zos.write(heapBuf.array()); } }
Source:
<code>public void testIrrelevantDoubleSpend() throws Exception { <START> Transaction tx0 = createFakeTx(PARAMS, COIN.multiply(5), OTHER_ADDRESS, OTHER_ADDRESS2)[1]; <END> Transaction tx1 = createFakeTx(PARAMS, COIN.multiply(5), OTHER_ADDRESS, OTHER_ADDRESS2)[1]; Transaction tx2 = new Transaction(PARAMS); tx2.addInput(tx0.getOutput(0)); tx2.addOutput(COIN, myAddress); tx2.addOutput(COIN, OTHER_ADDRESS); sendMoneyToWallet(AbstractBlockChain.NewBlockType.BEST_CHAIN, tx2, tx1, tx0); Transaction tx3 = new Transaction(PARAMS); tx3.addInput(tx1.getOutput(0)); tx3.addOutput(COIN, myAddress); tx3.addOutput(COIN, OTHER_ADDRESS); wallet.receivePending(tx3, null); Transaction tx4 = new Transaction(PARAMS); tx4.addInput(tx1.getOutput(0)); tx4.addInput(tx2.getOutput(1)); tx4.addOutput(COIN, OTHER_ADDRESS); sendMoneyToWallet(AbstractBlockChain.NewBlockType.BEST_CHAIN, tx4); wallet = roundTrip(wallet); log.info(wallet.toString()); }</code><technical_language>This version of createFakeTx creates feeder transactions throw away. Is this needed? "one address" version here</technical_language>

Target:
public void testIrrelevantDoubleSpend() throws Exception { Transaction tx0 = createFakeTx(PARAMS); Transaction tx1 = createFakeTx(PARAMS); Transaction tx2 = new Transaction(PARAMS); tx2.addInput(tx0.getOutput(0)); tx2.addOutput(COIN, myAddress); tx2.addOutput(COIN, OTHER_ADDRESS); sendMoneyToWallet(AbstractBlockChain.NewBlockType.BEST_CHAIN, tx2, tx1, tx0); Transaction tx3 = new Transaction(PARAMS); tx3.addInput(tx1.getOutput(0)); tx3.addOutput(COIN, myAddress); tx3.addOutput(COIN, OTHER_ADDRESS); wallet.receivePending(tx3, null); Transaction tx4 = new Transaction(PARAMS); tx4.addInput(tx1.getOutput(0)); tx4.addInput(tx2.getOutput(1)); tx4.addOutput(COIN, OTHER_ADDRESS); sendMoneyToWallet(AbstractBlockChain.NewBlockType.BEST_CHAIN, tx4); wallet = roundTrip(wallet); assertTrue(wallet.isConsistent()); }