auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void verifyAPIAvailableInPublisher(String apiName) throws Exception { HttpResponse response = apiPublisher.getAPI(apiName, API_CREATOR_PUBLISHER_USER, API_VERSION); log.info("Check API available in publisher response code for API \'" + apiName + "\' : " + response.getResponseCode()); log.info("Check API available in publisher response data for API \'" + apiName + "\' : " + response.getData()); assertTrue(response.getData().contains(apiName), "API deletion successful for API : " + apiName); assertFalse(new JSONObject(response.getData()).getBoolean("error"), "API deletion successful for API : " + apiName); }

Target:
private void verifyAPIAvailableInPublisher(String apiName) throws Exception { HttpResponse response = apiPublisher.getAPI(apiName, API_CREATOR_PUBLISHER_USERNAME, API_VERSION); log.info("Check API available in publisher response code for API \'" + apiName + "\' : " + response.getResponseCode()); log.info("Check API available in publisher response data for API \'" + apiName + "\' : " + response.getData()); assertTrue(response.getData().contains(apiName), "API has been delete : " + apiName); assertFalse(new JSONObject(response.getData()).getBoolean("error"), "API has been deleted : " + apiName); }
Source:
public void run() { LOG.debug("Starting lease keep-alive thread."); while (!leaseFreed) { try { Thread.sleep(LEASE_RENEWAL_PERIOD); } catch (InterruptedException e) { LOG.debug("Keep-alive thread for lease " + leaseID + " interrupted."); Thread.currentThread().interrupt(); } try { if (!leaseFreed) { store.renewLease(path, leaseID); LOG.info("Renewed lease " + leaseID + " on " + path); } } catch (IOException e) { if (!leaseFreed) { leaseFreed = true; LOG.warn("Attempt to renew lease " + leaseID + " on " + path + " failed, but lease not yet freed. Reason: " + e.getMessage()); } } } }

Target:
public void run() { LOG.debug("Starting lease keep-alive thread."); while (!leaseFreed) { try { Thread.sleep(LEASE_RENEWAL_PERIOD); } catch (InterruptedException e) { LOG.debug("Keep-alive thread for lease interrupted", leaseID); Thread.currentThread().interrupt(); } try { if (!leaseFreed) { LOG.debug("lease path: {}, renew lease id: {}", path, leaseID); client.renewLease(getRelativePath(path), leaseID); LOG.info("Renewed lease on {}", leaseID, path); } } catch (IOException e) { if (!leaseFreed) { leaseFreed = true; LOG.warn("Attempt to renew lease on failed, stopping renewal thread: ", leaseID, path, e.getMessage()); LOG.debug("Exception renewing lease", e); } } } }
Source:
public VmDevice mapRow(ResultSet rs, int rowNum) throws SQLException { VmDevice vmDevice = new VmDevice(); vmDevice.setId(new VmDeviceId(Guid.createGuidFromString(rs.getString("device_id")), Guid.createGuidFromString(rs .getString("vm_id")))); vmDevice.setDevice(rs.getString("device")); vmDevice.setType(VmDeviceGeneralType.forValue(rs.getString("type"))); vmDevice.setAddress(rs.getString("address")); vmDevice.setBootOrder(rs.getInt("boot_order")); String specParams = rs.getString("spec_params"); if (StringUtils.isEmpty(specParams)) { vmDevice.setSpecParams(new HashMap<String, Object>()); } else { vmDevice.setSpecParams(SerializationFactory .getDeserializer() .deserialize(specParams, HashMap.class)); } vmDevice.setIsManaged(rs.getBoolean("is_managed")); vmDevice.setIsPlugged(rs.getBoolean("is_plugged")); vmDevice.setIsReadOnly(rs.getBoolean("is_readonly")); vmDevice.setAlias(rs.getString("alias")); vmDevice.setCustomProperties(rs.getString("custom_properties")); return vmDevice; }

Target:
public VmDevice mapRow(ResultSet rs, int rowNum) throws SQLException { VmDevice vmDevice = new VmDevice(); vmDevice.setId(new VmDeviceId(Guid.createGuidFromString(rs.getString("device_id")), Guid.createGuidFromString(rs .getString("vm_id")))); vmDevice.setDevice(rs.getString("device")); vmDevice.setType(VmDeviceGeneralType.forValue(rs.getString("type"))); vmDevice.setAddress(rs.getString("address")); vmDevice.setBootOrder(rs.getInt("boot_order")); String specParams = rs.getString("spec_params"); if (StringUtils.isEmpty(specParams)) { vmDevice.setSpecParams(new HashMap<String, Object>()); } else { vmDevice.setSpecParams(SerializationFactory .getDeserializer() .deserialize(specParams, HashMap.class)); } vmDevice.setIsManaged(rs.getBoolean("is_managed")); vmDevice.setIsPlugged(rs.getBoolean("is_plugged")); vmDevice.setIsReadOnly(rs.getBoolean("is_readonly")); vmDevice.setAlias(rs.getString("alias")); vmDevice.setCustomProperties(DevicePropertiesUtils.getInstance() .convertProperties(rs.getString("custom_properties"))); return vmDevice; }
Source:
public Object resolveArgument(MethodParameter parameter, Message<?> message) throws Exception { Object value = message.getPayload(); if (this.canProcessMessageList) { Assert.state(value instanceof Collection, "This Argument Resolver support only messages with payload as Collection<Message<?>>"); Collection<Message<?>> messages = (Collection<Message<?>>) value; parameter.increaseNestingLevel(); if (Message.class.isAssignableFrom(parameter.getNestedParameterType())) { value = messages; } else { value = messages.stream() .map(Message::getPayload) .collect(Collectors.toList()); } parameter.decreaseNestingLevel(); } if (Iterator.class.isAssignableFrom(parameter.getParameterType())) { if (value instanceof Iterable) { return ((Iterable) value).iterator(); } else { return Collections.singleton(value).iterator(); } } else { return getEvaluationContext() .getTypeConverter() .convertValue(value, TypeDescriptor.forObject(value), TypeDescriptor.valueOf(parameter.getParameterType())); } }

Target:
public Object resolveArgument(MethodParameter parameter, Message<?> message) throws Exception { Object value = message.getPayload(); if (this.canProcessMessageList) { Assert.state(value instanceof Collection, "This Argument Resolver only supports messages with a payload of Collection<Message<?>>"); Collection<Message<?>> messages = (Collection<Message<?>>) value; parameter.increaseNestingLevel(); if (Message.class.isAssignableFrom(parameter.getNestedParameterType())) { value = messages; } else { value = messages.stream() .map(Message::getPayload) .collect(Collectors.toList()); } parameter.decreaseNestingLevel(); } if (Iterator.class.isAssignableFrom(parameter.getParameterType())) { if (value instanceof Iterable) { return ((Iterable) value).iterator(); } else { return Collections.singleton(value).iterator(); } } else { return getEvaluationContext() .getTypeConverter() .convertValue(value, TypeDescriptor.forObject(value), TypeDescriptor.valueOf(parameter.getParameterType())); } }
Source:
public <T> T setComponent(final Class<T> type, final T value) { T removed = null; if (value == null) { removed = (T) components.get(type); components.remove(type); } else { removed = (T) components.put(type, value); } if (removed != null) { fireEvent(new ComponentRemoved(type, value)); } if (value != null) { fireEvent(new ComponentAdded(type, value)); } return removed; }

Target:
public <T> T setComponent(final Class<T> type, final T value) { final T removed = (T) components.put(type, value); if (removed != null) { fireEvent(new ComponentRemoved(type, value)); } if (value != null) { fireEvent(new ComponentAdded(type, value)); } return removed; }
Source:
public void validateNodeAndNpmVersion() { try { List<String> nodeVersionCommand = new ArrayList<>(); nodeVersionCommand.add(getNodeExecutable()); nodeVersionCommand.add("--version"); FrontendVersion foundNodeVersion = FrontendUtils.getVersion("node", nodeVersionCommand); if (!ignoreVersionChecks) { FrontendUtils.validateToolVersion("node", foundNodeVersion, SUPPORTED_NODE_VERSION, SHOULD_WORK_NODE_VERSION); } } catch (UnknownVersionException e) { getLogger().warn("Error checking if node is new enough", e); } try { List<String> npmVersionCommand = new ArrayList<>( getNpmExecutable(false)); npmVersionCommand.add("--version"); FrontendVersion npmVersion = FrontendUtils.getVersion("npm", npmVersionCommand); if (!ignoreVersionChecks) { FrontendUtils.validateToolVersion("npm", npmVersion, SUPPORTED_NPM_VERSION, SHOULD_WORK_NPM_VERSION); } checkForFaultyNpmVersion(npmVersion); } catch (UnknownVersionException e) { getLogger().warn("Error checking if npm is new enough", e); } }

Target:
public void validateNodeAndNpmVersion() { if (ignoreVersionChecks) { return; } try { List<String> nodeVersionCommand = new ArrayList<>(); nodeVersionCommand.add(getNodeExecutable()); nodeVersionCommand.add("--version"); FrontendVersion foundNodeVersion = FrontendUtils.getVersion("node", nodeVersionCommand); FrontendUtils.validateToolVersion("node", foundNodeVersion, SUPPORTED_NODE_VERSION, SHOULD_WORK_NODE_VERSION); } catch (UnknownVersionException e) { getLogger().warn("Error checking if node is new enough", e); } try { List<String> npmVersionCommand = new ArrayList<>( getNpmExecutable(false)); npmVersionCommand.add("--version"); FrontendVersion npmVersion = FrontendUtils.getVersion("npm", npmVersionCommand); FrontendUtils.validateToolVersion("npm", npmVersion, SUPPORTED_NPM_VERSION, SHOULD_WORK_NPM_VERSION); checkForFaultyNpmVersion(npmVersion); } catch (UnknownVersionException e) { getLogger().warn("Error checking if npm is new enough", e); } }
Source:
public void testVisibilityForAnotherUserInOtherDomainInPublisher() throws APIManagerIntegrationTestException, ApiException { APIListDTO getAllApisResponse = restAPIPublisherOtherDomainUser.getAllAPIs("carbon.super"); assertFalse(APIMTestCaseUtils.isAPIAvailable(apiIdentifier, getAllApisResponse), "API is visible to another user in other domain in API Publisher. When Visibility is private." + getAPIIdentifierString(apiIdentifier)); }

Target:
public void testVisibilityForAnotherUserInOtherDomainInPublisher() throws APIManagerIntegrationTestException, ApiException { APIListDTO getAllApisResponse = restAPIPublisherOtherDomainUser .getAllAPIs(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME); assertFalse(APIMTestCaseUtils.isAPIAvailable(apiIdentifier, getAllApisResponse), "API is visible to another user in other domain in API Publisher. When Visibility is private." + getAPIIdentifierString(apiIdentifier)); }
Source:
private boolean setupPerspectiveStack(IEclipseContext context) { IPerspectiveRegistry registry = getWorkbench().getPerspectiveRegistry(); String forcedPerspectiveId = (String) context.get(E4Workbench.FORCED_PERSPECTIVE_ID); if (forcedPerspectiveId != null) { perspective = registry.findPerspectiveWithId(forcedPerspectiveId); if (perspective != null) { return false; } } List<MPerspectiveStack> perspStackList = modelService.findElements(model, null, MPerspectiveStack.class, null); MPerspectiveStack perspStack = !perspStackList.isEmpty() ? perspStackList.get(0) : null; if (perspStack != null && perspStack.getSelectedElement() != null) { perspective = registry.findPerspectiveWithId(perspStack.getSelectedElement() .getElementId()); if (perspective != null) { return false; } } if (perspective == null) { perspective = registry.findPerspectiveWithId(registry.getDefaultPerspective()); } return true; }

Target:
private boolean setupPerspectiveStack(IEclipseContext context) { IPerspectiveRegistry registry = getWorkbench().getPerspectiveRegistry(); String forcedPerspectiveId = (String) context.get(E4Workbench.FORCED_PERSPECTIVE_ID); if (forcedPerspectiveId != null) { perspective = registry.findPerspectiveWithId(forcedPerspectiveId); } List<MPerspectiveStack> perspStackList = modelService.findElements(model, null, MPerspectiveStack.class, null); MPerspective selectedPersp = null; if (!perspStackList.isEmpty()) { selectedPersp = perspStackList.get(0).getSelectedElement(); } if (perspective == null && selectedPersp != null) { perspective = registry.findPerspectiveWithId(selectedPersp.getElementId()); } if (perspective == null) { perspective = registry.findPerspectiveWithId(registry.getDefaultPerspective()); } return selectedPersp == null; }
Source:
protected CallStackAnalysis() { super(); fCallGraph = new CallGraphAnalysis(); ISegmentStore<CallStackEdge> links; try { File segStoreFile = new File(String.valueOf(getId()) + LINKS_SUFFIX); links = SegmentStoreFactory.<@NonNull CallStackEdge> createOnDiskSegmentStore(Objects.requireNonNull(segStoreFile.toPath()), CallStackEdge.READER); } catch (IOException e) { links = SegmentStoreFactory.createSegmentStore(SegmentStoreType.Fast); } fLinks = links; }

Target:
protected CallStackAnalysis() { super(); fCallGraph = new CallGraphAnalysis(); }
Source:
public void testBatchTranslateTextWithGlossaryAndModel() throws InterruptedException, ExecutionException, IOException, TimeoutException { BatchTranslateTextWithGlossaryAndModel.batchTranslateTextWithGlossaryAndModel( PROJECT_ID, "en", "ja", INPUT_URI, "gs://" + PROJECT_ID + "/" + PREFIX_PATH, GLOSSARY_ID, MODEL_ID); String got = bout.toString(); assertThat(got).contains("Total Characters: 25"); }

Target:
public void testBatchTranslateTextWithGlossaryAndModel() throws InterruptedException, ExecutionException, IOException, TimeoutException { BatchTranslateTextWithGlossaryAndModel.batchTranslateTextWithGlossaryAndModel( PROJECT_ID, "en", "ja", INPUT_URI, OUTPUT_URI, GLOSSARY_ID, MODEL_ID); String got = bout.toString(); assertThat(got).contains("Total Characters: 25"); }
Source:
void testEventStreamsDecoratedOnReadAndWrite() throws InterruptedException { ExecutorService customExecutor = Executors.newCachedThreadPool(); testSubject = DisruptorCommandBus.builder() .bufferSize(8) .producerType(ProducerType.SINGLE) .waitStrategy(new SleepingWaitStrategy()) .executor(customExecutor) .invokerThreadCount(2) .publisherThreadCount(3) .build(); testSubject.subscribe(StubCommand.class.getName(), stubHandler); SnapshotTriggerDefinition snapshotTriggerDefinition = mock(SnapshotTriggerDefinition.class); SnapshotTrigger snapshotTrigger = mock(SnapshotTrigger.class); when(snapshotTriggerDefinition.prepareTrigger(any())).thenReturn(snapshotTrigger); stubHandler.setRepository(testSubject.createRepository(eventStore, new GenericAggregateFactory<>( AnnotatedAggregateMetaModelFactory .inspectAggregate(StubAggregate.class)), snapshotTriggerDefinition)); CommandMessage<StubCommand> command = asCommandMessage(new StubCommand(aggregateIdentifier)); CommandCallback mockCallback = mock(CommandCallback.class); testSubject.dispatch(command, mockCallback); testSubject.dispatch(command); testSubject.stop(); assertFalse(customExecutor.awaitTermination(250, TimeUnit.MILLISECONDS)); customExecutor.shutdown(); assertTrue(customExecutor.awaitTermination(5, TimeUnit.SECONDS)); InOrder inOrder = inOrder(snapshotTrigger); inOrder.verify(snapshotTrigger).eventHandled(isA(DomainEventMessage.class)); inOrder.verify(snapshotTrigger).initializationFinished(); inOrder.verify(snapshotTrigger, times(2)).eventHandled(isA(DomainEventMessage.class)); }

Target:
void testEventStreamsDecoratedOnReadAndWrite() throws InterruptedException { ExecutorService customExecutor = Executors.newCachedThreadPool(); testSubject = DisruptorCommandBus.builder() .bufferSize(8) .producerType(ProducerType.SINGLE) .waitStrategy(new SleepingWaitStrategy()) .executor(customExecutor) .invokerThreadCount(2) .publisherThreadCount(3) .build(); testSubject.subscribe(StubCommand.class.getName(), stubHandler); SnapshotTriggerDefinition snapshotTriggerDefinition = mock(SnapshotTriggerDefinition.class); SnapshotTrigger snapshotTrigger = mock(SnapshotTrigger.class); when(snapshotTriggerDefinition.prepareTrigger(any())).thenReturn(snapshotTrigger); stubHandler.setRepository( testSubject.createRepository(eventStore, new GenericAggregateFactory<>(StubAggregate.class), snapshotTriggerDefinition)); CommandMessage<StubCommand> command = asCommandMessage(new StubCommand(aggregateIdentifier)); CommandCallback mockCallback = mock(CommandCallback.class); testSubject.dispatch(command, mockCallback); testSubject.dispatch(command); testSubject.stop(); assertFalse(customExecutor.awaitTermination(250, TimeUnit.MILLISECONDS)); customExecutor.shutdown(); assertTrue(customExecutor.awaitTermination(5, TimeUnit.SECONDS)); InOrder inOrder = inOrder(snapshotTrigger); inOrder.verify(snapshotTrigger).eventHandled(isA(DomainEventMessage.class)); inOrder.verify(snapshotTrigger).initializationFinished(); inOrder.verify(snapshotTrigger, times(2)).eventHandled(isA(DomainEventMessage.class)); }
Source:
public Boolean checkCanSyncSolr(String studyId, String userId) throws CatalogException { return true; }

Target:
public boolean checkCanSyncSolr(String studyId, String userId) throws CatalogException { if ("admin".equals(userId)) { return true; } return true; }
Source:
private void listComprehension(StringBuilder sb, String fromNodeVar, Relationship relationship, Node node, int level, int depth) { String direction = relationship.direction(node); Node toNode = relationship.other(node); String relVar = relVariableName(relationship, level); String toNodeVar = variableName(toNode, level); sb.append("[ ("); sb.append(fromNodeVar); sb.append(")"); switch (direction) { case INCOMING: appendRel(sb, relVar, relationship.type(), "<-[", "]-"); break; case OUTGOING: appendRel(sb, relVar, relationship.type(), "-[", "]->"); break; default: appendRel(sb, relVar, relationship.type(), "-[", "]-"); break; } sb.append("("); sb.append(toNodeVar); if (toNode.label() != null) { sb.append(":`"); sb.append(toNode.label()); sb.append("`"); } sb.append(") | [ "); sb.append(relVar); sb.append(", "); sb.append(toNodeVar); if (depth > 0 && !toNode.relationships().isEmpty()) { sb.append(", [ "); expand(sb, toNodeVar, toNode, level + 1, depth - 1); sb.append(" ]"); } sb.append(" ] ]"); }

Target:
private void listComprehension(StringBuilder sb, String fromNodeVar, Relationship relationship, Node node, int level, int depth) { String direction = relationship.direction(node); Node toNode = relationship.other(node); String relVar = relVariableName(relationship, level); String toNodeVar = variableName(toNode, level); sb.append("[ ("); sb.append(fromNodeVar); sb.append(")"); switch (direction) { case INCOMING: appendRel(sb, relVar, relationship.type(), "<-[", "]-"); break; case OUTGOING: appendRel(sb, relVar, relationship.type(), "-[", "]->"); break; default: appendRel(sb, relVar, relationship.type(), "-[", "]-"); break; } sb.append("("); sb.append(toNodeVar); if (toNode.label().isPresent()) { sb.append(":`"); sb.append(toNode.label().get()); sb.append("`"); } sb.append(") | [ "); sb.append(relVar); sb.append(", "); sb.append(toNodeVar); if (depth > 0 && !toNode.relationships().isEmpty()) { sb.append(", [ "); expand(sb, toNodeVar, toNode, level + 1, depth - 1); sb.append(" ]"); } sb.append(" ] ]"); }
Source:
public void processExpiration() { long start = 0; if (!Thread.currentThread().isInterrupted()) { try { if (trace) { log.trace("Purging data container of expired entries"); start = timeService.time(); } List<CompletableFuture> futures = new ArrayList<>(MAX_ASYNC_EXPIRATIONS); long currentTimeMillis = timeService.wallClockTime(); LocalizedCacheTopology topology = distributionManager.getCacheTopology(); IntSet segments = IntSets.from(topology.getReadConsistentHash().getPrimarySegmentsForOwner(localAddress)); dataContainer.running().forEachIncludingExpired(segments, (ice, segment) -> { if (ice.canExpire()) { boolean expiredMortal; boolean expiredTransient; V value; long lifespan; long maxIdle; synchronized (ice) { value = ice.getValue(); lifespan = ice.getLifespan(); maxIdle = ice.getMaxIdle(); expiredMortal = ExpiryHelper.isExpiredMortal(lifespan, ice.getCreated(), currentTimeMillis); expiredTransient = ExpiryHelper.isExpiredTransient(maxIdle, ice.getLastUsed(), currentTimeMillis); } if (expiredMortal) { addAndWaitIfFull(handleLifespanExpireEntry(ice.getKey(), value, lifespan, false), futures); } else if (expiredTransient) { addAndWaitIfFull(actualRemoveMaxIdleExpireEntry(ice.getKey(), value, maxIdle, false), futures); } } }); if (!futures.isEmpty()) { futures.forEach(CompletableFuture::join); } if (trace) { log.tracef("Purging data container completed in %s", Util.prettyPrintTime(timeService.timeDuration(start, TimeUnit.MILLISECONDS))); } } catch (Exception e) { log.exceptionPurgingDataContainer(e); } } if (!Thread.currentThread().isInterrupted()) { persistenceManager.purgeExpired(); } }

Target:
public void processExpiration() { if (!Thread.currentThread().isInterrupted()) { LocalizedCacheTopology topology; do { topology = distributionManager.getCacheTopology(); } while (purgeInMemoryContents(topology)); } if (!Thread.currentThread().isInterrupted()) { persistenceManager.purgeExpired(); } }
Source:
public void compareEqLongToInt() { assertThat(UnindexedMatcher.compareEq(1l, 1), is(true)); assertThat(UnindexedMatcher.compareEq(1, 1l), is(true)); assertThat(UnindexedMatcher.compareEq(1l, 2), is(false)); assertThat(UnindexedMatcher.compareEq(2, 1l), is(false)); }

Target:
public void compareEqLongToInt() { assertThat(compareEq(new Long(1l), new Integer(1)), is(true)); assertThat(compareEq(new Integer(1), new Long(1l)), is(true)); assertThat(compareEq(new Long(1l), new Integer(2)), is(false)); assertThat(compareEq(new Integer(2), new Long(1l)), is(false)); }
Source:
public String getTimestamp() { return new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()); }

Target:
public String getTimestamp() { return DATE_FORMAT.format(new Date()); }
Source:
public void setUp() throws Exception { super.setUp(); receivedEvents.clear(); messageQueueRegistry.clear(); messageExecutionRegistry.clear(); startCountDownLatch = new CountDownLatch(1); waitingCountDownLatchRef.set(new CountDownLatch(1)); runtimeService.addEventListener(spyMessageListener, ActivitiEventType.ACTIVITY_MESSAGE_SENT, ActivitiEventType.ACTIVITY_MESSAGE_WAITING, ActivitiEventType.ACTIVITY_MESSAGE_RECEIVED); runtimeService.addEventListener(catchMessageListener, ActivitiEventType.ACTIVITY_MESSAGE_WAITING); newEventSubscriptionQuery().eventType("message") .list() .stream() .forEach(subscription -> { Optional<String> correlationKey = Optional.of(subscription) .filter(it -> it.getProcessInstanceId() != null) .map(it -> it.getConfiguration()); SubscriptionKey key = new SubscriptionKey(subscription.getEventName(), correlationKey); BlockingQueue<ThrowMessage> messageQueue = registerSubscription(key, correlationKey); new Thread(() -> { try { ThrowMessage throwMessage = messageQueue.take(); String messageName = throwMessage.getName(); Map<String, Object> payload = throwMessage.getPayload() .orElse(null); String businessKey = throwMessage.getBusinessKey() .orElse(null); runtimeService.startProcessInstanceByMessage(messageName, businessKey, payload); startCountDownLatch.countDown(); } catch (InterruptedException e) { e.printStackTrace(); } }).start(); }); }

Target:
public void setUp() throws Exception { super.setUp(); receivedEvents.clear(); messageQueueRegistry.clear(); messageExecutionRegistry.clear(); startCountDownLatch = new CountDownLatch(1); waitingCountDownLatchRef.set(new CountDownLatch(1)); runtimeService.addEventListener(spyMessageListener, ActivitiEventType.ACTIVITY_MESSAGE_SENT, ActivitiEventType.ACTIVITY_MESSAGE_WAITING, ActivitiEventType.ACTIVITY_MESSAGE_RECEIVED); runtimeService.addEventListener(catchMessageListener, ActivitiEventType.ACTIVITY_MESSAGE_WAITING); initExistingMessageSubscriptions(); }
Source:
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; RepositoryTreeNode other = (RepositoryTreeNode) obj; if (myType == null) { if (other.myType != null) return false; } else if (!myType.equals(other.myType)) return false; if (myParent == null) { if (other.myParent != null) return false; } else if (!myParent.equals(other.myParent)) return false; if (myType == RepositoryTreeNodeType.REPOGROUP && other.myType == RepositoryTreeNodeType.REPOGROUP) { return hashCode() == other.hashCode(); } if (myRepository == null) { if (other.myRepository != null) { return false; } } else { if (other.myRepository == null) { return false; } if (!myRepository.getDirectory() .equals(other.myRepository.getDirectory())) { return false; } } if (myObject == null) { if (other.myObject != null) { return false; } } else { if (other.myObject == null) { return false; } if (!checkObjectsEqual(other.myObject)) { return false; } } return true; }

Target:
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; RepositoryTreeNode other = (RepositoryTreeNode) obj; if (myType == null) { if (other.myType != null) return false; } else if (!myType.equals(other.myType)) return false; if (considerParent(myType)) { if (myParent == null) { if (other.myParent != null) { return false; } } else if (!myParent.equals(other.myParent)) { return false; } } if (myType == RepositoryTreeNodeType.REPOGROUP && other.myType == RepositoryTreeNodeType.REPOGROUP) { RepositoryGroup myGroup = ((RepositoryGroupNode)this).getGroup(); RepositoryGroup otherGroup = ((RepositoryGroupNode)other).getGroup(); return myGroup.getGroupId().equals(otherGroup.getGroupId()) && myGroup.getName().equals(otherGroup.getName()); } if (myRepository == null) { if (other.myRepository != null) { return false; } } else { if (other.myRepository == null) { return false; } if (!myRepository.getDirectory() .equals(other.myRepository.getDirectory())) { return false; } } if (myObject == null) { if (other.myObject != null) { return false; } } else { if (other.myObject == null) { return false; } if (!checkObjectsEqual(other.myObject)) { return false; } } return true; }
Source:
public void setFirstReference(PDOMLinkage linkage, PDOMName name) throws CoreException { PDOMName head = null; Iterator iterator = new Iterator(record); while(head == null) { if (iterator.next == null) break; if (!linkage.equals(iterator.next.getLinkage())) iterator.next = iterator.advance(); else head = iterator.next; } if (head == null) add(name); else { long nextNameRec = iterator.node + Database.INT_SIZE + Database.PTR_SIZE; pdom.getDB().putRecPtr(nextNameRec, name == null ? 0 : name.getRecord()); } }

Target:
public void setFirstReference(PDOMLinkage linkage, PDOMName name) throws CoreException { PDOMName head = null; Iterator iterator = new Iterator(record); while (head == null) { if (iterator.next == null) break; if (!linkage.equals(iterator.next.getLinkage())) { iterator.next = iterator.advance(); } else { head = iterator.next; } } if (head == null) { add(name); } else { long nextNameRec = iterator.node + Database.INT_SIZE + Database.PTR_SIZE; pdom.getDB().putRecPtr(nextNameRec, name == null ? 0 : name.getRecord()); } }
Source:
public void before() throws Exception { CacheConfiguration<Integer, String> cacheConfiguration = CacheConfigurationBuilder .newCacheConfigurationBuilder(Integer.class, String.class, resources) .withExpiry(ExpiryPolicyBuilder.timeToLiveExpiration(Duration.ofMillis(TIME_TO_EXPIRATION))) .build(); StatisticsService statisticsService = new DefaultStatisticsService(new DefaultStatisticsServiceConfiguration()); cacheManager = CacheManagerBuilder.newCacheManagerBuilder() .withCache("cache", cacheConfiguration) .using(new DefaultPersistenceConfiguration(diskPath.newFolder())) .using(statisticsService) .using(new TimeSourceConfiguration(timeSource)) .build(true); cache = cacheManager.getCache("cache", Integer.class, String.class); tierStatistics = statisticsService.getCacheStatistics("cache") .getTierStatistics().get(tierName); }

Target:
public void before() throws Exception { CacheConfiguration<Integer, String> cacheConfiguration = CacheConfigurationBuilder .newCacheConfigurationBuilder(Integer.class, String.class, resources) .withExpiry(ExpiryPolicyBuilder.timeToLiveExpiration(Duration.ofMillis(TIME_TO_EXPIRATION))) .build(); StatisticsService statisticsService = new DefaultStatisticsService(); cacheManager = CacheManagerBuilder.newCacheManagerBuilder() .withCache("cache", cacheConfiguration) .using(new DefaultPersistenceConfiguration(diskPath.newFolder())) .using(statisticsService) .using(new TimeSourceConfiguration(timeSource)) .build(true); cache = cacheManager.getCache("cache", Integer.class, String.class); tierStatistics = statisticsService.getCacheStatistics("cache") .getTierStatistics().get(tierName); }
Source:
public Session getSessionForHost(URI uri) throws IOException { if (session != null && !session.getHost().equals(uri.getHost())) { close(); } if (session == null || !session.isConnected()) { try { int port = uri.getPort() <= 0 ? 22 : uri.getPort(); session = jsch.getSession(clientProvider.getUsername(), uri.getHost(), port); session.setConfig("StrictHostKeyChecking", "no"); session.setPassword(clientProvider.getPassword()); session.connect(); } catch (JSchException ex) { throw new IOException("Unable to connect to server", ex); } } return session; }

Target:
public Session getSessionForHost(URI uri) throws IOException { if (session != null && !session.getHost().equals(uri.getHost())) { close(); } if (session == null || !session.isConnected()) { try { int port = uri.getPort() <= 0 ? 22 : uri.getPort(); session = jsch.getSession(clientProvider.getUsername(), uri.getHost(), port); session.setConfig("StrictHostKeyChecking", "no"); session.setPassword(clientProvider.getPassword()); session.connect(); } catch (JSchException ex) { String msg = String.format("Unable to connect to host {}", uri.toString()); LOG.error(msg,ex); throw new IOException(msg, ex); } } return session; }
Source:
public void testPinSingleTrace() { assertEquals(CALL_STACK_VIEW_TITLE, fOriginalViewBot.getTitle()); SWTBotToolbarDropDownButton toolbarDropDownButton = fOriginalViewBot.toolbarDropDownButton(PIN_VIEW_BUTTON_NAME); toolbarDropDownButton.menuItem(PIN_TO_PREFIX + fUstTestTrace.getName()).click(); assertRenamed(PINNED_CALL_STACK_VIEW_TITLE); fOriginalViewBot.toolbarButton(UNPIN_VIEW_BUTTON_NAME).click(); assertRenamed(CALL_STACK_VIEW_TITLE); fOriginalViewBot.toolbarButton(PIN_VIEW_BUTTON_NAME).click(); assertRenamed(PINNED_CALL_STACK_VIEW_TITLE); }

Target:
public void testPinSingleTrace() { assertEquals(CALL_STACK_VIEW_TITLE, fOriginalViewBot.getTitle()); SWTBotToolbarDropDownButton toolbarDropDownButton = fOriginalViewBot.toolbarDropDownButton(PIN_VIEW_BUTTON_NAME); toolbarDropDownButton.menuItem(PIN_TO_PREFIX + fUstTestTrace.getName()).click(); assertOriginalViewTitle(PINNED_TO_UST_CALL_STACK_VIEW_TITLE); fOriginalViewBot.toolbarButton(UNPIN_VIEW_BUTTON_NAME).click(); assertOriginalViewTitle(CALL_STACK_VIEW_TITLE); fOriginalViewBot.toolbarButton(PIN_VIEW_BUTTON_NAME).click(); assertOriginalViewTitle(PINNED_TO_UST_CALL_STACK_VIEW_TITLE); }
Source:
private synchronized void record() { final long now = System.currentTimeMillis(); final long lastPeriodSeconds = (now - this.lastStartTime) / 1000; this.lastStartTime = now; final long seconds = (now - startTime) / 1000; final String elapsed = formatElapseTime(seconds); final String period = pad(fmt.format(lastPeriodSeconds), 4); final String processed = pad(fmt.format(this.processed), 13); final String readInfo; if (this.lastChrom == null) readInfo = "*/*"; else readInfo = this.lastChrom + ":" + fmt.format(this.lastPos); final String rnInfo; if(lastRN != null) { rnInfo = ", last read name: " + lastRN; } else { rnInfo = ""; } final long n = (this.processed % this.n == 0) ? this.n : this.processed % this.n; log(this.verb, " ", processed, " " + noun + ". Elapsed time: ", elapsed, "s. Time for last ", fmt.format(n), ": ", period, "s. Last read position: ", readInfo, rnInfo); }

Target:
private synchronized void record() { final long now = System.currentTimeMillis(); final long lastPeriodSeconds = (now - this.lastStartTime) / 1000; this.lastStartTime = now; final long seconds = (now - startTime) / 1000; final String elapsed = formatElapseTime(seconds); final String period = pad(fmt.format(lastPeriodSeconds), 4); final String processed = pad(fmt.format(this.processed), 13); final String readInfo; if (this.lastChrom == null) readInfo = "*/*"; else readInfo = this.lastChrom + ":" + fmt.format(this.lastPos); final String rnInfo; if(lastReadName != null) { rnInfo = ". Last read name: " + lastReadName; } else { rnInfo = ""; } final long n = (this.processed % this.n == 0) ? this.n : this.processed % this.n; log(this.verb, " ", processed, " " + noun + ". Elapsed time: ", elapsed, "s. Time for last ", fmt.format(n), ": ", period, "s. Last read position: ", readInfo, rnInfo); }
Source:
public void destroyTask(@PathVariable("name") String name, @RequestParam(required = false) Boolean cleanup) { if (cleanup != null && cleanup.equals(Boolean.TRUE)) { Set<Long> taskExecutionIds = this.dataflowTaskExecutionDao.getTaskExecutionIdsByTaskName(name); final Set<TaskExecutionControllerDeleteAction> actionsAsSet = new HashSet<>(); actionsAsSet.add(TaskExecutionControllerDeleteAction.CLEANUP); actionsAsSet.add(TaskExecutionControllerDeleteAction.REMOVE_DATA); if (!taskExecutionIds.isEmpty()) { this.taskDeleteService.cleanupExecutions(actionsAsSet, taskExecutionIds); } } this.taskDeleteService.deleteTaskDefinition(name); }

Target:
public void destroyTask(@PathVariable("name") String name, @RequestParam(required = false) Boolean cleanup) { boolean taskExecutionCleanup = (cleanup != null && cleanup) ? cleanup : false; this.taskDeleteService.deleteTaskDefinition(name, taskExecutionCleanup); }
Source:
public synchronized void waitUntilAllOperationsAreDone() throws InterruptedException { while(!pendingOperationsWithSize.isEmpty()) { if (lastOperationChange + MAX_UNCHANGED_WAIT_MS < System.currentTimeMillis()) { long lastUpdated = (System.currentTimeMillis() - lastOperationChange) / 1000; LOG.warn("No operations completed within the last %d seconds." + "There are still %d operations in progress.", lastUpdated, pendingOperationsWithSize.size()); break; } wait(WAIT_MILLIS); } }

Target:
public synchronized void waitUntilAllOperationsAreDone() throws InterruptedException { boolean performedWarning = false; while(!pendingOperationsWithSize.isEmpty()) { if (!performedWarning && lastOperationChange + INTERVAL_NO_SUCCESS_WARNING < System.currentTimeMillis()) { long lastUpdated = (System.currentTimeMillis() - lastOperationChange) / 1000; LOG.warn("No operations completed within the last %d seconds." + "There are still %d operations in progress.", lastUpdated, pendingOperationsWithSize.size()); performedWarning = true; } wait(WAIT_MILLIS); } if (performedWarning) { LOG.info("flush() completed"); } }
Source:
private void putUpWebUI() throws IOException { int port = conf.getInt(HBASE_CANARY_INFO_PORT, -1); if (port < 0) { return; } if (zookeeperMode) { LOG.info("WebUI is not supported in Zookeeper mode"); } else if (regionServerMode) { LOG.info("WebUI is not supported in RegionServer mode"); } else { String addr = conf.get("hbase.canary.info.bindAddress", "0.0.0.0"); try { InfoServer infoServer = new InfoServer("canary", addr, port, false, conf); infoServer.addUnprivilegedServlet("canary", "/canary-status", CanaryStatusServlet.class); infoServer.setAttribute("sink", this.sink); infoServer.start(); LOG.info("Bind Canary http info server to {}:{} ", addr, port); } catch (BindException e) { LOG.warn("Failed binding Canary http info server to {}:{}", addr, port, e); } } }

Target:
private void putUpWebUI() throws IOException { int port = conf.getInt(HBASE_CANARY_INFO_PORT, -1); if (port < 0) { return; } if (zookeeperMode) { LOG.info("WebUI is not supported in Zookeeper mode"); } else if (regionServerMode) { LOG.info("WebUI is not supported in RegionServer mode"); } else { String addr = conf.get(HBASE_CANARY_INFO_BINDADDRESS, "0.0.0.0"); try { InfoServer infoServer = new InfoServer("canary", addr, port, false, conf); infoServer.addUnprivilegedServlet("canary", "/canary-status", CanaryStatusServlet.class); infoServer.setAttribute("sink", this.sink); infoServer.start(); LOG.info("Bind Canary http info server to {}:{} ", addr, port); } catch (BindException e) { LOG.warn("Failed binding Canary http info server to {}:{}", addr, port, e); } } }
Source:
public void prepareToCloseChannels() { for ( Channel channel : allChannels ) { BoltProtocol protocol = BoltProtocol.forChannel( channel ); try { protocol.prepareToCloseChannel( channel ); } catch ( Throwable e ) { log.debug( "Failed to destruct Channel %s due to error %s. " + "It is safe to ignore this error as the channel will be closed despite if it is successfully destructed.", channel, e.getMessage() ); } } }

Target:
public void prepareToCloseChannels() { for ( Channel channel : allChannels ) { BoltProtocol protocol = BoltProtocol.forChannel( channel ); try { protocol.prepareToCloseChannel( channel ); } catch ( Throwable e ) { log.debug( "Failed to prepare to close Channel %s due to error %s. " + "It is safe to ignore this error as the channel will be closed despite if it is successfully prepared to close or not.", channel, e.getMessage() ); } } }
Source:
private static ValidationResult checkForStructuresWithoutMedia(Workpiece workpiece, Map<String, String> translations) { boolean error = false; boolean warning = false; Collection<String> messages = new HashSet<>(); Collection<String> structuresWithoutMedia = treeStream(workpiece.getRootElement(), IncludedStructuralElement::getChildren) .filter(structure -> structure.getViews().isEmpty()) .map(structure -> translations.get(MESSAGE_STRUCTURE_WITHOUT_MEDIA) + ' ' + structure) .collect(Collectors.toSet()); if (!structuresWithoutMedia.isEmpty()) { messages.addAll(structuresWithoutMedia); warning = true; } if (!treeStream(workpiece.getRootElement(), IncludedStructuralElement::getChildren) .flatMap(structure -> structure.getViews().stream()).map(View::getMediaUnit) .anyMatch(workpiece.getMediaUnits()::contains)) { messages.add(translations.get(MESSAGE_MEDIA_MISSING)); error = true; } return new ValidationResult(error ? State.ERROR : warning ? State.WARNING : State.SUCCESS, messages); }

Target:
private static ValidationResult checkForStructuresWithoutMedia(Workpiece workpiece, Map<String, String> translations) { boolean error = false; boolean warning = false; Collection<String> messages = new HashSet<>(); Collection<String> structuresWithoutMedia = treeStream(workpiece.getRootElement(), IncludedStructuralElement::getChildren) .filter(structure -> structure.getViews().isEmpty()) .map(structure -> translations.get(MESSAGE_STRUCTURE_WITHOUT_MEDIA) + ' ' + structure) .collect(Collectors.toSet()); if (!structuresWithoutMedia.isEmpty()) { messages.addAll(structuresWithoutMedia); warning = true; } if (!treeStream(workpiece.getRootElement(), IncludedStructuralElement::getChildren) .flatMap(structure -> structure.getViews().stream()).map(View::getMediaUnit) .allMatch(workpiece.getMediaUnits()::contains)) { messages.add(translations.get(MESSAGE_MEDIA_MISSING)); error = true; } return new ValidationResult(error ? State.ERROR : warning ? State.WARNING : State.SUCCESS, messages); }
Source:
private <ResponseType> ResponseType handleResponseFuture( final ListenableFuture<ResponseType> responseListenableFuture ) { final ResponseType response; try { response = responseListenableFuture.get(); } catch (final ExecutionException | InterruptedException e) { throw new GenieRuntimeException("Failed to perform request"); } return response; }

Target:
private <ResponseType> ResponseType handleResponseFuture( final ListenableFuture<ResponseType> responseListenableFuture ) { final ResponseType response; try { response = responseListenableFuture.get(); } catch (final ExecutionException | InterruptedException e) { throw new GenieRuntimeException("Failed to perform request", e); } return response; }
Source:
protected Statement withAfters(FrameworkMethod method, Object target, Statement statement) { List<FrameworkMethod> afters = getTestClass().getAnnotatedMethods(After.class); Statement nextStatement = statement; List<TestRule> testRules = getTestRules(target); ExpectedException expectedException = null; if (!testRules.isEmpty()) { for (TestRule rule : testRules) { if (rule instanceof BounceMemberRule) { nextStatement = ((BounceMemberRule) rule).stopBouncing(statement); } if (rule instanceof ExpectedException) { expectsException = true; } } } if (THREAD_DUMP_ON_FAILURE) { return new ThreadDumpAwareRunAfters(method, nextStatement, afters, target, expectedException); } if (afters.isEmpty()) { return nextStatement; } else { return new RunAfters(nextStatement, afters, target); } }

Target:
protected Statement withAfters(FrameworkMethod method, Object target, Statement statement) { List<FrameworkMethod> afters = getTestClass().getAnnotatedMethods(After.class); Statement nextStatement = statement; List<TestRule> testRules = getTestRules(target); ExpectedException expectedException = null; if (!testRules.isEmpty()) { for (TestRule rule : testRules) { if (rule instanceof BounceMemberRule) { nextStatement = ((BounceMemberRule) rule).stopBouncing(statement); } if (rule instanceof ExpectedException) { expectedException = (ExpectedException) rule; } } } if (THREAD_DUMP_ON_FAILURE) { return new ThreadDumpAwareRunAfters(method, nextStatement, afters, target, expectedException); } if (afters.isEmpty()) { return nextStatement; } else { return new RunAfters(nextStatement, afters, target); } }
Source:
public void onStart() { super.onStart(); mHandler.sendEmptyMessage(-1); mHandler.sendMessageDelayed(mHandler.obtainMessage(0), 1000); }

Target:
public void onStart() { super.onStart(); mHandler.sendEmptyMessage(DISABLE_BUTTONS); mHandler.sendMessageDelayed(mHandler.obtainMessage(ENABLE_BUTTONS), 1000); }
Source:
public void processPresign( Response response, AuthnRequest authnRequest, List<String> spMetadata, Set<Binding> supportedBindings) { Subject authnRequestSubject = authnRequest.getSubject(); if (authnRequestSubject == null) { return; } NameID authnRequestNameId = authnRequestSubject.getNameID(); if (authnRequestNameId == null) { return; } String authnRequestId = authnRequestNameId.getValue(); if (StringUtils.isBlank(authnRequestNameId.getValue())) { return; } if (!authnRequestSubject.getSubjectConfirmations().isEmpty()) { throw new SAMLRuntimeException( "The AuthnRequest contained a Subject with both a NameID and " + "1 or more SubjectConfirmations"); } if (getIdsFromResponseAsStream(response).noneMatch(authnRequestId::equals)) { throw new SAMLRuntimeException( String.format( "The AuthnRequest's Subject (with the NameID of %s) could not be matched against any " + "identifiers in the resulting Response (with the primary NameID of %s).", authnRequestId, getIdsFromResponseAsStream(response).findFirst().orElse(null))); } }

Target:
public void processPresign( Response response, AuthnRequest authnRequest, List<String> spMetadata, Set<Binding> supportedBindings) { Subject authnRequestSubject = authnRequest.getSubject(); if (authnRequestSubject == null) { return; } if (!authnRequestSubject.getSubjectConfirmations().isEmpty()) { throw new SAMLRuntimeException( "The AuthnRequest contained a Subject with 1 or more SubjectConfirmations."); } NameID authnRequestNameId = authnRequestSubject.getNameID(); if (authnRequestNameId == null) { return; } String authnRequestId = authnRequestNameId.getValue(); if (StringUtils.isBlank(authnRequestId)) { return; } if (idsFromResponseAsStream(response).noneMatch(authnRequestId::equals)) { throw new SAMLRuntimeException( String.format( "The AuthnRequest's Subject (with the NameID of %s) could not be matched against any " + "identifiers in the resulting Response (with the primary NameID of %s).", authnRequestId, nameIdsFromResponseAsStream(response).findFirst().orElse(null))); } }
Source:
public void testWithGroovyTemplate() throws Exception { args.put(ScriptContent.SCRIPT_TEMPLATE_ARG, "groovy-sample.template"); args.put(ScriptContent.SCRIPT_INIT_ARG, false); AbstractBuild build = mock(AbstractBuild.class); when(build.getResult()).thenReturn(Result.SUCCESS); when(build.getUrl()).thenReturn("email-test/34"); ExtendedEmailPublisher emailPublisher = new ExtendedEmailPublisher(); when(emailPublisher.DESCRIPTOR.getHudsonUrl()).thenReturn("http://localhost/"); mockChangeSet(build); String content = scriptContent.getContent(build, emailPublisher, null, args); String expected = "build result is SUCCESS" + "build url is http://localhost/email-test/34" + "Revision: (Kohsuke Kawaguchi) COMMIT MESSAGE" + "edit,path1" + "add,path2"; assertEquals(expected, content.replace("\r\n", "").replace("\n","")); }

Target:
public void testWithGroovyTemplate() throws Exception { args.put(ScriptContent.SCRIPT_TEMPLATE_ARG, "groovy-sample.template"); args.put(ScriptContent.SCRIPT_INIT_ARG, false); AbstractBuild build = mock(AbstractBuild.class); when(build.getResult()).thenReturn(Result.SUCCESS); when(build.getUrl()).thenReturn("email-test/34"); ExtendedEmailPublisher emailPublisher = new ExtendedEmailPublisher(); when(emailPublisher.DESCRIPTOR.getHudsonUrl()).thenReturn("http://localhost/"); mockChangeSet(build); String content = scriptContent.getContent(build, emailPublisher, null, args); String expectedFile = "hudson/plugins/emailext/templates/" + "groovy-sample.result"; InputStream in = getClass().getClassLoader().getResourceAsStream(expectedFile); String expected = new Scanner(in).useDelimiter("\\Z").next(); assertEquals(expected.trim(), content.trim()); }
Source:
protected String generateReplyAddress() { return EventbusAddresses.generateInternal("reply"); }

Target:
protected String generateReplyAddress() { return "__vertx.reply." + Long.toString(replySequence.incrementAndGet()); }
Source:
protected void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model) throws OperationFailedException { final PathAddress address = PathAddress.pathAddress(operation.get(OP_ADDR)); final String outboundSocketName = address.getLastElement().getValue(); context.addStep(new OperationStepHandler() { @Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { final String currentSocketBindingGroupName = address.getParent().getLastElement().getValue(); final Set<ResourceEntry> children = context.readResourceFromRoot(PathAddress.EMPTY_ADDRESS) .getChildren(ModelDescriptionConstants.SOCKET_BINDING_GROUP); for (Resource.ResourceEntry re : children) { if (re.getName().equalsIgnoreCase(currentSocketBindingGroupName)) { for (Resource.ResourceEntry entry : re.getChildren(ModelDescriptionConstants.SOCKET_BINDING)) { String name = entry.getName(); if (name.equalsIgnoreCase(outboundSocketName)) throw ControllerLogger.ROOT_LOGGER.socketBindingalreadyDeclared( Element.SOCKET_BINDING.getLocalName(), Element.OUTBOUND_SOCKET_BINDING.getLocalName(), name, Element.SOCKET_BINDING_GROUP.getLocalName(), currentSocketBindingGroupName); } break; } } } }, Stage.RUNTIME); try { installOutboundSocketBindingService(context, model, outboundSocketName); } catch (UnknownHostException e) { throw new OperationFailedException(e.toString()); } }

Target:
protected void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model) throws OperationFailedException { final PathAddress address = PathAddress.pathAddress(operation.get(OP_ADDR)); final String outboundSocketName = address.getLastElement().getValue(); try { installOutboundSocketBindingService(context, model, outboundSocketName); } catch (UnknownHostException e) { throw new OperationFailedException(e.toString()); } }
Source:
public void testRunTimedCmd_WithOutputRedirect() throws IOException { File outputRedirect = FileUtil.createTempFile("output_redirect", ".txt"); try { CommandResult result = RunUtil.getDefault() .runTimedCmd( SHORT_TIMEOUT_MS, new FileOutputStream(outputRedirect), null, "echo", "TEST_OUTPUT"); assertTrue(CommandStatus.SUCCESS.equals(result.getStatus())); assertEquals("TEST_OUTPUT\n", FileUtil.readStringFromFile(outputRedirect)); } finally { FileUtil.deleteFile(outputRedirect); } }

Target:
public void testRunTimedCmd_WithOutputRedirect() throws IOException { File outputRedirect = FileUtil.createTempFile("output_redirect", ".txt"); FileOutputStream outputStream = new FileOutputStream(outputRedirect); try { CommandResult result = RunUtil.getDefault() .runTimedCmd( SHORT_TIMEOUT_MS, outputStream, null, "echo", "TEST_OUTPUT"); assertTrue(CommandStatus.SUCCESS.equals(result.getStatus())); assertEquals("TEST_OUTPUT\n", FileUtil.readStringFromFile(outputRedirect)); } finally { FileUtil.deleteFile(outputRedirect); outputStream.close(); } }