auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void persistAutoStart(String serverName, ModelNode model) { Path startedFile = autoStartDataDir.resolve(serverName + STARTED_EXT); Path stoppedFile = autoStartDataDir.resolve(serverName + STOPPED_EXT); if (serverInventory != null && shouldUpdateAutoStart(model)) { ServerStatus status = serverInventory.determineServerStatus(serverName); try { if (status == ServerStatus.STARTED || status == ServerStatus.STARTING) { if (Files.notExists(startedFile)) { Files.createFile(startedFile); } Files.deleteIfExists(stoppedFile); model.get(AUTO_START).set(true); HostControllerLogger.ROOT_LOGGER.warn("We are updating the auto-start attribute to TRUE for " + serverName); } else if (status == ServerStatus.STOPPED || status == ServerStatus.STOPPING) { if (Files.notExists(stoppedFile)) { Files.createFile(stoppedFile); } Files.deleteIfExists(startedFile); model.get(AUTO_START).set(false); HostControllerLogger.ROOT_LOGGER.warn("We are updating the auto-start attribute to FALSE for " + serverName); } } catch (IOException ex) { HostControllerLogger.ROOT_LOGGER.error("Error persisting server autostart status", ex); } } }

Target:
private void persistAutoStart(String serverName, ModelNode model) { Path startedFile = autoStartDataDir.resolve(serverName + STARTED_EXT); Path stoppedFile = autoStartDataDir.resolve(serverName + STOPPED_EXT); if (serverInventory != null && shouldUpdateAutoStart(model)) { ServerStatus status = serverInventory.determineServerStatus(serverName); try { if (status == ServerStatus.STARTED || status == ServerStatus.STARTING) { if (Files.notExists(startedFile)) { Files.createFile(startedFile); } Files.deleteIfExists(stoppedFile); model.get(AUTO_START).set(true); } else if (status == ServerStatus.STOPPED || status == ServerStatus.STOPPING) { if (Files.notExists(stoppedFile)) { Files.createFile(stoppedFile); } Files.deleteIfExists(startedFile); model.get(AUTO_START).set(false); } } catch (IOException ex) { HostControllerLogger.ROOT_LOGGER.couldNotPersistAutoStartServerStatus(ex); } } }
Source:
private void handleAddingBarrier(BufferConsumer bufferConsumer, boolean insertAsHead) { assert Thread.holdsLock(buffers); if (insertAsHead) { inflightBufferSnapshot.clear(); for (BufferConsumer buffer : buffers) { try (BufferConsumer bc = buffer.copy()) { inflightBufferSnapshot.add(bc.build()); } } buffers.addFirst(bufferConsumer); } else { buffers.add(bufferConsumer); } }

Target:
private void handleAddingBarrier(BufferConsumer bufferConsumer, boolean insertAsHead) { assert Thread.holdsLock(buffers); if (insertAsHead) { checkState(inflightBufferSnapshot.isEmpty(), "Supporting only one concurrent checkpoint in unaligned " + "checkpoints"); for (BufferConsumer buffer : buffers) { try (BufferConsumer bc = buffer.copy()) { inflightBufferSnapshot.add(bc.build()); } } buffers.addFirst(bufferConsumer); } else { buffers.add(bufferConsumer); } }
Source:
protected boolean canDoAction() { if (validateNameAndStoragePoolNotNull()) { NetworkQoS oldNetworkQoS = getNetworkQoSDao().get(getNetworkQoS().getId()); if (oldNetworkQoS == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_NETWORK_QOS_NOT_FOUND); } else if (!oldNetworkQoS.getStoragePoolId().equals(getNetworkQoS().getStoragePoolId())) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_NETWORK_QOS_INVALID_DC_ID); } } return true; }

Target:
protected boolean canDoAction() { if (validateParameters()) { NetworkQoS oldNetworkQoS = getNetworkQoSDao().get(getNetworkQoS().getId()); if (oldNetworkQoS == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_NETWORK_QOS_NOT_FOUND); } else if (!oldNetworkQoS.getStoragePoolId().equals(getNetworkQoS().getStoragePoolId())) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_NETWORK_QOS_INVALID_DC_ID); } } return true; }
Source:
public void returnsCorrectSize() { final List<String> VALID_LIST = Arrays.asList( "Accept: text/plain", "Accept-Charset: utf-8", "Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==", "Cache-Control: no-cache", "From: user@example.com"); final String NO_NEXT_VALUE_ERROR = "Empty Error Message"; MatcherAssert .assertThat(new VerboseIterable<String>( VALID_LIST, NO_NEXT_VALUE_ERROR), IsIterableWithSize .<String> iterableWithSize(VALID_LIST.size())); }

Target:
public final void returnsCorrectSize() { final List<String> valid = Arrays.asList( "Accept: text/plain", "Accept-Charset: utf-8", "Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==", "Cache-Control: no-cache", "From: user@example.com" ); MatcherAssert.assertThat( new VerboseIterable<String>( valid, "Empty Error Message" ), Matchers.<String>iterableWithSize(valid.size()) ); }
Source:
public void setSlaveConnectTimeout(int slaveConnectTimeout) { if (slaveConnectTimeout < 0) { this.slaveConnectTimeout = 0; } else { this.slaveConnectTimeout = slaveConnectTimeout; } }

Target:
public void setSlaveConnectTimeout(int slaveConnectTimeout) { if (slaveConnectTimeout <= 0) { LOGGER.log(Level.WARNING, "Slave -> Jenkins connection timeout " + "cannot be <= 0. Falling back to the default value: " + DEFAULT_SLAVE_JENKINS_CONNECTION_TIMEOUT); this.slaveConnectTimeout = DEFAULT_SLAVE_JENKINS_CONNECTION_TIMEOUT; } else { this.slaveConnectTimeout = slaveConnectTimeout; } }
Source:
public InputStream open(String path, OpenOptions options) throws IOException { IOException te = null; FileSystem hdfs = getFs(); RetryPolicy retryPolicy = new CountingRetry(MAX_TRY); DistributedFileSystem dfs = null; if (hdfs instanceof DistributedFileSystem) { dfs = (DistributedFileSystem) hdfs; } while (retryPolicy.attempt()) { try { FSDataInputStream inputStream = hdfs.open(new Path(path)); if (options.getPositionShort()) { LOG.info("AMDEBUG: using pread"); return new HdfsPositionedUnderFileInputStream(inputStream, options.getOffset()); } try { inputStream.seek(options.getOffset()); } catch (IOException e) { inputStream.close(); throw e; } LOG.info("AMDEBUG: not using pread"); return new HdfsUnderFileInputStream(inputStream); } catch (IOException e) { LOG.warn("{} try to open : {}", retryPolicy.getAttemptCount(), path, e.getMessage()); te = e; if (options.getRecoverFailedOpen() && dfs != null && e.getMessage().toLowerCase() .startsWith("cannot obtain block length for")) { try { if (dfs.recoverLease(new Path(path))) { LOG.warn("HDFS recoverLease-1 success for: {}", path); } else { CommonUtils.sleepMs(5 * Constants.SECOND_MS); if (dfs.recoverLease(new Path(path))) { LOG.warn("HDFS recoverLease-2 success for: {}", path); } else { LOG.warn("HDFS recoverLease: path not closed: {}", path); } } } catch (IOException e1) { LOG.warn("HDFS recoverLease failed for: error: {}", path, e1.getMessage()); } } } } throw te; }

Target:
public InputStream open(String path, OpenOptions options) throws IOException { IOException te = null; FileSystem hdfs = getFs(); RetryPolicy retryPolicy = new CountingRetry(MAX_TRY); DistributedFileSystem dfs = null; if (hdfs instanceof DistributedFileSystem) { dfs = (DistributedFileSystem) hdfs; } while (retryPolicy.attempt()) { try { FSDataInputStream inputStream = hdfs.open(new Path(path)); if (options.getPositionShort()) { LOG.debug("Using pread API to HDFS"); return new HdfsPositionedUnderFileInputStream(inputStream, options.getOffset()); } try { inputStream.seek(options.getOffset()); } catch (IOException e) { inputStream.close(); throw e; } return new HdfsUnderFileInputStream(inputStream); } catch (IOException e) { LOG.warn("{} try to open : {}", retryPolicy.getAttemptCount(), path, e.getMessage()); te = e; if (options.getRecoverFailedOpen() && dfs != null && e.getMessage().toLowerCase() .startsWith("cannot obtain block length for")) { try { if (dfs.recoverLease(new Path(path))) { LOG.warn("HDFS recoverLease-1 success for: {}", path); } else { CommonUtils.sleepMs(5 * Constants.SECOND_MS); if (dfs.recoverLease(new Path(path))) { LOG.warn("HDFS recoverLease-2 success for: {}", path); } else { LOG.warn("HDFS recoverLease: path not closed: {}", path); } } } catch (IOException e1) { LOG.warn("HDFS recoverLease failed for: error: {}", path, e1.getMessage()); } } } } throw te; }
Source:
public void testGetDrugsByMapping_shouldGetAListOfNonRetiredDrugMappingsWithGivenCodeAndConceptSourceAndConceptmapTypes() throws Exception { ConceptReferenceTerm conceptReferenceTerm = conceptService.getConceptReferenceTermByCode("2332523", new ConceptSource(2)); List<ConceptMapType> conceptMapTypeList = conceptService.getConceptMapTypes(false, true); List<Drug> drugs = conceptService.getDrugsByMapping(conceptReferenceTerm.getCode(), conceptReferenceTerm.getConceptSource(), conceptMapTypeList, false); assertEquals(0, drugs.size()); }

Target:
public void testGetDrugsByMapping_shouldGetAListOfNonRetiredDrugMappingsWithGivenCodeAndConceptSourceAndConceptmapTypes() throws Exception { executeDataSet(GET_DRUG_MAPPINGS); List<ConceptMapType> conceptMapTypeList = conceptService.getConceptMapTypes(false, true); List<Drug> drugs = conceptService.getDrugsByMapping("WGT234", conceptService.getConceptSource(1), conceptMapTypeList, false); assertEquals(2, drugs.size()); assertTrue(containsId(drugs,2)); }
Source:
public void doIndex(StaplerRequest req, StaplerResponse rsp) { if (req.getHeader(URL_VALIDATION_HEADER) != null) { RSAPublicKey key = identity.getPublic(); rsp.setHeader(X_INSTANCE_IDENTITY, new String(Base64.encodeBase64(key.getEncoded()))); rsp.setStatus(200); return; } String eventType = req.getHeader("X-GitHub-Event"); if("ping".equals(eventType)) { LOGGER.info("Got a ping request from GitHub"); return; } if ("push".equals(eventType)) { String payload = req.getParameter("payload"); if (payload == null) { throw new IllegalArgumentException("Not intended to be browsed interactively (must specify payload parameter). " + "Make sure payload version is 'application/vnd.github+form'."); } processGitHubPayload(payload, GitHubPushTrigger.class); } else if (isNotEmpty(eventType)) { throw new IllegalArgumentException("Github Webhook event of type " + eventType + " is not supported. " + "Only push events are current supported"); } else { String payload = req.getParameter("payload"); if (payload == null) { throw new IllegalArgumentException("Not intended to be browsed interactively (must specify payload parameter)"); } processGitHubPayload(payload, GitHubPushTrigger.class); } }

Target:
public void doIndex(StaplerRequest req, StaplerResponse rsp) { if (req.getHeader(URL_VALIDATION_HEADER) != null) { RSAPublicKey key = identity.getPublic(); rsp.setHeader(X_INSTANCE_IDENTITY, new String(Base64.encodeBase64(key.getEncoded()))); rsp.setStatus(200); return; } String eventType = req.getHeader("X-GitHub-Event"); if ("ping".equals(eventType)) { LOGGER.debug("Got a ping request from GitHub"); return; } if ("push".equals(eventType)) { String payload = req.getParameter("payload"); if (payload == null) { throw new IllegalArgumentException("Not intended to be browsed interactively (must specify payload parameter). " + "Make sure payload version is 'application/vnd.github+form'."); } processGitHubPayload(payload, GitHubPushTrigger.class); } else if (isNotEmpty(eventType)) { throw new IllegalArgumentException("Github Webhook event of type " + eventType + " is not supported. " + "Only push events are current supported"); } else { String payload = req.getParameter("payload"); if (payload == null) { throw new IllegalArgumentException("Not intended to be browsed interactively (must specify payload parameter)"); } processGitHubPayload(payload, GitHubPushTrigger.class); } }
Source:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_gutenberg_editor, container, false); if (getArguments() != null) { mIsNewPost = getArguments().getBoolean(ARG_IS_NEW_POST); } mWPAndroidGlueCode.onCreateView( view.findViewById(R.id.gutenberg), mHtmlModeEnabled, new OnMediaLibraryButtonListener() { @Override public void onMediaLibraryButtonClicked() { onToolbarMediaButtonClicked(); } @Override public void onUploadMediaButtonClicked() { mEditorFragmentListener.onAddPhotoClicked(); } @Override public void onCapturePhotoButtonClicked() { checkAndRequestCameraAndStoragePermissions(); } }, new OnReattachQueryListener() { @Override public void onQueryCurrentProgressForUploadingMedia() { for (String mediaId : mUploadingMediaProgressMax.keySet()) { mWPAndroidGlueCode.mediaFileUploadProgress(Integer.valueOf(mediaId), mUploadingMediaProgressMax.get(mediaId)); } } }, getActivity().getApplication(), BuildConfig.DEBUG, BuildConfig.BUILD_GUTENBERG_FROM_SOURCE, mIsNewPost); if (getActivity() instanceof EditorFragmentActivity) { ((EditorFragmentActivity) getActivity()).initializeEditorFragment(); } setHasOptionsMenu(true); mInvalidateOptionsHandler = new Handler(); mInvalidateOptionsRunnable = new Runnable() { @Override public void run() { if (isAdded()) { getActivity().invalidateOptionsMenu(); } } }; mEditorFragmentListener.onEditorFragmentInitialized(); if (mIsNewPost) { showImplicitKeyboard(); } return view; }

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_gutenberg_editor, container, false); if (getArguments() != null) { mIsNewPost = getArguments().getBoolean(ARG_IS_NEW_POST); } mWPAndroidGlueCode.onCreateView( view.findViewById(R.id.gutenberg), mHtmlModeEnabled, new OnMediaLibraryButtonListener() { @Override public void onMediaLibraryButtonClicked() { onToolbarMediaButtonClicked(); } @Override public void onUploadMediaButtonClicked() { mEditorFragmentListener.onAddPhotoClicked(); } @Override public void onCapturePhotoButtonClicked() { checkAndRequestCameraAndStoragePermissions(); } }, new OnReattachQueryListener() { @Override public void onQueryCurrentProgressForUploadingMedia() { updateMediaProgress(); } }, getActivity().getApplication(), BuildConfig.DEBUG, BuildConfig.BUILD_GUTENBERG_FROM_SOURCE, mIsNewPost); if (getActivity() instanceof EditorFragmentActivity) { ((EditorFragmentActivity) getActivity()).initializeEditorFragment(); } setHasOptionsMenu(true); mInvalidateOptionsHandler = new Handler(); mInvalidateOptionsRunnable = new Runnable() { @Override public void run() { if (isAdded()) { getActivity().invalidateOptionsMenu(); } } }; mEditorFragmentListener.onEditorFragmentInitialized(); if (mIsNewPost) { showImplicitKeyboard(); } return view; }
Source:
public PerformancePublisher(String sourceDataFiles) { this.sourceDataFiles = sourceDataFiles; migrateParsers(); }

Target:
public PerformancePublisher(String sourceDataFiles) { this.sourceDataFiles = sourceDataFiles; }
Source:
public void updateConfiguration(Configuration configuration, HdfsContext context, URI uri) { if (cacheConfig.isCachingEnabled() && cacheConfig.getCacheType() == ALLUXIO) { configuration.set("alluxio.user.client.cache.async.write.enabled", String.valueOf(alluxioCacheConfig.isAsyncWriteEnabled())); configuration.set("alluxio.user.client.cache.dir", cacheConfig.getBaseDirectory().getPath()); configuration.set("alluxio.user.client.cache.size", cacheConfig.getMaxInMemoryCacheSize().toString()); configuration.set("alluxio.user.local.cache.enabled", String.valueOf(cacheConfig.isCachingEnabled())); configuration.set("alluxio.user.metrics.collection.enabled", String.valueOf(alluxioCacheConfig.isMetricsCollectionEnabled())); configuration.set("sink.jmx.class", alluxioCacheConfig.getJmxClass()); configuration.set("sink.jmx.domain", alluxioCacheConfig.getMetricsDomain()); } }

Target:
public void updateConfiguration(Configuration configuration, HdfsContext context, URI uri) { if (cacheConfig.isCachingEnabled() && cacheConfig.getCacheType() == ALLUXIO) { configuration.set("alluxio.user.local.cache.enabled", String.valueOf(cacheConfig.isCachingEnabled())); configuration.set("alluxio.user.client.cache.dir", cacheConfig.getBaseDirectory().getPath()); configuration.set("alluxio.user.client.cache.size", alluxioCacheConfig.getMaxCacheSize().toString()); configuration.set("alluxio.user.client.cache.async.write.enabled", String.valueOf(alluxioCacheConfig.isAsyncWriteEnabled())); configuration.set("alluxio.user.metrics.collection.enabled", String.valueOf(alluxioCacheConfig.isMetricsCollectionEnabled())); configuration.set("sink.jmx.class", alluxioCacheConfig.getJmxClass()); configuration.set("sink.jmx.domain", alluxioCacheConfig.getMetricsDomain()); } }
Source:
public synchronized void jobSubmitted(JobState job) { ClientJobState storedJobState = new ClientJobState(job); jobsMap.put(job.getId(), storedJobState); sState.getPendingJobs().add(storedJobState); job.setGenericInformation(storedJobState.getGenericInformation()); dispatchJobSubmitted(job); }

Target:
public synchronized void jobSubmitted(JobState job) { ClientJobState storedJobState = new ClientJobState(job); jobsMap.put(job.getId(), storedJobState); sState.getPendingJobs().add(storedJobState); dispatchJobSubmitted(job); }
Source:
private void performSaveAfterChecks() { currentMessageBuilder = createMessageBuilder(true); if (currentMessageBuilder != null) { setProgressBarIndeterminateVisibility(true); currentMessageBuilder.setHighPriority(isHighPriority); currentMessageBuilder.buildAsync(this); } }

Target:
private void performSaveAfterChecks() { currentMessageBuilder = createMessageBuilder(true); if (currentMessageBuilder != null) { setProgressBarIndeterminateVisibility(true); currentMessageBuilder.buildAsync(this); } }
Source:
AlphaJumpTestAdapter() { mStrings = new String[100]; for (int i = 0; i < 100; i++) { mStrings[i] = "Dummy" + i; } }

Target:
AlphaJumpTestAdapter() { for (int i = 0; i < sSize; i++) { mStrings[i] = "Dummy" + i; } }
Source:
private static Class<? extends LwM2mNode> nodeClassFromPath(LwM2mPath path) { if (path.isObject()) { return LwM2mObject.class; } else if (path.isObjectInstance()) { return LwM2mObjectInstance.class; } else if (path.isResource()) { return LwM2mResource.class; } throw new IllegalArgumentException("invalid path level: " + path); }

Target:
public static Class<? extends LwM2mNode> nodeClassFromPath(LwM2mPath path) { if (path.isObject()) { return LwM2mObject.class; } else if (path.isObjectInstance()) { return LwM2mObjectInstance.class; } else if (path.isResource()) { return LwM2mResource.class; } throw new IllegalArgumentException("invalid path level: " + path); }
Source:
public String getTitle() { return "ProjectsDetailScreen"; }

Target:
public String getTitle() { return ts.getTranslation( LibraryConstants.ProjectDetailScreen ); }
Source:
public void update(GameContainer container, StateBasedGame game, int delta) throws SlickException { float deltaF = delta / 1000f; for (Viewport viewport : viewports) { viewport.update(deltaF); } }

Target:
public void update(GameContainer container, StateBasedGame game, int delta) throws SlickException { float deltaInSeconds = delta / 1000f; for (Structure structure : map.getStructures()) { structure.update(deltaInSeconds); } for (Viewport viewport : viewports) { viewport.update(deltaInSeconds); } }
Source:
public void endToEndReplicationWithMultiNodeSinglePartitionTest() throws InterruptedException, IOException, InstantiationException { DataNodeId dataNodeId = nonSSLCluster.getFirstDataNode(); endToEndReplicationWithMultiNodeSinglePartitionTest(nonSSLCluster, "DC1", "", dataNodeId.getPort(), new Port(dataNodeId.getPort(), PortType.PLAINTEXT), new Port(dataNodeId.getPort() + 3, PortType.PLAINTEXT), new Port(dataNodeId.getPort() + 6, PortType.PLAINTEXT)); }

Target:
public void endToEndReplicationWithMultiNodeSinglePartitionTest() throws InterruptedException, IOException, InstantiationException { cluster = new MockCluster(notificationSystem); DataNodeId dataNodeId = cluster.getClusterMap().getDataNodeIds().get(0); ArrayList<String> dataCenterList = Utils.splitString("DC1,DC2,DC3", ","); List<DataNodeId> dataNodes = cluster.getOneDataNodeFromEachDatacenter(dataCenterList); endToEndReplicationWithMultiNodeSinglePartitionTest("DC1", "", dataNodeId.getPort(), new Port(dataNodes.get(0).getPort(), PortType.PLAINTEXT), new Port(dataNodes.get(1).getPort(), PortType.PLAINTEXT), new Port(dataNodes.get(2).getPort(), PortType.PLAINTEXT)); }
Source:
private static List<KubernetesCloud> getUsageRestrictedKubernetesClouds() { List<KubernetesCloud> k8sClouds = new ArrayList<>(); for (Cloud cloud : Jenkins.getInstance().clouds) { if (isUsageRestrictedKubernetesCloud(cloud)) { k8sClouds.add((KubernetesCloud) cloud); } } Collections.sort(k8sClouds, CLOUD_BY_NAME); return k8sClouds; }

Target:
private static List<KubernetesCloud> getUsageRestrictedKubernetesClouds() { List<KubernetesCloud> clouds = Jenkins.get().clouds .getAll(KubernetesCloud.class) .stream() .filter(KubernetesCloud::isUsageRestricted) .collect(Collectors.toList()); Collections.sort(clouds, Comparator.<Cloud, String>comparing(o -> o.name)); return clouds; }
Source:
public String generateVersionChecksum(RepoObject repoObject) throws RepoException { StringBuilder sb = new StringBuilder(); sb.append(repoObject.getKey()); sb.append(TimestampFormatter.getFormattedTimestamp(repoObject.getCreationDate())).append(System.nanoTime()); if (repoObject.getTag() != null){ sb.append(repoObject.getTag()); } if (repoObject.getContentType() != null){ sb.append(repoObject.getContentType()); } if (repoObject.getDownloadName() != null ){ sb.append(repoObject.getDownloadName()); } sb.append(repoObject.getChecksum()); return checksumToString(this.digest(sb.toString())); }

Target:
public String generateVersionChecksum(RepoObject repoObject) throws RepoException { StringBuilder sb = new StringBuilder(); sb.append(repoObject.getKey()); sb.append(TimestampFormatter.getFormattedTimestamp(repoObject.getCreationDate())); if (repoObject.getTag() != null){ sb.append(repoObject.getTag()); } if (repoObject.getContentType() != null){ sb.append(repoObject.getContentType()); } if (repoObject.getDownloadName() != null ){ sb.append(repoObject.getDownloadName()); } if (repoObject.getUserMetadata() != null ){ sb.append(repoObject.getUserMetadata()); } sb.append(repoObject.getChecksum()); return checksumToString(this.digest(sb.toString())); }
Source:
protected GoVisitor buildGoVisitor(@NotNull final ProblemsHolder holder, @NotNull LocalInspectionToolSession session) { return new GoVisitor() { @Override public void visitContinueStatement(@NotNull GoContinueStatement o) { PsiElement parent = o.getContinue().getParent(); while (parent != null) { if (parent instanceof GoForStatement) { return; } parent = parent.getParent(); } holder.registerProblem(o.getContinue(), "Continue statement not inside a for loop."); } }; }

Target:
protected GoVisitor buildGoVisitor(@NotNull final ProblemsHolder holder, @NotNull LocalInspectionToolSession session) { return new GoVisitor() { @Override public void visitContinueStatement(@NotNull GoContinueStatement o) { if (PsiTreeUtil.getParentOfType(o.getContinue(), GoForStatement.class) == null) { holder .registerProblem(o.getContinue(), "Continue statement not inside a for loop.", ProblemHighlightType.GENERIC_ERROR_OR_WARNING); } } }; }
Source:
public PreferredProperties mergeWithParent(PreferredProperties parent, boolean mergePartitionPreference) { List<LocalProperty<Symbol>> newLocal = ImmutableList.<LocalProperty<Symbol>>builder() .addAll(localProperties) .addAll(parent.getLocalProperties()) .build(); Builder builder = builder() .local(newLocal); if (globalProperties.isPresent()) { Global currentGlobal = globalProperties.get(); Global newGlobal = parent.getGlobalProperties() .map(g -> currentGlobal.mergeWithParent(g, mergePartitionPreference)) .orElse(currentGlobal); builder.global(newGlobal); } else { builder.global(parent.getGlobalProperties()); } return builder.build(); }

Target:
public PreferredProperties mergeWithParent(PreferredProperties parent, boolean mergePartitionPreference) { List<LocalProperty<VariableReferenceExpression>> newLocal = ImmutableList.<LocalProperty<VariableReferenceExpression>>builder() .addAll(localProperties) .addAll(parent.getLocalProperties()) .build(); Builder builder = builder() .local(newLocal); if (globalProperties.isPresent()) { Global currentGlobal = globalProperties.get(); Global newGlobal = parent.getGlobalProperties() .map(global -> currentGlobal.mergeWithParent(global, mergePartitionPreference)) .orElse(currentGlobal); builder.global(newGlobal); } else { builder.global(parent.getGlobalProperties()); } return builder.build(); }
Source:
public AMQPMirrorControllerTarget(AMQPSessionCallback sessionSPI, AMQPConnectionContext connection, AMQPSessionContext protonSession, Receiver receiver, ActiveMQServer server) { super(sessionSPI, connection, protonSession, receiver); if (logger.isDebugEnabled()) { logger.debug("Adding Remote Control target", new Exception("debug")); } this.server = server; }

Target:
public AMQPMirrorControllerTarget(AMQPSessionCallback sessionSPI, AMQPConnectionContext connection, AMQPSessionContext protonSession, Receiver receiver, ActiveMQServer server) { super(sessionSPI, connection, protonSession, receiver); this.server = server; }
Source:
public void testFilterContentContainsSimpleExcludesEntry() throws Exception { File filterFile = createFilterFile("excludes=SomeTest"); RegexFileFilter filter = new RegexFileFilter(filterFile); assertThat(filter.match(mockClass("SomeTest")), is(true)); }

Target:
public void testFilterContentContainsSimpleExcludesEntry() throws Exception { File filterFile = createFilterFile("exclude=SomeTest"); RegexFileFilter filter = new RegexFileFilter(filterFile); assertThat(filter.match(mockClass("SomeTest")), is(true)); }
Source:
public Object getAdapter(Class adapter) { if (adapter == IPropertySheetPage.class) { return adapter.cast(new TabbedPropertySheetPage(this)); } return super.getAdapter(adapter); }

Target:
public Object getAdapter(Class adapter) { if (adapter == IPropertySheetPage.class) { return adapter.cast(new TabbedPropertySheetPage(this.propertyPageContributor)); } return super.getAdapter(adapter); }
Source:
private void ensureDirectory() throws IOException { File dir = new File(getDirectory()); if (!dir.exists()) { FileUtils.forceMkdir(dir); } Assert.isTrue(dir.exists()); }

Target:
private void ensureDirectory() throws IOException { File dir = new File(directory); if (!dir.exists()) { FileUtils.forceMkdir(dir); } Assert.isTrue(dir.exists()); Assert.isTrue(dir.canWrite()); }
Source:
public void singFirstVerse() { assertEquals("99 bottles of beer on the wall, 99 bottles of beer.\n" + "Take one down and pass it around, 98 bottles of beer on the wall.\n\n", new BeerSong().verse(99)); }

Target:
public void singFirstVerse() { assertEquals("99 bottles of beer on the wall, 99 bottles of beer.\n" + "Take one down and pass it around, 98 bottles of beer on the wall.\n\n", beerSong.verse(99)); }
Source:
private void addPartition(String partition) throws IOException { PartitionDescProto.Builder builder = PartitionDescProto.newBuilder(); builder.setPartitionName(partition); String[] partitionKeyPairs = partition.split("/"); for(int i = 0; i < partitionKeyPairs.length; i++) { String partitionKeyPair = partitionKeyPairs[i]; String[] split = partitionKeyPair.split("="); PartitionKeyProto.Builder keyBuilder = PartitionKeyProto.newBuilder(); keyBuilder.setColumnName(split[0]); keyBuilder.setPartitionValue(split[1]); builder.addPartitionKeys(keyBuilder.build()); } if (this.plan.getUri() == null) { String[] split = CatalogUtil.splitTableName(plan.getTableName()); int endIndex = storeTablePath.toString().indexOf(split[1]) + split[1].length(); String outputPath = storeTablePath.toString().substring(0, endIndex); builder.setPath(outputPath + "/" + partition); } else { builder.setPath(this.plan.getUri().toString() + "/" + partition); } context.addPartition(builder.build()); }

Target:
private void addPartition(String partition) throws IOException { PartitionDescProto.Builder builder = PartitionDescProto.newBuilder(); builder.setPartitionName(partition); String[] partitionKeyPairs = partition.split("/"); for(int i = 0; i < partitionKeyPairs.length; i++) { String partitionKeyPair = partitionKeyPairs[i]; String[] split = partitionKeyPair.split("="); PartitionKeyProto.Builder keyBuilder = PartitionKeyProto.newBuilder(); keyBuilder.setColumnName(split[0]); keyBuilder.setPartitionValue(StringUtils.unescapePathName(split[1])); builder.addPartitionKeys(keyBuilder.build()); } if (this.plan.getUri() == null) { int endIndex = storeTablePath.toString().indexOf(FileTablespace.TMP_STAGING_DIR_PREFIX); String outputPath = storeTablePath.toString().substring(0, endIndex); builder.setPath(outputPath + partition); } else { builder.setPath(this.plan.getUri().toString() + "/" + partition); } context.addPartition(builder.build()); }
Source:
public void initialize(AddAction schemaObject) { Action action = schemaObject.getAction(); for (String tag : schemaObject.getTags()) { SceneActor scene = gameLoop.getSceneView().getCurrentScene(); Array<SceneElementActor> sceneElements = scene.findByTag(tag); if (sceneElements != null) { for (SceneElementActor sceneElement : sceneElements) { sceneElement.addAction(action); } } } }

Target:
public void initialize(AddAction schemaObject) { Action action = schemaObject.getAction(); for (String tag : schemaObject.getTags()) { SceneActor scene = gameLoop.getSceneView().getCurrentScene(); Array<SceneElementActor> sceneElements = scene.findByTag(tag); for (SceneElementActor sceneElement : sceneElements) { sceneElement.addAction(action); } } }
Source:
public KeyStore loadTrustStore(String trustStorePath, String trustStoreType, String trustStorePassword) throws KeyStoreException, CertificateException, NoSuchAlgorithmException, IOException { if (isEmpty(trustStorePath)) { throw new IllegalArgumentException("Wrong TrustStore file path configuration"); } FileInputStream fin = null; try { fin = new FileInputStream(trustStorePath); final KeyStore ks = KeyStore.getInstance(isEmpty(trustStoreType) ? KeyStore.getDefaultType() : trustStoreType); ks.load(fin, trustStorePassword == null ? null : trustStorePassword.toCharArray()); return ks; } finally { try { if (fin != null) { fin.close(); } } catch (Exception ignore) { } } }

Target:
public KeyStore loadTrustStore(String trustStorePath, String trustStoreType, String trustStorePassword) throws Exception { if (isEmpty(trustStorePath)) { throw new IllegalArgumentException("Wrong TrustStore file path configuration"); } FileInputStream fin = null; try { fin = new FileInputStream(trustStorePath); final KeyStore ks = KeyStore.getInstance(isEmpty(trustStoreType) ? KeyStore.getDefaultType() : trustStoreType); ks.load(fin, trustStorePassword == null ? null : trustStorePassword.toCharArray()); return ks; } finally { if (fin != null) { fin.close(); } } }
Source:
public static void validateHttpResponseHeaderConfig(String config) { try { String[] configTokens = config.trim().split("\\s+", 2); if (configTokens.length != 2) { throw new ConfigException(String.format("Invalid format of header config \"%s\". " + "Expected: \"[ation] [header name]:[header value]\"", config)); } String method = configTokens[0].trim(); validateHeaderConfigAction(method); String header = configTokens[1]; String[] headerTokens = header.trim().split(":"); if (headerTokens.length != 2) { throw new ConfigException( String.format("Invalid format of header name and header value pair \"%s\". " + "Expected: \"[header name]:[header value]\"", header)); } String headerName = headerTokens[0].trim(); if (headerName.contains(" ")) { throw new ConfigException(String.format("Invalid header name \"%s\". " + "The \"[header name]\" cannot contain whitespace", headerName)); } } catch (ArrayIndexOutOfBoundsException e) { throw new ConfigException(String.format("Invalid header config \"%s\".", config), e); } }

Target:
static void validateHttpResponseHeaderConfig(String config) { try { String[] configTokens = config.trim().split("\\s+", 2); if (configTokens.length != 2) { throw new ConfigException(String.format("Invalid format of header config '%s\'. " + "Expected: '[ation] [header name]:[header value]'", config)); } String method = configTokens[0].trim(); validateHeaderConfigAction(method); String header = configTokens[1]; String[] headerTokens = header.trim().split(":"); if (headerTokens.length != 2) { throw new ConfigException( String.format("Invalid format of header name and header value pair '%s'. " + "Expected: '[header name]:[header value]'", header)); } String headerName = headerTokens[0].trim(); if (headerName.isEmpty() || headerName.matches(".*\\s+.*")) { throw new ConfigException(String.format("Invalid header name '%s'. " + "The '[header name]' cannot contain whitespace", headerName)); } } catch (ArrayIndexOutOfBoundsException e) { throw new ConfigException(String.format("Invalid header config '%s'.", config), e); } }
Source:
public InputStream getLogs(boolean follow, String container) { this.follow = follow; this.container = container; start(); SequenceInputStream is = new SequenceInputStream(getProcess().getInputStream(), getProcess().getErrorStream()); return is; }

Target:
public InputStream getLogs(boolean follow, String container) { container = StringUtils.defaultIfBlank(container, ""); synchronized (cache) { if(cache.containsKey(container)) { return cache.get(container).getLogs(); } PodLogs logs = null; try { logs = new PodLogs(client, follow, container); return logs.getLogs(); }catch(Exception e) { throw e; }finally { if(logs != null) { cache.put(container, logs); } } } }
Source:
private static void addThirdpartyPaths(List<String> result) { File thirdpartyRoot = new File(jmDir + File.separator + "lib" + File.separator + "3rdparty"); File[] thirdpartyDirs = thirdpartyRoot.listFiles(new FileFilter() { @Override public boolean accept(File pathname) { return pathname.isDirectory(); } }); if (thirdpartyDirs != null) { for (File libDir : thirdpartyDirs) { File[] libJars = libDir.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.endsWith(".jar"); } }); for (File libJar : libJars) { result.add(libJar.getPath()); } } } }

Target:
private static void addThirdpartyPaths(List<String> result) { File thirdpartyRoot = new File(jmDir + File.separator + "lib" + File.separator + "3rdparty"); File[] thirdpartyDirs = thirdpartyRoot.listFiles(new FileFilter() { @Override public boolean accept(File pathname) { return pathname.isDirectory(); } }); if (thirdpartyDirs != null) { for (File libDir : thirdpartyDirs) { File[] libJars = libDir.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.endsWith(".jar"); } }); if (libJars != null) { for (File libJar : libJars) { result.add(libJar.getPath()); } } } } }
Source:
public void testJoinFnInitAndClose() throws Exception { TestJoinFunction joinFn = new TestJoinFunction(); StreamOperatorTask sot = createStreamOperatorTask(new SystemClock(), new TestJoinStreamApplication(joinFn)); List<Integer> output = new ArrayList<>(); MessageCollector messageCollector = envelope -> output.add((Integer) envelope.getMessage()); numbers.forEach(n -> sot.process(new FirstStreamIME(n, n), messageCollector, taskCoordinator)); assertEquals(joinFn.getNumCloseCalls(), 0); sot.close(); assertEquals(joinFn.getNumInitCalls(), 1); assertEquals(joinFn.getNumCloseCalls(), 1); }

Target:
public void testJoinFnInitAndClose() throws Exception { TestJoinFunction joinFn = new TestJoinFunction(); StreamOperatorTask sot = createStreamOperatorTask(new SystemClock(), new TestJoinStreamApplication(joinFn)); assertEquals(joinFn.getNumInitCalls(), 1); MessageCollector messageCollector = mock(MessageCollector.class); numbers.forEach(n -> sot.process(new FirstStreamIME(n, n), messageCollector, taskCoordinator)); assertEquals(joinFn.getNumCloseCalls(), 0); sot.close(); assertEquals(joinFn.getNumCloseCalls(), 1); }
Source:
private File compressSource(File sourceFolder) throws IOException { File compressFile = File.createTempFile("java_package", "tar.gz"); try (TarArchiveOutputStream tarArchiveOutputStream = new TarArchiveOutputStream( new GZIPOutputStream(new FileOutputStream(compressFile)))) { tarArchiveOutputStream.setLongFileMode(TarArchiveOutputStream.LONGFILE_GNU); for (Path sourceFile : Files.walk(sourceFolder.toPath()).collect(Collectors.toList())) { String relativePath = sourceFolder.toPath().relativize(sourceFile).toString(); TarArchiveEntry entry = new TarArchiveEntry(sourceFile.toFile(), relativePath); if (sourceFile.toFile().isFile()) { try (InputStream inputStream = new FileInputStream(sourceFile.toFile())) { tarArchiveOutputStream.putArchiveEntry(entry); IOUtils.copy(inputStream, tarArchiveOutputStream); tarArchiveOutputStream.closeArchiveEntry(); } } else { tarArchiveOutputStream.putArchiveEntry(entry); tarArchiveOutputStream.closeArchiveEntry(); } } } return compressFile; }

Target:
private File compressSource(File sourceFolder) throws IOException { File compressFile = File.createTempFile("java_package", "tar.gz"); compressFile.deleteOnExit(); try (TarArchiveOutputStream tarArchiveOutputStream = new TarArchiveOutputStream( new GZIPOutputStream(new FileOutputStream(compressFile)))) { tarArchiveOutputStream.setLongFileMode(TarArchiveOutputStream.LONGFILE_GNU); for (Path sourceFile : Files.walk(sourceFolder.toPath()).collect(Collectors.toList())) { String relativePath = sourceFolder.toPath().relativize(sourceFile).toString(); TarArchiveEntry entry = new TarArchiveEntry(sourceFile.toFile(), relativePath); if (sourceFile.toFile().isFile()) { try (InputStream inputStream = new FileInputStream(sourceFile.toFile())) { tarArchiveOutputStream.putArchiveEntry(entry); IOUtils.copy(inputStream, tarArchiveOutputStream); tarArchiveOutputStream.closeArchiveEntry(); } } else { tarArchiveOutputStream.putArchiveEntry(entry); tarArchiveOutputStream.closeArchiveEntry(); } } } return compressFile; }
Source:
public void onScrollChanged(int oldScrollY, int scrollY, boolean isHumanScroll) { if (webView == null) { return; } int animMargin = 0; int scrollDelta = scrollY - oldScrollY; if (gravity == Gravity.BOTTOM) { if (oldScrollY < scrollY) { animMargin = Math.min(hideableView.getHeight(), (int) hideableView.getTranslationY() + scrollDelta); } else { animMargin = Math.max(0, (int) hideableView.getTranslationY() + scrollDelta); } } else if (gravity == Gravity.TOP) { if (oldScrollY > scrollY) { animMargin = Math.min(0, (int) hideableView.getTranslationY() - scrollDelta); } else { animMargin = Math.max(-hideableView.getHeight(), (int) hideableView.getTranslationY() - scrollDelta); } } hideableView.setTranslationY(animMargin); if (anchoredView != null) { anchoredView.setTranslationY(animMargin); } hideableView.setElevation(scrollY > 0 ? DimenUtil.dpToPx(DimenUtil.getDimension(R.dimen.toolbar_default_elevation)) : 0); }

Target:
public void onScrollChanged(int oldScrollY, int scrollY, boolean isHumanScroll) { if (webView == null) { return; } int animMargin = 0; int scrollDelta = scrollY - oldScrollY; if (gravity == Gravity.BOTTOM) { if (oldScrollY < scrollY) { animMargin = Math.min(hideableView.getHeight(), (int) hideableView.getTranslationY() + scrollDelta); } else { animMargin = Math.max(0, (int) hideableView.getTranslationY() + scrollDelta); } } else if (gravity == Gravity.TOP) { if (oldScrollY > scrollY) { animMargin = Math.min(0, (int) hideableView.getTranslationY() - scrollDelta); } else { animMargin = Math.max(-hideableView.getHeight(), (int) hideableView.getTranslationY() - scrollDelta); } } hideableView.setTranslationY(animMargin); if (anchoredView != null) { anchoredView.setTranslationY(animMargin); } float elevation = scrollY == 0 && oldScrollY != 0 ? 0 : DimenUtil.dpToPx(DimenUtil.getDimension(R.dimen.toolbar_default_elevation)); if (elevation != hideableView.getElevation()) { hideableView.setElevation(elevation); } }
Source:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (ContextCompat.checkSelfPermission(this, WRITE_EXTERNAL_STORAGE) != PERMISSION_GRANTED) { ActivityCompat.requestPermissions(this, new String[]{WRITE_EXTERNAL_STORAGE}, PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE); } else { writePermission= true; } setTitle(getIntent().getExtras().getString("selection_name")); setContentView(R.layout.player_simple_layout); EMBED = getIntent().getExtras().getString("embed_code"); PCODE = getIntent().getExtras().getString("pcode"); DOMAIN = getIntent().getExtras().getString("domain"); APIKEY =getIntent().getExtras().getString("apikey"); SECRET = getIntent().getExtras().getString("secret"); ACCOUNT_ID = getIntent().getExtras().getString("accountid"); AUTOPLAY = getIntent().getExtras().getBoolean("autoPlay"); OoyalaPlayerLayout playerLayout = (OoyalaPlayerLayout) findViewById(R.id.ooyalaPlayer); Options options = new Options.Builder().setUseExoPlayer(true).build(); player = new OoyalaPlayer(PCODE, new PlayerDomain(DOMAIN), this, options); playerLayoutController = new OoyalaPlayerLayoutController(playerLayout, player); player.addObserver(this); if (player.setEmbedCode(EMBED)) { if(AUTOPLAY) player.play(); } else { Log.e(TAG, "Asset Failure"); } }

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (ContextCompat.checkSelfPermission(this, WRITE_EXTERNAL_STORAGE) != PERMISSION_GRANTED) { ActivityCompat.requestPermissions(this, new String[]{WRITE_EXTERNAL_STORAGE}, PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE); } else { writePermission= true; } setTitle(getIntent().getExtras().getString("selection_name")); setContentView(R.layout.player_simple_layout); EMBED = getIntent().getExtras().getString("embed_code"); PCODE = getIntent().getExtras().getString("pcode"); DOMAIN = getIntent().getExtras().getString("domain"); APIKEY =getIntent().getExtras().getString("apikey"); SECRET = getIntent().getExtras().getString("secret"); ACCOUNT_ID = getIntent().getExtras().getString("accountid"); AUTOPLAY = getIntent().getExtras().getBoolean("autoPlay"); OoyalaPlayerLayout playerLayout = (OoyalaPlayerLayout) findViewById(R.id.ooyalaPlayer); Options options = new Options.Builder().setUseExoPlayer(true).build(); player = new OoyalaPlayer(PCODE, new PlayerDomain(DOMAIN), this, options); playerLayoutController = new OoyalaPlayerLayoutController(playerLayout, player); player.addObserver(this); if (player.setEmbedCode(EMBED)) { if(AUTOPLAY) { player.play(); } } else { Log.e(TAG, "Asset Failure"); } }
Source:
public void testDirValidation() throws IOException { CommandStringBuilder csb = new CommandStringBuilder(CliStrings.ALTER_DISK_STORE); csb.addOption(CliStrings.ALTER_DISK_STORE__DISKSTORENAME, "diskStoreName"); csb.addOption(CliStrings.ALTER_DISK_STORE__REGIONNAME, "regionName"); csb.addOption(CliStrings.ALTER_DISK_STORE__DISKDIRS, "wrongDiskDir"); csb.addOption(CliStrings.ALTER_DISK_STORE__CONCURRENCY__LEVEL, "5"); String commandString = csb.toString(); gfsh.executeAndAssertThat(command, commandString).statusIsError() .containsOutput("Could not find disk-dirs: \"wrongDiskDir"); }

Target:
public void testDirValidation() { CommandStringBuilder csb = new CommandStringBuilder(CliStrings.ALTER_DISK_STORE); csb.addOption(CliStrings.ALTER_DISK_STORE__DISKSTORENAME, "diskStoreName"); csb.addOption(CliStrings.ALTER_DISK_STORE__REGIONNAME, "regionName"); csb.addOption(CliStrings.ALTER_DISK_STORE__DISKDIRS, "wrongDiskDir"); csb.addOption(CliStrings.ALTER_DISK_STORE__CONCURRENCY__LEVEL, "5"); String commandString = csb.toString(); gfsh.executeAndAssertThat(command, commandString).statusIsError() .containsOutput("Could not find disk-dirs: \"wrongDiskDir"); }
Source:
public void readExistingIdReturnsTheEvent(EventDao mockedEventDao) throws RecordNotFoundException { long eventId = 1; Event mockedEvent = mock(Event.class); when(mockedEventDao.read(eventId)).thenReturn(mockedEvent); Event result = eventsInteractor.getById(eventId); assertEquals(mockedEvent, result); verify(mockedEventDao, times(1)).read(eventId); }

Target:
public void readExistingIdReturnsTheEvent(EventDao mockedEventDao) throws RecordNotFoundException { Event mockedEvent = mock(Event.class); when(mockedEventDao.read(AN_EVENT_ID)).thenReturn(mockedEvent); Event result = eventsInteractor.getById(AN_EVENT_ID); assertEquals(mockedEvent, result); }
Source:
public static <T> T withLocalModeOverride(Callable<T> c, long ttlSec, Map<String, Object> daemonConf) throws Exception { LOG.info("\n\n\t\tSTARTING LOCAL MODE CLUSTER\n\n"); Builder builder = new Builder(); if (daemonConf != null) { builder.withDaemonConf(daemonConf); } try (LocalCluster local = builder.build(); LocalDRPC drpc = new LocalDRPC(local.metricRegistry); DRPCClient.LocalOverride drpcOverride = new DRPCClient.LocalOverride(drpc)) { LOG.info("\n\n\t\tRUNNING LOCAL CLUSTER for seconds.\n\n", ttlSec); Thread.sleep(ttlSec * 1000); LOG.info("\n\n\t\tSTOPPING LOCAL MODE CLUSTER\n\n"); T ret = c.call(); return ret; } }

Target:
public static <T> T withLocalModeOverride(Callable<T> c, long ttlSec, Map<String, Object> daemonConf) throws Exception { LOG.info("\n\n\t\tSTARTING LOCAL MODE CLUSTER\n\n"); Builder builder = new Builder(); if (daemonConf != null) { builder.withDaemonConf(daemonConf); } try (LocalCluster local = builder.build(); LocalDRPC drpc = new LocalDRPC(local.metricRegistry); DRPCClient.LocalOverride drpcOverride = new DRPCClient.LocalOverride(drpc)) { T ret = c.call(); LOG.info("\n\n\t\tRUNNING LOCAL CLUSTER for seconds.\n\n", ttlSec); Thread.sleep(ttlSec * 1000); LOG.info("\n\n\t\tSTOPPING LOCAL MODE CLUSTER\n\n"); return ret; } }
Source:
protected void added(Object[] elements) { List<Object> kids = null; boolean changed = false; synchronized (this) { ModelNode[] childrenNodes = getRootNode().getChildrenNodes(); if (childrenNodes == null) { kids = new ArrayList<>(elements.length); } else { kids = new ArrayList<>(elements.length + childrenNodes.length); for (ModelNode childrenNode : childrenNodes) { kids.add(childrenNode.getElement()); } } for (Object element : elements) { if (!kids.contains(element)) { kids.add(element); changed = true; } } } if (changed) { setChildren(getRootNode(), kids); } }

Target:
protected void added(Object[] elements) { List<Object> kids = null; boolean changed = false; synchronized (this) { ModelNode[] childrenNodes = getRootNode().getChildrenNodes(); if (childrenNodes == null) { kids = new ArrayList<>(elements.length); } else { kids = new ArrayList<>(elements.length + childrenNodes.length); for (ModelNode childNode : childrenNodes) { kids.add(childNode.getElement()); } } for (Object element : elements) { if (!kids.contains(element)) { kids.add(element); changed = true; } } } if (changed) { setChildren(getRootNode(), kids); } }
Source:
public Boolean call() throws Exception { if (DynamicClusterImpl.this.getMembers().isEmpty()) return false; if (Lifecycle.RUNNING != DynamicClusterImpl.this.sensors().get(SERVICE_STATE_ACTUAL)) return false; for (Entity member : DynamicClusterImpl.this.getMembers()) if (Boolean.FALSE.equals(member.sensors().get(SERVICE_UP))) return false; return true; }

Target:
public Boolean call() throws Exception { if (DynamicClusterImpl.this.getMembers().isEmpty()) return false; if (Lifecycle.RUNNING != DynamicClusterImpl.this.sensors().get(SERVICE_STATE_ACTUAL)) return false; for (Entity member : DynamicClusterImpl.this.getMembers()) if (!Boolean.TRUE.equals(member.sensors().get(SERVICE_UP))) return false; return true; }