auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected boolean isAllowClusterWithVirtGluster() { Boolean allowVirGluster = Config.<Boolean> GetValue(ConfigValues.AllowClusterWithVirtGlusterEnabled); <START> if (allowVirGluster == null) { <END> allowVirGluster = Boolean.TRUE; } return allowVirGluster; }</code><technical_language>need for this check, null</technical_language>

Target:
protected boolean isAllowClusterWithVirtGluster() { Boolean allowVirGluster = Config.<Boolean> GetValue(ConfigValues.AllowClusterWithVirtGlusterEnabled); return allowVirGluster; }
Source:
<code>public DeleteTaskService deleteTaskService(TaskExplorer taskExplorer, LauncherRepository launcherRepository, <START> TaskDefinitionRepository taskDefinitionRepository, AuditRecordService auditRecordService) { <END> return new DefaultDeleteTaskService(taskExplorer,launcherRepository,taskDefinitionRepository, auditRecordService); }</code><technical_language>Tabbing a bit here</technical_language>

Target:
public TaskDeleteService deleteTaskService(TaskExplorer taskExplorer, LauncherRepository launcherRepository, TaskDefinitionRepository taskDefinitionRepository, AuditRecordService auditRecordService) { return new DefaultTaskDeleteService(taskExplorer, launcherRepository, taskDefinitionRepository, auditRecordService); }
Source:
<code>public boolean suppressFlingGesture(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { <START> return suppressFlingGesture; <END> }</code><technical_language>a lot of code in concerned Slider. I sense try extract a custom view handle this. a RangeSlider</technical_language>

Target:
public boolean suppressFlingGesture(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { return slider.isTrackingTouch(); }
Source:
<code>public void fileFinished(AuditEvent event) { final String fileName = event.getFileName(); final FileMessages errorEvents = fileMessages.get(fileName); synchronized (writerLock) { if (errorEvents != null) { writeFileOpeningTag(fileName); for (AuditEvent errorEvent : errorEvents.errors) { writeFileError(errorEvent); } for (Throwable exception : errorEvents.exceptions) { writeException(exception); } } <START> writeFileClosingTag(); <END> } fileMessages.remove(fileName); }</code><technical_language>file open tag level file close tag? If errorEvents is null, write a close tag open tag</technical_language>

Target:
public void fileFinished(AuditEvent event) { final String fileName = event.getFileName(); final FileMessages messages = fileMessages.get(fileName); synchronized (writerLock) { writeFileMessages(fileName, messages); } fileMessages.remove(fileName); }
Source:
<code>public void placeNewOrder(Market m, String symbol, int volume, double price, OrderType orderType) throws StockMarketExpection { if (orderType == OrderType.BUY) { if ((price*volume) > this.cashInHand) { throw new StockMarketExpection("Cannot place order for stock: " + symbol + " since there is not enough money." + " Trader: " + this.name); } for(int i = 0; i < this.ordersPlaced.size(); i++) { if (this.ordersPlaced.get(i).getStockSymbol().equals(symbol)) { throw new StockMarketExpection("Cannot place order for stock: " + symbol + " since this trader already has" + "an order for this stock. Trader: " + this.name); } } Order order = new BuyOrder(symbol, volume, price, this); this.ordersPlaced.add(order); m.addOrder(order); } if (orderType == OrderType.SELL) { boolean owns = false; int numberStocksOwned = 0; for (int i = 0; i < this.position.size(); i++) { if (this.position.get(i).getStockSymbol() == symbol) { owns = true; numberStocksOwned = <START> this.position.get(i).getSize(); <END> } } if (!owns) { throw new StockMarketExpection("Cannot place order for stock: " + symbol + " since this trader does not" + "own this stock. Trader: " + this.name); } if (numberStocksOwned < volume){ throw new StockMarketExpection("Cannot place order for stock: " + symbol + " since this trader does not" + "own enough shares of this stock. Trader: " + this.name); } Order order = new SellOrder(symbol, volume, price, this); this.ordersPlaced.add(order); m.addOrder(order); } }</code><technical_language>message chain</technical_language>

Target:
public void placeNewOrder(Market m, String symbol, int volume, double price, OrderType orderType) throws StockMarketExpection { if (orderType == OrderType.BUY) { if ((price*volume) > this.cashInHand) { throw new StockMarketExpection("Cannot place order for stock: " + symbol + " since there is not enough money." + " Trader: " + this.name); } for(int i = 0; i < this.ordersPlaced.size(); i++) { if (this.ordersPlaced.get(i).getStockSymbol().equals(symbol)) { throw new StockMarketExpection("Cannot place order for stock: " + symbol + " since this trader already has" + "an order for this stock. Trader: " + this.name); } } Order order = new BuyOrder(symbol, volume, price, this); this.ordersPlaced.add(order); m.addOrder(order); } if (orderType == OrderType.SELL) { boolean owns = false; int numberStocksOwned = 0; for (int i = 0; i < this.position.size(); i++) { if (this.position.get(i).getStockSymbol() == symbol) { owns = true; numberStocksOwned = this.position.get(i); numberStocksOwned = numbersStockOwned.getSize(); } } if (!owns) { throw new StockMarketExpection("Cannot place order for stock: " + symbol + " since this trader does not" + "own this stock. Trader: " + this.name); } if (numberStocksOwned < volume){ throw new StockMarketExpection("Cannot place order for stock: " + symbol + " since this trader does not" + "own enough shares of this stock. Trader: " + this.name); } Order order = new SellOrder(symbol, volume, price, this); this.ordersPlaced.add(order); m.addOrder(order); } }
Source:
<code>public Optional<CatchupServerAddress> find( MemberId upstream ) { <START> Optional<CoreServerInfo> coreAddresses = coreTopology.find( upstream ); <END> Optional<ReadReplicaInfo> readReplicaAddresses = readReplicaTopology.findAddressFor( upstream ); if ( coreAddresses.isPresent() ) { return Optional.of( coreAddresses.get() ); } else if ( readReplicaAddresses.isPresent() ) { return Optional.of( readReplicaAddresses.get() ); } else { return Optional.empty(); } }</code><technical_language>rename local variables too</technical_language>

Target:
public Optional<CatchupServerAddress> find( MemberId upstream ) { Optional<CatchupServerAddress> coreCatchupAddress = coreTopology.find( upstream ).map( a -> (CatchupServerAddress) a ); Optional<CatchupServerAddress> readCatchupAddress = readReplicaTopology.find( upstream ).map( a -> (CatchupServerAddress) a ); return coreCatchupAddress.map( Optional::of ).orElse( readCatchupAddress ); }
Source:
<code>public MessageChannel getDiscardChannel() { if (this.discardChannelName != null) { <START> this.discardChannel = getChannelResolver().resolveDestination(this.discardChannelName); <END> this.discardChannelName = null; } return this.discardChannel; }</code><technical_language>NPE 2 concurrent threads</technical_language>

Target:
public MessageChannel getDiscardChannel() { String channelName = this.discardChannelName; if (channelName != null) { this.discardChannel = getChannelResolver().resolveDestination(channelName); this.discardChannelName = null; } return this.discardChannel; }
Source:
<code>public void init(Shell splash) { super.init(splash); String progressString = null; IProduct product = Platform.getProduct(); if (product != null) { progressString = product.getProperty(IProductConstants.STARTUP_PROGRESS_RECT); } Rectangle progressRect = StringConverter.asRectangle(progressString, PROCESS_BAR_RECTANGLE); setProgressRect(progressRect); try { setForeground(getSplash().getDisplay().getSystemColor(SWT.COLOR_WHITE).getRGB()); <START> } catch (IllegalArgumentException e) { <END> } getContent().addPaintListener(new PaintListener() { @Override public void paintControl(PaintEvent e) { e.gc.setForeground(getForeground()); e.gc.drawText( NLS.bind(Messages.SplahScreen_VersionString, TracingRcpPlugin.getDefault().getBundle().getVersion().toString()), VERSION_LOCATION.x, VERSION_LOCATION.y, true); } }); }</code><technical_language>explain is catch for</technical_language>

Target:
public void init(Shell splash) { super.init(splash); String progressString = null; IProduct product = Platform.getProduct(); if (product != null) { progressString = product.getProperty(IProductConstants.STARTUP_PROGRESS_RECT); } Rectangle progressRect = StringConverter.asRectangle(progressString, PROCESS_BAR_RECTANGLE); setProgressRect(progressRect); setForeground(FOREGROUND_COLOR); getContent().addPaintListener(new PaintListener() { @Override public void paintControl(PaintEvent e) { e.gc.setForeground(getForeground()); e.gc.drawText( NLS.bind(Messages.SplahScreen_VersionString, TracingRcpPlugin.getDefault().getBundle().getVersion().toString()), VERSION_LOCATION.x, VERSION_LOCATION.y, true); } }); }
Source:
<code>public RequestCreator memoryPolicy(MemoryPolicy policy, MemoryPolicy... additional) { if (policy == null) { throw new IllegalArgumentException("Memory policy cannot be null"); } this.memoryPolicy |= policy.index; if (additional != null && additional.length > 0) { for (MemoryPolicy memoryPolicy : additional) { <START> if (memoryPolicy != null) { <END> this.memoryPolicy |= memoryPolicy.index; } } } return this; }</code><technical_language>== throw</technical_language>

Target:
public RequestCreator memoryPolicy(MemoryPolicy policy, MemoryPolicy... additional) { if (policy == null) { throw new IllegalArgumentException("Memory policy cannot be null."); } this.memoryPolicy |= policy.index; if (additional == null) { throw new IllegalArgumentException("Memory policy cannot be null."); } if (additional.length > 0) { for (MemoryPolicy memoryPolicy : additional) { if (memoryPolicy == null) { throw new IllegalArgumentException("Memory policy cannot be null."); } this.memoryPolicy |= memoryPolicy.index; } } return this; }
Source:
<code>public boolean tunnelAuthInProgress() { <START> if (!zooKeeper.getClientConfig().isSaslClientEnabled()) { <END> return false; } if (saslLoginFailed == true) { return false; } if (zooKeeperSaslClient == null) { return true; } return zooKeeperSaslClient.clientTunneledAuthenticationInProgress(); }</code><technical_language>If ClientCnxn.clientConfig is final replace this clientConfig.isSaslClientEnabled()</technical_language>

Target:
public boolean tunnelAuthInProgress() { if (!clientConfig.isSaslClientEnabled()) { return false; } if (saslLoginFailed == true) { return false; } if (zooKeeperSaslClient == null) { return true; } return zooKeeperSaslClient.clientTunneledAuthenticationInProgress(); }
Source:
<code>public Set<String> getSessionIdsFull() { Set<String> sessionsId = null; try { String[] keys = this.store.keys(); sessionsId = new HashSet<>(Arrays.asList(keys)); } catch (IOException e) { <START> log.error("An error occurred while listing active session: " + e); <END> } return sessionsId; }</code><technical_language>log.error("An error occurred while listing active session.", e);</technical_language>

Target:
public Set<String> getSessionIdsFull() { Set<String> sessionsId = null; try { String[] keys = this.store.keys(); sessionsId = new HashSet<>(Arrays.asList(keys)); } catch (IOException e) { log.error("An error occurred while listing active sessions: ", e); } return sessionsId; }
Source:
<code>public void debugClearMessagesLocally(final List<MessageReference> messages) { if (!K9.DEVELOPER_MODE) { <START> throw new AssertionError("method must only be used in debug build!"); <END> } actOnMessagesGroupedByAccountAndFolder(messages, new MessageActor() { @Override public void act(final Account account, final LocalFolder messageFolder, final List<LocalMessage> accountMessages) { putBackground("debugClearLocalMessages", null, new Runnable() { @Override public void run() { for (LocalMessage message : accountMessages) { try { message.debugClearLocalData(); } catch (MessagingException e) { throw new AssertionError("clearing local message content failed!", e); } } } }); } }); }</code><technical_language>Please update this string "developer mode" instead of "debug build"</technical_language>

Target:
public void debugClearMessagesLocally(final List<MessageReference> messages) { if (!K9.DEVELOPER_MODE) { throw new AssertionError("method must only be used in developer mode!"); } actOnMessagesGroupedByAccountAndFolder(messages, new MessageActor() { @Override public void act(final Account account, final LocalFolder messageFolder, final List<LocalMessage> accountMessages) { putBackground("debugClearLocalMessages", null, new Runnable() { @Override public void run() { for (LocalMessage message : accountMessages) { try { message.debugClearLocalData(); } catch (MessagingException e) { throw new AssertionError("clearing local message content failed!", e); } } } }); } }); }
Source:
<code>public void testUnmarshallTopLevelEventWithEdgesEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateConditionalEvent emptyEvent = getCatchingIntermediateNodeById(diagram, EMPTY_WITH_EDGES_TOP_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_OUTGOING_EDGE); assertGeneralSet(emptyEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertConditionalEventExecutionSet(emptyEvent.getExecutionSet(), CONDITION_EXPRESSION_SCRIPT_DEFAULT_VALUE, CONDITION_EXPRESSION_LANGUAGE, CONDITION_ERPRESSION_TYPE, NON_CANCELLING, <START> ""); <END> }</code><technical_language>suggestion EMPTY_VALUE);</technical_language>

Target:
public void testUnmarshallTopLevelEventWithEdgesEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateConditionalEvent emptyEvent = getCatchingIntermediateNodeById(diagram, EMPTY_WITH_EDGES_TOP_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_OUTGOING_EDGE); assertGeneralSet(emptyEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertConditionalEventExecutionSet(emptyEvent.getExecutionSet(), CONDITION_EXPRESSION_SCRIPT_DEFAULT_VALUE, CONDITION_EXPRESSION_LANGUAGE, CONDITION_ERPRESSION_TYPE, NON_CANCELLING, EMPTY_VALUE); }
Source:
<code>public void markChargeAsCaptureApproved_shouldThrowAnExceptionWhenChargeIsNotFound() { String nonExistingChargeExternalId = "non-existing-id"; when(mockedChargeDao.findByExternalId(nonExistingChargeExternalId)).thenReturn(Optional.empty()); try { cardCaptureService.markChargeAsCaptureApproved(nonExistingChargeExternalId); fail("expecting ChargeNotFoundRuntimeException"); } catch (ChargeNotFoundRuntimeException e) { } verify(mockedChargeDao).findByExternalId(nonExistingChargeExternalId); <START> verifyNoMoreInteractions(mockedChargeDao); <END> }</code><technical_language>sufficient expect exception thrown. I if over-coupling this test implementation extra verifications</technical_language>

Target:
public void markChargeAsCaptureApproved_shouldThrowAnExceptionWhenChargeIsNotFound() { String nonExistingChargeExternalId = "non-existing-id"; when(mockedChargeDao.findByExternalId(nonExistingChargeExternalId)).thenReturn(Optional.empty()); try { cardCaptureService.markChargeAsCaptureApproved(nonExistingChargeExternalId); fail("expecting ChargeNotFoundRuntimeException"); } catch (ChargeNotFoundRuntimeException e) { } verify(mockedChargeDao, never()).mergeAndNotifyStatusHasChanged(any(), any()); }
Source:
<code>protected List<ProgramState> copyConstraint(SymbolicValue from, SymbolicValue to, ProgramState programState, BooleanConstraint booleanConstraint) { Constraint constraintLeft = programState.getConstraint(from); if (constraintLeft instanceof BooleanConstraint) { BooleanConstraint boolConstraint = (BooleanConstraint) constraintLeft; return to.setConstraint(programState, shouldNotInverse().equals(booleanConstraint) ? boolConstraint : boolConstraint.inverse()); } else if (constraintLeft instanceof ObjectConstraint) { ObjectConstraint nullConstraint = (ObjectConstraint) constraintLeft; <START> if (nullConstraint.isNull() || nullConstraint.isInversible()) { <END> return to.setConstraint(programState, shouldNotInverse().equals(booleanConstraint) ? nullConstraint : nullConstraint.inverse()); } else if (shouldNotInverse().equals(booleanConstraint)) { return to.setConstraint(programState, nullConstraint); } } return ImmutableList.of(programState); }</code><technical_language>implementation, operand is irrelevant here</technical_language>

Target:
protected List<ProgramState> copyConstraint(SymbolicValue from, SymbolicValue to, ProgramState programState, BooleanConstraint booleanConstraint) { Constraint constraintLeft = programState.getConstraint(from); if (constraintLeft instanceof BooleanConstraint) { BooleanConstraint boolConstraint = (BooleanConstraint) constraintLeft; return to.setConstraint(programState, shouldNotInverse().equals(booleanConstraint) ? boolConstraint : boolConstraint.inverse()); } else if (constraintLeft instanceof ObjectConstraint) { ObjectConstraint objectConstraint = (ObjectConstraint) constraintLeft; if (objectConstraint.isInversible()) { return to.setConstraint(programState, shouldNotInverse().equals(booleanConstraint) ? objectConstraint : objectConstraint.inverse()); } else if (shouldNotInverse().equals(booleanConstraint)) { return to.setConstraint(programState, objectConstraint); } } return ImmutableList.of(programState); }
Source:
<code>public void searchSingle(ThreadState state) { String predicate = "id = '" + generatedIds[state.random.nextInt(generatedIds.length)] + "'"; <START> System.out.println( map.values(new SqlPredicate(predicate))); <END> }</code><technical_language>I hope remove system.out code :)</technical_language>

Target:
public Collection<Transaction> searchSingle(ThreadState state) { String predicate = "id = '" + map.get(state.random.nextInt(keyCount)).getUniversalId() + "'"; return map.values(new SqlPredicate(predicate)); }
Source:
<code>public boolean isSameTarget(TransportConfiguration... configs) { <START> boolean yes = false; <END> for (TransportConfiguration cfg : configs) { if (cfg == null) { continue; } if (NettyConnectorFactory.class.getName().equals(cfg.getFactoryClassName())) { if (configuration.get(TransportConstants.PORT_PROP_NAME).equals(cfg.getParams().get(TransportConstants.PORT_PROP_NAME))) { Object hostParam = configuration.get(TransportConstants.HOST_PROP_NAME); if (hostParam != null) { if (hostParam.equals(cfg.getParams().get(TransportConstants.HOST_PROP_NAME))) { yes = true; break; } else { if (isLocalhost((String) configuration.get(TransportConstants.HOST_PROP_NAME)) && isLocalhost((String) cfg.getParams().get(TransportConstants.HOST_PROP_NAME))) { yes = true; break; } } } else if (cfg.getParams().get(TransportConstants.HOST_PROP_NAME) == null) { yes = true; break; } } } } return yes; }</code><technical_language>@gaohoward rename yes? :) call result if :)</technical_language>

Target:
public boolean isSameTarget(TransportConfiguration... configs) { boolean result = false; for (TransportConfiguration cfg : configs) { if (cfg == null) { continue; } if (NettyConnectorFactory.class.getName().equals(cfg.getFactoryClassName())) { if (configuration.get(TransportConstants.PORT_PROP_NAME).equals(cfg.getParams().get(TransportConstants.PORT_PROP_NAME))) { Object hostParam = configuration.get(TransportConstants.HOST_PROP_NAME); if (hostParam != null) { if (hostParam.equals(cfg.getParams().get(TransportConstants.HOST_PROP_NAME))) { result = true; break; } else { if (isLocalhost((String) configuration.get(TransportConstants.HOST_PROP_NAME)) && isLocalhost((String) cfg.getParams().get(TransportConstants.HOST_PROP_NAME))) { result = true; break; } } } else if (cfg.getParams().get(TransportConstants.HOST_PROP_NAME) == null) { result = true; break; } } } } return result; }
Source:
<code>public static void main(String[] args) throws Exception { InetSocketAddress addr = SocketUtils.socketAddress(DNS_SERVER_HOST, DNS_SERVER_PORT); final CountDownLatch latch = new CountDownLatch(1); EventLoopGroup group = new NioEventLoopGroup(); try { Bootstrap b = new Bootstrap(); b.group(group) .channel(NioDatagramChannel.class) .handler(new ChannelInitializer<DatagramChannel>() { @Override protected void initChannel(DatagramChannel ch) throws Exception { ChannelPipeline p = ch.pipeline(); p.addLast(new DatagramDnsQueryEncoder()) .addLast(new DatagramDnsResponseDecoder()) .addLast(new SimpleChannelInboundHandler<DatagramDnsResponse>() { @Override protected void channelRead0(ChannelHandlerContext ctx, DatagramDnsResponse msg) throws Exception { try { handleQueryResp(msg); } finally { latch.countDown(); } } }); } }); Channel ch = b.bind(0).sync().channel(); DnsQuery query = new DatagramDnsQuery(null, addr, 1).setRecord( DnsSection.QUESTION, new DefaultDnsQuestion(QUERY_DOMAIN, DnsRecordType.A)); <START> ch.writeAndFlush(query); <END> latch.await(10L, TimeUnit.SECONDS); ch.close().sync(); } finally { group.shutdownGracefully(); } }</code><technical_language>call sync()</technical_language>

Target:
public static void main(String[] args) throws Exception { InetSocketAddress addr = new InetSocketAddress(DNS_SERVER_HOST, DNS_SERVER_PORT); EventLoopGroup group = new NioEventLoopGroup(); try { Bootstrap b = new Bootstrap(); b.group(group) .channel(NioDatagramChannel.class) .handler(new ChannelInitializer<DatagramChannel>() { @Override protected void initChannel(DatagramChannel ch) throws Exception { ChannelPipeline p = ch.pipeline(); p.addLast(new DatagramDnsQueryEncoder()) .addLast(new DatagramDnsResponseDecoder()) .addLast(new SimpleChannelInboundHandler<DatagramDnsResponse>() { @Override protected void channelRead0(ChannelHandlerContext ctx, DatagramDnsResponse msg) { try { handleQueryResp(msg); } finally { ctx.close(); } } }); } }); final Channel ch = b.bind(0).sync().channel(); DnsQuery query = new DatagramDnsQuery(null, addr, 1).setRecord( DnsSection.QUESTION, new DefaultDnsQuestion(QUERY_DOMAIN, DnsRecordType.A)); ch.writeAndFlush(query).sync(); boolean succ = ch.closeFuture().await(10, TimeUnit.SECONDS); if (!succ) { System.err.println("dns query timeout!"); ch.close().sync(); } } finally { group.shutdownGracefully(); } }
Source:
<code>public Object execute(ExecutionEvent event) throws ExecutionException { Shell activeShell= HandlerUtil.getActiveShell(event); Object newNameValue= HandlerUtil.getVariable(event, LTK_RENAME_COMMAND_NEWNAME_PARAMETER_KEY); String newName= null; if (newNameValue instanceof String) { newName= (String) newNameValue; } else if (newNameValue != null) { RefactoringUIPlugin.logErrorMessage(NLS.bind(RefactoringUIMessages.RenameResourceHandler_ERROR_EXPECTED_STRING, newNameValue.getClass().getName())); } ISelection sel= HandlerUtil.getCurrentSelection(event); if (sel instanceof IStructuredSelection) { IResource resource= getCurrentResource((IStructuredSelection) sel); if (resource != null) { RenameResourceWizard refactoringWizard; if (newName != null) { refactoringWizard= new RenameResourceWizard(resource, newName); } else { refactoringWizard= new RenameResourceWizard(resource); } boolean isCompositeChange= refactoringWizard.checkCompositeChange(PlatformUI.getWorkbench().getActiveWorkbenchWindow(), false); RefactoringWizardOpenOperation op= new RefactoringWizardOpenOperation(refactoringWizard); <START> if (isCompositeChange) { <END> try { op.run(activeShell, RefactoringUIMessages.RenameResourceHandler_title); } catch (InterruptedException e) { } } } } return null; }</code><technical_language>composite is 1 criterion (as preview useful), I another criterion is more rename wizard show some options. I imagine condition if (previewIsInteresting || refactoringWizard.hasOptions() { op.run(...); // show wizard } else { refactoringWizard.applyChange(...); // show wizard }</technical_language>

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { Shell activeShell= HandlerUtil.getActiveShell(event); Object newNameValue= HandlerUtil.getVariable(event, LTK_RENAME_COMMAND_NEWNAME_PARAMETER_KEY); String newName= null; if (newNameValue instanceof String) { newName= (String) newNameValue; } else if (newNameValue != null) { RefactoringUIPlugin.logErrorMessage(NLS.bind(RefactoringUIMessages.RenameResourceHandler_ERROR_EXPECTED_STRING, newNameValue.getClass().getName())); } ISelection sel= HandlerUtil.getCurrentSelection(event); if (sel instanceof IStructuredSelection) { IResource resource= getCurrentResource((IStructuredSelection) sel); if (resource != null) { RenameResourceWizard refactoringWizard; if (newName != null) { refactoringWizard= new RenameResourceWizard(resource, newName); } else { refactoringWizard= new RenameResourceWizard(resource); } RefactoringProcessor processor= ((ProcessorBasedRefactoring) refactoringWizard.getRefactoring()).getProcessor(); Change change= getChange(refactoringWizard); RefactoringWizardOpenOperation op= new RefactoringWizardOpenOperation(refactoringWizard); try { if (isCompositeChange(change) || !(processor instanceof RenameResourceProcessor)) { op.run(activeShell, RefactoringUIMessages.RenameResourceHandler_title); } else { change.perform(new NullProgressMonitor()); } } catch (InterruptedException | CoreException e) { RefactoringUIPlugin.log(e); } } } return null; }
Source:
<code>public Optional<BPMNSignalReceivedEvent> from(ActivitiSignalEvent internalEvent) { BPMNSignalReceivedEventImpl event = new BPMNSignalReceivedEventImpl(toSignalConverter.from(internalEvent)); <START> if (event!=null) { <END> event.setProcessInstanceId(internalEvent.getProcessInstanceId()); event.setProcessDefinitionId(internalEvent.getProcessDefinitionId()); } return Optional.of(event); }</code><technical_language>I remove this if event null: instantiate it. dit check else</technical_language>

Target:
public Optional<BPMNSignalReceivedEvent> from(ActivitiSignalEvent internalEvent) { BPMNSignalReceivedEventImpl event = new BPMNSignalReceivedEventImpl(toSignalConverter.from(internalEvent)); event.setProcessInstanceId(internalEvent.getProcessInstanceId()); event.setProcessDefinitionId(internalEvent.getProcessDefinitionId()); return Optional.of(event); }
Source:
<code>private static void reassignDelayedInitParams() { appContext = delayedInitParams.context; googleProjectNumber = delayedInitParams.googleProjectNumber; appId = delayedInitParams.appId; notificationWillShowInForegroundHandler = delayedInitParams.notificationWillShowInForegroundHandler; notificationOpenedHandler = delayedInitParams.notificationOpenedHandler; delayedInitParams = null; <START> if (appContext != null) <END> setAppContext(appContext); }</code><technical_language>a hack of setting value. call method need here</technical_language>

Target:
private static void reassignDelayedInitParams() { appContext = delayedInitParams.context; googleProjectNumber = delayedInitParams.googleProjectNumber; appId = delayedInitParams.appId; notificationWillShowInForegroundHandler = delayedInitParams.notificationWillShowInForegroundHandler; notificationOpenedHandler = delayedInitParams.notificationOpenedHandler; delayedInitParams = null; if (appId != null && appContext != null) { setupPrivacyConsent(appContext); init(); } }
Source:
<code>public void testStatementPeriodYEARLY() { Calendar date = Calendar.getInstance(); Calendar aCalendar = Calendar.getInstance(); date = Calendar.getInstance(); date.set(Calendar.MONTH, Calendar.JANUARY); date.set(Calendar.DATE, 1); Calendar period[] = quotaStatement.statementTime(date, STATEMENT_PERIODS.YEARLY); assertTrue("period != null", period != null); <START> assertTrue("period[0].before(period[1])" + period[0].toString(), period[0].before(period[1])); <END> assertTrue("period[0].get(Calendar.DATE) == 1" + period[0].toString(), period[0].get(Calendar.DATE) == 1); assertTrue("period[0].get(Calendar.MONTH) == Calendar.JANUARY" + period[0].toString(), period[0].get(Calendar.MONTH) == Calendar.JANUARY); aCalendar = Calendar.getInstance(); aCalendar.set(Calendar.MONTH, Calendar.DECEMBER); aCalendar.set(Calendar.DATE, aCalendar.getActualMaximum(Calendar.DAY_OF_MONTH) + 1); assertTrue(" period[1].get(Calendar.DATE) == aCalendar.get(Calendar.DATE)" + period[1].toString(), period[1].get(Calendar.DATE) == aCalendar.get(Calendar.DATE)); assertTrue("period[1].get(Calendar.MONTH) == aCalendar.get(Calendar.MONTH)" + period[1].toString(), period[1].get(Calendar.MONTH) == aCalendar.get(Calendar.MONTH)); }</code><technical_language>Add assertion length of period is 2 avoid a confusing ArrayIndexOutofBoundsException</technical_language>

Target:
public void testStatementPeriodYEARLY() { Calendar date = Calendar.getInstance(); Calendar aCalendar = Calendar.getInstance(); date = Calendar.getInstance(); date.set(Calendar.MONTH, Calendar.JANUARY); date.set(Calendar.DATE, 1); Calendar period[] = quotaStatement.statementTime(date, STATEMENT_PERIODS.YEARLY); assertTrue("period != null", period != null); assertTrue(period.length == 2); assertTrue("period[0].before(period[1])" + period[0].toString(), period[0].before(period[1])); assertTrue("period[0].get(Calendar.DATE) == 1" + period[0].toString(), period[0].get(Calendar.DATE) == 1); assertTrue("period[0].get(Calendar.MONTH) == Calendar.JANUARY" + period[0].toString(), period[0].get(Calendar.MONTH) == Calendar.JANUARY); aCalendar = Calendar.getInstance(); aCalendar.set(Calendar.MONTH, Calendar.DECEMBER); aCalendar.set(Calendar.DATE, aCalendar.getActualMaximum(Calendar.DAY_OF_MONTH) + 1); assertTrue(" period[1].get(Calendar.DATE) == aCalendar.get(Calendar.DATE)" + period[1].toString(), period[1].get(Calendar.DATE) == aCalendar.get(Calendar.DATE)); assertTrue("period[1].get(Calendar.MONTH) == aCalendar.get(Calendar.MONTH)" + period[1].toString(), period[1].get(Calendar.MONTH) == aCalendar.get(Calendar.MONTH)); }
Source:
<code>public static String getJavaSqliteDescription( Database database, String name ) { <START> String s_javasqlite_description = ""; <END> try { s_javasqlite_description = "sqlite[" + getSqliteVersion(database) + "],"; s_javasqlite_description += "spatialite[" + getSpatialiteVersion(database) + "],"; s_javasqlite_description += "proj4[" + getProj4Version(database) + "],"; s_javasqlite_description += "geos[" + getGeosVersion(database) + "],"; s_javasqlite_description += "spatialite_properties[" + getSpatialiteProperties(database) + "],"; s_javasqlite_description += "rasterlite2_properties[" + getRaster2Version(database) + "]]"; } catch (Exception e) { if (i_SpatialiteVersion > 3) { s_javasqlite_description += "rasterlite2_properties[none]]"; } else { s_javasqlite_description += "exception[? not a spatialite database, or spatialite < 4 ?]]"; } GPLog.androidLog(4, "DaoSpatialite[" + name + "].getJavaSqliteDescription[" + s_javasqlite_description + "]", e); } return s_javasqlite_description; }</code><technical_language>instead of usign a variable set locally in here, this be: if(JavaSqliteDescription == null){ // code define } return JavaSqliteDescription; in other place a check needs done</technical_language>

Target:
public static String getJavaSqliteDescription( Database database, String name ) { if (JavaSqliteDescription.equals("")) { try { JavaSqliteDescription = "sqlite[" + getSqliteVersion(database) + "],"; JavaSqliteDescription += "spatialite[" + getspatialiteVersion(database) + "],"; JavaSqliteDescription += "proj4[" + getProj4Version(database) + "],"; JavaSqliteDescription += "geos[" + getGeosVersion(database) + "],"; JavaSqliteDescription += "spatialite_properties[" + getSpatialiteProperties(database) + "],"; JavaSqliteDescription += "rasterlite2_properties[" + getRaster2Version(database) + "]]"; } catch (Exception e) { if (i_SpatialiteVersion > 3) { JavaSqliteDescription += "rasterlite2_properties[none]]"; } else { JavaSqliteDescription += "exception[? not a spatialite database, or spatialite < 4 ?]]"; GPLog.androidLog(4, "DaoSpatialite[" + name + "].getJavaSqliteDescription[" + JavaSqliteDescription + "]", e); } } } return JavaSqliteDescription; }
Source:
<code>public ListBoxModel doFillCloudItems() { ListBoxModel result = new ListBoxModel(); <START> result.add("-- any --", ""); <END> Jenkins.get().clouds .getAll(KubernetesCloud.class) .forEach(cloud -> result.add(cloud.name)); return result; }</code><technical_language>suggestion result.add("-any-", "");</technical_language>

Target:
public ListBoxModel doFillCloudItems() { ListBoxModel result = new ListBoxModel(); result.add("—any—", ""); Jenkins.get().clouds .getAll(KubernetesCloud.class) .forEach(cloud -> result.add(cloud.name)); return result; }
Source:
<code>public Set<String> assaysAnalyzedForThisDataColumn() { <START> return null; <END> }</code><technical_language>This, method below, dangerous. I strongly suggest returning immutable empty set. If want flag this method called, throw a non-checked (i.e. wrapped) OperationNotSupportedException</technical_language>

Target:
public Set<String> assaysAnalyzedForThisDataColumn() { return ImmutableSet.of(id); }
Source:
<code>private void add( NodeUpdates updates ) { for ( IndexEntryUpdate indexUpdate : updates.forIndexes( populations.keySet(), NO_UNCHANGED_PROPERTIES ) ) { <START> IndexPopulation population = populations.get( indexUpdate.descriptor() ); <END> try { population.onUpdate( indexUpdate ); } catch ( Throwable failure ) { fail( population, failure ); } } }</code><technical_language>This reason populations changed a List Map, I if allow passing IndexPopulation objects (opaquely) NodeUpdates.forIndexes(...) method, avoid this lookup altogether. add a bit of overhead data structures gain. passing IndexPopulation objects add code complexity instead. Feels of try out</technical_language>

Target:
private void add( NodeUpdates updates ) { for ( IndexEntryUpdate<IndexPopulation> indexUpdate : updates.forIndexKeys( populations ) ) { try { indexUpdate.indexKey().onUpdate( indexUpdate ); } catch ( Throwable failure ) { fail( indexUpdate.indexKey(), failure ); } } }
Source:
<code>protected void configure() { <START> bind(PathBuilder.class) <END> .toInstance( new PathBuilder(config.getString("zookeeper.root_key"))); bind(InterfaceDataUpdater.class) .to(DefaultInterfaceDataUpdater.class); bind(InterfaceScanner.class) .to(MockInterfaceScanner.class); bind(MidolmanConfig.class) .toInstance(new MidolmanConfig(config, ConfigFactory.empty())); bind(MidonetBackend.class) .to(MidonetTestBackend.class).asEagerSingleton(); bind(MidonetBackendConfig.class) .toInstance( new MidonetBackendConfig(config.withFallback( MidoTestConfigurator.forAgents()))); bind(HostService.class) .to(TestableHostService.class).asEagerSingleton(); }</code><technical_language>nit: some of needed</technical_language>

Target:
protected void configure() { bind(InterfaceDataUpdater.class) .to(DefaultInterfaceDataUpdater.class); bind(InterfaceScanner.class) .to(MockInterfaceScanner.class) .asEagerSingleton(); bind(MidolmanConfig.class) .toInstance(new MidolmanConfig(config, ConfigFactory.empty())); bind(MidonetBackend.class) .to(MidonetTestBackend.class).asEagerSingleton(); bind(MidonetBackendConfig.class) .toInstance( new MidonetBackendConfig(config.withFallback( MidoTestConfigurator.forAgents()))); bind(HostService.class) .to(TestableHostService.class).asEagerSingleton(); }
Source:
<code>protected void endSuccessfully() { setVmTemplateId(getParameters().getVmTemplateId()); setVmId(getVmIdFromImageParameters()); isVmInDb = getVm() != null; getVmStaticDAO().incrementDbGeneration(getVmTemplateId()); for (VdcActionParametersBase p : getParameters().getImagesParameters()) { Backend.getInstance().endAction(VdcActionType.CreateImageTemplate, p, <START> getContext().duplicate().resetCompensationContext().resetExecutionContext().resetLock()); <END> } if (reloadVmTemplateFromDB() != null) { endDefaultOperations(); } checkTrustedService(); setSucceeded(true); }</code><technical_language>dupContext() method in CommandBase</technical_language>

Target:
protected void endSuccessfully() { setVmTemplateId(getParameters().getVmTemplateId()); setVmId(getVmIdFromImageParameters()); isVmInDb = getVm() != null; getVmStaticDAO().incrementDbGeneration(getVmTemplateId()); for (VdcActionParametersBase p : getParameters().getImagesParameters()) { Backend.getInstance().endAction(VdcActionType.CreateImageTemplate, p, getContext().duplicate().withoutCompensationContext().withoutExecutionContext().withoutLock()); } if (reloadVmTemplateFromDB() != null) { endDefaultOperations(); } checkTrustedService(); setSucceeded(true); }
Source:
<code>public void handleDebugEvents(DebugEvent[] events) { for (DebugEvent event : events) { if (event.getSource() instanceof IThread) { handleDebugEvent(event); } else if (event.getSource() instanceof IWatchExpression) { handleWatchExpressionEvent(event); <START> } else if (event.getSource() instanceof IVariable <END> && event.getKind() == DebugEvent.CHANGE && event.getDetail() == DebugEvent.CONTENT) { eventManager.addEvent(new DebugEventBase( EventType.MODIFY_VARIABLE_VALUE, new Date())); } } }</code><technical_language>Extract if conditions named structures (variables functions), isThread, ... ? (Especially is difficult comprehend)</technical_language>

Target:
public void handleDebugEvents(DebugEvent[] events) { for (DebugEvent event : events) { if (isThread(event.getSource())) { handleDebugEvent(event); } else if (isWatchExpression(event.getSource())) { handleWatchExpressionEvent(event); } else if (isVariableModificationEvent(event)) { debugEventManager.addEvent(new DebugEventBase( DebugEventType.MODIFY_VARIABLE_VALUE, new Date())); } } }
Source:
<code>public void setListener() { jTree.getSelectionModel().setSelectionMode( TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); jTree.getSelectionModel().addTreeSelectionListener( new TreeSelectionListener() { @Override public void valueChanged( TreeSelectionEvent treeSelectionEvent) { TreePath[] treePath = jTree.getSelectionPaths(); for (TreePath path : treePath) { DefaultMutableTreeNode select = (DefaultMutableTreeNode) path .getLastPathComponent(); String selectName = select.toString(); <START> if (selectName.equals("Common ancestor") || selectName.equals("Phylogentic tree")) { <END> selected.addAll(getChildsOfAncestor(select)); } else { selected.add(select.toString()); } } } }); }</code><technical_language>a. Line is longer 120 characters b. typo: Phylogentic Phylogenetic. This is spelled wrong in tree itself, spelled wrong here. fix in places</technical_language>

Target:
public void setListener() { jTree.getSelectionModel().setSelectionMode( TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); jTree.getSelectionModel().addTreeSelectionListener( new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent treeSelectionEvent) { TreePath[] treePath = jTree.getSelectionPaths(); if (treePath != null) { for (TreePath path : treePath) { DefaultMutableTreeNode select = (DefaultMutableTreeNode) path .getLastPathComponent(); String selectName = select.toString(); if (selectName.equals(PhyloController.LABEL_COMMON_ANCESTOR) || selectName.equals(PhyloController.LABEL_PHYLOGENETIC_TREE)) { selected.addAll(getChildsOfAncestor(select)); } else { selected.add(select.toString()); } } } } }); }
Source:
<code>public void testStopDuringProcess() throws ExecutionException, InterruptedException, TimeoutException { PersistenceManager persistenceManager = extractComponent(cache, PersistenceManager.class); StreamingMarshaller marshaller = extractComponent(cache, StreamingMarshaller.class); persistenceManager.writeToAllNonTxStores(marshalledEntry("k1", "v1", marshaller), BOTH); persistenceManager.writeToAllNonTxStores(marshalledEntry("k2", "v2", marshaller), BOTH); persistenceManager.writeToAllNonTxStores(marshalledEntry("k3", "v3", marshaller), BOTH); final CountDownLatch before = new CountDownLatch(1); final CountDownLatch after = new CountDownLatch(1); final AtomicInteger count = new AtomicInteger(0); Future<Void> c = fork(() -> persistenceManager.processOnAllStores(new WithinThreadExecutor(), null, (marshalledEntry, taskContext) -> { before.countDown(); after.await(); count.incrementAndGet(); }, true, true)); before.await(30, TimeUnit.SECONDS); Future<Void> stopFuture = fork(persistenceManager::stop); <START> Exceptions.expectException(TimeoutException.class, () -> stopFuture.get(15, TimeUnit.SECONDS)); <END> after.countDown(); c.get(30, TimeUnit.SECONDS); stopFuture.get(30, TimeUnit.SECONDS); assertEquals(3, count.get()); }</code><technical_language>15 seconds long</technical_language>

Target:
public void testStopDuringProcess() throws ExecutionException, InterruptedException, TimeoutException { PersistenceManager persistenceManager = extractComponent(cache, PersistenceManager.class); StreamingMarshaller marshaller = extractComponent(cache, StreamingMarshaller.class); persistenceManager.writeToAllNonTxStores(marshalledEntry("k1", "v1", marshaller), BOTH); persistenceManager.writeToAllNonTxStores(marshalledEntry("k2", "v2", marshaller), BOTH); persistenceManager.writeToAllNonTxStores(marshalledEntry("k3", "v3", marshaller), BOTH); final CountDownLatch before = new CountDownLatch(1); final CountDownLatch after = new CountDownLatch(1); final AtomicInteger count = new AtomicInteger(0); Future<Void> c = fork(() -> persistenceManager.processOnAllStores(new WithinThreadExecutor(), null, (marshalledEntry, taskContext) -> { before.countDown(); after.await(); count.incrementAndGet(); }, true, true)); before.await(30, TimeUnit.SECONDS); Future<Void> stopFuture = fork(persistenceManager::stop); expectException(TimeoutException.class, () -> stopFuture.get(1, TimeUnit.SECONDS)); after.countDown(); c.get(30, TimeUnit.SECONDS); stopFuture.get(30, TimeUnit.SECONDS); assertEquals(3, count.get()); }
Source:
<code>public CassandraFrameworkProtos.RackDc getDefaultRackDc() { CassandraFrameworkProtos.RackDc rackDc = get().getDefaultRackDc(); <START> if (rackDc == null) rackDc = CassandraFrameworkProtos.RackDc.newBuilder().setRack("RACK0").setDc("DC0").build(); <END> return rackDc; }</code><technical_language>Please add // TODO: Persistence Schema Update more appropriately address code needed update object schemas in future</technical_language>

Target:
public CassandraFrameworkProtos.RackDc getDefaultRackDc() { CassandraFrameworkProtos.RackDc rackDc = getDefaultConfigRole().getRackDc(); if (rackDc == null) rackDc = CassandraFrameworkProtos.RackDc.newBuilder().setRack("RACK0").setDc("DC0").build(); return rackDc; }
Source:
<code>protected long indexCount(final String query, final long timeoutMillis) { final String queryStringQuery = findAndReplaceQueryDates(translateQuery(query, null).getQuery()); IndiciesInfo info; try { info = this.indiciesAPI.loadIndicies(); } catch(DotDataException ee) { Logger.fatal(this, "Can't get indicies information",ee); return 0; } <START> final Client client = new ESClient().getClient(); <END> final QueryStringQueryBuilder queryStringQueryBuilder = QueryBuilders.queryStringQuery(queryStringQuery); final SearchRequestBuilder searchRequestBuilder = client.prepareSearch().setSize(0); searchRequestBuilder.setTimeout(TimeValue.timeValueMillis(timeoutMillis)); searchRequestBuilder.setQuery(queryStringQueryBuilder); searchRequestBuilder.setIndices( query.contains("+live:true") && !query.contains("+deleted:true")? info.live: info.working); return searchRequestBuilder.execute().actionGet().getHits().getTotalHits(); }</code><technical_language>instance variable this.client do want instantiate again</technical_language>

Target:
protected long indexCount(final String query, final long timeoutMillis) { final String queryStringQuery = findAndReplaceQueryDates(translateQuery(query, null).getQuery()); IndiciesInfo info; try { info = this.indiciesAPI.loadIndicies(); } catch(DotDataException ee) { Logger.fatal(this, "Can't get indicies information",ee); return 0; } final Client client = this.client.getClient(); final QueryStringQueryBuilder queryStringQueryBuilder = QueryBuilders.queryStringQuery(queryStringQuery); final SearchRequestBuilder searchRequestBuilder = client.prepareSearch().setSize(0); searchRequestBuilder.setTimeout(TimeValue.timeValueMillis(timeoutMillis)); searchRequestBuilder.setQuery(queryStringQueryBuilder); searchRequestBuilder.setIndices( query.contains("+live:true") && !query.contains("+deleted:true")? info.live: info.working); return searchRequestBuilder.execute().actionGet().getHits().getTotalHits(); }
Source:
<code>private void initValues() { if (networkAttachment == null) { return; } boolean newAttachment = networkAttachment.getId() == null; boolean attachmentNotReportedByTheEngine = networkAttachment.getReportedConfigurations() == null; boolean syncedNetwork = attachmentNotReportedByTheEngine || networkAttachment.getReportedConfigurations().isNetworkInSync(); boolean syncRequestedByUser = !syncedNetwork && Boolean.TRUE.equals(getIsToSync().getEntity()); if (newAttachment || syncedNetwork || syncRequestedByUser) { syncWith(new InterfacePropertiesAccessor.FromNetworkAttachmentForModel(networkAttachment, networkQos, nic)); } else { <START> syncWith(new InterfacePropertiesAccessor.FromNic(nic)); <END> getDnsConfigurationModel().setEntity(reportedDnsResolverConfiguration); } }</code><technical_language>I is cleaner add hostDnsConfig a parameter "FromNic" constructor</technical_language>

Target:
private void initValues() { if (networkAttachment == null) { return; } boolean newAttachment = networkAttachment.getId() == null; boolean attachmentNotReportedByTheEngine = networkAttachment.getReportedConfigurations() == null; boolean syncedNetwork = attachmentNotReportedByTheEngine || networkAttachment.getReportedConfigurations().isNetworkInSync(); boolean syncRequestedByUser = !syncedNetwork && Boolean.TRUE.equals(getIsToSync().getEntity()); if (newAttachment || syncedNetwork || syncRequestedByUser) { syncWith(new InterfacePropertiesAccessor.FromNetworkAttachmentForModel(networkAttachment, networkQos, nic)); } else { syncWith(new InterfacePropertiesAccessor.FromNic(nic, reportedDnsResolverConfiguration)); } }
Source:
<code>private String getTokenValue(String str) { if (str != null) { <START> if (prefixPattern==null) { <END> prefixPattern = Pattern.compile(prefix); } if (postfixPattern==null) { postfixPattern = Pattern.compile(postfix); } Matcher prefixMatcher = this.prefixPattern.matcher(str); if (prefixMatcher.find()) { int tokenStart = prefixMatcher.end(); String str2 = str.substring(tokenStart); Matcher postfixMatcher = this.postfixPattern.matcher(str2); if (postfixMatcher.find()) { int tokenEnd = postfixMatcher.start(); return str2.substring(0, tokenEnd); } } } return null; }</code><technical_language>avoid duplicate pattern initialisation. remove done in pre/postfix setters</technical_language>

Target:
private String getTokenValue(String str) { if (str != null) { checkPatterns(); Matcher prefixMatcher = this.prefixPattern.matcher(str); if (prefixMatcher.find()) { int tokenStart = prefixMatcher.end(); String str2 = str.substring(tokenStart); Matcher postfixMatcher = this.postfixPattern.matcher(str2); if (postfixMatcher.find()) { int tokenEnd = postfixMatcher.start(); return str2.substring(0, tokenEnd); } } } return null; }
Source:
<code>public boolean canAccessTarget(AsyncJobStatus target, SubResource subResource, Access required) { <START> if (isOwnerInvalid(target)) { <END> return false; } String principal = target.getPrincipal(); boolean principalMatch = principal != null && principal.equals(this.principalName); if ("user".equalsIgnoreCase(principalType)) { Access allowed = principalMatch ? Access.ALL : Access.READ_ONLY; return allowed.provides(required); } else if ("consumer".equalsIgnoreCase(principalType)) { return principalMatch && Access.ALL.provides(required); } return false; }</code><technical_language>(slowly) moving this type of check in permissions and, instead, checking job is created. job is created, assumed cleared of sorts of checks. If this is facilitate some kind of targeting for cancelling/fetching status, more robust solutions, and/or checks do in resource(s)</technical_language>

Target:
public boolean canAccessTarget(AsyncJobStatus target, SubResource subResource, Access required) { String principal = target.getPrincipalName(); boolean principalMatch = principal != null && principal.equals(this.principalName); if ("user".equalsIgnoreCase(principalType)) { Access allowed = principalMatch ? Access.ALL : Access.READ_ONLY; return allowed.provides(required); } else if ("consumer".equalsIgnoreCase(principalType)) { return principalMatch && Access.ALL.provides(required); } return false; }