auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void deliver_updates_through_several_threads() throws InterruptedException { final int threadsCount = Given.THREADS_COUNT_IN_POOL_EXECUTOR; @SuppressWarnings("LocalVariableNamingConvention") final int threadExecutionMaxAwaitSeconds = Given.AWAIT_SECONDS; <START> final Map<String, Object> threadInvocationRegistry = new ConcurrentHashMap<>(threadsCount); <END> final Stand stand = mock(Stand.class); doNothing().when(stand).update(ArgumentMatchers.any(), any(Any.class)); final StandFunnel standFunnel = StandFunnel.newBuilder() .setStand(stand) .build(); final ExecutorService processes = Executors.newFixedThreadPool(threadsCount); final Runnable task = new Runnable() { @Override public void run() { final String threadName = Thread.currentThread().getName(); Assert.assertFalse(threadInvocationRegistry.containsKey(threadName)); standFunnel.post(new Object(), Any.getDefaultInstance()); threadInvocationRegistry.put(threadName, new Object()); } }; for (int i = 0; i < threadsCount; i++) { processes.execute(task); } processes.awaitTermination(threadExecutionMaxAwaitSeconds, TimeUnit.SECONDS); Assert.assertEquals(threadInvocationRegistry.size(), threadsCount); }</code><technical_language>do need Map? Set is enough</technical_language>

Target:
public void deliver_updates_through_several_threads() throws InterruptedException { final int threadsCount = Given.THREADS_COUNT_IN_POOL_EXECUTOR; @SuppressWarnings("LocalVariableNamingConvention") final int threadExecutionMaxAwaitSeconds = Given.AWAIT_SECONDS; final Set<String> threadInvocationRegistry = new ConcurrentSet<>(); final Stand stand = mock(Stand.class); doNothing().when(stand).update(ArgumentMatchers.any(), any(Any.class)); final StandFunnel standFunnel = StandFunnel.newBuilder() .setStand(stand) .build(); final ExecutorService executor = Executors.newFixedThreadPool(threadsCount); final Runnable task = new Runnable() { @Override public void run() { final String threadName = Thread.currentThread().getName(); Assert.assertFalse(threadInvocationRegistry.contains(threadName)); standFunnel.post(new Object(), Any.getDefaultInstance()); threadInvocationRegistry.add(threadName); } }; for (int i = 0; i < threadsCount; i++) { executor.execute(task); } executor.awaitTermination(threadExecutionMaxAwaitSeconds, TimeUnit.SECONDS); Assert.assertEquals(threadInvocationRegistry.size(), threadsCount); }
Source:
<code>public void testSaveAllAndFindAll() { final Mono<Void> deletedMono = repository.deleteAll(); StepVerifier.create(deletedMono).thenAwait().verifyComplete(); Flux<LongIdDomainPartition> savedAllFlux = this.repository.saveAll(Arrays.asList(DOMAIN_1, DOMAIN_2)); <START> StepVerifier.create(savedAllFlux).thenConsumeWhile(domain -> true).expectComplete().verify(); <END> final Flux<LongIdDomainPartition> allFlux = repository.findAll(); StepVerifier.create(allFlux).expectNextCount(2).verifyComplete(); }</code><technical_language>verify count well, done below</technical_language>

Target:
public void testSaveAllAndFindAll() { final Mono<Void> deletedMono = repository.deleteAll(); StepVerifier.create(deletedMono).thenAwait().verifyComplete(); Flux<LongIdDomainPartition> savedAllFlux = this.repository.saveAll(Arrays.asList(DOMAIN_1, DOMAIN_2)); StepVerifier.create(savedAllFlux).expectNextCount(2).verifyComplete(); final Flux<LongIdDomainPartition> allFlux = repository.findAll(); StepVerifier.create(allFlux).expectNextCount(2).verifyComplete(); }
Source:
<code><START> void markDependencyCancelled(final DependencyInstanceContext context) { <END> this.executorService.submit(() -> { final DependencyInstance depInst = findDependencyInstanceByContext(context); if (depInst != null) { logger.info( String.format("setting dependency instance[id: %s, name: %s] status to cancelled", depInst.getTriggerInstance().getId(), depInst.getDepName())); if (cancelledByDependencyPlugin(depInst)) { processStatusAndCancelCauseUpdate(depInst, Status.CANCELLING, CancellationCause.FAILURE); cancelTriggerInstance(depInst.getTriggerInstance()); } else if (cancelledByAzkaban(depInst)) { processStatusUpdate(depInst, Status.CANCELLED); } else { logger.warn(String.format("OnCancel of dependency instance[id: %s, name: %s] is ignored", depInst.getTriggerInstance().getId(), depInst.getDepName())); return; } if (depInst.getTriggerInstance().getStatus() == Status.CANCELLED) { logger.info( String.format("trigger instance with execId %s is cancelled", depInst.getTriggerInstance().getId())); this.triggerProcessor.processTermination(depInst.getTriggerInstance()); removeRunningTriggerInstById(depInst.getTriggerInstance().getId()); } } else { logger.warn(String.format("unable to find trigger instance with context %s when marking " + "it cancelled", context)); } }); }</code><technical_language>public please</technical_language>

Target:
public void markDependencyCancelled(final DependencyInstanceContext context) { this.executorService.submit(() -> { final DependencyInstance depInst = findDependencyInstanceByContext(context); if (depInst != null) { logger.info( String.format("setting dependency instance[id: %s, name: %s] status to cancelled", depInst.getTriggerInstance().getId(), depInst.getDepName())); if (cancelledByDependencyPlugin(depInst)) { processStatusAndCancelCauseUpdate(depInst, Status.CANCELLING, CancellationCause.FAILURE); cancelTriggerInstance(depInst.getTriggerInstance()); } else if (cancelledByAzkaban(depInst)) { processStatusUpdate(depInst, Status.CANCELLED); } else { logger.warn(String.format("OnCancel of dependency instance[id: %s, name: %s] is ignored", depInst.getTriggerInstance().getId(), depInst.getDepName())); return; } if (depInst.getTriggerInstance().getStatus() == Status.CANCELLED) { logger.info( String.format("trigger instance with execId %s is cancelled", depInst.getTriggerInstance().getId())); this.triggerProcessor.processTermination(depInst.getTriggerInstance()); removeRunningTriggerInstById(depInst.getTriggerInstance().getId()); } } else { logger.warn(String.format("unable to find trigger instance with context %s when marking " + "it cancelled", context)); } }); }
Source:
<code><START> public void aspectPotionEffect(TickEvent.PlayerTickEvent event) { <END> SburbConnection c = SkaianetHandler.getMainConnection(IdentifierHandler.encode(event.player), true); if(c==null || !c.enteredGame() || MinestuckConfig.aspectEffects == false) return; int rung = MinestuckPlayerData.getData(IdentifierHandler.encode(event.player)).echeladder.getRung(); EnumAspect aspect = MinestuckPlayerData.getTitle(IdentifierHandler.encode(event.player)).getHeroAspect(); int potionLevel = (int) (aspectStrength[aspect.ordinal()] * rung); if(event.player.getEntityWorld().getTotalWorldTime() % 380 == IdentifierHandler.encode(event.player).hashCode() % 380) { if(rung > 22 && aspect == HOPE) { event.player.addPotionEffect(new PotionEffect(MobEffects.WATER_BREATHING, 600, 0)); } if(potionLevel > 0) { event.player.addPotionEffect(new PotionEffect(aspectEffects[aspect.ordinal()], 600, potionLevel-1)); } } }</code><technical_language>Line break {</technical_language>

Target:
public void aspectPotionEffect(TickEvent.PlayerTickEvent event) { IdentifierHandler.PlayerIdentifier identifier = IdentifierHandler.encode(event.player); SburbConnection c = SkaianetHandler.getMainConnection(identifier, true); if(c == null || !c.enteredGame() || MinestuckConfig.aspectEffects == false) return; int rung = MinestuckPlayerData.getData(identifier).echeladder.getRung(); EnumAspect aspect = MinestuckPlayerData.getTitle(identifier).getHeroAspect(); int potionLevel = (int) (aspectStrength[aspect.ordinal()] * rung); if(event.player.getEntityWorld().getTotalWorldTime() % 380 == identifier.hashCode() % 380) { if(rung > 18 && aspect == HOPE) { event.player.addPotionEffect(new PotionEffect(MobEffects.WATER_BREATHING, 600, 0)); } if(potionLevel > 0) { event.player.addPotionEffect(new PotionEffect(aspectEffects[aspect.ordinal()], 600, potionLevel-1)); } } }
Source:
<code>private void setDisableP2Mirrors(TargetPlatformConfiguration result, Xpp3Dom configuration) { Xpp3Dom disableP2mirrorsDom = configuration.getChild("disableP2Mirrors"); if (disableP2mirrorsDom != null) { String message = "Unsupported target-platform-configuration <disableP2Mirrors>. Use tycho.disableP2Mirrors -D command line parameter or settings.xml property."; <START> throw new RuntimeException(message); <END> } }</code><technical_language>this a warning ignore pom configuration? a parent pom projects <disableP2Mirrors></technical_language>

Target:
private void setDisableP2Mirrors(TargetPlatformConfiguration result, Xpp3Dom configuration) { Xpp3Dom disableP2mirrorsDom = configuration.getChild("disableP2Mirrors"); if (disableP2mirrorsDom != null) { logger.warn("Unsupported target-platform-configuration <disableP2Mirrors>. Use tycho.disableP2Mirrors -D command line parameter or settings.xml property."); } }
Source:
<code>public ChoiceParameterDefinition(String name, String choices, String description) { super(name, description); <START> this.choices = Arrays.asList(choices.split(CHOICES_DELIMITER)); <END> defaultValue = null; }</code><technical_language>setChoicesText</technical_language>

Target:
public ChoiceParameterDefinition(String name, String choices, String description) { super(name, description); setChoicesText(choices); defaultValue = null; }
Source:
<code>public String toString() { return "ResourceMethodConfigImpl{" + "_timeoutMs=" + _timeoutMs + ", _validateQueryParams=" + _validateQueryParams + <START> ", _validateResourceKeyParams=" + _validateResourceKeys + <END> "}"; }</code><technical_language>nit: update this string</technical_language>

Target:
public String toString() { return "ResourceMethodConfigImpl{" + "_timeoutMs=" + _timeoutMs + ", _validateQueryParams=" + _validateQueryParams + ", _validateResourceKeys=" + _validateResourceKeys + "}"; }
Source:
<code>public static RequestPath parse(RestRequest restRequest, List<String> prefixesToRemove, String clusterName) throws RestServiceException { String blobIdHeader = RestUtils.getHeader(restRequest.getArgs(), Headers.BLOB_ID, false); if (blobIdHeader != null) { int nextOffset = matchPathSegments(blobIdHeader, 0, clusterName, true); <START> String blobIdStr = nextOffset >= 0 ? blobIdHeader.substring(nextOffset) : blobIdHeader; <END> restRequest.setArg(Headers.BLOB_ID, blobIdStr); } return parse(restRequest.getPath(), restRequest.getArgs(), prefixesToRemove, clusterName); }</code><technical_language>do this is consistent signedChunkId: String blobIdHeader = RestUtils.getHeader(restRequest.getArgs(), RestUtils.Headers.BLOB_ID, false); if (blobIdHeader != null) { String blobIdStr = parse(blobIdHeader, Collections.emptyMap(), prefixesToRemove, clusterName).getOperationOrBlobId(false); restRequest.setArg(RestUtils.Headers.BLOB_ID, blobIdStr); } This ensure resources stripped off, code handle</technical_language>

Target:
public static RequestPath parse(RestRequest restRequest, List<String> prefixesToRemove, String clusterName) throws RestServiceException { String blobIdHeader = RestUtils.getHeader(restRequest.getArgs(), Headers.BLOB_ID, false); if (blobIdHeader != null) { String blobIdStr = parse(blobIdHeader, Collections.emptyMap(), prefixesToRemove, clusterName).getOperationOrBlobId(false); restRequest.setArg(Headers.BLOB_ID, blobIdStr); } return parse(restRequest.getPath(), restRequest.getArgs(), prefixesToRemove, clusterName); }
Source:
<code>public void testCreateRoute() { gateway = gwApi.createInternetGateway(TEST_REGION, InternetGatewayOptions.NONE); assertNotNull(gateway, "Gateway was not successfully created"); final Boolean attached = gwApi.attachInternetGateway(TEST_REGION, gateway.id(), vpc.id()); assertTrue(attached, "Gateway " + gateway.id() + " failed to attach to VPC " + vpc.id()); final boolean created = routeTableApi.createRoute(TEST_REGION, routeTable.id(), gatewayId(gateway.id()) .destinationCidrBlock(TEST_DESTINATION_CIDR)); assertTrue(created, "Failed to add route to table " + routeTable.id()); final ImmutableList<RouteTable> routeTables = routeTableApi.describeRouteTables(TEST_REGION, routeTable.id()).toList(); assertEquals(routeTables.size(), 1, "Could not find existing route table " + routeTable.id()); boolean foundRoute = false; <START> for (Route route : routeTables.get(0).routeSet()) { <END> if (route.gatewayId().equals(gateway.id())) { foundRoute = true; assertEquals(route.destinationCidrBlock(), TEST_DESTINATION_CIDR, "CIDR routed through " + gateway.id() + " does not match specification " + TEST_DESTINATION_CIDR); break; } } assertTrue(foundRoute, "Could not find route added to gateway " + gateway.id()); }</code><technical_language>Apply pattern mentioned instead of loops flags</technical_language>

Target:
public void testCreateRoute() { gateway = gwApi.createInternetGateway(TEST_REGION, InternetGatewayOptions.NONE); assertNotNull(gateway, "Gateway was not successfully created"); final Boolean attached = gwApi.attachInternetGateway(TEST_REGION, gateway.id(), vpc.id()); assertTrue(attached, "Gateway " + gateway.id() + " failed to attach to VPC " + vpc.id()); final boolean created = routeTableApi.createRoute(TEST_REGION, routeTable.id(), gatewayId(gateway.id()) .destinationCidrBlock(TEST_DESTINATION_CIDR)); assertTrue(created, "Failed to add route to table " + routeTable.id()); final ImmutableList<RouteTable> routeTables = routeTableApi.describeRouteTables(TEST_REGION, routeTable.id()).toList(); assertEquals(routeTables.size(), 1, "Could not find existing route table " + routeTable.id()); Optional<Route> optRoute = Iterables.tryFind(routeTables.get(0).routeSet(), new Predicate<Route>() { @Override public boolean apply(Route route) { return route.gatewayId().equals(gateway.id()); } }); assertTrue(optRoute.isPresent(), "Could not find route added to gateway " + gateway.id()); Route route = optRoute.get(); assertEquals(route.destinationCidrBlock(), TEST_DESTINATION_CIDR, "CIDR routed through " + gateway.id() + " does not match specification " + TEST_DESTINATION_CIDR); }
Source:
<code>public boolean isTerminated() { for (ComputationPool pool : pools) { if (!pool.isTerminated()) { return false; } } <START> return true; <END> }</code><technical_language>Stream solution: return pools.stream().allMatch(ComputationPool::isTerminated)</technical_language>

Target:
public boolean isTerminated() { return pools.stream().allMatch(ComputationPool::isTerminated); }
Source:
<code>public void shutdown() throws InterruptedException { <START> if (_periodicRebalancerFutureTasks != null) { _periodicRebalancerFutureTasks.cancel(false); } <END> _periodicalRebalanceExecutor.shutdown(); stopPeriodRebalance(); shutdownOnDemandTimer(); logger.info("Shutting down pipeline", Pipeline.Type.DEFAULT.name()); shutdownPipeline(_eventThread, _eventQueue); logger.info("Shutting down pipeline", Pipeline.Type.TASK.name()); shutdownPipeline(_taskEventThread, _taskEventQueue); _asyncTasksThreadPool.shutdownNow(); try { _asyncTasksThreadPool.awaitTermination(EVENT_THREAD_JOIN_TIMEOUT, TimeUnit.MILLISECONDS); } catch (InterruptedException ex) { logger.warn("Timeout when terminating async tasks. Some async tasks are still executing."); } shutdownAsyncFIFOWorkers(); enableClusterStatusMonitor(false); _rebalancerRef.closeRebalancer(); }</code><technical_language>need cancel task while stopPeriodRebalance is called here</technical_language>

Target:
public void shutdown() throws InterruptedException { stopPeriodRebalance(); _periodicalRebalanceExecutor.shutdown(); if (!_periodicalRebalanceExecutor .awaitTermination(EVENT_THREAD_JOIN_TIMEOUT, TimeUnit.MILLISECONDS)) { _periodicalRebalanceExecutor.shutdownNow(); } shutdownOnDemandTimer(); logger.info("Shutting down pipeline", Pipeline.Type.DEFAULT.name()); shutdownPipeline(_eventThread, _eventQueue); logger.info("Shutting down pipeline", Pipeline.Type.TASK.name()); shutdownPipeline(_taskEventThread, _taskEventQueue); _asyncTasksThreadPool.shutdownNow(); try { _asyncTasksThreadPool.awaitTermination(EVENT_THREAD_JOIN_TIMEOUT, TimeUnit.MILLISECONDS); } catch (InterruptedException ex) { logger.warn("Timeout when terminating async tasks. Some async tasks are still executing."); } shutdownAsyncFIFOWorkers(); enableClusterStatusMonitor(false); _rebalancerRef.closeRebalancer(); }
Source:
<code>private static void checkInitialized() { if (httpClient == null) { <START> throw new IllegalStateException("HttpClient is not initialized."); <END> } }</code><technical_language>this HttpCustomHeaderClient , HttpClient</technical_language>

Target:
private static void checkInitialized() { if (httpClient == null) { throw new IllegalStateException("HttpCustomHeaderClient is not initialized."); } }
Source:
<code>private void handleParameter(Symbol parameter) { Type leastSpecificType = findLeastSpecificType(parameter); <START> if (!parameter.type().is(leastSpecificType.fullyQualifiedName()) <END> && !leastSpecificType.is("java.lang.Object")) { String suggestedType = leastSpecificType.fullyQualifiedName().replace('$', '.'); reportIssue(parameter.declaration(), String.format("Use '%s' here; it is a more general type than '%s'.", suggestedType, parameter.type().name())); } }</code><technical_language>equals (and ==) FQN</technical_language>

Target:
private void handleParameter(Symbol parameter) { Type leastSpecificType = findLeastSpecificType(parameter); if (parameter.type() != leastSpecificType && !leastSpecificType.is("java.lang.Object")) { String suggestedType = leastSpecificType.fullyQualifiedName().replace('$', '.'); reportIssue(parameter.declaration(), String.format("Use '%s' here; it is a more general type than '%s'.", suggestedType, parameter.type().name())); } }
Source:
<code>public void twoOperatorsStoreRetrieveWithMessageSelectorTransactionTest() { createOperator(); outputOperator.beginWindow(0L); outputOperator.endWindow(); JMSStringSinglePortOutputOperator outputOperator2 = createOperator2(); outputOperator2.beginWindow(1L); outputOperator2.endWindow(); long windowIdOp = outputOperator.getStore().getCommittedWindowId(APP_ID, OPERATOR_ID); Assert.assertEquals(0L, windowIdOp); long windowIdOp2 = outputOperator2.getStore().getCommittedWindowId(APP_ID, OPERATOR_2_ID); Assert.assertEquals(1L, windowIdOp2); <START> deleteOperator(); <END> outputOperator2.teardown(); }</code><technical_language>refactor deleteOperator operator argument for outputOperator outputOperstor2</technical_language>

Target:
public void twoOperatorsStoreRetrieveWithMessageSelectorTransactionTest() { JMSStringSinglePortOutputOperator jmsOutputOperator = createOperator(testOperatorContext); jmsOutputOperator.beginWindow(0L); jmsOutputOperator.endWindow(); JMSStringSinglePortOutputOperator jmsOutputOperator2 = createOperator(testOperator2Context); jmsOutputOperator2.beginWindow(1L); jmsOutputOperator2.endWindow(); long windowIdOp = jmsOutputOperator.getStore().getCommittedWindowId(APP_ID, OPERATOR_ID); Assert.assertEquals(0L, windowIdOp); long windowIdOp2 = jmsOutputOperator2.getStore().getCommittedWindowId(APP_ID, OPERATOR_2_ID); Assert.assertEquals(1L, windowIdOp2); jmsOutputOperator.teardown(); jmsOutputOperator2.teardown(); }
Source:
<code>protected double getServoAngleRange() { <START> return ServoSubsystem.kMaxServoAngle - ServoSubsystem.kMinServoAngle; <END> }</code><technical_language>passed in values</technical_language>

Target:
protected static double getServoAngleRange() { return ServoSubsystem.MAX_SERVO_ANGLE - ServoSubsystem.MIN_SERVO_ANGLE; }
Source:
<code>private <T extends PlanNode> void findAllRecursive(PlanNode node, ImmutableList.Builder<T> nodes) { node = lookup.resolve(node); if (where.test(node)) { nodes.add((T) node); } <START> if (skipOnly.test(node) || where.test(node)) { <END> for (PlanNode source : node.getSources()) { findAllRecursive(source, nodes); } } }</code><technical_language>skipOnly is named terribly wrong. long means "continue search when", _not_ modify this if</technical_language>

Target:
private <T extends PlanNode> void findAllRecursive(PlanNode node, ImmutableList.Builder<T> nodes) { node = lookup.resolve(node); if (where.test(node)) { nodes.add((T) node); } if (skipOnly.test(node)) { for (PlanNode source : node.getSources()) { findAllRecursive(source, nodes); } } }
Source:
<code>public Expr apply(final List<Expr> args) { if (args.size() < 1 || args.size() > 3) { throw new IAE("'%s' must have 1 to 3 arguments", name()); } final Expr arg = args.get(0); final String formatString = args.size() > 1 ? (String) args.get(1).getLiteralValue() : null; <START> final DateTimeZone timeZone = args.size() > 2 <END> ? DateTimeZone.forID((String) args.get(2).getLiteralValue()) : DateTimeZone.UTC; final DateTimeFormatter formatter = formatString == null ? ISODateTimeFormat.dateTime() : DateTimeFormat.forPattern(formatString).withZone(timeZone); class TimestampFormatExpr implements Expr { @Nonnull @Override public ExprEval eval(final ObjectBinding bindings) { return ExprEval.of(formatter.print(arg.eval(bindings).asLong())); } @Override public void visit(final Visitor visitor) { arg.visit(visitor); visitor.visit(this); } } return new TimestampFormatExpr(); }</code><technical_language>Please if-else</technical_language>

Target:
public Expr apply(final List<Expr> args) { if (args.size() < 1 || args.size() > 3) { throw new IAE("Function[%s] must have 1 to 3 arguments", name()); } final Expr arg = args.get(0); final String formatString; final DateTimeZone timeZone; if (args.size() > 1) { Preconditions.checkArgument(args.get(1).isLiteral(), "Function[%s] format arg must be a literal", name()); formatString = (String) args.get(1).getLiteralValue(); } else { formatString = null; } if (args.size() > 2) { timeZone = ExprUtils.toTimeZone(args.get(2)); } else { timeZone = DateTimeZone.UTC; } final DateTimeFormatter formatter = formatString == null ? ISODateTimeFormat.dateTime() : DateTimeFormat.forPattern(formatString).withZone(timeZone); class TimestampFormatExpr implements Expr { @Nonnull @Override public ExprEval eval(final ObjectBinding bindings) { return ExprEval.of(formatter.print(arg.eval(bindings).asLong())); } @Override public void visit(final Visitor visitor) { arg.visit(visitor); visitor.visit(this); } } return new TimestampFormatExpr(); }
Source:
<code>protected int getMaxRampStage() { <START> return 5; <END> }</code><technical_language>enums constants instead of hardcoded numbers here? Also, making RAMP_STAGE_MAX protected good enough avoids this function</technical_language>

Target:
protected int getMaxRampStage() { return MAX_RAMP_STAGE; }
Source:
<code>public void uninstall() { IWorkbenchPartSite site= fTextEditor.getSite(); IWorkbenchWindow window; if (site == null) { window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); } else { window= site.getWorkbenchWindow(); <START> } <END> window.getPartService().removePartListener(fPartListener); fPartListener= null; Shell shell= window.getShell(); if (shell != null && !shell.isDisposed()) shell.removeShellListener(fActivationListener); fActivationListener= null; JavaCore.removeElementChangedListener(fJavaElementChangedListener); fJavaElementChangedListener= null; IWorkspace workspace= JavaPlugin.getWorkspace(); workspace.removeResourceChangeListener(fResourceChangeListener); fResourceChangeListener= null; JavaPlugin.getDefault().getCombinedPreferenceStore().removePropertyChangeListener(fPropertyChangeListener); fPropertyChangeListener= null; super.uninstall(); }</code><technical_language>This is a workaround. site.getWorkbenchWindow() 'null' this point. Also, workaround is wrong, reconciler uninstalled a non-active window, e.g. exit</technical_language>

Target:
public void uninstall() { IWorkbenchPartSite site= fTextEditor.getSite(); IWorkbenchWindow window; if (site == null) { window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); } else { window= site.getWorkbenchWindow(); } if (window != null && !PlatformUI.getWorkbench().isClosing()) { window.getPartService().removePartListener(fPartListener); fPartListener= null; Shell shell= window.getShell(); if (shell != null && !shell.isDisposed()) shell.removeShellListener(fActivationListener); fActivationListener= null; } JavaCore.removeElementChangedListener(fJavaElementChangedListener); fJavaElementChangedListener= null; IWorkspace workspace= JavaPlugin.getWorkspace(); workspace.removeResourceChangeListener(fResourceChangeListener); fResourceChangeListener= null; JavaPlugin.getDefault().getCombinedPreferenceStore().removePropertyChangeListener(fPropertyChangeListener); fPropertyChangeListener= null; super.uninstall(); }
Source:
<code>private boolean isNewerFormVersionAvailable(DriveListItem item) { FormsDao formsDao = new FormsDao(); <START> Cursor cursor = formsDao.getFormsCursorForFormFilePath(new StoragePathProvider().getDirPath(StorageSubdirectory.FORMS) + File.separator + item.getName()); <END> if (cursor != null && cursor.moveToFirst()) { Long lastModifiedLocal = new File(new StoragePathProvider().getDirPath(StorageSubdirectory.FORMS) + File.separator + item.getName()).lastModified(); Long lastModifiedServer = item.getDate().getValue(); return lastModifiedServer > lastModifiedLocal; } return false; }</code><technical_language>cursor closed/ [try-with-resources](<LINK_0> for that</technical_language>

Target:
private boolean isNewerFormVersionAvailable(DriveListItem item) { Long lastModifiedLocal = new File(storagePathProvider.getDirPath(StorageSubdirectory.FORMS) + File.separator + item.getName()).lastModified(); Long lastModifiedServer = item.getDate().getValue(); return lastModifiedServer > lastModifiedLocal; }
Source:
<code>private String getItemType(Item i) { Item item = i; if(i instanceof GroupItem){ <START> logger.debug("mySQL: Item is GroupItem, try to find ItemType by BaseItem"); <END> item = ((GroupItem) i).getBaseItem(); if(item == null){ logger.debug("mySQL: BaseItem GroupItem:<ItemType> is not defined in *.items searching for first Member and try to use as ItemType"); item = ((GroupItem) i).getMembers().get(0); if(item == null){ logger.debug("mySQL: ItemType NOT found! Use STRINGITEM now."); return sqlTypes.get("STRINGITEM"); } logger.debug("mySQL: ItemType found by first Member!"); } } String itemType = item.getClass().toString().toUpperCase(); itemType = itemType.substring(itemType.lastIndexOf('.') + 1); if(sqlTypes.get(itemType) == null) return sqlTypes.get("STRINGITEM"); return sqlTypes.get(itemType); }</code><technical_language>please add itemName log statement (using parameterised logging) for sake of readability of logs (also applies subsequent statements) image log hand try give advice problem be</technical_language>

Target:
private String getItemType(Item i) { Item item = i; if(i instanceof GroupItem){ item = ((GroupItem) i).getBaseItem(); if(item == null){ logger.debug("mySQL: Cannot detect ItemType for because the GroupItems' base type isn't set in *.items File.", i.getName()); item = ((GroupItem) i).getMembers().get(0); if(item == null){ logger.debug("mySQL: No ItemType found for first Child-Member of GroupItem {}, use ItemType STRINGITEM ({}) as Fallback", i.getName(), sqlTypes.get("STRINGITEM")); return sqlTypes.get("STRINGITEM"); } } } String itemType = item.getClass().getSimpleName().toUpperCase(); if(sqlTypes.get(itemType) == null){ logger.debug("mySQL: No sqlType found for ItemType {}, use ItemType STRINGITEM ({}) as Fallback for {}", itemType, sqlTypes.get("STRINGITEM"), i.getName()); return sqlTypes.get("STRINGITEM"); } logger.debug("mySQL: Use ItemType ({}) for Item {}", itemType, sqlTypes.get(itemType), itemType, i.getName()); return sqlTypes.get(itemType); }
Source:
<code>private void removeDeletedRows() { <START> SortedSet<Cell> cp = (SortedSet<Cell>)((TreeSet<Cell>)dataToReturn).clone(); <END> for (Cell element : cp) { long timestamp = element.getTimestamp(); if (timestamp == maxTombstoneTimestamp && shouldRemoveMostRecentTombstone()) dataToReturn.remove(element); else if (timestamp < maxTombstoneTimestamp) { dataToReturn.remove(element); } } }</code><technical_language>This here, remove clone() ? I able iterator .remove() method iterator do this in a single pass</technical_language>

Target:
private void removeDeletedRows() { Iterator<Cell> it = dataToReturn.iterator(); while (it.hasNext()) { Cell element = it.next(); long timestamp = element.getTimestamp(); if (timestamp == maxTombstoneTimestamp && shouldRemoveMostRecentTombstone()) it.remove(); else if (timestamp < maxTombstoneTimestamp) { it.remove(); } } }
Source:
<code>private void setupOpenSearch() throws IOException { Map<String, Object> openSearchProperties = getOpenSearchSourceProperties( OPENSEARCH_SOURCE_ID, OPENSEARCH_PATH.getUrl(), getServiceManager()); <START> getServiceManager().createManagedService(OPENSEARCH_FACTORY_PID, openSearchProperties).getPid(); <END> }</code><technical_language>Do need of getPid() calls</technical_language>

Target:
private void setupOpenSearch() throws IOException { Map<String, Object> openSearchProperties = getOpenSearchSourceProperties( OPENSEARCH_SOURCE_ID, OPENSEARCH_PATH.getUrl(), getServiceManager()); getServiceManager().createManagedService(OPENSEARCH_FACTORY_PID, openSearchProperties); }
Source:
<code>protected String getHandledTableName(DbMapComponent component, String tableName, String alias) { if (alias == null) { return replaceVariablesForExpression(component, tableName); } else { List<IConnection> inputConnections = (List<IConnection>) component.getIncomingConnections(); IConnection iconn = this.getConnectonByName(inputConnections, tableName); String handledTableName = ""; boolean inputIsELTDBMap = false; INode source = iconn.getSource(); String schemaValue = ""; String tableValue = ""; if (source != null) { inputIsELTDBMap = isELTDBMap(source); if (inputIsELTDBMap) { tableValue = iconn.getName(); } else { IElementParameter schemaParam = source.getElementParameter("ELT_SCHEMA_NAME"); IElementParameter tableParam = source.getElementParameter("ELT_TABLE_NAME"); if (schemaParam != null && schemaParam.getValue() != null) { schemaValue = schemaParam.getValue().toString(); } if (tableParam != null && tableParam.getValue() != null) { tableValue = tableParam.getValue().toString(); } } } <START> String schemaNoQuote = TalendTextUtils.removeQuotes(schemaValue); <END> boolean hasSchema = !"".equals(schemaNoQuote); if (hasSchema) { handledTableName = schemaValue + "+\".\"+"; } handledTableName = handledTableName + tableValue; return "\" +" + handledTableName + "+ \""; } }</code><technical_language>some junits test mothod "getHandledTableName"</technical_language>

Target:
protected String getHandledTableName(DbMapComponent component, String tableName, String alias) { if (alias == null) { return replaceVariablesForExpression(component, tableName); } else { List<IConnection> inputConnections = (List<IConnection>) component.getIncomingConnections(); IConnection iconn = this.getConnectonByName(inputConnections, tableName); if (iconn != null) { String handledTableName = ""; boolean inputIsELTDBMap = false; INode source = iconn.getSource(); String schemaValue = ""; String tableValue = ""; if (source != null) { inputIsELTDBMap = isELTDBMap(source); if (inputIsELTDBMap) { tableValue = iconn.getName(); } else { IElementParameter schemaParam = source.getElementParameter("ELT_SCHEMA_NAME"); IElementParameter tableParam = source.getElementParameter("ELT_TABLE_NAME"); if (schemaParam != null && schemaParam.getValue() != null) { schemaValue = schemaParam.getValue().toString(); } if (tableParam != null && tableParam.getValue() != null) { tableValue = tableParam.getValue().toString(); } } } String schemaNoQuote = TalendTextUtils.removeQuotes(schemaValue); boolean hasSchema = !"".equals(schemaNoQuote); if (hasSchema) { handledTableName = schemaValue + "+\".\"+"; } handledTableName = handledTableName + tableValue; return "\" +" + handledTableName + "+ \""; } } return tableName; }
Source:
<code>catch (PrivilegedActionException pae) { <START> <END> }</code><technical_language>I catch block for ClassNotFoundException throw this catch block, bad practice</technical_language>

Target:
catch (PrivilegedActionException pae) { LogMessages.LOGGER.error(pae); }
Source:
<code>public EncryptionGroup(List<Integer> nodes, Optional<Slice> keyMetadata, Slice statistics) { <START> this.nodes = ImmutableList.copyOf(nodes); <END> this.keyMetadata = keyMetadata; this.statistics = statistics; }</code><technical_language>requireNotNull for arguments</technical_language>

Target:
public EncryptionGroup(List<Integer> nodes, Optional<Slice> keyMetadata, Slice statistics) { this.nodes = ImmutableList.copyOf(requireNonNull(nodes, "nodes is null")); this.keyMetadata = requireNonNull(keyMetadata, "keyMetadata is null"); this.statistics = requireNonNull(statistics, "statistics is null"); }
Source:
<code>public static InputStream loadResource(String resourceFile) { InputStream stream = null; try { String file = localResourceDir + resourceFile; if (!new File(file).exists()) { logger.debug("Loading from classpath", resourceFile); <START> stream = ResourceUtilities.class.getResourceAsStream("/"+resourceFile); <END> } else { logger.debug("Loading from local directory", resourceFile); stream = new FileInputStream(file); } stream = checkGZipped(stream); } catch (Exception e) { logger.error("Could not load {}. Exception {}", resourceFile, e.toString()); System.exit(-1); } return stream; }</code><technical_language>if is a problem IOUtils.lsResources() method, please create issue give example</technical_language>

Target:
public static InputStream loadResource(String resourceFile) { InputStream stream = null; try { String file = localResourceDir + resourceFile; if (!new File(file).exists()) { logger.debug("Loading from classpath", resourceFile); List<URL> list = IOUtils.lsResources(ResourceUtilities.class, resourceFile); if (list.isEmpty()) { logger.error("Could not load " + resourceFile); System.exit(-1); } URL fileURL = list.get(0); URLConnection connection = fileURL.openConnection(); stream = connection.getInputStream(); } else { logger.debug("Loading from local directory", resourceFile); stream = new FileInputStream(file); } stream = checkGZipped(stream); } catch (Exception e) { logger.error("Could not load {}. Exception {}", resourceFile, e.toString()); System.exit(-1); } return stream; }
Source:
<code>public void init() throws Exception { super.init(); serverConfigurationManager = new ServerConfigurationManager( new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN)); serverConfigurationManager.applyConfiguration( <START> Paths.get(getESBResourceLocation(), "nhttp", "transport", "ESBJAVA4940", "axis2.xml").toFile()); <END> String carbonHome = System.getProperty(ServerConstants.CARBON_HOME); File log4jProperties = Paths.get(carbonHome, "repository", "conf", "log4j.properties").toFile(); applyProperty(log4jProperties, "log4j.logger.org.apache.synapse.transport.http.wire", "DEBUG"); serverConfigurationManager.restartGracefully(); super.init(); loadESBConfigurationFromClasspath("/artifacts/ESB/nhttp/transport/ESBJAVA4940/synapseConfig.xml"); logViewer = new LogViewerClient(contextUrls.getBackEndUrl(), getSessionCookie()); }</code><technical_language>applyConfigurationWithoutRestart applyConfiguration method restarts server configuration is applied</technical_language>

Target:
public void init() throws Exception { super.init(); serverConfigurationManager = new ServerConfigurationManager( new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN)); serverConfigurationManager.applyConfigurationWithoutRestart( Paths.get(getESBResourceLocation(), "nhttp", "transport", "ESBJAVA4940", "axis2.xml").toFile()); String carbonHome = System.getProperty(ServerConstants.CARBON_HOME); File log4jProperties = Paths.get(carbonHome, "repository", "conf", "log4j.properties").toFile(); applyProperty(log4jProperties, "log4j.logger.org.apache.synapse.transport.http.wire", "DEBUG"); serverConfigurationManager.restartGracefully(); super.init(); loadESBConfigurationFromClasspath("/artifacts/ESB/nhttp/transport/ESBJAVA4940/synapseConfig.xml"); logViewer = new LogViewerClient(contextUrls.getBackEndUrl(), getSessionCookie()); }
Source:
<code>public ListenableFuture<Void> release() { <START> try { checkNotReleased(); } catch (IllegalStateException e) { return Futures.immediateFailedFuture(e); } <END> if (mState == State.OPEN) { close(); } mState = State.RELEASED; mObservableState.postValue(State.RELEASED); return Futures.immediateFuture(null); }</code><technical_language>I get rid of checkNotReleased(). Calling release() multiple times allowed for Camera. If is released return a successful future</technical_language>

Target:
public ListenableFuture<Void> release() { if (mState == State.OPEN) { close(); } if (mState != State.RELEASED) { mState = State.RELEASED; mObservableState.postValue(State.RELEASED); } return Futures.immediateFuture(null); }
Source:
<code>public void putAndActivate(final InternalCacheEntry newEntry) { ((ConcurrentHashMapV8<Object, InternalCacheEntry>) entries) .compute(newEntry.getKey(), new ConcurrentHashMapV8.BiFun<Object, InternalCacheEntry, InternalCacheEntry>() { @Override public InternalCacheEntry apply(Object key, InternalCacheEntry entry) { <START> if (entry == null && activator != null) { <END> activator.activate(key); } return newEntry; } }); }</code><technical_language>activator is null</technical_language>

Target:
public void putAndActivate(final InternalCacheEntry newEntry) { ((ConcurrentHashMapV8<Object, InternalCacheEntry>) entries) .compute(newEntry.getKey(), new ConcurrentHashMapV8.BiFun<Object, InternalCacheEntry, InternalCacheEntry>() { @Override public InternalCacheEntry apply(Object key, InternalCacheEntry entry) { if (entry == null) { activator.activate(key); } return newEntry; } }); }
Source:
<code>String getAzureContainerName(BlobId blobId) { <START> return getAzureContainerName(new CloudBlobMetadata(blobId)); <END> }</code><technical_language>Instead of adding a new constructor CloudBlobMetadata for this purpose, call getClusterAwareAzureContainerName(blobID.getPartitionId().toPathString())</technical_language>

Target:
String getAzureContainerName(BlobId blobId) { return getAzureContainerName( new CloudBlobMetadata(blobId, 0, Utils.Infinite_Time, 0, CloudBlobMetadata.EncryptionOrigin.NONE)); }
Source:
<code>public boolean equals(final Object obj) { boolean result = false; if (this == obj) { result = true; } else { if (obj instanceof ViewpointItemImpl) { final ViewpointItemImpl objItem = (ViewpointItemImpl) obj; <START> result = <END> EqualityHelper.areEquals(this.viewpoint, objItem.viewpoint); result = this.parent.equals(objItem.parent); } } return result; }</code><technical_language>line remove</technical_language>

Target:
public boolean equals(final Object obj) { boolean result = false; if (this == obj) { result = true; } else { if (obj instanceof ViewpointItemImpl) { final ViewpointItemImpl objItem = (ViewpointItemImpl) obj; result = EqualityHelper.areEquals(this.viewpoint, objItem.viewpoint); result = result && this.parent.equals(objItem.parent); } } return result; }
Source:
<code>private ProxyConfiguration constructDefaultProxyConfiguration(Configuration configuration) { <START> ProxyAuthenticationType authentication = null; <END> if (this.proxyConfiguration != null) { authentication = this.proxyConfiguration.authentication(); } authentication = authentication == null ? ProxyAuthenticationType.NONE : authentication; String proxyAddress = configuration.get(BaseConfigurations.HTTP_PROXY); String host; Integer port; Proxy proxy = null; if (proxyAddress != null) { String[] hostPort = proxyAddress.split(":"); host = hostPort[0]; port = Integer.parseInt(hostPort[1]); proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(host, port)); } String username = configuration.get(ProxyConfiguration.PROXY_USERNAME); String password = configuration.get(ProxyConfiguration.PROXY_PASSWORD); return new ProxyConfiguration(authentication, proxy, username, password); }</code><technical_language>java ProxyAuthenticationType authentication = ProxyAuthenticationType.NONE; if (this.proxyConfiguration != null) { authentication = this.proxyConfiguration.authentication(); }</technical_language>

Target:
private ProxyConfiguration constructDefaultProxyConfiguration(Configuration configuration) { ProxyAuthenticationType authentication = ProxyAuthenticationType.NONE; if (proxyConfiguration != null) { authentication = proxyConfiguration.authentication(); } String proxyAddress = configuration.get(BaseConfigurations.HTTP_PROXY); Proxy proxy = null; if (proxyAddress != null) { String[] hostPort = proxyAddress.split(":"); if (hostPort.length < 2) { throw new IllegalArgumentException("HTTP_PROXY cannot be parsed into a proxy"); } String host = hostPort[0]; Integer port = Integer.parseInt(hostPort[1]); proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(host, port)); } String username = configuration.get(ProxyConfiguration.PROXY_USERNAME); String password = configuration.get(ProxyConfiguration.PROXY_PASSWORD); return new ProxyConfiguration(authentication, proxy, username, password); }
Source:
<code>private boolean canFindVmOrTemplate() { boolean retValue = true; if (getParameters().getOperation() == ImageOperation.Copy) { VmTemplate template = getVmTemplateDAO().get(getImage().getvm_guid()); if (template == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_DOES_NOT_EXIST); retValue = false; } else { setVmTemplate(template); sharedLockMap = Collections.singletonMap(LockingGroup.TEMPLATE.name(), getImage().getvm_guid()); } } else { List<VM> listVms = getVmDAO().getForImageGroup(getImage().getId()); if (!listVms.isEmpty()) { sharedLockMap = new HashMap<String, Guid>(); int vmNum = 1; <START> for (VM vm : listVms) { <END> sharedLockMap.put(LockingGroup.VM.name() + vmNum, vm.getId()); vmNum++; } } retValue = true; } return retValue; }</code><technical_language>code is wrong..., is showing u understand a locking mechanism, next time if a change please add reviewer</technical_language>

Target:
private boolean canFindVmOrTemplate() { boolean retValue = true; if (getParameters().getOperation() == ImageOperation.Copy) { VmTemplate template = getVmTemplateDAO().get(getImage().getvm_guid()); if (template == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_DOES_NOT_EXIST); retValue = false; } else { setVmTemplate(template); sharedLockMap = Collections.singletonMap(getImage().getvm_guid(), LockingGroup.TEMPLATE.name()); } } else { List<VM> listVms = getVmsForImageGroup(); if (!listVms.isEmpty()) { sharedLockMap = new HashMap<Guid, String>(); for (VM vm : listVms) { sharedLockMap.put(vm.getId(), LockingGroup.VM.name()); } } retValue = true; } return retValue; }
Source:
<code>void publishMessagesFromQueue() { if (connectionState == MqttManagerConnectionState.Connected && mqttMessageQueue != null) { final AWSIotMqttQueueMessage message = mqttMessageQueue.poll(); if (message != null) { try { if (message.getUserData() != null && message.getUserData().getUserCallback() != null) { mqttClient .publish(message.getTopic(), message.getMessage(), message.getQos() .asInt(), false, message.getUserData(), null); } else { mqttClient .publish(message.getTopic(), message.getMessage(), message.getQos() .asInt(), false); } } catch (final MqttException e) { userPublishCallback(message.getUserData().getUserCallback(), AWSIotMqttMessageDeliveryCallback.MessageDeliveryStatus.Fail, message.getUserData().getUserData()); } <START> if (mReconnectHandlerThread != null && mReconnectHandler != null) { <END> mReconnectHandler.postDelayed(new Runnable() { @Override public void run() { publishMessagesFromQueue(); } }, drainingInterval); } else { LOGGER.warn("failed to schedule publish from queue, handler thread is missing"); } } } }</code><technical_language>I notice a difference here: HandlerThread created looper existing code looper main thread. Do reasoning this change</technical_language>

Target:
void publishMessagesFromQueue() { if (connectionState == MqttManagerConnectionState.Connected && mqttMessageQueue != null) { final AWSIotMqttQueueMessage message = mqttMessageQueue.poll(); if (message != null) { try { if (message.getUserData() != null && message.getUserData().getUserCallback() != null) { mqttClient .publish(message.getTopic(), message.getMessage(), message.getQos() .asInt(), false, message.getUserData(), null); } else { mqttClient .publish(message.getTopic(), message.getMessage(), message.getQos() .asInt(), false); } } catch (final MqttException e) { notifyPublishResult(message.getUserData().getUserCallback(), AWSIotMqttMessageDeliveryCallback.MessageDeliveryStatus.Fail, message.getUserData().getUserData(), new AmazonClientException("Client error while publishing.", e)); } if (mReconnectHandlerThread != null && mReconnectHandler != null) { mReconnectHandler.postDelayed(new Runnable() { @Override public void run() { publishMessagesFromQueue(); } }, drainingInterval); } else { LOGGER.warn("failed to schedule publish from queue, handler thread is missing"); } } } }
Source:
<code>public static void enforeceCallingOrSelfReadPrecisePhoneStatePermissionOrCarrierPrivilege( Context context, int subId, String message) { if (context.checkCallingOrSelfPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) == PERMISSION_GRANTED) { return; } if (context.checkCallingOrSelfPermission(Manifest.permission.READ_PRECISE_PHONE_STATE) == PERMISSION_GRANTED) { return; } if (DBG) { <START> Rlog.d(LOG_TAG, <END> "No READ_PRIVILEDED_PHONE_STATE nor READ_PRECISE_PHONE_STATE permission" + ", check carrier privilege next."); } enforceCallingOrSelfCarrierPrivilege(subId, message); }</code><technical_language>Do need change this Rlog</technical_language>

Target:
public static void enforeceCallingOrSelfReadPrecisePhoneStatePermissionOrCarrierPrivilege( Context context, int subId, String message) { if (context.checkCallingOrSelfPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) == PERMISSION_GRANTED) { return; } if (context.checkCallingOrSelfPermission(Manifest.permission.READ_PRECISE_PHONE_STATE) == PERMISSION_GRANTED) { return; } if (DBG) { Rlog.d(LOG_TAG, "No READ_PRIVILEGED_PHONE_STATE nor READ_PRECISE_PHONE_STATE permission" + ", check carrier privilege next."); } enforceCallingOrSelfCarrierPrivilege(subId, message); }
Source:
<code>private void resetDecoder() { if (decoder == null) { decodeBuffer = CharBuffer.allocate(stringDecoderBufferSize); decoder = MessagePack.UTF8.newDecoder() .onMalformedInput(actionOnMalformedString) .onUnmappableCharacter(actionOnUnmappableString); } else { decoder.reset(); } <START> decodeStringBuffer = new StringBuilder(); <END> }</code><technical_language>decodeStringBuffer.setLength(0) a bit faster</technical_language>

Target:
private void resetDecoder() { if (decoder == null) { decodeBuffer = CharBuffer.allocate(stringDecoderBufferSize); decoder = MessagePack.UTF8.newDecoder() .onMalformedInput(actionOnMalformedString) .onUnmappableCharacter(actionOnUnmappableString); } else { decoder.reset(); } if (decodeStringBuffer == null) { decodeStringBuffer = new StringBuilder(); } else { decodeStringBuffer.setLength(0); } }
Source:
<code>void shouldUpdateChargeToSystemCancel_IfEpdqStatusIs6AndChargeStatusIsNotRelevant() { final String payload = notificationPayloadForTransaction(payId, EPDQ_AUTHORISED_CANCELLED); charge = Charge.from(ChargeEntityFixture.aValidChargeEntity() .withStatus(CAPTURED) .build()); setUpGatewayAccountToReturnGatewayAccountEntity(Optional.of(gatewayAccountEntity)); setUpChargeServiceToReturnCharge(Optional.of(charge)); <START> final boolean result = notificationService.handleNotificationFor(payload, FORWARDED_IP_ADDRESSES); assertTrue(result); <END> verifyNoInteractions(mockChargeNotificationProcessor); }</code><technical_language>inlined</technical_language>

Target:
void shouldUpdateChargeToSystemCancel_IfEpdqStatusIs6AndChargeStatusIsNotRelevant() { final String payload = notificationPayloadForTransaction(payId, EPDQ_AUTHORISED_CANCELLED); charge = Charge.from(ChargeEntityFixture.aValidChargeEntity() .withStatus(CAPTURED) .build()); setUpGatewayAccountToReturnGatewayAccountEntity(Optional.of(gatewayAccountEntity)); setUpChargeServiceToReturnCharge(Optional.of(charge)); assertTrue(notificationService.handleNotificationFor(payload, FORWARDED_IP_ADDRESSES)); verifyNoInteractions(mockChargeNotificationProcessor); }