auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static ParallelTransferOptions populateAndApplyDefaults(ParallelTransferOptions other) { other = other == null ? new ParallelTransferOptions() : other; return new ParallelTransferOptions() .setBlockSize(other.getBlockSizeLong() == null ? Long.valueOf(BlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE) : other.getBlockSizeLong()) .setNumBuffers(other.getNumBuffers() == null ? Integer.valueOf(BlobAsyncClient.BLOB_DEFAULT_NUMBER_OF_BUFFERS) : other.getNumBuffers()) .setProgressReceiver(other.getProgressReceiver()) .setMaxSingleUploadSize(other.getMaxSingleUploadSizeLong() == null ? Long.valueOf(BlockBlobAsyncClient.MAX_UPLOAD_BLOB_BYTES_LONG) : other.getMaxSingleUploadSizeLong()); }

Target:
public static ParallelTransferOptions populateAndApplyDefaults(ParallelTransferOptions other) { other = other == null ? new ParallelTransferOptions() : other; Long blockSize = other.getBlockSizeLong(); if (blockSize == null) { blockSize = (long) BlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE; } Integer numBuffers = other.getNumBuffers(); if (numBuffers == null) { numBuffers = BlobAsyncClient.BLOB_DEFAULT_NUMBER_OF_BUFFERS; } Long maxSingleUploadSize = other.getMaxSingleUploadSizeLong(); if (maxSingleUploadSize == null) { maxSingleUploadSize = BlockBlobAsyncClient.MAX_UPLOAD_BLOB_BYTES_LONG; } return new ParallelTransferOptions() .setBlockSizeLong(blockSize) .setNumBuffers(numBuffers) .setProgressReceiver(other.getProgressReceiver()) .setMaxSingleUploadSizeLong(maxSingleUploadSize); }
Source:
public LockException(Throwable cause, int statusCode) { super(cause); this.statusCode = statusCode; }

Target:
public LockException(Throwable cause, int statusCode) { super(cause, statusCode); }
Source:
public ClusterParticipant getClusterParticipant() throws IOException { if (clusterParticipant == null) { clusterParticipant = new ClusterParticipant() { private final List<PartitionStateChangeListener> listeners = new LinkedList<>(); @Override public void participate(List<AmbryHealthReport> ambryHealthReports, DataNodeId currentNode) { Set<String> partitionsOnNode = getClusterMap().getReplicaIds(currentNode) .stream() .map(r -> r.getPartitionId().toPathString()) .collect(Collectors.toSet()); for (PartitionStateChangeListener listener : listeners) { for (String partitionName : partitionsOnNode) { listener.onPartitionBecomeLeaderFromStandby(partitionName); } } } @Override public void close() { } @Override public boolean setReplicaSealedState(ReplicaId replicaId, boolean isSealed) { return false; } @Override public boolean setReplicaStoppedState(List<ReplicaId> replicaIds, boolean markStop) { return false; } @Override public List<String> getSealedReplicas() { return Collections.emptyList(); } @Override public List<String> getStoppedReplicas() { return Collections.emptyList(); } @Override public void registerPartitionStateChangeListener(StateModelListenerType listenerType, PartitionStateChangeListener partitionStateChangeListener) { listeners.add(partitionStateChangeListener); } }; } return clusterParticipant; }

Target:
public ClusterParticipant getClusterParticipant() throws IOException { if (clusterParticipant == null) { clusterParticipant = new ClusterParticipant() { private final List<PartitionStateChangeListener> listeners = new LinkedList<>(); @Override public void participate(List<AmbryHealthReport> ambryHealthReports) { DataNodeId currentNode = getClusterMap().getDataNodeId(clusterMapConfig.clusterMapHostName, clusterMapConfig.clusterMapPort); Set<String> partitionsOnNode = getClusterMap().getReplicaIds(currentNode) .stream() .map(r -> r.getPartitionId().toPathString()) .collect(Collectors.toSet()); for (PartitionStateChangeListener listener : listeners) { for (String partitionName : partitionsOnNode) { listener.onPartitionBecomeLeaderFromStandby(partitionName); } } } @Override public void close() { } @Override public boolean setReplicaSealedState(ReplicaId replicaId, boolean isSealed) { return false; } @Override public boolean setReplicaStoppedState(List<ReplicaId> replicaIds, boolean markStop) { return false; } @Override public List<String> getSealedReplicas() { return Collections.emptyList(); } @Override public List<String> getStoppedReplicas() { return Collections.emptyList(); } @Override public void registerPartitionStateChangeListener(StateModelListenerType listenerType, PartitionStateChangeListener partitionStateChangeListener) { listeners.add(partitionStateChangeListener); } }; } return clusterParticipant; }
Source:
public static Map<String, String> getFormatSettingsFromFile(File file) { SAXParserFactory factory = SAXParserFactory.newInstance(); XMLParser parserXML = new XMLParser(); try { SAXParser parser = factory.newSAXParser(); parser.parse(new FileInputStream(file), parserXML); } catch (ParserConfigurationException | SAXException | IOException e) { LOG.error("It is not possible to parse file " + file.getName(), e); } return parserXML.getSettings(); }

Target:
public static Map<String, String> getFormatSettingsFromFile(File file) { SAXParserFactory factory = SAXParserFactory.newInstance(); XMLParser parserXML = new XMLParser(); try (FileInputStream fis = new FileInputStream(file)) { SAXParser parser = factory.newSAXParser(); parser.parse(fis, parserXML); } catch (ParserConfigurationException | SAXException | IOException e) { LOG.error("It is not possible to parse file " + file.getName(), e); } return parserXML.getSettings(); }
Source:
public static ProcessBatchResult processBatchSuccess(Page page) { return new ProcessBatchResult(ProcessBatchState.SUCCESS, page); }

Target:
public static ProcessBatchResult processBatchSuccess(Page page) { return new ProcessBatchResult(ProcessBatchState.SUCCESS, requireNonNull(page)); }
Source:
public void testXLSXFileImport() throws Exception { MockMultipartFile multipartFile = getTestMultipartFile("/simple-valid.xlsx", CONTENT_TYPE_EXCEL); Sheet sheet = mock(Sheet.class); DataCollection dataCollection = mock(DataCollection.class); EntityType table = mock(EntityType.class); String tableId = "generated_table_id"; File file = mock(File.class); when(fileStore.store(any(InputStream.class), anyString())).thenReturn(file); when(excelService.buildExcelSheetFromFile(file)).thenReturn(sheet); when(oneClickImporterService.buildDataCollection("simple-valid", sheet)).thenReturn(dataCollection); when(entityService.createEntityType(dataCollection)).thenReturn(tableId); when(table.getId()).thenReturn(tableId); mockMvc.perform(fileUpload(OneClickImporterController.URI + "/upload").file(multipartFile)) .andExpect(status().isOk()); verify(oneClickImporterService).buildDataCollection("simple-valid", sheet); }

Target:
public void testXLSXFileImport() throws Exception { MockMultipartFile multipartFile = getTestMultipartFile("/simple-valid.xlsx", CONTENT_TYPE_EXCEL); Sheet sheet = mock(Sheet.class); DataCollection dataCollection = mock(DataCollection.class); EntityType table = mock(EntityType.class); String tableId = "generated_table_id"; File file = mock(File.class); String fileName = "file-name"; when(file.getName()).thenReturn(fileName); when(fileStore.store(any(InputStream.class), anyString())).thenReturn(file); when(excelService.buildExcelSheetFromFile(file)).thenReturn(sheet); when(oneClickImporterService.buildDataCollection("simple-valid", sheet)).thenReturn(dataCollection); when(entityService.createEntityType(dataCollection)).thenReturn(table); when(table.getId()).thenReturn(tableId); mockMvc.perform(fileUpload(OneClickImporterController.URI + "/upload").file(multipartFile)) .andExpect(status().isCreated()) .andExpect(header().string("Location", StringEndsWith.endsWith(tableId))) .andExpect(jsonPath("$.entityId").value(tableId)) .andExpect(jsonPath("$.baseFileName").value(fileName)); verify(oneClickImporterService).buildDataCollection("simple-valid", sheet); }
Source:
public List<Action> resolve(List<Diagnosis> diagnosis) { for (Diagnosis diagnoses : diagnosis) { Symptom bpSymptom = diagnoses.getSymptoms().get(DIAGNOSIS_SLOW_INSTANCE.text()); if (bpSymptom == null || bpSymptom.getComponents().isEmpty()) { continue; } if (bpSymptom.getComponents().size() > 1) { throw new UnsupportedOperationException("Multiple components with back pressure symptom"); } String stmgrId = bpSymptom.getComponents().get(0).getId(); String urlStr = "http://" + physicalPlanProvider.getShellUrl(stmgrId) + "/killexecutor"; URL url = new URL(urlStr); HttpURLConnection con = (HttpURLConnection) url.openConnection(); con.setRequestMethod("POST"); con.setDoOutput(true); DataOutputStream out = new DataOutputStream(con.getOutputStream()); out.writeBytes("secret=" + topologyName); out.flush(); out.close(); int status = con.getResponseCode(); LOG.info("Restarting container: " + url.toString() + "; result: " + status); con.disconnect(); ContainerRestart action = new ContainerRestart(); LOG.info("Broadcasting container restart event"); eventManager.onEvent(action); List<Action> actions = new ArrayList<>(); actions.add(action); return actions; } return null; }

Target:
public List<Action> resolve(List<Diagnosis> diagnosis) { List<Action> actions = new ArrayList<>(); for (Diagnosis diagnoses : diagnosis) { Symptom bpSymptom = diagnoses.getSymptoms().get(DIAGNOSIS_SLOW_INSTANCE.text()); if (bpSymptom == null || bpSymptom.getComponents().isEmpty()) { continue; } if (bpSymptom.getComponents().size() > 1) { throw new UnsupportedOperationException("Multiple components with back pressure symptom"); } String stmgrId = bpSymptom.getComponent().getName(); boolean b = schedulerClient.restartTopology( RestartTopologyRequest.newBuilder().setContainerIndex(Integer.valueOf(stmgrId)).build()); LOG.info("Restarted container: " + stmgrId + "; result: " + b); ContainerRestart action = new ContainerRestart(); LOG.info("Broadcasting container restart event"); eventManager.onEvent(action); actions.add(action); return actions; } return actions; }
Source:
protected C getUiHandlers() { if (uiHandlers == null) { logger.severe("uiHandlers are not set. You should call setUiHandlers() from your presenter's constructor."); } return uiHandlers; }

Target:
protected C getUiHandlers() { if (uiHandlers == null) { logger.severe("uiHandlers are not set. You should call " + "setUiHandlers() from your presenter's constructor to make " + "the UiHandlers instance available."); } return uiHandlers; }
Source:
protected PowerDogLocalApiBindingConfig parseInnerBindingConfig(Item item, String bindingConfig, PowerDogLocalApiBindingConfig config, Command key) throws BindingConfigParseException { logger.debug("PowerDogLocalAPI:parseInnerBindingConfig called"); PowerDogLocalApiBindingConfigElement configElement; Matcher matcher = INNER_BINDING_PATTERN.matcher(bindingConfig); if (!matcher.matches()) { throw new BindingConfigParseException( "bindingConfig '" + bindingConfig + "' doesn't represent a valid binding-configuration. A valid configuration is matched by the RegExp '" + INNER_BINDING_PATTERN + "'"); } matcher.reset(); while (matcher.find()) { configElement = new PowerDogLocalApiBindingConfigElement(); configElement.serverId = matcher.group(1); configElement.valueId = matcher.group(2); configElement.refreshInterval = Integer.valueOf(matcher.group(3)); if (matcher.group(4).isEmpty()) configElement.name = "Current_Value"; else configElement.name = matcher.group(4).substring(1); logger.debug("PowerDogLocalAPI: " + configElement); config.put(key, configElement); } return config; }

Target:
protected PowerDogLocalApiBindingConfig parseInnerBindingConfig(Item item, String bindingConfig, PowerDogLocalApiBindingConfig config, Command key) throws BindingConfigParseException { logger.debug("PowerDogLocalAPI:parseInnerBindingConfig called"); PowerDogLocalApiBindingConfigElement configElement; Matcher matcher = INNER_BINDING_PATTERN.matcher(bindingConfig); if (!matcher.matches()) { throw new BindingConfigParseException("bindingConfig '" + bindingConfig + "' doesn't represent a valid binding-configuration. A valid configuration is matched by the RegExp '" + INNER_BINDING_PATTERN + "'"); } matcher.reset(); while (matcher.find()) { configElement = new PowerDogLocalApiBindingConfigElement(); configElement.serverId = matcher.group(1); configElement.valueId = matcher.group(2); configElement.refreshInterval = Integer.valueOf(matcher.group(3)); if (matcher.group(4).isEmpty()) { configElement.name = "Current_Value"; } else { configElement.name = matcher.group(4).substring(1); } logger.debug("PowerDogLocalAPI: {}", configElement); config.put(key, configElement); } return config; }
Source:
public static RootedPath getWorkspaceRootedFile(RootedPath directory, Environment env) throws IOException, InterruptedException { RootedPath workspaceRootedFile = RootedPath.toRootedPath( directory.getRoot(), directory .getRootRelativePath() .getRelative(LabelConstants.WORKSPACE_DOT_BAZEL_FILE_NAME)); SkyKey workspaceFileKey = FileValue.key(workspaceRootedFile); FileValue value; value = (FileValue) env.getValueOrThrow(workspaceFileKey, IOException.class); if (value == null) { return null; } if (value.exists() && !value.isDirectory()) { return workspaceRootedFile; } return RootedPath.toRootedPath( directory.getRoot(), directory .getRootRelativePath() .getRelative(LabelConstants.WORKSPACE_FILE_NAME)); }

Target:
public static RootedPath getWorkspaceRootedFile(RootedPath directory, Environment env) throws IOException, InterruptedException { RootedPath workspaceRootedFile = RootedPath.toRootedPath( directory.getRoot(), directory .getRootRelativePath() .getRelative(LabelConstants.WORKSPACE_DOT_BAZEL_FILE_NAME)); SkyKey workspaceFileKey = FileValue.key(workspaceRootedFile); FileValue value; value = (FileValue) env.getValueOrThrow(workspaceFileKey, IOException.class); if (value == null) { return null; } if (value.isFile() && !value.isSpecialFile()) { return workspaceRootedFile; } return RootedPath.toRootedPath( directory.getRoot(), directory .getRootRelativePath() .getRelative(LabelConstants.WORKSPACE_FILE_NAME)); }
Source:
private SpecificDatumWriter getDatumWriter(Schema fieldSchema) { SpecificDatumWriter writer = writerMap.get(fieldSchema); if (writer == null) { writer = new SpecificDatumWriter(fieldSchema); writerMap.put(fieldSchema, writer); } return writer; }

Target:
private SpecificDatumWriter getDatumWriter(Schema fieldSchema) { SpecificDatumWriter writer = writerMap.computeIfAbsent(fieldSchema, (t) -> { return new SpecificDatumWriter(t); }); return writer; }
Source:
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws Exception { List<TServerStatus> tservers; final InstanceOperations instanceOps = shellState.getConnector().instanceOperations(); final boolean paginate = !cl.hasOption(disablePaginationOpt.getOpt()); if (cl.hasOption(tserverOption.getOpt())) { tservers = new ArrayList<>(); for (TServerStatus ts : instanceOps.getTabletServerStatus()) { if (ts.getName().equals(cl.getOptionValue(tserverOption.getOpt()))) { tservers.add(ts); } } } else if (cl.hasOption(allOption.getOpt())) { tservers = instanceOps.getTabletServerStatus(); } else { throw new MissingOptionException("Missing options"); } if (tservers.isEmpty()) { throw new TabletServerNotFoundException("Tablet Servers not found"); } shellState.printLines(new TabletServerStatusIterator(tservers, shellState), paginate); return 0; }

Target:
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws Exception { List<Map<String,String>> tservers; final InstanceOperations instanceOps = shellState.getConnector().instanceOperations(); final boolean paginate = !cl.hasOption(disablePaginationOpt.getOpt()); if (cl.hasOption(tserverOption.getOpt())) { tservers = new ArrayList<>(); for (Map<String,String> ts : instanceOps.getTabletServerStatus()) { if (ts.get("server").equals(cl.getOptionValue(tserverOption.getOpt()))) { tservers.add(ts); } } } else if (cl.hasOption(allOption.getOpt())) { tservers = instanceOps.getTabletServerStatus(); } else { throw new MissingOptionException("Missing options"); } shellState.printLines(new TabletServerStatusIterator(tservers, shellState), paginate); return 0; }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof TaskPropertyType)) { return false; } TaskPropertyType that = (TaskPropertyType) o; if (!name.equals(that.name)) { return false; } return true; }

Target:
public boolean equals(Object o) { return this == o || o instanceof TaskPropertyType; }
Source:
public ChangeInfo getChangeInfo(final int reviewId, IProgressMonitor monitor) throws GerritException { return execute(monitor, new Operation<ChangeInfo>() { @Override public void execute(IProgressMonitor monitor) throws GerritException { try { Request<ChangeInfo> request = new Request<ChangeInfo>() { @Override public HttpMethodBase createMethod() throws IOException { GetMethod method = new GetMethod(client.getUrl() + "/changes/" + reviewId + "/revisions/current/review"); method.setRequestHeader("Accept", "application/json"); return method; } @Override public ChangeInfo process(HttpMethodBase method) throws IOException { return ChangeInfo.fromJson(method.getResponseBodyAsString()); } }; ChangeInfo result = client.execute(request, monitor); onSuccess(result); } catch (Exception e) { onFailure(e); } } }); }

Target:
public ChangeInfo getChangeInfo(final int reviewId, IProgressMonitor monitor) throws GerritException { final String uri = "/changes/" + reviewId + "/revisions/current/review"; return executeGetRestRequest(uri, ChangeInfo.class, monitor); }
Source:
public void setUp() throws Exception { setBrickPosition = 1; Script script = BrickTestUtils.createProjectAndGetStartScript("askBricksTest"); script.addBrick(new AskBrick(getResourcesString(R.string.brick_ask_default_question))); baseActivityTestRule.launchActivity(null); }

Target:
public void setUp() throws Exception { brickPosition = 1; Script script = BrickTestUtils.createProjectAndGetStartScript("askBricksTest"); script.addBrick(new AskBrick(getResourcesString(R.string.brick_ask_default_question))); instrument = getInstrumentation(); baseActivityTestRule.launchActivity(null); project = ProjectManager.getInstance().getCurrentProject(); }
Source:
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); wrapper.clear(); bindVarTypesStack.push(wrapper.bindVariableTypes); namedStatementWrapperStack.push(wrapper); } } sink().put('3'); sink().putNetworkInt(Integer.BYTES); }

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:
public void stop() { synchronized (lock) { List<State> expectedStates = ImmutableList.of(State.NEW, State.RUNNING, State.STARTED, State.IN_REBALANCE); 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); } } }

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:
private static boolean isExcluded(VariableTree variable) { return isStaticOrFinal(variable) || variable.symbol().metadata().isAnnotatedWith("javax.inject.Inject") || variable.symbol().metadata().isAnnotatedWith("javax.ejb.EJB"); }

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:
public List<Set<Long>> getSegmentKeySets() { return store.getSegments().stream().map(OffHeapChainMap::keySet).collect(Collectors.toList()); }

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:
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); execute(); assertAllCommandsUsed(); assertPermanentCount(playerA, "Goblin Piker", 1); }

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:
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); } return null; }, true); if (!runtime.getParameters().isCacheDisabled() && cacheOption == CacheOption.WRITE_THROUGH) { readCache.put(token.getSequence(), ld); } }

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:
protected <T> T newPlugin(Class<T> klass) { ClassLoader classLoader = delegatingLoader.pluginClassLoader(klass.getName()); if (classLoader == null) { classLoader = delegatingLoader; } return newPlugin(classLoader, klass); }

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:
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 { deleted = deleteFile(collection, uri); } eventType = COLLECTION_CONTENT_DELETED; collection.save(); if (deleted) { removeEmptyCollectionDirectories(path); collectionHistoryDaoSupplier.get().saveCollectionHistoryEvent(new CollectionHistoryEvent(collection, session, eventType, uri)); } return deleted; }

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:
private static Optional<String> getBranchName(Optional<Branch> branchOpt) { if (!branchOpt.isPresent()) { return Optional.empty(); } Branch branch = branchOpt.get(); if (!branch.isLegacyFeature() && !branch.isMain()) { return branch.getName(); } return Optional.empty(); }

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:
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( 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]); } }

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:
public String toString() { return String.format("%s: %s bp", readName, getReadLength()); }

Target:
public String toString() { return toFastQString(); }
Source:
public void testFeedingAcks() throws Exception { int numIterations = 10000; AckManager manager = new AckManager(); Channel channel = new MockChannel(); manager.init(); long start = System.currentTimeMillis(); Timber.LogEvent e; 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(); }

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:
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); }

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:
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() != null ? info.getEmail() : null); userIdentity.setName(info.getName()); userIdentity.setTimeZone(info.getTimeZoneOffset()); userIdentity.setDate(parseTimeStamp(info.getDate())); return userIdentity; }

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:
public BrooklynVersion() { readPropertiesFromMavenResource(BrooklynVersion.class.getClassLoader()); readPropertiesFromOsgiResource(BrooklynVersion.class.getClassLoader(), "org.apache.brooklyn.core"); checkVersions(); }

Target:
public BrooklynVersion() { readPropertiesFromMavenResource(BrooklynVersion.class.getClassLoader()); readPropertiesFromOsgiResource(BrooklynVersion.class.getClassLoader(), BROOKLYN_CORE_SYMBOLIC_NAME); checkVersions(); }
Source:
public void testRobotIsCreatedWithCorrectInitialOrientation() { final Orientation initialOrientation = Orientation.NORTH; final Robot robot = new Robot(new GridPosition(0, 0), initialOrientation); final Orientation actualOrientation = robot.getOrientation(); assertTrue(actualOrientation.equals(initialOrientation)); }

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:
public void testThrowCustomCheckedException() { try { errorHandling.handleErrorByThrowingCustomCheckedException(); throw new AssertionFailedError(); } catch (Exception e) { assertFalse(e instanceof RuntimeException); assertFalse(checkedExceptions.contains(e.getClass())); } }

Target:
public void testThrowCustomCheckedException() throws CustomCheckedException { thrown.expect(CustomCheckedException.class); errorHandling.handleErrorByThrowingCustomCheckedException(); }
Source:
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, isCustom); allServers.add(server); } } return (allServers.size() > 0 ? allServers : null); }

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:
public RoughArtifact populateArtifact(Queue<DoorsTableRow> queue) { Conditions.checkNotNullOrEmpty(queue, "Queue"); RoughArtifact combined = populateArtifact(queue.poll()); while (!queue.isEmpty()) { combineDoorsArtifacts(combined, populateArtifact(queue.poll())); } return combined; }

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:
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) { 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); }

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:
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 { IOUtils.closeQuietly(file); } return resultingTemplate; }

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:
public void recoverNodes(NodeSource nodeSource) { logger.info(START_TO_RECOVER_NODES); int lookUpTimeout = PAResourceManagerProperties.RM_NODELOOKUP_TIMEOUT.getValueAsInt(); String nodeSourceName = nodeSource.getName(); makeSureNodeSourceHasNoNode(nodeSource, nodeSourceName); 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); }

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:
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(); Map<String, ResourceAssignment> baselineAssignment = clusterModel.getBaseline(); 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; }

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:
private void changeOpacity(String selector, int value, WebDriver driver) { JavascriptActions javascriptActions = new JavascriptActions(driver); javascriptActions.changeElementOpacity(selector, value); }

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:
private int doubleEqual(Object actual, Object expected) { if (isFloatingPointValue(actual) && isFloatingPointValue(expected)) { Double actualDouble = Double.valueOf(actual.toString()); Double expectedDouble = Double.valueOf(expected.toString()); Double threshold = DOUBLE_FUZZY_MATCH_THRESHOLD; return DoubleMath.fuzzyCompare(actualDouble, expectedDouble, threshold); } return -1; }

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:
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); }

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:
private ExceptionScopeInstance getExceptionScopeInstance(Throwable e) { String exceptionName = e.getClass().getName(); Context exceptionContext = getContextContainer().getDefaultContext(ExceptionScope.EXCEPTION_SCOPE).resolveContext(exceptionName); return exceptionContext == null ? null : (ExceptionScopeInstance) getContextInstance(exceptionContext); }

Target:
private ExceptionScopeInstance getExceptionScopeInstance(Throwable e) { return (ExceptionScopeInstance) resolveContextInstance(ExceptionScope.EXCEPTION_SCOPE, e.getClass().getName()); }