auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private List<TextEditGroup> addGetterSetterChanges(CompilationUnit root, ASTRewrite rewriter, String lineDelimiter, boolean usingLocalSetter, boolean usingLocalGetter) throws CoreException { List<TextEditGroup> result= new ArrayList<>(2); AST ast= root.getAST(); <START> FieldDeclaration decl= (FieldDeclaration) ASTNodes.getParent(fFieldDeclaration, ASTNode.FIELD_DECLARATION); <END> int position= 0; int numberOfMethods= 0; List<BodyDeclaration> members= ASTNodes.getBodyDeclarations(decl.getParent()); for (BodyDeclaration element : members) { if (element.getNodeType() == ASTNode.METHOD_DECLARATION) { if (fInsertionIndex == -1) { break; } else if (fInsertionIndex == numberOfMethods) { position++; break; } numberOfMethods++; } position++; } ListRewrite rewrite= fRewriter.getListRewrite(decl.getParent(), getBodyDeclarationsProperty(decl.getParent())); if (!usingLocalGetter && fCreateGetter) { TextEditGroup description= new TextEditGroup(RefactoringCoreMessages.SelfEncapsulateField_add_getter); result.add(description); rewrite.insertAt(createGetterMethod(ast, rewriter, lineDelimiter), position++, description); } if (!JdtFlags.isFinal(fField) && !usingLocalSetter && fCreateSetter) { TextEditGroup description= new TextEditGroup(RefactoringCoreMessages.SelfEncapsulateField_add_setter); result.add(description); rewrite.insertAt(createSetterMethod(ast, rewriter, lineDelimiter), position, description); } if (!JdtFlags.isPrivate(fField)) { result.add(makeDeclarationPrivate(rewriter, decl)); } return result; }</code><technical_language>More unnecessary changes</technical_language>

Target:
private List<TextEditGroup> addGetterSetterChanges(CompilationUnit root, ASTRewrite rewriter, String lineDelimiter, boolean usingLocalSetter, boolean usingLocalGetter) throws CoreException { List<TextEditGroup> result= new ArrayList<>(2); AST ast= root.getAST(); FieldDeclaration decl= (FieldDeclaration)ASTNodes.getParent(fFieldDeclaration, ASTNode.FIELD_DECLARATION); int position= 0; int numberOfMethods= 0; List<BodyDeclaration> members= ASTNodes.getBodyDeclarations(decl.getParent()); for (Iterator<BodyDeclaration> iter= members.iterator(); iter.hasNext();) { BodyDeclaration element= iter.next(); if (element.getNodeType() == ASTNode.METHOD_DECLARATION) { if (fInsertionIndex == -1) { break; } else if (fInsertionIndex == numberOfMethods) { position++; break; } numberOfMethods++; } position++; } TextEditGroup description; ListRewrite rewrite= fRewriter.getListRewrite(decl.getParent(), getBodyDeclarationsProperty(decl.getParent())); if (!usingLocalGetter && fCreateGetter) { description= new TextEditGroup(RefactoringCoreMessages.SelfEncapsulateField_add_getter); result.add(description); rewrite.insertAt(createGetterMethod(ast, rewriter, lineDelimiter), position++, description); } if (!JdtFlags.isFinal(fField) && !usingLocalSetter && fCreateSetter) { description= new TextEditGroup(RefactoringCoreMessages.SelfEncapsulateField_add_setter); result.add(description); rewrite.insertAt(createSetterMethod(ast, rewriter, lineDelimiter), position, description); } if (!JdtFlags.isPrivate(fField)) result.add(makeDeclarationPrivate(rewriter, decl)); return result; }
Source:
<code><START> public EnhancerBuilderImpl( <END> Class<?> hostClass, Collection<Method> enhanceableMethods, Map<Method, Method> bridgeDelegates) { this.hostClass = hostClass; this.enhanceableMethods = enhanceableMethods.toArray(new Method[enhanceableMethods.size()]); this.bridgeDelegates = ImmutableMap.copyOf(bridgeDelegates); }</code><technical_language>nit, need public</technical_language>

Target:
EnhancerBuilderImpl( Class<?> hostClass, Collection<Method> enhanceableMethods, Map<Method, Method> bridgeDelegates) { this.hostClass = hostClass; this.enhanceableMethods = enhanceableMethods.toArray(new Method[enhanceableMethods.size()]); this.bridgeDelegates = ImmutableMap.copyOf(bridgeDelegates); }
Source:
<code>protected void reorganize() { IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(); if (fOrganizers == null) { fElements = breakpoints; } else { IBreakpointOrganizer organizer = fOrganizers[0]; Map<IAdaptable, BreakpointContainer> categoriesToContainers = new HashMap<>(); for (IBreakpoint breakpoint : breakpoints) { IAdaptable[] categories = organizer.getCategories(breakpoint); if (categories == null || categories.length == 0) { categories = OtherBreakpointCategory.getCategories(organizer); } for (IAdaptable category : categories) { BreakpointContainer container = categoriesToContainers.get(category); if (container == null) { IBreakpointOrganizer[] nesting = null; if (fOrganizers.length > 1) { nesting = new IBreakpointOrganizer[fOrganizers.length - 1]; System.arraycopy(fOrganizers, 1, nesting, 0, nesting.length); } container = new BreakpointContainer(category, organizer, nesting); categoriesToContainers.put(category, container); } container.addBreakpoint(breakpoint); } } IAdaptable[] emptyCategories = organizer.getCategories(); if (emptyCategories != null) { for (IAdaptable <START> category : <END> emptyCategories) { BreakpointContainer container = categoriesToContainers.get(category); if (container == null) { container = new BreakpointContainer(category, organizer, null); categoriesToContainers.put(category, container); } } } fElements = categoriesToContainers.values().toArray(); } fViewer.getControl().setRedraw(false); fViewer.refresh(); fViewer.getControl().setRedraw(true); }</code><technical_language>emptyCategory</technical_language>

Target:
protected void reorganize() { IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(); if (fOrganizers == null) { fElements = breakpoints; } else { IBreakpointOrganizer organizer = fOrganizers[0]; Map<IAdaptable, BreakpointContainer> categoriesToContainers = new HashMap<>(); for (IBreakpoint breakpoint : breakpoints) { IAdaptable[] categories = organizer.getCategories(breakpoint); if (categories == null || categories.length == 0) { categories = OtherBreakpointCategory.getCategories(organizer); } for (IAdaptable category : categories) { BreakpointContainer container = categoriesToContainers.get(category); if (container == null) { IBreakpointOrganizer[] nesting = null; if (fOrganizers.length > 1) { nesting = new IBreakpointOrganizer[fOrganizers.length - 1]; System.arraycopy(fOrganizers, 1, nesting, 0, nesting.length); } container = new BreakpointContainer(category, organizer, nesting); categoriesToContainers.put(category, container); } container.addBreakpoint(breakpoint); } } IAdaptable[] emptyCategories = organizer.getCategories(); if (emptyCategories != null) { for (IAdaptable emptyCategory : emptyCategories) { BreakpointContainer container = categoriesToContainers.get(emptyCategory); if (container == null) { container = new BreakpointContainer(emptyCategory, organizer, null); categoriesToContainers.put(emptyCategory, container); } } } fElements = categoriesToContainers.values().toArray(); } fViewer.getControl().setRedraw(false); fViewer.refresh(); fViewer.getControl().setRedraw(true); }
Source:
<code>private boolean initializeIfNeeded() { lock.lock(); try { if (initialized) { return false; } List<ZNRecord> records = propertyStore.getChildren(CONFIG_PATH, null, AccessOption.PERSISTENT); listener.onDataNodeConfigChange(lazyIterable(records)); initialized = true; } catch (Exception e) { <START> LOGGER.error("Exception during DataNodeConfig initialization", e); <END> } finally { lock.unlock(); } return true; }</code><technical_language>curious, if exception occurs, block startup of current node</technical_language>

Target:
private synchronized boolean initializeIfNeeded() { boolean partialUpdateAllowed = false; try { if (initFuture.isDone()) { partialUpdateAllowed = !initFuture.isCompletedExceptionally(); } else { List<ZNRecord> records = propertyStore.getChildren(CONFIG_PATH, null, AccessOption.PERSISTENT); listener.onDataNodeConfigChange(lazyIterable(records)); initFuture.complete(null); } } catch (Throwable t) { initFuture.completeExceptionally(t); } return partialUpdateAllowed; }
Source:
<code><START> public void testAddTwice() throws CoreException { <END> TaskReviewsMappingsStore taskReviewsMappingStore = getEmptyTaskReviewStore(); addReviewData(review1, descriptionWithTaskUrl1); TaskContainerDelta delta = new TaskContainerDelta(review1, Kind.ADDED); taskReviewsMappingStore.containersChanged(ImmutableSet.of(delta)); taskReviewsMappingStore.containersChanged(ImmutableSet.of(delta)); assertTrue(taskReviewsMappingStore.getReviewUrls(taskUrl1).contains(reviewUrl1)); assertTrue(taskReviewsMappingStore.getTaskUrl(reviewUrl1).equals(taskUrl1)); }</code><technical_language>this a special case of below</technical_language>

Target:
public void testAddTwice() throws CoreException { TaskReviewsMappingsStore taskReviewsMappingStore = getEmptyTaskReviewStore(); addReviewData(review1, descriptionWithTaskUrl1); TaskContainerDelta delta = new TaskContainerDelta(review1, Kind.ADDED); taskReviewsMappingStore.containersChanged(ImmutableSet.of(delta)); taskReviewsMappingStore.containersChanged(ImmutableSet.of(delta)); Collection<String> reviewUrls = taskReviewsMappingStore.getReviewUrls(taskUrl1); assertTrue(reviewUrls.contains(reviewUrl1)); assertTrue(reviewUrls.size() == 1); assertTrue(taskReviewsMappingStore.getTaskUrl(reviewUrl1).equals(taskUrl1)); }
Source:
<code>private void addNewElement(int hashPosition, Block block, int position) { elementType.appendTo(block, position, elementBlock); if (elementBlock.getSizeInBytes() - initialElementBlockSizeInBytes > FOUR_MEGABYTES) { throw new PrestoException( EXCEEDED_FUNCTION_MEMORY_LIMIT, format("The input to %s is too large. More than %s of memory is needed to hold the intermediate hash set.\n", functionName, MAX_FUNCTION_MEMORY)); } blockPositionByHash.set(hashPosition, elementBlock.getPositionCount() - 1); <START> if (++size >= maxFill) { <END> rehash(); } }</code><technical_language>"++x >= y" does't in Presto code base. I put size++ right line 156</technical_language>

Target:
private void addNewElement(int hashPosition, Block block, int position) { elementType.appendTo(block, position, elementBlock); if (elementBlock.getSizeInBytes() - initialElementBlockSizeInBytes > FOUR_MEGABYTES) { throw new PrestoException( EXCEEDED_FUNCTION_MEMORY_LIMIT, format("The input to %s is too large. More than %s of memory is needed to hold the intermediate hash set.\n", functionName, MAX_FUNCTION_MEMORY)); } blockPositionByHash.set(hashPosition, elementBlock.getPositionCount() - 1); size++; if (size >= maxFill) { rehash(); } }
Source:
<code>public CommandHandlingExecutor(JobServerContext jobServerContext, TaskExecutorManager taskExecutorManager, JobMasterClient masterClient, WorkerNetAddress workerNetAddress) { mServerContext = Preconditions.checkNotNull(jobServerContext); mTaskExecutorManager = Preconditions.checkNotNull(taskExecutorManager, "taskExecutorManager"); mMasterClient = Preconditions.checkNotNull(masterClient, "masterClient"); mWorkerNetAddress = Preconditions.checkNotNull(workerNetAddress, "workerNetAddress"); if (ServerConfiguration.getBoolean(PropertyKey.TEST_MODE)) { <START> mHealthReporter = new AlwaysHealthyJobWorkerHealthReporter(); <END> } else { mHealthReporter = new JobWorkerHealthReporter(); } }</code><technical_language>Instead of a switch here, add logic in JobWorkerHealthReporter health factor configurable</technical_language>

Target:
public CommandHandlingExecutor(JobServerContext jobServerContext, TaskExecutorManager taskExecutorManager, JobMasterClient masterClient, WorkerNetAddress workerNetAddress) { mServerContext = Preconditions.checkNotNull(jobServerContext); mTaskExecutorManager = Preconditions.checkNotNull(taskExecutorManager, "taskExecutorManager"); mMasterClient = Preconditions.checkNotNull(masterClient, "masterClient"); mWorkerNetAddress = Preconditions.checkNotNull(workerNetAddress, "workerNetAddress"); if (ServerConfiguration.getBoolean(PropertyKey.JOB_WORKER_THROTTLING)) { mHealthReporter = new JobWorkerHealthReporter(); } else { mHealthReporter = new AlwaysHealthyJobWorkerHealthReporter(); } }
Source:
<code>public void testRemoveButton() throws Exception { if (!endToEndTestEnabled()) { return; } try { createNewNote(); waitForParagraph(1, "READY"); driver.findElement(By.xpath(getParagraphXPath(1) + " driver.findElement(By.xpath(getParagraphXPath(1) + " waitForParagraph(2, "READY"); Integer oldNosOfParas = driver.findElements(By.xpath(" collector.checkThat("Before Remove : Number of paragraphs are ", oldNosOfParas, CoreMatchers.equalTo(2)); driver.findElement(By.xpath(getParagraphXPath(1) + " driver.findElement(By.xpath(getParagraphXPath(1) + " sleep(1000, true); driver.findElement(By.xpath(" " <START> sleep(1000, true); <END> Integer newNosOfParas = driver.findElements(By.xpath(" collector.checkThat("After Remove : Number of paragraphs are", newNosOfParas, CoreMatchers.equalTo(oldNosOfParas - 1)); ZeppelinITUtils.sleep(1000, false); deleteTestNotebook(driver); } catch (Exception e) { handleException("Exception in ParagraphActionsIT while testRemoveButton ", e); } }</code><technical_language>Is a reason this method ZeppelinITUtils.sleep(1000, false); in method? If same, while refactored impl</technical_language>

Target:
public void testRemoveButton() throws Exception { if (!endToEndTestEnabled()) { return; } try { createNewNote(); waitForParagraph(1, "READY"); driver.findElement(By.xpath(getParagraphXPath(1) + " driver.findElement(By.xpath(getParagraphXPath(1) + " .click(); waitForParagraph(2, "READY"); Integer oldNosOfParas = driver.findElements(By.xpath (" collector.checkThat("Before Remove : Number of paragraphs are ", oldNosOfParas, CoreMatchers.equalTo(2)); driver.findElement(By.xpath(getParagraphXPath(1) + " clickAndWait(By.xpath(getParagraphXPath(1) + " clickAndWait(By.xpath(" "] Integer newNosOfParas = driver.findElements(By.xpath (" collector.checkThat("After Remove : Number of paragraphs are", newNosOfParas, CoreMatchers.equalTo(oldNosOfParas - 1)); ZeppelinITUtils.sleep(1000, false); deleteTestNotebook(driver); } catch (Exception e) { handleException("Exception in ParagraphActionsIT while testRemoveButton ", e); } }
Source:
<code>public double calculateFitness(TaskRequest taskRequest, VirtualMachineCurrentState targetVM, TaskTrackerState taskTrackerState) { double totalWeightedScores = 0.0; double totalWeights = 0.0; for (WeightedFitnessCalculator calculator : calculators) { <START> double score = calculator.getFitnessCalculator().calculateFitness(taskRequest, targetVM, taskTrackerState); <END> totalWeightedScores += (score * calculator.getWeight()); totalWeights += calculator.getWeight(); } return totalWeightedScores / totalWeights; }</code><technical_language>a fitness function returns 0.0 score, means is fit all. This return 0.0 final answer. current code proceed average of other fitness functions. incorrect result</technical_language>

Target:
public double calculateFitness(TaskRequest taskRequest, VirtualMachineCurrentState targetVM, TaskTrackerState taskTrackerState) { double totalWeightedScores = 0.0; double totalWeights = 0.0; for (WeightedFitnessCalculator calculator : calculators) { double score = calculator.getFitnessCalculator().calculateFitness(taskRequest, targetVM, taskTrackerState); if (score == 0.0) { return score; } totalWeightedScores += (score * calculator.getWeight()); totalWeights += calculator.getWeight(); } return totalWeightedScores / totalWeights; }
Source:
<code>private void initialiseMetrics(MetricRegistry metricRegistry) { <START> metricRegistry.<Gauge<Integer>>register("connectordb.numbackends", () -> numBackends); <END> metricRegistry.<Gauge<Integer>>register("connectordb.xact_commit", () -> xactCommit); metricRegistry.<Gauge<Integer>>register("connectordb.xact_rollback", () -> xactRollback); metricRegistry.<Gauge<Integer>>register("connectordb.blks_read", () -> blksRead); metricRegistry.<Gauge<Integer>>register("connectordb.blks_hit", () -> blksHit); metricRegistry.<Gauge<Integer>>register("connectordb.tup_returned", () -> tupReturned); metricRegistry.<Gauge<Integer>>register("connectordb.tup_fetched", () -> tupFetched); metricRegistry.<Gauge<Integer>>register("connectordb.tup_inserted", () -> tupInserted); metricRegistry.<Gauge<Integer>>register("connectordb.tup_updated", () -> tupUpdated); metricRegistry.<Gauge<Integer>>register("connectordb.tup_deleted", () -> tupDeleted); metricRegistry.<Gauge<Integer>>register("connectordb.conflicts", () -> conflicts); metricRegistry.<Gauge<Integer>>register("connectordb.temp_files", () -> tempFiles); metricRegistry.<Gauge<Integer>>register("connectordb.deadlocks", () -> deadlocks); metricRegistry.<Gauge<Double>>register("connectordb.blk_read_time", () -> blkReadTime); metricRegistry.<Gauge<Double>>register("connectordb.blk_write_time", () -> blkWriteTime); }</code><technical_language>metricRegistry works fully. this reporting initialise time get send everytime check()</technical_language>

Target:
private void initialiseMetrics(MetricRegistry metricRegistry) { for (String key : longDatabaseStatsMap.keySet()) { metricRegistry.<Gauge<Long>>register("connectordb." + key, () -> longDatabaseStatsMap.get(key)); } for (String key : doubleDatabaseStatsMap.keySet()) { metricRegistry.<Gauge<Double>>register("connectordb." + key, () -> doubleDatabaseStatsMap.get(key)); } metricRegistry.<Gauge<Integer>>register("connectordb.stats_healthy", () -> statsHealthy); }
Source:
<code>private Film getBasicFilm(ProgData progData) { Film film = new Film(PaHelper.getFilmUri(identifierFor(progData)), PaHelper.getEpisodeCurie(identifierFor(progData)), Publisher.PA); film.addAliasUrl(PaHelper.getFilmRtAlias(progData.getRtFilmnumber())); <START> film.addAlias(PaHelper.getProgIdAlias(progData.getProgId())); <END> setBasicDetails(progData, film); return film; }</code><technical_language>adding aliases PA progIds, no</technical_language>

Target:
private Film getBasicFilm(ProgData progData) { Film film = new Film(PaHelper.getFilmUri(identifierFor(progData)), PaHelper.getEpisodeCurie(identifierFor(progData)), Publisher.PA); setBasicDetails(progData, film); return film; }
Source:
<code>public void doSearchType(ITypeBinding typeBinding, IProgressMonitor monitor) throws CoreException { IMethodBinding[] methods = typeBinding.getDeclaredMethods(); IVariableBinding[] fields = typeBinding.getDeclaredFields(); SubMonitor subMonitor = SubMonitor.convert(monitor, "Searching for references.", methods.length + fields.length); for (IMethodBinding methodBinding : methods) { if (monitor.isCanceled()) throw new OperationCanceledException(); if (methodOverrides(methodBinding)) continue; IMethod method = (IMethod) methodBinding.getJavaElement(); if (method == null) continue; if (hasReferences(method, subMonitor.newChild(1))) continue; result.unusedElementFound(method); unusedMemberCount++; } for (IVariableBinding fieldBinding : fields) { if (monitor.isCanceled()) <START> throw new OperationCanceledException(); <END> IField field = (IField) fieldBinding.getJavaElement(); if (field == null) continue; if (hasReferences(field, subMonitor.newChild(1))) continue; result.unusedElementFound(field); unusedMemberCount++; } if (monitor.isCanceled()) throw new OperationCanceledException(); }</code><technical_language>remove this cancel check subMonitor.split(1) in line 151</technical_language>

Target:
public void doSearchType(ITypeBinding typeBinding, IProgressMonitor monitor) throws CoreException { IMethodBinding[] methods = typeBinding.getDeclaredMethods(); IVariableBinding[] fields = typeBinding.getDeclaredFields(); SubMonitor subMonitor = SubMonitor.convert(monitor, "Searching for references.", methods.length + fields.length); for (IMethodBinding methodBinding : methods) { if (monitor.isCanceled()) throw new OperationCanceledException(); if (methodOverrides(methodBinding)) continue; IMethod method = (IMethod) methodBinding.getJavaElement(); if (method == null) continue; if (hasReferences(method, subMonitor.newChild(1))) continue; result.unusedElementFound(method); unusedMemberCount++; } for (IVariableBinding fieldBinding : fields) { IField field = (IField) fieldBinding.getJavaElement(); if (field == null) continue; if (hasReferences(field, subMonitor.split(1))) continue; result.unusedElementFound(field); unusedMemberCount++; } if (monitor.isCanceled()) throw new OperationCanceledException(); }
Source:
<code>public long writeTo(WritableByteChannel channel) throws IOException { if (materializedBlobBuffer == null) { throw new IllegalStateException("Attempt to write out a PutRequest that cannot be written out."); } long written = 0; <START> if (sentBytes < sizeInBytes()) { <END> if (bufferToSend == null) { bufferToSend = ByteBuffer.allocate(sizeExcludingBlobSize()); writeHeader(); bufferToSend.put(blobId.toBytes()); BlobPropertiesSerDe.putBlobPropertiesToBuffer(bufferToSend, properties); bufferToSend.putInt(usermetadata.capacity()); bufferToSend.put(usermetadata); bufferToSend.putShort((short) blobType.ordinal()); bufferToSend.putLong(blobSize); bufferToSend.flip(); } if (bufferToSend.hasRemaining()) { written = channel.write(bufferToSend); } if (!bufferToSend.hasRemaining()) { written += channel.write(materializedBlobBuffer); } sentBytes += written; } return written; }</code><technical_language>overhead calculate sizeInBytes() for call</technical_language>

Target:
public long writeTo(WritableByteChannel channel) throws IOException { long written = 0; if (sentBytes < sizeInBytes()) { if (bufferToSend == null) { bufferToSend = ByteBuffer.allocate(sizeExcludingBlobSize()); writeHeader(); bufferToSend.put(blobId.toBytes()); BlobPropertiesSerDe.putBlobPropertiesToBuffer(bufferToSend, properties); bufferToSend.putInt(usermetadata.capacity()); bufferToSend.put(usermetadata); bufferToSend.putShort((short) blobType.ordinal()); bufferToSend.putLong(blobSize); bufferToSend.flip(); } if (bufferToSend.hasRemaining()) { written = channel.write(bufferToSend); } if (!bufferToSend.hasRemaining()) { written += channel.write(blob); } sentBytes += written; } return written; }
Source:
<code>private void makeTree(InternalJob job) { <START> final Set<String> taskNames = job.getITasks() <END> .stream() .filter(internalTask -> internalTask.getFlowScript() != null) .filter(internalTask -> FlowActionType.parse(internalTask.getFlowScript() .getActionType()) .equals(FlowActionType.IF)) .flatMap(internalTask -> Stream.of(internalTask.getFlowScript() .getActionTarget(), internalTask.getFlowScript() .getActionTargetElse(), internalTask.getFlowScript() .getActionContinuation()) .filter(Objects::nonNull) .filter(action -> !action.equals(internalTask.getName()))) .collect(Collectors.toSet()); for (InternalTask td : job.getITasks()) { EligibleTaskDescriptor lt = new EligibleTaskDescriptorImpl(td); if (isEntryPoint(td, taskNames)) { eligibleTasks.put(td.getId(), lt); } if (td.getJoinedBranches() != null || td.getIfBranch() != null) { branchTasks.put(td.getId(), lt); } allTasksWithTheirChildren.put(td, lt); } for (InternalTask td : job.getITasks()) { if (td.getDependences() != null) { TaskDescriptor taskDescriptor = allTasksWithTheirChildren.get(td); for (InternalTask depends : td.getIDependences()) { ((EligibleTaskDescriptorImpl) taskDescriptor).addParent(allTasksWithTheirChildren.get(depends)); } for (TaskDescriptor lt : taskDescriptor.getParents()) { ((EligibleTaskDescriptorImpl) lt).addChild(taskDescriptor); hasChildren.add(lt.getTaskId()); } } } }</code><technical_language>rename this to, for example nonEligibleTaskNames</technical_language>

Target:
private void makeTree(InternalJob job) { final Set<String> nonEligibleTaskNames = job.getITasks() .stream() .filter(internalTask -> internalTask.getFlowScript() != null) .filter(internalTask -> FlowActionType.parse(internalTask.getFlowScript() .getActionType()) .equals(FlowActionType.IF)) .flatMap(internalTask -> Stream.of(internalTask.getFlowScript() .getActionTarget(), internalTask.getFlowScript() .getActionTargetElse(), internalTask.getFlowScript() .getActionContinuation()) .filter(Objects::nonNull) .filter(action -> !action.equals(internalTask.getName()))) .collect(Collectors.toSet()); for (InternalTask td : job.getITasks()) { EligibleTaskDescriptor lt = new EligibleTaskDescriptorImpl(td); if (isEntryPoint(td, nonEligibleTaskNames)) { eligibleTasks.put(td.getId(), lt); } if (td.getJoinedBranches() != null || td.getIfBranch() != null) { branchTasks.put(td.getId(), lt); } allTasksWithTheirChildren.put(td, lt); } for (InternalTask td : job.getITasks()) { if (td.getDependences() != null) { TaskDescriptor taskDescriptor = allTasksWithTheirChildren.get(td); for (InternalTask depends : td.getIDependences()) { ((EligibleTaskDescriptorImpl) taskDescriptor).addParent(allTasksWithTheirChildren.get(depends)); } for (TaskDescriptor lt : taskDescriptor.getParents()) { ((EligibleTaskDescriptorImpl) lt).addChild(taskDescriptor); hasChildren.add(lt.getTaskId()); } } } }
Source:
<code>public Boolean run() { Application application = cloudHubClient.getApplication(applicationName); applicationStatus = application.getStatus(); <START> if (application != null && expectedStatus.equals(application.getStatus())) { <END> return false; } return true; }</code><technical_language>I get it. If application is null, throw a NPE invoking getStatus</technical_language>

Target:
public Boolean run() { Application application = cloudHubClient.getApplications(applicationName); if (application != null) { applicationStatus = application.getStatus(); if (application != null && expectedStatus.equals(application.getStatus())) { return false; } } return true; }
Source:
<code>private byte[] encodeTlvValue(Object value, Type type) { LOG.trace("Encoding value in TLV", value); switch (type) { case STRING: return TlvEncoder.encodeString((String) value); case INTEGER: return TlvEncoder.encodeInteger((Number) value); case FLOAT: return TlvEncoder.encodeFloat((Number) value); case BOOLEAN: return TlvEncoder.encodeBoolean((Boolean) value); case TIME: return TlvEncoder.encodeDate((Date) value); case OPAQUE: return (byte[]) value; case OBJLNK: <START> return TlvEncoder.encodeObjlnk((ObjectLink) value); <END> default: throw new CodecException(String.format("Invalid value %s for type %s", value, type)); } }</code><technical_language>A try/catch block (for IllegalArgumentException) added TlvEncoder.encode() methods. cleaner raise TlvException instead of IllegalArgumentException in TlvEncoder class</technical_language>

Target:
private byte[] encodeTlvValue(Object value, Type type) { LOG.trace("Encoding value in TLV", value); try { switch (type) { case STRING: return TlvEncoder.encodeString((String) value); case INTEGER: return TlvEncoder.encodeInteger((Number) value); case FLOAT: return TlvEncoder.encodeFloat((Number) value); case BOOLEAN: return TlvEncoder.encodeBoolean((Boolean) value); case TIME: return TlvEncoder.encodeDate((Date) value); case OPAQUE: return (byte[]) value; case OBJLNK: return TlvEncoder.encodeObjlnk((ObjectLink) value); default: throw new CodecException(String.format("Invalid value %s for type %s", value, type)); } } catch (IllegalArgumentException e) { throw new CodecException(String.format("Invalid value %s for type %s", value, type), e); } }
Source:
<code>public AuthRegistryConfig(String repository, String username, String password, <START> String auth, <END> String email, String serverAddress) { this.repository = repository; this.username = username; this.password = password; this.auth = auth; this.email = email; this.serverAddress = serverAddress; }</code><technical_language>overload require this used</technical_language>

Target:
public AuthRegistryConfig(String repository, String username, String password, String auth, String email, String serverAddress) { this.repository = repository; this.username = username; this.password = password; this.auth = auth; this.email = email; this.serverAddress = serverAddress; properties.put("username", username); properties.put("password", password); properties.put("auth", auth); properties.put("email", email); properties.put("serveraddress", serverAddress); configs.put(repository, properties); }
Source:
<code>public void getMetricsFromFeed(@NonNull Callback<List<Metric>> callback, Resource resource) { URI uri = Uris.getUri(String.format(BackendPipes.Paths.FEED_METRICS, resource.getFeed(), <START> resource.getId().replace("/","%2F"))); <END> readPipe(BackendPipes.Names.FEED_METRICS, uri, callback); }</code><technical_language>This is a proper encode metricId. URLEncoder.encode() is method searching for</technical_language>

Target:
public void getMetricsFromFeed(@NonNull Callback<List<Metric>> callback, Resource resource) { URI uri = Uris.getUri(String.format(BackendPipes.Paths.FEED_METRICS, resource.getFeed(), Uris.getEncodedParameter(resource.getId()))); readPipe(BackendPipes.Names.FEED_METRICS, uri, callback); }
Source:
<code>public StructuredEventContainer getStructuredEventsForStack(String name, Long workspaceId) { <START> return getEventsForUserWithResourceId(CloudbreakEventService.DATAHUB_RESOURCE_TYPE, getStackIfAvailable(workspaceId, name).getId()); <END> }</code><technical_language>determine if is a datalake</technical_language>

Target:
public StructuredEventContainer getStructuredEventsForStack(String name, Long workspaceId) { StackView stackView = stackService.getViewByNameInWorkspace(name, workspaceId); return getEventsForUserWithResourceId(stackView.getType().getResourceType(), getStackIfAvailable(workspaceId, name, stackView.getType()).getId()); }
Source:
<code>public synchronized Long persist(final String name, final EntityEntry entry, final boolean useAutoInc) throws DatabaseEngineException { ResultSet generatedKeys = null; try { getConnection(); final MappedEntity me = entities.get(name); if (me == null) { throw new DatabaseEngineException(String.format("Unknown entity '%s'", name)); } final PreparedStatement ps; if (useAutoInc) { ps = me.getInsertReturning(); } else { ps = me.getInsertWithAutoInc(); } entityToPreparedStatement(me.getEntity(), ps, entry, useAutoInc); generatedKeys = ps.executeQuery(); long ret = 0; if (useAutoInc) { if (generatedKeys.next()) { ret = generatedKeys.getLong(1); } } else if (hasIdentityColumn(me.getEntity())) { final List<Map<String, ResultColumn>> q = query( <START> "SELECT max(" + quotize(me.getAutoIncColumn()) + ") FROM" + quotize(name) <END> ); if (!q.isEmpty()) { ret = q.get(0).values().iterator().next().toLong(); } executeUpdateSilently(format("SELECT setval('%s', %d, false)", getQuotizedSequenceName(me.getEntity(), me.getAutoIncColumn()), ret + 1 )); ret = 0; } return ret == 0 ? null : ret; } catch (final Exception ex) { throw new DatabaseEngineException("Something went wrong persisting the entity", ex); } finally { try { if (generatedKeys != null) { generatedKeys.close(); } } catch (final Exception e) { logger.trace("Error closing result set.", e); } } }</code><technical_language>this missing a space FROM? Is this tested? format a choice here</technical_language>

Target:
public synchronized Long persist(final String name, final EntityEntry entry, final boolean useAutoInc) throws DatabaseEngineException { ResultSet generatedKeys = null; try { getConnection(); final MappedEntity me = entities.get(name); if (me == null) { throw new DatabaseEngineException(String.format("Unknown entity '%s'", name)); } final PreparedStatement ps; if (useAutoInc) { ps = me.getInsertReturning(); } else { ps = me.getInsertWithAutoInc(); } entityToPreparedStatement(me.getEntity(), ps, entry, useAutoInc); generatedKeys = ps.executeQuery(); long ret = 0; if (useAutoInc) { if (generatedKeys.next()) { ret = generatedKeys.getLong(1); } } else if (hasIdentityColumn(me.getEntity())) { final List<Map<String, ResultColumn>> q = query( format("SELECT max(%s) FROM %s", quotize(me.getAutoIncColumn()), quotize(name)) ); if (!q.isEmpty()) { ret = q.get(0).values().iterator().next().toLong(); } executeUpdateSilently(format("SELECT setval('%s', %d, false)", getQuotizedSequenceName(me.getEntity(), me.getAutoIncColumn()), ret + 1 )); ret = 0; } return ret == 0 ? null : ret; } catch (final Exception ex) { throw new DatabaseEngineException("Something went wrong persisting the entity", ex); } finally { try { if (generatedKeys != null) { generatedKeys.close(); } } catch (final Exception e) { logger.trace("Error closing result set.", e); } } }
Source:
<code><START> public void convert_missing_doi() throws IOException { <END> ImmutableMap<String, String> extIds = ImmutableMap.of("other", "2"); Result sourceDataset = documentEntity(extIds); DataSetReference metadata = converter.convert(sourceDataset); assertNotNull(metadata); assertEquals(ID, metadata.getId()); assertEquals("other", metadata.getReferenceType()); assertEquals("2", metadata.getIdForGivenType()); assertEquals(1, metadata.getCreatorNames().size()); assertEquals(FULL_NAME, metadata.getCreatorNames().get(0)); assertEquals(2, metadata.getTitles().size()); assertEquals(TITLE, metadata.getTitles().get(0)); assertEquals(OTHER_TITLE, metadata.getTitles().get(1)); assertEquals(ABSTRACT, metadata.getDescription()); assertEquals(PUBLISHER, metadata.getPublisher()); assertEquals(YEAR, metadata.getPublicationYear()); assertEquals(1, metadata.getFormats().size()); assertEquals(FORMAT, metadata.getFormats().iterator().next()); assertEquals(RESOURCE_TYPE_CLASSID, metadata.getResourceTypeValue()); assertEquals(1, metadata.getAlternateIdentifiers().size()); assertEquals(extIds, metadata.getAlternateIdentifiers()); }</code><technical_language>Exception is thrown</technical_language>

Target:
public void convert_missing_doi() { ImmutableMap<String, String> extIds = ImmutableMap.of("other", "2"); Result sourceDataset = documentEntity(extIds); DataSetReference metadata = converter.convert(sourceDataset); assertNotNull(metadata); assertEquals(ID, metadata.getId()); assertEquals("other", metadata.getReferenceType()); assertEquals("2", metadata.getIdForGivenType()); assertEquals(1, metadata.getCreatorNames().size()); assertEquals(FULL_NAME, metadata.getCreatorNames().get(0)); assertEquals(2, metadata.getTitles().size()); assertEquals(TITLE, metadata.getTitles().get(0)); assertEquals(OTHER_TITLE, metadata.getTitles().get(1)); assertEquals(ABSTRACT, metadata.getDescription()); assertEquals(PUBLISHER, metadata.getPublisher()); assertEquals(YEAR, metadata.getPublicationYear()); assertEquals(1, metadata.getFormats().size()); assertEquals(FORMAT, metadata.getFormats().iterator().next()); assertEquals(RESOURCE_TYPE_CLASSID, metadata.getResourceTypeValue()); assertEquals(1, metadata.getAlternateIdentifiers().size()); assertEquals(extIds, metadata.getAlternateIdentifiers()); }
Source:
<code>public ManagedObjectReference getDecendentMoRef(ManagedObjectReference root, String type, String name) throws Exception { if (name == null || name.length() == 0) { return null; } try { PropertySpec pSpec = new PropertySpec(); pSpec.setType(type); pSpec.setAll(false); pSpec.getPathSet().add("name"); ObjectSpec oSpec = new ObjectSpec(); oSpec.setObj(root); oSpec.setSkip(false); oSpec.getSelectSet().addAll(constructCompleteTraversalSpec()); PropertyFilterSpec spec = new PropertyFilterSpec(); spec.getPropSet().add(pSpec); spec.getObjectSet().add(oSpec); List<PropertyFilterSpec> specArr = new ArrayList<PropertyFilterSpec>(); specArr.add(spec); ManagedObjectReference propCollector = getPropCol(); List<ObjectContent> ocary = vimPort.retrieveProperties(propCollector, specArr); if (ocary == null || ocary.size() == 0) { return null; } for (ObjectContent oc : ocary) { ManagedObjectReference mor = oc.getObj(); List<DynamicProperty> propary = oc.getPropSet(); if (type == null || type.equals(mor.getType())) { if (propary.size() > 0) { String propval = (String)propary.get(0).getVal(); if (propval != null && name.equalsIgnoreCase(propval)) return mor; } } } <START> } catch (Exception e) { <END> s_logger.debug("Failed to get mor for name: " + name + " and type: " + type, e); throw e; } return null; }</code><technical_language>please catch specific exceptions, (even passthrough throwing)</technical_language>

Target:
public ManagedObjectReference getDecendentMoRef(ManagedObjectReference root, String type, String name) throws Exception { if (name == null || name.length() == 0) { return null; } try { PropertySpec pSpec = new PropertySpec(); pSpec.setType(type); pSpec.setAll(false); pSpec.getPathSet().add("name"); ObjectSpec oSpec = new ObjectSpec(); oSpec.setObj(root); oSpec.setSkip(false); oSpec.getSelectSet().addAll(constructCompleteTraversalSpec()); PropertyFilterSpec spec = new PropertyFilterSpec(); spec.getPropSet().add(pSpec); spec.getObjectSet().add(oSpec); List<PropertyFilterSpec> specArr = new ArrayList<PropertyFilterSpec>(); specArr.add(spec); ManagedObjectReference propCollector = getPropCol(); List<ObjectContent> ocary = vimPort.retrieveProperties(propCollector, specArr); if (ocary == null || ocary.size() == 0) { return null; } for (ObjectContent oc : ocary) { ManagedObjectReference mor = oc.getObj(); List<DynamicProperty> propary = oc.getPropSet(); if (type == null || type.equals(mor.getType())) { if (propary.size() > 0) { String propval = (String)propary.get(0).getVal(); if (propval != null && name.equalsIgnoreCase(propval)) return mor; } } } } catch (InvalidPropertyFaultMsg invalidPropertyException) { s_logger.debug("Failed to get Vmware ManagedObjectReference for name: " + name + " and type: " + type + " due to " + invalidPropertyException.getMessage()); throw invalidPropertyException; } catch (RuntimeFaultFaultMsg runtimeFaultException) { s_logger.debug("Failed to get Vmware ManagedObjectReference for name: " + name + " and type: " + type + " due to " + runtimeFaultException.getMessage()); throw runtimeFaultException; } return null; }
Source:
<code>public void preInit(FMLPreInitializationEvent event) { <START> Log.setModLog(event.getModLog()); <END> configDir = new File(event.getModConfigurationDirectory(), "antiqueatlas"); configDir.mkdir(); extTileIdMap = ExtTileIdMap.instance(); extTileConfig = new ExtTileConfig(new File(configDir, "tileids.json")); extTileConfig.load(extTileIdMap); registerVanillaCustomTiles(); checkSaveConfig(); }</code><technical_language>exactly, TehNut meant. add a static Log class. private static final Logger LOGGER = LogManager.getLogger(AntiqueAtlasMod.ID);</technical_language>

Target:
public void preInit(FMLPreInitializationEvent event) { configDir = new File(event.getModConfigurationDirectory(), "antiqueatlas"); configDir.mkdir(); extTileIdMap = ExtTileIdMap.instance(); extTileConfig = new ExtTileConfig(new File(configDir, "tileids.json")); extTileConfig.load(extTileIdMap); registerVanillaCustomTiles(); checkSaveConfig(); }
Source:
<code>public String buildConditionSql(String objName, String fieldName, String customizedValue, String customizedRelation, String tableName, boolean caseSensitive) { Pair<String, String> pair = new Pair<>(); pair.setFirst(customizedRelation); pair.setSecond(customizedValue); formatValue(fieldName, pair, caseSensitive); if (("''".equals(pair.getSecond()) || "'null'".equalsIgnoreCase(pair.getSecond())) && ("=".equals(pair.getFirst()) || "!=".equals(pair.getFirst()))) { String nullRelation = "=".equals(pair.getFirst()) ? "IS" : "IS NOT"; return StringFormat.format("(%1$s.%2$s %3$s NULL)", tableName, getDbFieldName(fieldName), nullRelation); } else { SearchObjectAutoCompleter.EntitySearchInfo info = SearchObjectAutoCompleter.getEntitySearchInfo(objName); if (info.commaDelimitedListColumns != null && info.commaDelimitedListColumns.contains(fieldName.toLowerCase())) { return StringFormat.format("%1$s %2$s ANY(string_to_array(%3$s.%4$s, ','))", pair.getSecond(), pair.getFirst(), tableName, getDbFieldName(fieldName)); } <START> String formatString = " %1$s.%2$s %3$s %4$s "; <END> if (pair.getFirst().equalsIgnoreCase("LIKE") || pair.getFirst().equalsIgnoreCase("ILIKE")) { formatString = " (%1$s.%2$s IS NULL OR %1$s.%2$s %3$s %4$s) "; } return StringFormat.format(formatString, tableName, getDbFieldName(fieldName), pair.getFirst(), SyntaxChecker.escapeUnderScore(pair.getSecond(), customizedRelation)); } }</code><technical_language>this moved 'else' part of new condition</technical_language>

Target:
public String buildConditionSql(String objName, String fieldName, String customizedValue, String customizedRelation, String tableName, boolean caseSensitive) { Pair<String, String> pair = new Pair<>(); pair.setFirst(customizedRelation); pair.setSecond(customizedValue); formatValue(fieldName, pair, caseSensitive); if (("''".equals(pair.getSecond()) || "'null'".equalsIgnoreCase(pair.getSecond())) && ("=".equals(pair.getFirst()) || "!=".equals(pair.getFirst()))) { String nullRelation = "=".equals(pair.getFirst()) ? "IS" : "IS NOT"; return StringFormat.format("(%1$s.%2$s %3$s NULL)", tableName, getDbFieldName(fieldName), nullRelation); } else { SearchObjectAutoCompleter.EntitySearchInfo info = SearchObjectAutoCompleter.getEntitySearchInfo(objName); if (info.commaDelimitedListColumns != null && info.commaDelimitedListColumns.contains(fieldName.toLowerCase())) { return StringFormat.format("%1$s %2$s ANY(string_to_array(%3$s.%4$s, ','))", pair.getSecond(), pair.getFirst(), tableName, getDbFieldName(fieldName)); } String formatString; if (pair.getFirst().equalsIgnoreCase("LIKE") || pair.getFirst().equalsIgnoreCase("ILIKE")) { formatString = " (%1$s.%2$s IS NULL OR %1$s.%2$s %3$s %4$s) "; } else { formatString = " %1$s.%2$s %3$s %4$s "; } return StringFormat.format(formatString, tableName, getDbFieldName(fieldName), pair.getFirst(), SyntaxChecker.escapeUnderScore(pair.getSecond(), customizedRelation)); } }
Source:
<code>public Map<String, String> getMetadataLanguages() { Map<String, String> metadataLanguages = new HashMap<>(); <START> metadataLanguages.put("English", "en"); <END> metadataLanguages.put("Deutsch", "de"); return metadataLanguages; }</code><technical_language>This pretty hardcoded, is configurable</technical_language>

Target:
public Map<String, String> getMetadataLanguages() { Map<String, String> metadataLanguages = new HashMap<>(); String[] availableMetadataLanguages = ConfigCore.getStringArrayParameter(ParameterCore.METADATA_LANGUAGE_LIST); for (String availableLanguage : availableMetadataLanguages) { String[] language = availableLanguage.split("-"); metadataLanguages.put(language[0], language[1]); } return metadataLanguages; }
Source:
<code>public Map<GroupKey, List<Result>> load(SearchKey key) throws DiscoveryException, SQLException, TskCoreException { List<Result> domainResults = getResultDomainsFromDatabase(key); <START> DiscoveryAttributes.FrequencyAttribute freqAttr = new DiscoveryAttributes.FrequencyAttribute(); <END> freqAttr.addAttributeToResults(domainResults, key.getSleuthkitCase(), key.getCentralRepository()); for (AbstractFilter filter : key.getFilters()) { if (filter.useAlternateFilter()) { domainResults = filter.applyAlternateFilter(domainResults, key.getSleuthkitCase(), key.getCentralRepository()); } } List<AttributeType> searchAttributes = new ArrayList<>(); searchAttributes.add(key.getGroupAttributeType()); searchAttributes.addAll(key.getFileSortingMethod().getRequiredAttributes()); for (AttributeType attr : searchAttributes) { attr.addAttributeToResults(domainResults, key.getSleuthkitCase(), key.getCentralRepository()); } final SearchResults searchResults = new SearchResults( key.getGroupSortingType(), key.getGroupAttributeType(), key.getFileSortingMethod()); searchResults.add(domainResults); return searchResults.toLinkedHashMap(); }</code><technical_language>I run CR for query</technical_language>

Target:
public Map<GroupKey, List<Result>> load(SearchKey key) throws DiscoveryException, SQLException, TskCoreException, InterruptedException { List<Result> domainResults = getResultDomainsFromDatabase(key); List<AttributeType> searchAttributes = new ArrayList<>(); searchAttributes.add(key.getGroupAttributeType()); searchAttributes.addAll(key.getFileSortingMethod().getRequiredAttributes()); for (AttributeType attr : searchAttributes) { if (Thread.currentThread().isInterrupted()) { throw new InterruptedException(); } attr.addAttributeToResults(domainResults, key.getSleuthkitCase(), key.getCentralRepository()); } for (AbstractFilter filter : key.getFilters()) { if (Thread.currentThread().isInterrupted()) { throw new InterruptedException(); } if (filter.useAlternateFilter()) { domainResults = filter.applyAlternateFilter(domainResults, key.getSleuthkitCase(), key.getCentralRepository()); } } final SearchResults searchResults = new SearchResults( key.getGroupSortingType(), key.getGroupAttributeType(), key.getFileSortingMethod()); searchResults.add(domainResults); return searchResults.toLinkedHashMap(); }
Source:
<code>private static SparseArray<String> getStringsForLocale(Locale targetLocale, @StringRes int[] strings) { <START> Resources currentResources = WikipediaApp.getInstance().getResources(); <END> Configuration config = new Configuration(currentResources.getConfiguration()); Locale systemLocale = config.locale; config.locale = targetLocale; SparseArray<String> localizedStrings = new SparseArray<>(); Resources targetResources = new Resources(currentResources.getAssets(), currentResources.getDisplayMetrics(), config); for (int stringRes : strings) { localizedStrings.put(stringRes, targetResources.getString(stringRes)); } config.locale = systemLocale; new Resources(currentResources.getAssets(), currentResources.getDisplayMetrics(), config); return localizedStrings; }</code><technical_language>a helper method for lines called localizedResources something</technical_language>

Target:
private static SparseArray<String> getStringsForLocale(Locale targetLocale, @StringRes int[] strings) { Configuration config = getCurrentConfiguration(); Locale systemLocale = config.locale; config.locale = targetLocale; SparseArray<String> localizedStrings = getTargetStrings(strings, config); config.locale = systemLocale; resetConfiguration(config); return localizedStrings; }
Source:
<code>private void setFalseChecked() { if (OPTION_CHECKED != null) { <START> OPTION_CHECKED.clear(); <END> setFalse(); } }</code><technical_language>ok, .clear() do ... no</technical_language>

Target:
private void setFalseChecked() { if (OPTION_CHECKED != null) { setFalse(); } }
Source:
<code>public void shouldSaveConditionInRulesPage() throws DotSecurityException, DotDataException { final Role role = new RoleDataGen().nextPersisted(); final User user = new UserDataGen().roles(role).nextPersisted(); final Host host = new SiteDataGen().nextPersisted(); final Template template = new TemplateDataGen().nextPersisted(); final HTMLPageAsset htmlPageAsset = new HTMLPageDataGen(host, template) .nextPersisted(); addPermission(role, htmlPageAsset, PermissionAPI.PERMISSION_PUBLISH); addRulesPermission(role, host, true); final Rule rule = new RuleDataGen().page(htmlPageAsset).nextPersisted(); final ConditionGroup conditionGroup = new ConditionGroupDataGen().rule(rule).next(); <START> this.addRulesPermission(role, host, true); <END> rulesAPI.saveConditionGroup(conditionGroup, user, false); List<Rule> allRules = rulesAPI.getAllRules(user, false); checkCondition(user, conditionGroup, allRules); }</code><technical_language>is this done again? done in line 111</technical_language>

Target:
public void shouldSaveConditionInRulesPage() throws DotSecurityException, DotDataException { final Role role = new RoleDataGen().nextPersisted(); final User user = new UserDataGen().roles(role).nextPersisted(); final Host host = new SiteDataGen().nextPersisted(); final Template template = new TemplateDataGen().nextPersisted(); final HTMLPageAsset htmlPageAsset = new HTMLPageDataGen(host, template) .nextPersisted(); addPermission(role, htmlPageAsset, PermissionAPI.PERMISSION_PUBLISH); addRulesPublishPermissions(role, host); final Rule rule = new RuleDataGen().page(htmlPageAsset).nextPersisted(); final ConditionGroup conditionGroup = new ConditionGroupDataGen().rule(rule).next(); rulesAPI.saveConditionGroup(conditionGroup, user, false); List<Rule> allRules = rulesAPI.getAllRules(user, false); createConditionAndCheck(user, conditionGroup, allRules); }