auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void processClose(long lo, long msgLimit, CharSequenceObjHashMap<NamedStatementWrapper> namedStatementMap) throws BadProtocolException { final byte type = Unsafe.getUnsafe().getByte(lo); if (type == 'S') { lo = lo + 1; long hi = getStringLength(lo, msgLimit); checkNotTrue(hi == -1, "bad prepared statement name length"); CharSequence statementName = getStatementName(lo, hi); if (statementName != null) { final NamedStatementWrapper wrapper = namedStatementMap.get(statementName); <START> wrapper.clear(); <END> bindVarTypesStack.push(wrapper.bindVariableTypes); namedStatementWrapperStack.push(wrapper); } } sink().put('3'); sink().putNetworkInt(Integer.BYTES); }</code><technical_language>this assumes statement is found, e.g. happy days protocol scenario. prepared for protocol abuse NPE here. throw BadProtocolException</technical_language>

Target:
private void processClose(long lo, long msgLimit, CharSequenceObjHashMap<NamedStatementWrapper> namedStatementMap) throws BadProtocolException { final byte type = Unsafe.getUnsafe().getByte(lo); if (type == 'S') { lo = lo + 1; long hi = getStringLength(lo, msgLimit); checkNotTrue(hi == -1, "bad prepared statement name length"); CharSequence statementName = getStatementName(lo, hi); if (statementName != null) { final NamedStatementWrapper wrapper = namedStatementMap.get(statementName); if (wrapper != null) { IntList bindVariableTypes = wrapper.bindVariableTypes; if (bindVariableTypes != null) { bindVarTypesPool.push(bindVariableTypes); } namedStatementWrapperPool.push(wrapper); } else { LOG.error().$("invalid statement name [value=").$(statementName).$(']').$(); throw BadProtocolException.INSTANCE; } } } else if (type == 'P') { LOG.info().$("close message for portal - ignoring").$(); } else { LOG.error().$("invalid type for close message [type=").$(type).$(']').$(); throw BadProtocolException.INSTANCE; } prepareCloseComplete(); }
Source:
<code>public void stop() { synchronized (lock) { <START> List<State> expectedStates = ImmutableList.of(State.NEW, State.RUNNING, State.STARTED, State.IN_REBALANCE); <END> if (expectedStates.contains(state)) { state = State.STOPPING; try { LOGGER.info("Shutting down the container: of stream processor: {}.", container, processorId); boolean hasContainerShutdown = stopSamzaContainer(); if (!hasContainerShutdown) { LOGGER.info("Interrupting the container: thread to die.", container); executorService.shutdownNow(); LOGGER.info("Waiting ms for the container:{} thread to die.", taskShutdownMs, container); executorService.awaitTermination(taskShutdownMs, TimeUnit.MILLISECONDS); } } catch (Throwable throwable) { LOGGER.error(String.format("Exception occurred on container: %s shutdown of stream processor: %s.", container, processorId), throwable); } LOGGER.info("Shutting down JobCoordinator of stream processor: {}.", processorId); jobCoordinator.stop(); } else { LOGGER.info("StreamProcessor state is: {}. Ignoring the stop.", state); } } }</code><technical_language>Stop called in state. this check needs if STOPPING</technical_language>

Target:
public void stop() { synchronized (lock) { if (state != State.STOPPING && state != State.STOPPED) { state = State.STOPPING; try { LOGGER.info("Shutting down the container: of stream processor: {}.", container, processorId); boolean hasContainerShutdown = stopSamzaContainer(); if (!hasContainerShutdown) { LOGGER.info("Interrupting the container: thread to die.", container); executorService.shutdownNow(); } } catch (Throwable throwable) { LOGGER.error(String.format("Exception occurred on container: %s shutdown of stream processor: %s.", container, processorId), throwable); } LOGGER.info("Shutting down JobCoordinator of stream processor: {}.", processorId); jobCoordinator.stop(); } else { LOGGER.info("StreamProcessor state is: {}. Ignoring the stop.", state); } } }
Source:
<code>private static boolean isExcluded(VariableTree variable) { <START> return isStaticOrFinal(variable) || variable.symbol().metadata().isAnnotatedWith("javax.inject.Inject") || variable.symbol().metadata().isAnnotatedWith("javax.ejb.EJB"); <END> }</code><technical_language>if injected 2 times, calling times variable.symbol().metadata() is efficient. Please a dedicated intermediate variable</technical_language>

Target:
private static boolean isExcluded(VariableTree variable) { SymbolMetadata varMetadata = variable.symbol().metadata(); return isStaticOrFinal(variable) || varMetadata.isAnnotatedWith("javax.inject.Inject") || varMetadata.isAnnotatedWith("javax.ejb.EJB"); }
Source:
<code>public List<Set<Long>> getSegmentKeySets() { <START> return store.getSegments().stream().map(OffHeapChainMap::keySet).collect(Collectors.toList()); <END> }</code><technical_language>simply return anonymous abstract list delegates methods implement</technical_language>

Target:
public List<Set<Long>> getSegmentKeySets() { return new AbstractList<Set<Long>>() { @Override public Set<Long> get(int index) { return store.getSegments().get(index).keySet(); } @Override public int size() { return store.getSegments().size(); } }; }
Source:
<code>public void testCyclone() { addCard(Zone.LIBRARY, playerA, "Goblin Piker"); addCard(Zone.LIBRARY, playerA, "Swamp", 10); skipInitShuffling(); addCard(Zone.BATTLEFIELD, playerA, "Mountain"); addCard(Zone.BATTLEFIELD, playerA, "Unpredictable Cyclone"); addCard(Zone.HAND, playerA, "Desert Cerodon"); activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cycling"); setChoice(playerA, "Yes"); setStopAt(1, PhaseStep.END_TURN); <START> execute(); <END> assertAllCommandsUsed(); assertPermanentCount(playerA, "Goblin Piker", 1); }</code><technical_language>Add setStrictChooseMode(true); execute(); ensure targets/choices commands missing</technical_language>

Target:
public void testCyclone() { addCard(Zone.LIBRARY, playerA, "Goblin Piker"); addCard(Zone.LIBRARY, playerA, "Swamp", 10); skipInitShuffling(); addCard(Zone.BATTLEFIELD, playerA, "Mountain"); addCard(Zone.BATTLEFIELD, playerA, "Unpredictable Cyclone"); addCard(Zone.HAND, playerA, "Desert Cerodon"); activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cycling"); setChoice(playerA, "Yes"); setStopAt(1, PhaseStep.END_TURN); setStrictChooseMode(true); execute(); assertAllCommandsUsed(); assertPermanentCount(playerA, "Goblin Piker", 1); }
Source:
<code>public void write(@Nonnull IToken token, @Nonnull Object data, @Nonnull CacheOption cacheOption) { ILogData ld; if (data instanceof ILogData) { ld = (ILogData) data; } else { ld = new LogData(DataType.DATA, data); } layoutHelper(e -> { Layout l = e.getLayout(); if (token.getEpoch() != l.getEpoch()) { throw new StaleTokenException(l.getEpoch()); } ld.useToken(token); ld.setId(runtime.getParameters().getClientId()); try { l.getReplicationMode(token.getSequence()) .getReplicationProtocol(runtime) .write(e, ld); } catch (OverwriteException ex) { if (ex.getOverWriteCause() == OverwriteCause.SAME_DATA){ validateStateOfWrittenEntry(token.getSequence(), ld); } else { throw ex; } } catch (WriteSizeException we) { throw we; } catch (RuntimeException re) { log.error("write: got exception during replication protocol write", re); validateStateOfWrittenEntry(token.getSequence(), ld); } <START> return null; <END> }, true); if (!runtime.getParameters().isCacheDisabled() && cacheOption == CacheOption.WRITE_THROUGH) { readCache.put(token.getSequence(), ld); } }</code><technical_language>include token</technical_language>

Target:
public void write(@Nonnull IToken token, @Nonnull Object data, @Nonnull CacheOption cacheOption) { ILogData ld; if (data instanceof ILogData) { ld = (ILogData) data; } else { ld = new LogData(DataType.DATA, data); } layoutHelper(e -> { Layout l = e.getLayout(); if (token.getEpoch() != l.getEpoch()) { throw new StaleTokenException(l.getEpoch()); } ld.useToken(token); ld.setId(runtime.getParameters().getClientId()); try { l.getReplicationMode(token.getSequence()) .getReplicationProtocol(runtime) .write(e, ld); } catch (OverwriteException ex) { if (ex.getOverWriteCause() == OverwriteCause.SAME_DATA){ validateStateOfWrittenEntry(token.getSequence(), ld); } else { throw ex; } } catch (WriteSizeException we) { throw we; } catch (RuntimeException re) { log.error("write: Got exception during replication protocol write with token: {}", token, re); validateStateOfWrittenEntry(token.getSequence(), ld); } return null; }, true); if (!runtime.getParameters().isCacheDisabled() && cacheOption == CacheOption.WRITE_THROUGH) { readCache.put(token.getSequence(), ld); } }
Source:
<code>protected <T> T newPlugin(Class<T> klass) { <START> ClassLoader classLoader = delegatingLoader.pluginClassLoader(klass.getName()); <END> if (classLoader == null) { classLoader = delegatingLoader; } return newPlugin(classLoader, klass); }</code><technical_language>time get here, class generally loaded. Do simply class loader of class class loader again</technical_language>

Target:
protected static <T> T newPlugin(Class<T> klass) { ClassLoader savedLoader = compareAndSwapLoaders(klass.getClassLoader()); try { return Utils.newInstance(klass); } catch (Throwable t) { throw new ConnectException("Instantiation error", t); } finally { compareAndSwapLoaders(savedLoader); } }
Source:
<code>public boolean deleteContent( Collection collection, String uri, Session session ) throws IOException, ZebedeeException { if (collection == null) { throw new BadRequestException("Please specify a collection"); } if (session == null || !permissionsService.canEdit(session.getEmail())) { throw new UnauthorizedException(getUnauthorizedMessage(session)); } if (StringUtils.isBlank(uri)) { throw new BadRequestException("Please provide a URI"); } Path path = collection.find(uri); if (path == null || !collection.isInCollection(uri)) { throw new NotFoundException( "This URI cannot be found in the collection"); } boolean deleted; CollectionEventType eventType; if (isDataVisualisationFile(path)) { deleted = collection.deleteDataVisContent(session, Paths.get(uri)); } else if (Files.isDirectory(path)) { deleted = collection.deleteContentDirectory(session.getEmail(), uri); } else { <START> deleted = deleteFile(collection, uri); <END> } eventType = COLLECTION_CONTENT_DELETED; collection.save(); if (deleted) { removeEmptyCollectionDirectories(path); collectionHistoryDaoSupplier.get().saveCollectionHistoryEvent(new CollectionHistoryEvent(collection, session, eventType, uri)); } return deleted; }</code><technical_language>Method name is slightly misleading, deleting a file, deleting more that. (?) lines of deleteFileAndRelated()</technical_language>

Target:
public boolean deleteContent( Collection collection, String uri, Session session ) throws IOException, ZebedeeException { if (collection == null) { throw new BadRequestException("Please specify a collection"); } if (session == null || !permissionsService.canEdit(session.getEmail())) { throw new UnauthorizedException(getUnauthorizedMessage(session)); } if (StringUtils.isBlank(uri)) { throw new BadRequestException("Please provide a URI"); } Path contentTargetPath = collection.find(uri); if (contentTargetPath == null || !collection.isInCollection(uri)) { throw new NotFoundException( "This URI cannot be found in the collection"); } boolean deleted = deletcContentFromCollection(collection, session, contentTargetPath, uri); collection.save(); if (deleted) { removeEmptyCollectionDirectories(contentTargetPath); collectionHistoryDaoSupplier.get().saveCollectionHistoryEvent(new CollectionHistoryEvent(collection, session, COLLECTION_CONTENT_DELETED, uri)); } return deleted; }
Source:
<code><START> private static Optional<String> getBranchName(Optional<Branch> branchOpt) { <END> if (!branchOpt.isPresent()) { return Optional.empty(); } Branch branch = branchOpt.get(); if (!branch.isLegacyFeature() && !branch.isMain()) { return branch.getName(); } return Optional.empty(); }</code><technical_language>![MINOR](<LINK_1> 'Severity: MINOR') a "Branch" parameter instead. [![rule](<LINK_0>](<LINK_2></technical_language>

Target:
private static Optional<String> getBranchName(Optional<Branch> branchOpt) { if (!branchOpt.isPresent()) { return Optional.empty(); } Branch branch = branchOpt.get(); if (!branch.isLegacyFeature() && !branch.isMain()) { return Optional.of(branch.getName()); } return Optional.empty(); }
Source:
<code>private void setValuesForGroupby( List<BlockBuilder> blockBuilders, List<Type> types, int numGroupByClause, JsonNode group, String[] values) { requireNonNull(group, "Expected valid group"); requireNonNull(values, "Expected valid values in group by"); Preconditions.checkState( <START> blockBuilders.size() == values.length + group.size(), <END> String.format( "Expected pinot to return total of %d values for group by, but got only %d group-by-keys and %d values", blockBuilders.size(), group.size(), values.length)); for (int i = 0; i < group.size(); i++) { setValue(types.get(i), blockBuilders.get(i), asText(group.get(i))); } for (int i = 0; i < values.length; i++) { int metricColumnIndex = i + numGroupByClause; setValue(types.get(metricColumnIndex), blockBuilders.get(metricColumnIndex), values[i]); } }</code><technical_language>params for format in line param line</technical_language>

Target:
private void setValuesForGroupby( List<BlockBuilder> blockBuilders, List<Type> types, int numGroupByClause, JsonNode group, String[] values) { requireNonNull(group, "Expected valid group"); requireNonNull(values, "Expected valid values in group by"); checkState( blockBuilders.size() == values.length + group.size(), String.format( "Expected pinot to return total of %d values for group by, but got only %d group-by-keys and %d values", blockBuilders.size(), group.size(), values.length)); for (int i = 0; i < group.size(); i++) { setValue(types.get(i), blockBuilders.get(i), asText(group.get(i))); } for (int i = 0; i < values.length; i++) { int metricColumnIndex = i + numGroupByClause; setValue(types.get(metricColumnIndex), blockBuilders.get(metricColumnIndex), values[i]); } }
Source:
<code><START> public String toString() { <END> return String.format("%s: %s bp", readName, getReadLength()); }</code><technical_language>a bit afraid is a code out in while relies this giving output. add a method toFastQString() calls encode obvious do this do? I toString call produce output avoid giving people surprise headaches</technical_language>

Target:
public String toString() { return toFastQString(); }
Source:
<code>public void testFeedingAcks() throws Exception { int numIterations = 10000; AckManager manager = new AckManager(); Channel channel = new MockChannel(); manager.init(); long start = System.currentTimeMillis(); <START> Timber.LogEvent e; <END> for (int i = 0; i < numIterations; i++) { e = getDummyLogEventBuilder().setId("id" + i).build(); manager.ack(channel, e); } long duration = System.currentTimeMillis() - start; log.info("Processed " + numIterations + " acknowledgements in "+ duration + "ms (" + (numIterations / ( (double)duration / 1000)) + " per sec)"); manager.shutdown(); }</code><technical_language>"e" is exception. definition. :)</technical_language>

Target:
public void testFeedingAcks() throws Exception { int numIterations = 10000; AckManager manager = new AckManager(); Channel channel = new MockChannel(); manager.init(); long start = System.currentTimeMillis(); Timber.LogEvent event; for (int i = 0; i < numIterations; i++) { event = getDummyLogEventBuilder().setId("id" + i).build(); manager.ack(channel, event); } long duration = System.currentTimeMillis() - start; log.info("Processed " + numIterations + " acknowledgements in "+ duration + "ms (" + (numIterations / ( (double)duration / 1000)) + " per sec)"); manager.shutdown(); }
Source:
<code><START> ARN(String arn) { <END> this.arn = arn; Matcher arnMatcher = PATTERN.matcher(arn); if (!arnMatcher.matches()) { throw new IllegalArgumentException(arn + " is not a valid ARN"); } this.region = arnMatcher.group(1); this.account = arnMatcher.group(2); this.name = arnMatcher.group(3); }</code><technical_language>public</technical_language>

Target:
public ARN(String arn) { this.arn = arn; Matcher arnMatcher = PATTERN.matcher(arn); if (!arnMatcher.matches()) { throw new IllegalArgumentException(arn + " is not a valid ARN"); } this.region = arnMatcher.group(1); this.account = arnMatcher.group(2); this.name = arnMatcher.group(3); }
Source:
<code>private UserIdentity toUserIdentity(GitPersonalInfo info, AccountInfo accInfo, IProgressMonitor monitor) throws GerritException { UserIdentity userIdentity = new UserIdentity(); userIdentity.setAccount(new Account.Id(accInfo.getId())); <START> userIdentity.setEmail(info.getEmail() != null ? info.getEmail() : null); <END> userIdentity.setName(info.getName()); userIdentity.setTimeZone(info.getTimeZoneOffset()); userIdentity.setDate(parseTimeStamp(info.getDate())); return userIdentity; }</code><technical_language>is "info.getEmail()"</technical_language>

Target:
private UserIdentity toUserIdentity(GitPersonalInfo info, AccountInfo accInfo, IProgressMonitor monitor) throws GerritException { UserIdentity userIdentity = new UserIdentity(); userIdentity.setAccount(new Account.Id(accInfo.getId())); userIdentity.setEmail(info.getEmail()); userIdentity.setName(info.getName()); userIdentity.setTimeZone(info.getTimeZoneOffset()); userIdentity.setDate(parseTimeStamp(info.getDate())); return userIdentity; }
Source:
<code>public BrooklynVersion() { readPropertiesFromMavenResource(BrooklynVersion.class.getClassLoader()); <START> readPropertiesFromOsgiResource(BrooklynVersion.class.getClassLoader(), "org.apache.brooklyn.core"); <END> checkVersions(); }</code><technical_language>constant BROOKLYN_CORE_SYMBOLIC_NAME</technical_language>

Target:
public BrooklynVersion() { readPropertiesFromMavenResource(BrooklynVersion.class.getClassLoader()); readPropertiesFromOsgiResource(BrooklynVersion.class.getClassLoader(), BROOKLYN_CORE_SYMBOLIC_NAME); checkVersions(); }
Source:
<code>public void testRobotIsCreatedWithCorrectInitialOrientation() { final Orientation initialOrientation = Orientation.NORTH; final Robot robot = new Robot(new GridPosition(0, 0), initialOrientation); final Orientation actualOrientation = robot.getOrientation(); <START> assertTrue(actualOrientation.equals(initialOrientation)); <END> }</code><technical_language>wondering if actualOrientation is carrying intention-revealing weight, here. this compare with: java @Test public void testRobotIsCreatedWithCorrectInitialOrientation() { final Orientation initialOrientation = Orientation.NORTH; final Robot robot = new Robot(new GridPosition(0, 0), initialOrientation); assertEquals(robot.getOrientation(), initialOrientation); }</technical_language>

Target:
public void testRobotIsCreatedWithCorrectInitialOrientation() { final Orientation initialOrientation = Orientation.NORTH; final Robot robot = new Robot(new GridPosition(0, 0), initialOrientation); assertTrue(robot.getOrientation().equals(initialOrientation)); }
Source:
<code>public void testThrowCustomCheckedException() { try { <START> errorHandling.handleErrorByThrowingCustomCheckedException(); <END> throw new AssertionFailedError(); } catch (Exception e) { assertFalse(e instanceof RuntimeException); assertFalse(checkedExceptions.contains(e.getClass())); } }</code><technical_language>able deal this in other tests, i.e. thrown.expect(CustomCheckedException.class); for next tests</technical_language>

Target:
public void testThrowCustomCheckedException() throws CustomCheckedException { thrown.expect(CustomCheckedException.class); errorHandling.handleErrorByThrowingCustomCheckedException(); }
Source:
<code>private List<LoginServer> getLoginServersFromPreferences(SharedPreferences prefs) { int numServers = prefs.getInt(NUMBER_OF_ENTRIES, 0); if (numServers == 0) { return null; } final List<LoginServer> allServers = new ArrayList<>(); for (int i = 0; i < numServers; i++) { <START> final String name = prefs.getString(String.format(Locale.US, SERVER_NAME, i), null); <END> final String url = prefs.getString(String.format(Locale.US, SERVER_URL, i), null); boolean isCustom = prefs.getBoolean(String.format(Locale.US, IS_CUSTOM, i), false); if (name != null && url != null) { final LoginServer server = new LoginServer(name, url, isCustom); allServers.add(server); } } return (allServers.size() > 0 ? allServers : null); }</code><technical_language>if shared prefs urls coming previous versions malformed, remain malformed app is updated</technical_language>

Target:
private List<LoginServer> getLoginServersFromPreferences(SharedPreferences prefs) { int numServers = prefs.getInt(NUMBER_OF_ENTRIES, 0); if (numServers == 0) { return null; } final List<LoginServer> allServers = new ArrayList<>(); for (int i = 0; i < numServers; i++) { final String name = prefs.getString(String.format(Locale.US, SERVER_NAME, i), null); final String url = prefs.getString(String.format(Locale.US, SERVER_URL, i), null); boolean isCustom = prefs.getBoolean(String.format(Locale.US, IS_CUSTOM, i), false); if (name != null && url != null) { final LoginServer server = new LoginServer(name, url.trim(), isCustom); allServers.add(server); } } return (allServers.size() > 0 ? allServers : null); }
Source:
<code>public RoughArtifact populateArtifact(Queue<DoorsTableRow> queue) { Conditions.checkNotNullOrEmpty(queue, "Queue"); <START> <END> RoughArtifact combined = populateArtifact(queue.poll()); while (!queue.isEmpty()) { combineDoorsArtifacts(combined, populateArtifact(queue.poll())); } return combined; }</code><technical_language>double poll here? this drain instead</technical_language>

Target:
public RoughArtifact populateArtifact(Queue<DoorsTableRow> queue) { Conditions.checkNotNullOrEmpty(queue, "Queue"); RoughArtifact combined = populateArtifact(queue.remove()); while (!queue.isEmpty()) { combineDoorsArtifacts(combined, populateArtifact(queue.remove())); } return combined; }
Source:
<code>private void internalDeleteBundleAndDependencies (final String bundleId, final User user) throws DotDataException { this.validateBundleDeletePermission(user, bundleId); Logger.info(this, "Removing bundle: " + bundleId + " and dependencies by: " + user.getUserId()); try { Logger.info(this, "Removing audit status for a bundle: " + bundleId); this.publishAuditAPI.deletePublishAuditStatus(bundleId); } catch (DotPublisherException e) { <START> <END> throw new DotDataException(e); } Logger.info(this, "Removing all pushed assets for a bundle: " + bundleId); this.pushedAssetsAPI.deletePushedAssetsByBundleId(bundleId); Logger.info(this, "Removing all assets from bundle: " + bundleId); this.bundleFactory.deleteAllAssetsFromBundle(bundleId); Logger.info(this, "Removing environments from bundle: " + bundleId); this.bundleFactory.deleteBundleEnvironmentByBundle(bundleId); Logger.info(this, "Removing bundle: " + bundleId); this.deleteBundle(bundleId); }</code><technical_language>Please log bundle ID here</technical_language>

Target:
private void internalDeleteBundleAndDependencies (final String bundleId, final User user) throws DotDataException { this.validateBundleDeletePermission(user, bundleId); Logger.info(this, "Removing bundle: " + bundleId + " and dependencies by: " + user.getUserId()); try { Logger.info(this, "Removing audit status for a bundle: " + bundleId); this.publishAuditAPI.deletePublishAuditStatus(bundleId); } catch (DotPublisherException e) { Logger.error(this,"Error Removing audit status for bundle: " + bundleId,e); throw new DotDataException(e); } Logger.info(this, "Removing all pushed assets for a bundle: " + bundleId); this.pushedAssetsAPI.deletePushedAssetsByBundleId(bundleId); Logger.info(this, "Removing all assets from bundle: " + bundleId); this.bundleFactory.deleteAllAssetsFromBundle(bundleId); Logger.info(this, "Removing environments from bundle: " + bundleId); this.bundleFactory.deleteBundleEnvironmentByBundle(bundleId); Logger.info(this, "Removing bundle: " + bundleId); this.deleteBundle(bundleId); }
Source:
<code>public static ScenarioTemplate Deserialize(File inputFile) { ScenarioTemplate resultingTemplate = null; FileInputStream file = null; try { JAXBContext context = JAXBContext.newInstance(ScenarioTemplate.class); Unmarshaller um = context.createUnmarshaller(); file = new FileInputStream(inputFile); Source inputSource = MekHqXmlUtil.createSafeXmlSource(file); JAXBElement<ScenarioTemplate> templateElement = um.unmarshal(inputSource, ScenarioTemplate.class); resultingTemplate = templateElement.getValue(); } catch(Exception e) { MekHQ.getLogger().error(ScenarioTemplate.class, "Deserialize", "Error Deserializing Scenario Template", e); } finally { <START> IOUtils.closeQuietly(file); <END> } return resultingTemplate; }</code><technical_language>I prefer [try-with-resources](<LINK_0> (aka C#'s using-statement) model</technical_language>

Target:
public static ScenarioTemplate Deserialize(File inputFile) { ScenarioTemplate resultingTemplate = null; try { JAXBContext context = JAXBContext.newInstance(ScenarioTemplate.class); Unmarshaller um = context.createUnmarshaller(); try (FileInputStream fileStream = new FileInputStream(inputFile)) { Source inputSource = MekHqXmlUtil.createSafeXmlSource(fileStream); JAXBElement<ScenarioTemplate> templateElement = um.unmarshal(inputSource, ScenarioTemplate.class); resultingTemplate = templateElement.getValue(); } } catch(Exception e) { MekHQ.getLogger().error(ScenarioTemplate.class, "Deserialize", "Error Deserializing Scenario Template", e); } return resultingTemplate; }
Source:
<code>public void recoverNodes(NodeSource nodeSource) { logger.info(START_TO_RECOVER_NODES); int lookUpTimeout = PAResourceManagerProperties.RM_NODELOOKUP_TIMEOUT.getValueAsInt(); String nodeSourceName = nodeSource.getName(); <START> makeSureNodeSourceHasNoNode(nodeSource, nodeSourceName); <END> Collection<RMNodeData> nodesData = rmCore.getDbManager().getNodesByNodeSource(nodeSourceName); logger.info("Number of nodes found in database for node source " + nodeSourceName + ": " + nodesData.size()); Map<NodeState, Integer> nodeStates = new HashMap<>(); int totalEligibleRecoveredNodes = 0; for (RMNodeData rmNodeData : nodesData) { String nodeUrl = rmNodeData.getNodeUrl(); RMNode rmnode = null; Node node = tryToLookupNode(nodeSource, lookUpTimeout, nodeUrl); if (node != null) { rmnode = recoverNodeInternally(nodeSource, rmNodeData, nodeUrl, node); nodesLockRestorationManager.handle(rmnode, rmNodeData.getProvider()); Integer nbNodesInState = nodeStates.get(rmnode.getState()); int newNbNodesInState = nbNodesInState == null ? 1 : nbNodesInState + 1; nodeStates.put(rmnode.getState(), newNbNodesInState); } else { rmCore.getDbManager().removeNode(rmNodeData); triggerDownNodeHandling(nodeSource, rmNodeData, nodeUrl); } if (isEligible(rmnode)) { rmCore.addEligibleNode(rmnode); totalEligibleRecoveredNodes++; } } int totalRecoveredNodes = 0; logNodeRecoverySummary(nodeSourceName, nodeStates, totalRecoveredNodes, totalEligibleRecoveredNodes); }</code><technical_language>name a bit more clear delete nodes does. I "makeSure"really means. :-D</technical_language>

Target:
protected void recoverNodes(NodeSource nodeSource) { logger.info(START_TO_RECOVER_NODES); int lookUpTimeout = PAResourceManagerProperties.RM_NODELOOKUP_TIMEOUT.getValueAsInt(); String nodeSourceName = nodeSource.getName(); this.logWarnIfNodeSourceHasNoNode(nodeSource, nodeSourceName); Collection<RMNodeData> nodesData = this.rmCore.getDbManager().getNodesByNodeSource(nodeSourceName); logger.info("Number of nodes found in database for node source " + nodeSourceName + ": " + nodesData.size()); List<RMNode> recoveredEligibleNodes = Collections.synchronizedList(new ArrayList<RMNode>()); Map<NodeState, Integer> recoveredNodeStatesCounter = new HashMap<>(); for (RMNodeData rmNodeData : nodesData) { String nodeUrl = rmNodeData.getNodeUrl(); Node node = this.tryToLookupNode(nodeSource, lookUpTimeout, nodeUrl); RMNode rmnode = this.recoverRMNode(nodeSource, recoveredNodeStatesCounter, rmNodeData, nodeUrl, node); if (this.isEligible(rmnode)) { recoveredEligibleNodes.add(rmnode); } } this.rmCore.setEligibleNodesToRecover(recoveredEligibleNodes); this.logNodeRecoverySummary(nodeSourceName, recoveredNodeStatesCounter, recoveredEligibleNodes.size()); }
Source:
<code>private List<AssignableReplica> getOrderedAssignableReplica(ClusterModel clusterModel) { Map<String, Set<AssignableReplica>> replicasByResource = clusterModel.getAssignableReplicaMap(); List<AssignableReplica> orderedAssignableReplicas = replicasByResource.values().stream().flatMap(replicas -> replicas.stream()) .collect(Collectors.toList()); Map<String, ResourceAssignment> bestPossibleAssignment = clusterModel.getBestPossibleAssignment(); <START> Map<String, ResourceAssignment> baselineAssignment = clusterModel.getBaseline(); <END> orderedAssignableReplicas.sort((o1, o2) -> { String resourceName1 = o1.getResourceName(); String resourceName2 = o2.getResourceName(); if (bestPossibleAssignment.containsKey(resourceName1) == bestPossibleAssignment .containsKey(resourceName2)) { if (baselineAssignment.containsKey(resourceName1) == baselineAssignment .containsKey(resourceName2)) { int statePriority1 = o1.getStatePriority(); int statePriority2 = o2.getStatePriority(); if (statePriority1 == statePriority2) { if (resourceName1.equals(resourceName2)) { return o1.getPartitionName().compareTo(o2.getPartitionName()); } else { return resourceName1.compareTo(resourceName2); } } else { return statePriority2 - statePriority1; } } else { return baselineAssignment.containsKey(resourceName1) ? -1 : 1; } } else { return bestPossibleAssignment.containsKey(resourceName1) ? -1 : 1; } }); return orderedAssignableReplicas; }</code><technical_language>nit: Add get method in cluster model get assignableReplicas. I feel code is repeated</technical_language>

Target:
private List<AssignableReplica> getOrderedAssignableReplica(ClusterModel clusterModel) { Map<String, Set<AssignableReplica>> replicasByResource = clusterModel.getAssignableReplicaMap(); List<AssignableReplica> orderedAssignableReplicas = replicasByResource.values().stream().flatMap(replicas -> replicas.stream()) .collect(Collectors.toList()); Map<String, ResourceAssignment> bestPossibleAssignment = clusterModel.getContext().getBestPossibleAssignment(); Map<String, ResourceAssignment> baselineAssignment = clusterModel.getContext().getBaselineAssignment(); orderedAssignableReplicas.sort((replica1, replica2) -> { String resourceName1 = replica1.getResourceName(); String resourceName2 = replica2.getResourceName(); if (bestPossibleAssignment.containsKey(resourceName1) == bestPossibleAssignment .containsKey(resourceName2)) { if (baselineAssignment.containsKey(resourceName1) == baselineAssignment .containsKey(resourceName2)) { int statePriority1 = replica1.getStatePriority(); int statePriority2 = replica2.getStatePriority(); if (statePriority1 == statePriority2) { if (resourceName1.equals(resourceName2)) { return replica1.getPartitionName().compareTo(replica2.getPartitionName()); } else { return resourceName1.compareTo(resourceName2); } } else { return statePriority1 - statePriority2; } } else { return baselineAssignment.containsKey(resourceName1) ? -1 : 1; } } else { return bestPossibleAssignment.containsKey(resourceName1) ? -1 : 1; } }); return orderedAssignableReplicas; }
Source:
<code>private void changeOpacity(String selector, int value, WebDriver driver) { <START> JavascriptActions javascriptActions = new JavascriptActions(driver); <END> javascriptActions.changeElementOpacity(selector, value); }</code><technical_language>left this logger</technical_language>

Target:
private void changeOpacity(String selector, int value, WebDriver driver) { PageObjectLogging.log("CSS selector", selector, true, driver); JavascriptActions javascriptActions = new JavascriptActions(driver); javascriptActions.changeElementOpacity(selector, value); }
Source:
<code>private int doubleEqual(Object actual, Object expected) { if (isFloatingPointValue(actual) && isFloatingPointValue(expected)) { Double actualDouble = Double.valueOf(actual.toString()); Double expectedDouble = Double.valueOf(expected.toString()); <START> Double threshold = DOUBLE_FUZZY_MATCH_THRESHOLD; <END> return DoubleMath.fuzzyCompare(actualDouble, expectedDouble, threshold); } return -1; }</code><technical_language>Inline this variable</technical_language>

Target:
private int doubleEqual(Object actual, Object expected) { if (isFloatingPointValue(actual) && isFloatingPointValue(expected)) { Double actualDouble = Double.valueOf(actual.toString()); Double expectedDouble = Double.valueOf(expected.toString()); return DoubleMath.fuzzyCompare(actualDouble, expectedDouble, MACHINE_EPSILON_DOUBLE_64B); } return -1; }
Source:
<code>public void testGetCacheNames() { <START> Boolean passed = StreamSupport.stream(cacheManager.getCacheNames().spliterator(), true) <END> .anyMatch(n -> getCacheNamesTestCacheName.equalsIgnoreCase(n)); assertTrue(getCacheNamesTestCacheName + " cache name was not found in list retrieved from CacheManager", passed); }</code><technical_language>boolean work</technical_language>

Target:
public void testGetCacheNames() { boolean passed = StreamSupport.stream(cacheManager.getCacheNames().spliterator(), true) .anyMatch(n -> getCacheNamesTestCacheName.equalsIgnoreCase(n)); assertTrue(getCacheNamesTestCacheName + " cache name was not found in list retrieved from CacheManager", passed); }
Source:
<code>private ExceptionScopeInstance getExceptionScopeInstance(Throwable e) { String exceptionName = e.getClass().getName(); Context exceptionContext = getContextContainer().getDefaultContext(ExceptionScope.EXCEPTION_SCOPE).resolveContext(exceptionName); <START> return exceptionContext == null ? null : (ExceptionScopeInstance) getContextInstance(exceptionContext); <END> }</code><technical_language>reason approach for other node instances: String exceptionName = e.getClass().getName(); ExceptionScopeInstance exceptionScopeInstance = (ExceptionScopeInstance) resolveContextInstance(ExceptionScope.EXCEPTION_SCOPE, exceptionName);</technical_language>

Target:
private ExceptionScopeInstance getExceptionScopeInstance(Throwable e) { return (ExceptionScopeInstance) resolveContextInstance(ExceptionScope.EXCEPTION_SCOPE, e.getClass().getName()); }
Source:
<code>protected ImageDescriptor decorateImage(ImageDescriptor baseImage, Object element) { if (!(element instanceof IFile)) { return super.decorateImage(baseImage, element); } IPath elementPath = new Path(repositoryMapping .getRepoRelativePath((IFile) element)); <START> if (leftOnlyPaths.contains(elementPath)) { <END> return UIIcons.ELCL16_ADD; } if (rightOnly.contains(elementPath)) { return UIIcons.ELCL16_DELETE; } if (equalContentPaths.contains(elementPath)) { return UIIcons.ELCL16_SYNCED; } return super.decorateImage(baseImage, element); }</code><technical_language>call this "addedPaths" instead of "leftOnlyPaths"</technical_language>

Target:
protected ImageDescriptor decorateImage(ImageDescriptor baseImage, Object element) { if (!(element instanceof IFile)) { return super.decorateImage(baseImage, element); } IPath elementPath = new Path(repositoryMapping .getRepoRelativePath((IFile) element)); if (addedPaths.contains(elementPath)) { return UIIcons.ELCL16_ADD; } if (deletedPaths.contains(elementPath)) { return UIIcons.ELCL16_DELETE; } if (equalContentPaths.contains(elementPath)) { return UIIcons.ELCL16_SYNCED; } return super.decorateImage(baseImage, element); }
Source:
<code>public void setUp() { final LocalizedMessage message1 = new LocalizedMessage(10, 51, "messages.properties", null, null, null, LeftCurlyCheck.class, null); final TreeWalkerAuditEvent event1 = new TreeWalkerAuditEvent(null, "Test.java", message1, null); final LocalizedMessage message2 = new LocalizedMessage(12, 30, "messages.properties", null, null, null, RightCurlyCheck.class, null); final TreeWalkerAuditEvent event2 = new TreeWalkerAuditEvent(null, "Test.java", message2, null); final LocalizedMessage message3 = new LocalizedMessage(10, 50, "messages.properties", null, null, null, LeftCurlyCheck.class, null); final TreeWalkerAuditEvent event3 = new TreeWalkerAuditEvent(null, "Test.java", message3, null); final LocalizedMessage message4 = new LocalizedMessage(10, 51, "messages.properties", null, null, null, LeftCurlyCheck.class, null); final TreeWalkerAuditEvent event4 = new TreeWalkerAuditEvent(null, "TestWrong.java", message4, null); <START> XpathFileGeneratorAstFilter.addEvent(event1); <END> XpathFileGeneratorAstFilter.addEvent(event2); XpathFileGeneratorAstFilter.addEvent(event3); XpathFileGeneratorAstFilter.addEvent(event4); XpathFileGeneratorAstFilter.addQuery("/QUERY/FIRST_CASE"); XpathFileGeneratorAstFilter.addQuery("/QUERY/SECOND_CASE"); XpathFileGeneratorAstFilter.addQuery("/QUERY/THIRD_CASE"); XpathFileGeneratorAstFilter.addQuery("/QUERY/FOURTH_CASE"); }</code><technical_language>good for quick testing ... I agree. please redo test more functional , load java file, some config, validate it, recheck output</technical_language>

Target:
public void setUp() throws Exception { final TreeWalkerAuditEvent event1 = createTreeWalkerAuditEvent( "InputXpathFileGeneratorAuditListener.java", 3, 51, TokenTypes.LCURLY, LeftCurlyCheck.class); final TreeWalkerAuditEvent event2 = createTreeWalkerAuditEvent( "InputXpathFileGeneratorAuditListener.java", 15, 5, TokenTypes.METHOD_DEF, MethodParamPadCheck.class); final TreeWalkerAuditEvent event3 = createTreeWalkerAuditEvent( "InputXpathFileGeneratorAuditListener.java", 17, 13, TokenTypes.LITERAL_FOR, NestedForDepthCheck.class); final TreeWalkerAuditEvent event4 = createTreeWalkerAuditEvent( "InputXpathFileGeneratorAuditListener.java", 5, 5, TokenTypes.VARIABLE_DEF, JavadocVariableCheck.class); final XpathFileGeneratorAstFilter astFilter = new XpathFileGeneratorAstFilter(); astFilter.accept(event1); astFilter.accept(event2); astFilter.accept(event3); astFilter.accept(event4); }
Source:
<code>void fetchEvents() { setIsLoading(true); if (Utils.isOnline(getActivity())) { <START> onListLoadMore(1, 0); <END> } else { App.getInstance().getModelCache().getAsync(mCacheKey, false, new ModelCache.CacheListener() { @Override public void onGet(Object item) { if (checkValidCache(item)) { ArrayList<Event> events = (ArrayList<Event>) item; mAdapter.addAll(events); setIsLoading(false); Snackbar snackbar = Snackbar.make(getView(), R.string.cached_content, Snackbar.LENGTH_SHORT); ColoredSnackBar.info(snackbar).show(); } else { App.getInstance().getModelCache().removeAsync(mCacheKey); onNotFound(); } } @Override public void onNotFound(String key) { onNotFound(); } private void onNotFound() { setIsLoading(false); showError(R.string.offline_alert); } }); } }</code><technical_language>onListLoadMore(1, 0) is understandable. extract this a separate method sayin loadFirstPageOfEvents()</technical_language>

Target:
void fetchEvents() { setIsLoading(true); if (Utils.isOnline(getActivity())) { loadFirstPage(); } else { App.getInstance().getModelCache().getAsync(mCacheKey, false, new ModelCache.CacheListener() { @Override public void onGet(Object item) { if (checkValidCache(item)) { ArrayList<Event> events = (ArrayList<Event>) item; mAdapter.addAll(events); setIsLoading(false); Snackbar snackbar = Snackbar.make(getView(), R.string.cached_content, Snackbar.LENGTH_SHORT); ColoredSnackBar.info(snackbar).show(); } else { App.getInstance().getModelCache().removeAsync(mCacheKey); onNotFound(); } } @Override public void onNotFound(String key) { onNotFound(); } private void onNotFound() { setIsLoading(false); showError(R.string.offline_alert); } }); } }
Source:
<code><START> public String toString() { <END> return "CoreIdPool{" + "assigned=" + ids + ", available=" + available + '}'; }</code><technical_language>synchronized</technical_language>

Target:
public synchronized String toString() { return "CpuIdPool{" + "assigned=" + ids + ", available=" + available + '}'; }
Source:
<code>protected ExecutionMediator createExecutionMediator() { if (executionMediatorFactory != null) { return executionMediatorFactory.get(); } <START> return new DefaultExecutionMediator(extensionModel, componentModel, connectionManager, muleContext.getErrorTypeRepository()); <END> }</code><technical_language>if a supplier, creating instance, create default supplier</technical_language>

Target:
protected ExecutionMediator createExecutionMediator() { return new DefaultExecutionMediator(extensionModel, componentModel, connectionManager, muleContext.getErrorTypeRepository()); }
Source:
<code>private boolean match(SCM scm, URIish url) { if (scm instanceof GitSCM) { for (RemoteConfig remoteConfig : ((GitSCM) scm).getRepositories()) { for (URIish urIish : remoteConfig.getURIs()) { if (GitStatus.looselyMatches(urIish, url)) return true; } } } else if (scm instanceof MercurialSCM) { try { URI hgUri = new URI(((MercurialSCM) scm).getSource()); String remote = url.toString(); <START> if (almostMatches(hgUri, remote)) <END> return true; } catch (URISyntaxException ex) { LOGGER.log(Level.SEVERE, "Could not parse jobSource uri " + ex); } } return false; }</code><technical_language>Please, if open/close brackets {, } if is line</technical_language>

Target:
private boolean match(SCM scm, URIish url) { if (scm instanceof GitSCM) { for (RemoteConfig remoteConfig : ((GitSCM) scm).getRepositories()) { for (URIish urIish : remoteConfig.getURIs()) { if (GitStatus.looselyMatches(urIish, url)) { return true; } } } } else if (scm instanceof MercurialSCM) { try { URI hgUri = new URI(((MercurialSCM) scm).getSource()); String remote = url.toString(); if (looselyMatches(hgUri, remote)) { return true; } } catch (URISyntaxException ex) { LOGGER.log(Level.SEVERE, "Could not parse jobSource uri: {0} ", ex); } } return false; }
Source:
<code>public boolean canMatchTrace(ITmfTrace trace) { if (!(trace instanceof CtfTmfTrace)) { return false; } CtfTmfTrace ktrace = (CtfTmfTrace) trace; String[] events = { TcpEventStrings.INET_SOCK_LOCAL_IN, TcpEventStrings.INET_SOCK_LOCAL_OUT }; Set<String> traceEvents = TmfEventTypeCollectionHelper.getEventNames(ktrace.getEventTypeSet()); traceEvents.retainAll(Arrays.asList(events)); <START> return traceEvents.size() > 0; <END> }</code><technical_language>!traceEvents.isEmtpy()</technical_language>

Target:
public boolean canMatchTrace(ITmfTrace trace) { if (!(trace instanceof CtfTmfTrace)) { return false; } CtfTmfTrace ktrace = (CtfTmfTrace) trace; Set<String> events = ImmutableSet.of( TcpEventStrings.INET_SOCK_LOCAL_IN, TcpEventStrings.INET_SOCK_LOCAL_OUT ); Set<String> traceEvents = TmfEventTypeCollectionHelper.getEventNames(ktrace.getEventTypes()); traceEvents.retainAll(events); return !traceEvents.isEmpty(); }
Source:
<code>public AcknowledgementType auditLog(LogEventRequestType request, AssertionType assertion) { LOG.debug("Entering AuditRepositoryProxyWebServiceSecured.auditLog(...)"); <START> if (request.getAuditMessage() == null) { <END> LOG.error("Audit Request is null"); } secureRequest.setAuditMessage(request.getAuditMessage()); secureRequest.setDirection(request.getDirection()); secureRequest.setInterface(request.getInterface()); secureRequest.setCommunityId(request.getCommunityId()); try { String url = oProxyHelper.getUrlLocalHomeCommunity(NhincConstants.AUDIT_REPO_SECURE_SERVICE_NAME); if (NullChecker.isNotNullish(url)) { ServicePortDescriptor<AuditRepositoryManagerSecuredPortType> portDescriptor = new AuditRepositorySecuredServicePortDescriptor(); CONNECTClient<AuditRepositoryManagerSecuredPortType> client = CONNECTCXFClientFactory.getInstance() .getCONNECTClientSecured(portDescriptor, url, assertion); synchronized (result) { result = (AcknowledgementType) client.invokePort(AuditRepositoryManagerSecuredPortType.class, "logEvent", secureRequest); } } } catch (Exception e) { LOG.error("Failed to call the web service (" + NhincConstants.AUDIT_REPO_SECURE_SERVICE_NAME + "). An unexpected exception occurred. " + "Exception: " + e.getLocalizedMessage(), e); } LOG.debug("In AuditRepositoryProxyWebServiceSecured.auditLog(...) - completed called to ConnectionManager to retrieve endpoint."); return result; }</code><technical_language>Need handle scenario request.getAuditMessage() == null populated for LogEventSecureRequestType .setAuditMessage(). LogEventSecureRequestType is a jaxb class AuditMessage a required field</technical_language>

Target:
public AcknowledgementType auditLog(LogEventRequestType request, AssertionType assertion) { LOG.debug("Entering AuditRepositoryProxyWebServiceSecured.auditLog(...)"); if (request.getAuditMessage() == null) { LOG.error("Audit Request Message is null"); synchronized (result) { return result; } } else { secureRequest.setAuditMessage(request.getAuditMessage()); } secureRequest.setDirection(request.getDirection()); secureRequest.setInterface(request.getInterface()); secureRequest.setCommunityId(request.getCommunityId()); try { String url = oProxyHelper.getUrlLocalHomeCommunity(NhincConstants.AUDIT_REPO_SECURE_SERVICE_NAME); if (NullChecker.isNotNullish(url)) { ServicePortDescriptor<AuditRepositoryManagerSecuredPortType> portDescriptor = new AuditRepositorySecuredServicePortDescriptor(); CONNECTClient<AuditRepositoryManagerSecuredPortType> client = CONNECTCXFClientFactory.getInstance() .getCONNECTClientSecured(portDescriptor, url, assertion); synchronized (result) { result = (AcknowledgementType) client.invokePort(AuditRepositoryManagerSecuredPortType.class, invokeMethodName, secureRequest); } } } catch (Exception e) { LOG.error("Failed to call the web service (" + NhincConstants.AUDIT_REPO_SECURE_SERVICE_NAME + "). An unexpected exception occurred. " + "Exception: " + e.getLocalizedMessage(), e); } LOG.debug("In AuditRepositoryProxyWebServiceSecured.auditLog(...) - completed called to ConnectionManager to " + "retrieve endpoint."); return result; }
Source:
<code>public void actionPerformed(@NotNull AnActionEvent e, @NotNull Notification notification) { final JFrame parent = WindowManager.getInstance().getFrame(e.getProject()); if (parent == null) { return; } UIUtil.invokeLaterIfNeeded(() -> { final Optional<ServerConnection> connection = getGlobalSettings().getServerConnections().stream().filter(s -> s.getName().equals(connectionName)).findAny(); if (connection.isPresent()) { SonarLintGlobalConfigurable globalConfigurable = new SonarLintGlobalConfigurable(); <START> ShowSettingsUtil.getInstance().editConfigurable(parent, globalConfigurable, () -> globalConfigurable.editNotifications(connection.get())); <END> } else if (e.getProject() != null) { SonarLintConsole.get(e.getProject()).error("Unable to find connection with name: " + connectionName); notification.expire(); } }); }</code><technical_language>Do need open full configurable ? open wizard notifications page ? focus required part</technical_language>

Target:
public void actionPerformed(@NotNull AnActionEvent e, @NotNull Notification notification) { final JFrame parent = WindowManager.getInstance().getFrame(e.getProject()); if (parent == null) { return; } UIUtil.invokeLaterIfNeeded(() -> { final Optional<ServerConnection> connectionToEditOpt = getGlobalSettings().getServerConnections().stream().filter(s -> s.getName().equals(connectionName)).findAny(); if (connectionToEditOpt.isPresent()) { final ServerConnection connectionToEdit = connectionToEditOpt.get(); final ServerConnectionWizard wizard = ServerConnectionWizard.forNotificationsEdition(connectionToEdit); if (wizard.showAndGet()) { final ServerConnection editedConnection = wizard.getConnection(); final List<ServerConnection> serverConnections = getGlobalSettings().getServerConnections(); serverConnections.set(serverConnections.indexOf(connectionToEdit), editedConnection); register(); } } else if (e.getProject() != null) { SonarLintConsole.get(e.getProject()).error("Unable to find connection with name: " + connectionName); notification.expire(); } }); }
Source:
<code>private void setupCursors() { Dir d = directions[currentDirection]; switch ( d ) { case OUT: groupCursor.outgoing( relationshipCursor ); onRelationship = relationshipCursor.next(); break; case IN: groupCursor.incoming( relationshipCursor ); onRelationship = relationshipCursor.next(); break; case LOOP: groupCursor.loops( relationshipCursor ); onRelationship = relationshipCursor.next(); break; default: <START> throw new IllegalStateException( "Lorem ipsus, Brutus" ); <END> } }</code><technical_language>cute all, include direction d</technical_language>

Target:
private void setupCursors() { Dir d = directions[currentDirection]; switch ( d ) { case OUT: groupCursor.outgoing( relationshipCursor ); onRelationship = relationshipCursor.next(); break; case IN: groupCursor.incoming( relationshipCursor ); onRelationship = relationshipCursor.next(); break; case LOOP: groupCursor.loops( relationshipCursor ); onRelationship = relationshipCursor.next(); break; default: throw new IllegalStateException( "Lorem ipsus, Brutus. (could not setup cursor for Dir='" + d + "')" ); } }