auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void executeCommand() { getVdsGroup().setArchitecture(getArchitecture()); checkMaxMemoryOverCommitValue(); getVdsGroup().setDetectEmulatedMachine(true); DbFacade.getInstance().getVdsGroupDao().save(getVdsGroup()); if (!getVdsGroup().getFencingPolicy().isFencingEnabled()) { AuditLogableBase alb = new AuditLogableBase(); alb.setVdsGroupId(getVdsGroup().getId()); AuditLogDirector.log(alb, AuditLogType.FENCING_DISABLED_IN_CLUSTER_POLICY); } if (getParameters().getVdsGroup().getStoragePoolId() != null) { final String networkName = NetworkUtils.getEngineNetwork(); List<Network> networks = DbFacade .getInstance() .getNetworkDao() .getAllForDataCenter( getParameters().getVdsGroup().getStoragePoolId()); Network net = LinqUtils.firstOrNull(networks, new Predicate<Network>() { @Override public boolean eval(Network network) { return network.getName().equals(networkName); } }); if (net != null) { DbFacade.getInstance().getNetworkClusterDao().save( new NetworkCluster(getParameters().getVdsGroup().getId(), net.getId(), NetworkStatus.OPERATIONAL, true, true, true)); } } setActionReturnValue(getVdsGroup().getId()); setSucceeded(true); }

Target:
protected void executeCommand() { getVdsGroup().setArchitecture(getArchitecture()); checkMaxMemoryOverCommitValue(); getVdsGroup().setDetectEmulatedMachine(true); DbFacade.getInstance().getVdsGroupDao().save(getVdsGroup()); alertIfFencingDisabled(); if (getParameters().getVdsGroup().getStoragePoolId() != null) { final String networkName = NetworkUtils.getEngineNetwork(); List<Network> networks = DbFacade .getInstance() .getNetworkDao() .getAllForDataCenter( getParameters().getVdsGroup().getStoragePoolId()); Network net = LinqUtils.firstOrNull(networks, new Predicate<Network>() { @Override public boolean eval(Network network) { return network.getName().equals(networkName); } }); if (net != null) { DbFacade.getInstance().getNetworkClusterDao().save( new NetworkCluster(getParameters().getVdsGroup().getId(), net.getId(), NetworkStatus.OPERATIONAL, true, true, true)); } } setActionReturnValue(getVdsGroup().getId()); setSucceeded(true); }
Source:
public void close() throws IOException { fFileInputStream.close(); }

Target:
public void close() throws IOException { fFileChannel.close(); fFileInputStream.close(); }
Source:
public CloseableIterator<Journal.JournalEntry> getJournalEntryIterator() { Journal.JournalEntry entry = Journal.JournalEntry.newBuilder().setUpdateDatabaseInfo( toJournalProto(getDatabaseInfo(), mName)).build(); return CloseableIterator.noopCloseable( Iterators.concat(Iterators.singletonIterator(entry), getTableIterator(), getTablePartitionsIterator())); }

Target:
public CloseableIterator<Journal.JournalEntry> getJournalEntryIterator() { Journal.JournalEntry entry = Journal.JournalEntry.newBuilder().setUpdateDatabaseInfo( toJournalProto(getDatabaseInfo(), mName)).build(); return CloseableIterator.noopCloseable( Iterators.concat(Iterators.singletonIterator(entry), getTableIterator())); }
Source:
public String getUuidProperty() { return null; }

Target:
public String getUuidProperty() { return IDENTIFIER_SOURCE_UUID; }
Source:
public void setReviewInput(ReviewInput reviewInput) { fReviewInput.setLabels(reviewInput.getLabels()); fReviewInput.setMessage(reviewInput.getMessage()); }

Target:
public void setReviewInput(ReviewInput reviewInput) { fReviewInput = reviewInput; }
Source:
private PhysicalOperation createSpatialLookupJoin(JoinNode node, PlanNode probeNode, Symbol probeSymbol, PlanNode buildNode, Symbol buildSymbol, BiPredicate<OGCGeometry, OGCGeometry> spatialRelationshipTest, Optional<Expression> joinFilter, LocalExecutionPlanContext context) { PhysicalOperation probeSource = probeNode.accept(this, context); PagesSpatialIndexFactory pagesSpatialIndexFactory = createPagesSpatialIndexFactory(node, buildNode, buildSymbol, probeSource.getLayout(), joinFilter, context); OperatorFactory operator = createSpatialLookupJoin(node, probeNode, probeSource, probeSymbol, pagesSpatialIndexFactory, spatialRelationshipTest, context); ImmutableMap.Builder<Symbol, Integer> outputMappings = ImmutableMap.builder(); List<Symbol> outputSymbols = node.getOutputSymbols(); for (int i = 0; i < outputSymbols.size(); i++) { Symbol symbol = outputSymbols.get(i); outputMappings.put(symbol, i); } return new PhysicalOperation(operator, outputMappings.build(), probeSource); }

Target:
private PhysicalOperation createSpatialLookupJoin( JoinNode node, PlanNode probeNode, Symbol probeSymbol, PlanNode buildNode, Symbol buildSymbol, BiPredicate<OGCGeometry, OGCGeometry> spatialRelationshipTest, Optional<Expression> joinFilter, LocalExecutionPlanContext context) { PhysicalOperation probeSource = probeNode.accept(this, context); PagesSpatialIndexFactory pagesSpatialIndexFactory = createPagesSpatialIndexFactory(node, buildNode, buildSymbol, probeSource.getLayout(), spatialRelationshipTest, joinFilter, context); OperatorFactory operator = createSpatialLookupJoin(node, probeNode, probeSource, probeSymbol, pagesSpatialIndexFactory, context); ImmutableMap.Builder<Symbol, Integer> outputMappings = ImmutableMap.builder(); List<Symbol> outputSymbols = node.getOutputSymbols(); for (int i = 0; i < outputSymbols.size(); i++) { Symbol symbol = outputSymbols.get(i); outputMappings.put(symbol, i); } return new PhysicalOperation(operator, outputMappings.build(), probeSource); }
Source:
public final void write() throws IOException { if ( !writeChecksumFile ) { return; } Timer.Context writeTimer = metricRegistry == null ? null : metricRegistry.timer( CHECKSUM_WRITE ).time(); try { logger.info( "Writing file: {}", checksumExtension, checksumTransfer ); Timer.Context openTimer = metricRegistry == null ? null : metricRegistry.timer( CHECKSUM_WRITE ).time(); try (PrintStream out = new PrintStream( checksumTransfer.openOutputStream( TransferOperation.GENERATE ) )) { openTimer.stop(); out.print( getDigestHex() ); } } finally { if ( writeTimer != null ) { writeTimer.stop(); } } }

Target:
public final void write() throws IOException { if ( !writeChecksumFile ) { return; } Timer.Context writeTimer = timerProvider.apply( CHECKSUM_WRITE ); try { logger.info( "Writing file: {}", checksumExtension, checksumTransfer ); Timer.Context openTimer = timerProvider.apply( CHECKSUM_WRITE_OPEN ); try (PrintStream out = new PrintStream( checksumTransfer.openOutputStream( TransferOperation.GENERATE ) )) { if ( openTimer != null ) { openTimer.stop(); } out.print( getDigestHex() ); } } finally { if ( writeTimer != null ) { writeTimer.stop(); } } }
Source:
public void createSampleBoard(boolean isDialogShown) { logger.info("Creating " + SAMPLE_BOARD); panelControl.closeAllPanels(); List<PanelInfo> panelData = new ArrayList<>(); for (int i = 0; i < SAMPLE_PANEL_NAMES.size(); i++) { panelData.add(new PanelInfo(SAMPLE_PANEL_NAMES.get(i), SAMPLE_PANEL_FILTERS.get(i))); } createBoard(panelData, SAMPLE_BOARD); panelControl.selectPanel(0); triggerBoardSaveEventSequence(SAMPLE_BOARD); if (isDialogShown){ DialogMessage.showInformationDialog("Auto-create Board - " + SAMPLE_BOARD, SAMPLE_BOARD_DIALOG); } }

Target:
public void createSampleBoard(boolean isDialogShown) { logger.info("Creating " + SAMPLE_BOARD); panelControl.closeAllPanels(); List<PanelInfo> panelData = new ArrayList<>(); for (Map.Entry<String, String> entry : getSamplePanelDetails().entrySet()) { panelData.add(new PanelInfo(entry.getKey(), entry.getValue())); } createBoard(panelData, SAMPLE_BOARD); panelControl.selectPanel(0); triggerBoardSaveEventSequence(SAMPLE_BOARD); if (isDialogShown){ DialogMessage.showInformationDialog("Auto-create Board - " + SAMPLE_BOARD, SAMPLE_BOARD_DIALOG); } }
Source:
public static byte[] encode(EhcacheEntityResponse response) { switch (response.getType()) { case FAILURE: Failure failure = (Failure)response; byte[] failureMsg = LifeCycleOpCodec.marshall(failure.getCause()); ByteBuffer buffer = ByteBuffer.allocate(OP_CODE_OFFSET + failureMsg.length); buffer.put(EhcacheEntityResponse.Type.FAILURE.getOpCode()); buffer.put(failureMsg); return buffer.array(); case SUCCESS: buffer = ByteBuffer.allocate(OP_CODE_OFFSET); buffer.put(EhcacheEntityResponse.Type.SUCCESS.getOpCode()); return buffer.array(); case GET_RESPONSE: GetResponse getResponse = (GetResponse)response; byte[] encodedChain = ChainCodec.encode(getResponse.getChain()); int chainLen = encodedChain.length; buffer = ByteBuffer.allocate(OP_CODE_OFFSET + chainLen); buffer.put(EhcacheEntityResponse.Type.GET_RESPONSE.getOpCode()); buffer.put(encodedChain); return buffer.array(); default: throw new UnsupportedOperationException("The operation is not supported"); } }

Target:
public static byte[] encode(EhcacheEntityResponse response) { switch (response.getType()) { case FAILURE: Failure failure = (Failure)response; byte[] failureMsg = LifeCycleOpCodec.marshall(failure.getCause()); ByteBuffer buffer = ByteBuffer.allocate(OP_CODE_OFFSET + failureMsg.length); buffer.put(EhcacheEntityResponse.Type.FAILURE.getOpCode()); buffer.put(failureMsg); return buffer.array(); case SUCCESS: buffer = ByteBuffer.allocate(OP_CODE_OFFSET); buffer.put(EhcacheEntityResponse.Type.SUCCESS.getOpCode()); return buffer.array(); case GET_RESPONSE: GetResponse getResponse = (GetResponse)response; byte[] encodedChain = ChainCodec.encode(getResponse.getChain()); int chainLen = encodedChain.length; buffer = ByteBuffer.allocate(OP_CODE_OFFSET + chainLen); buffer.put(EhcacheEntityResponse.Type.GET_RESPONSE.getOpCode()); buffer.put(encodedChain); return buffer.array(); default: throw new UnsupportedOperationException("The operation is not supported : " + response.getType()); } }
Source:
private void checkIfHostComponentsInDeleteFriendlyState(ServiceComponentHostRequest request, Cluster cluster) throws AmbariException { Service service = cluster.getService(request.getServiceName()); ServiceComponent component = service.getServiceComponent(request.getComponentName()); ServiceComponentHost componentHost = component.getServiceComponentHost(request.getHostname()); if (!componentHost.canBeRemoved()) { throw new AmbariException("Host Component cannot be removede. Component in undeletable state." + ", clusterName=" + request.getClusterName() + ", serviceName=" + request.getServiceName() + ", componentName=" + request.getComponentName() + ", hostname=" + request.getHostname() + ", request=" + request + ", currentState=" + componentHost.getState()); } }

Target:
private void checkIfHostComponentsInDeleteFriendlyState(ServiceComponentHostRequest request, Cluster cluster) throws AmbariException { Service service = cluster.getService(request.getServiceName()); ServiceComponent component = service.getServiceComponent(request.getComponentName()); ServiceComponentHost componentHost = component.getServiceComponentHost(request.getHostname()); if (!componentHost.canBeRemoved()) { throw new AmbariException("Current host component state prohibiting component removal." + ", clusterName=" + request.getClusterName() + ", serviceName=" + request.getServiceName() + ", componentName=" + request.getComponentName() + ", hostname=" + request.getHostname() + ", request=" + request + ", state=" + componentHost.getState()); } }
Source:
private void validateServiceComponent() { IHeader header = getHeader(ICoreConstants.SERVICE_COMPONENT); if (header == null) return; if (getHeader(Constants.BUNDLE_ACTIVATIONPOLICY) != null) return; report(PDECoreMessages.BundleErrorReporter_serviceComponentLazyStart, header.getLineNumber() + 1, CompilerFlags.WARNING, PDEMarkerFactory.M_SERVICECOMPONENT_MISSING_LAZY, PDEMarkerFactory.CAT_OTHER); }

Target:
private void validateServiceComponent() { IHeader header = getHeader(ICoreConstants.SERVICE_COMPONENT); if (header == null) { return; } if (getHeader(Constants.BUNDLE_ACTIVATIONPOLICY) != null) { return; } report(PDECoreMessages.BundleErrorReporter_serviceComponentLazyStart, header.getLineNumber() + 1, CompilerFlags.WARNING, PDEMarkerFactory.M_SERVICECOMPONENT_MISSING_LAZY, PDEMarkerFactory.CAT_OTHER); }
Source:
public void write(I aggregateId, Snapshot snapshot) { checkNotClosed(); checkNotNull(aggregateId); checkNotNull(snapshot); final AggregateStorageRecord record = AggregateStorageRecord.newBuilder() .setTimestamp(checkIsPositive(snapshot.getTimestamp(), "Snapshot timestamp")) .setEventType(SNAPSHOT_TYPE_NAME) .setEventId("") .setVersion(snapshot.getVersion()) .setSnapshot(snapshot) .build(); writeRecord(aggregateId, record); }

Target:
public void write(I aggregateId, Snapshot snapshot) { checkNotClosed(); checkNotNull(aggregateId); checkNotNull(snapshot); final Timestamp timestamp = checkPositive(snapshot.getTimestamp(), "Snapshot timestamp"); final AggregateStorageRecord record = AggregateStorageRecord.newBuilder() .setTimestamp(timestamp) .setEventType(SNAPSHOT_TYPE_NAME) .setEventId("") .setVersion(snapshot.getVersion()) .setSnapshot(snapshot) .build(); writeRecord(aggregateId, record); }
Source:
private Key generateKey() { try { KeyGenerator kgen = KeyGenerator.getInstance(CIPHER_ALGORITHM); kgen.init(128, new SecureRandom(toBytes(KEY))); SecretKey secretKey = kgen.generateKey(); byte[] enCodeFormat = secretKey.getEncoded(); return new SecretKeySpec(enCodeFormat, CIPHER_ALGORITHM); } catch (Exception e) { e.printStackTrace(); } return null; }

Target:
private Key generateKey() { try { KeyGenerator kgen = KeyGenerator.getInstance(CIPHER_ALGORITHM); kgen.init(128, new SecureRandom(toBytes(KEY))); SecretKey secretKey = kgen.generateKey(); byte[] enCodeFormat = secretKey.getEncoded(); return new SecretKeySpec(enCodeFormat, CIPHER_ALGORITHM); } catch (Exception e) { LOG.warn("Cannot generate key for decryption", e); } return null; }
Source:
public static void main(String[] args) { var serverStartTime = System.nanoTime(); var delayedService = new DelayedRemoteService(serverStartTime, 5); var delayedServiceCircuitBreaker = new DefaultCircuitBreaker(delayedService, 3000, 2, 2000 * 1000 * 1000); var quickService = new QuickRemoteService(); var quickServiceCircuitBreaker = new DefaultCircuitBreaker(quickService, 3000, 2, 2000 * 1000 * 1000); var monitoringService = new MonitoringService(delayedServiceCircuitBreaker, quickServiceCircuitBreaker); LOGGER.info(monitoringService.localResourceResponse()); LOGGER.info(monitoringService.delayedServiceResponse()); LOGGER.info(monitoringService.delayedServiceResponse()); LOGGER.info(delayedServiceCircuitBreaker.getState()); LOGGER.info(monitoringService.quickServiceResponse()); LOGGER.info(quickServiceCircuitBreaker.getState()); try { Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } LOGGER.info(delayedServiceCircuitBreaker.getState()); LOGGER.info(monitoringService.delayedServiceResponse()); LOGGER.info(delayedServiceCircuitBreaker.getState()); }

Target:
public static void main(String[] args) { var serverStartTime = System.nanoTime(); var delayedService = new DelayedRemoteService(serverStartTime, 5); var delayedServiceCircuitBreaker = new DefaultCircuitBreaker(delayedService, 3000, 2, 2000 * 1000 * 1000); var quickService = new QuickRemoteService(); var quickServiceCircuitBreaker = new DefaultCircuitBreaker(quickService, 3000, 2, 2000 * 1000 * 1000); var monitoringService = new MonitoringService(delayedServiceCircuitBreaker, quickServiceCircuitBreaker); LOGGER.info(monitoringService.localResourceResponse()); LOGGER.info(monitoringService.delayedServiceResponse()); LOGGER.info(monitoringService.delayedServiceResponse()); LOGGER.info(delayedServiceCircuitBreaker.getState()); LOGGER.info(monitoringService.quickServiceResponse()); LOGGER.info(quickServiceCircuitBreaker.getState()); try { LOGGER.info("Waiting for delayed service to become responsive"); Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } LOGGER.info(delayedServiceCircuitBreaker.getState()); LOGGER.info(monitoringService.delayedServiceResponse()); LOGGER.info(delayedServiceCircuitBreaker.getState()); }
Source:
private boolean instantiateTree() throws IOException { index = new GBPTree<>( pageCache, storeFile, new LabelScanLayout(), pageSize, treeMonitor(), getDirty ); return getDirty.isDirty(); }

Target:
private boolean instantiateTree() throws IOException { monitors.addMonitorListener( treeMonitor() ); GBPTree.Monitor monitor = monitors.newMonitor( GBPTree.Monitor.class ); MutableBoolean isDirty = new MutableBoolean(); Header.Reader getDirty = (pageCursor, length) -> isDirty.setValue( pageCursor.getByte() == DIRTY ); index = new GBPTree<>( pageCache, storeFile, new LabelScanLayout(), pageSize, monitor, getDirty ); return isDirty.getValue(); }
Source:
public SearchResult doSearch(final SearchParameters parameters) throws InvalidQueryException { final MapSqlParameterSource parameterSource = new MapSqlParameterSource(); final var whereClauses = new ArrayList<String>(); for (Condition condition : parameters.getConditions()) { if (condition.getField().equals(Condition.Field.fedora_id) && condition.getOperator().equals(Condition.Operator.EQ)) { var object = condition.getObject(); if (!object.equals("*")) { if (object.contains("*")) { object = object.replace("*", "%"); whereClauses.add(FEDORA_ID_DB_COLUMN + " like '" + object + "'"); } else { whereClauses.add(FEDORA_ID_DB_COLUMN + " = '" + object + "'"); } } } else { throw new InvalidQueryException("Condition not supported: " + condition.getField() + condition.getOperator().getStringValue() + condition.getObject()); } } final var sql = new StringBuffer("select " + FEDORA_ID_DB_COLUMN + " from resources"); if (!whereClauses.isEmpty()) { sql.append(" where "); for (int x = 0; x < whereClauses.size(); x++) { if (x > 0) { sql.append(" and "); } sql.append(whereClauses.get(x)); } } sql.append(" order by " + FEDORA_ID_DB_COLUMN); sql.append(" limit :limit offset :offset"); parameterSource.addValue("limit", parameters.getMaxResults()); parameterSource.addValue("offset", parameters.getOffset()); final List<Map<String, Object>> items = jdbcTemplate.queryForList(sql.toString(), parameterSource); final var pagination = new PaginationInfo(parameters.getMaxResults(), parameters.getOffset()); return new SearchResult(items, pagination); }

Target:
public SearchResult doSearch(final SearchParameters parameters) throws InvalidQueryException { final MapSqlParameterSource parameterSource = new MapSqlParameterSource(); final var whereClauses = new ArrayList<String>(); for (Condition condition : parameters.getConditions()) { if (condition.getField().equals(Condition.Field.FEDORA_ID) && condition.getOperator().equals(Condition.Operator.EQ)) { var object = condition.getObject(); if (!object.equals("*")) { if (object.contains("*")) { object = object.replace("*", "%"); whereClauses.add(FEDORA_ID_COLUMN + " like '" + object + "'"); } else { whereClauses.add(FEDORA_ID_COLUMN + " = '" + object + "'"); } } } else { throw new InvalidQueryException("Condition not supported: \"" + condition + "\""); } } final var sql = new StringBuilder("select " + FEDORA_ID_COLUMN + " from " + RESOURCES_TABLE); if (!whereClauses.isEmpty()) { sql.append(" where "); for (var it = whereClauses.iterator(); it.hasNext(); ) { sql.append(it.next()); if (it.hasNext()) { sql.append(" and "); } } } sql.append(" order by " + FEDORA_ID_COLUMN); sql.append(" limit :limit offset :offset"); parameterSource.addValue("limit", parameters.getMaxResults()); parameterSource.addValue("offset", parameters.getOffset()); final List<Map<String, Object>> items = jdbcTemplate.queryForList(sql.toString(), parameterSource); final var pagination = new PaginationInfo(parameters.getMaxResults(), parameters.getOffset()); return new SearchResult(items, pagination); }
Source:
public ApplicationBean() { standardInboundAuthTypes = new ArrayList<String>(); standardInboundAuthTypes.add("oauth2"); standardInboundAuthTypes.add("wstrust"); standardInboundAuthTypes.add("samlsso"); standardInboundAuthTypes.add("openid"); standardInboundAuthTypes.add("passivests"); }

Target:
public ApplicationBean() { }
Source:
public boolean contains(TokenRange that) { if (this.isEmpty() || that.isEmpty()) return false; return this.contains(that.start, true) && this.contains(that.end, false); }

Target:
public boolean contains(TokenRange that) { if (this.isEmpty() || that.isEmpty() || !this.intersects(that)) return false; List<TokenRange> intersection = this.intersectWith(that); return intersection.size() == 1 && intersection.get(0).equals(that); }
Source:
public void setup() throws Exception { MockitoAnnotations.initMocks(this); nameProvider = new ParanamerNameProvider(new DefaultCacheStore<AccessibleObject, List<Parameter>>()); this.provider = getProvider(); this.errors = new ArrayList<>(); when(converters.existsFor(Long.class)).thenReturn(true); when(converters.existsFor(long.class)).thenReturn(true); when(converters.existsFor(String.class)).thenReturn(true); when(converters.to(Long.class)).thenReturn(new LongConverter()); when(converters.to(long.class)).thenReturn(new PrimitiveLongConverter()); when(converters.to(String.class)).thenReturn(new StringConverter()); buyA = method("buyA", House.class); kick = method("kick", AngryCat.class); error = method("error", WrongCat.class); array = method("array", Long[].class); list = method("list", List.class); listOfObject= method("listOfObject", List.class); abc = method("abc", ABC.class); simple = method("simple", Long.class); string = method("string", String.class); stringArray = method("stringArray", String[].class); dependency = method("dependency", Result.class); primitive = method("primitive", long.class); doNothing = method("doNothing"); generic = DefaultControllerMethod.instanceFor(Specific.class, new Mirror().on(Specific.class).reflect().method("generic").withAnyArgs()); }

Target:
public void setup() throws Exception { MockitoAnnotations.initMocks(this); nameProvider = new ParanamerNameProvider(new DefaultCacheStore<AccessibleObject, List<Parameter>>()); this.provider = getProvider(); this.errors = new ArrayList<>(); when(converters.existsFor(Long.class)).thenReturn(true); when(converters.existsFor(long.class)).thenReturn(true); when(converters.existsFor(String.class)).thenReturn(true); when(converters.to(Long.class)).thenReturn(new LongConverter()); when(converters.to(long.class)).thenReturn(new PrimitiveLongConverter()); when(converters.to(String.class)).thenReturn(new StringConverter()); buyA = method("buyA", House.class); kick = method("kick", AngryCat.class); error = method("error", WrongCat.class); array = method("array", Long[].class); list = method("list", List.class); listOfObject= method("listOfObject", List.class); abc = method("abc", ABC.class); simple = method("simple", Long.class); string = method("string", String.class); stringArray = method("stringArray", String[].class); dependency = method("dependency", Result.class); primitive = method("primitive", long.class); doNothing = method("doNothing"); generic = DefaultControllerMethod.instanceFor(Specific.class, Generic.class.getDeclaredMethod("generic", Object.class)); }
Source:
public ProcessingFamilyDefinition() { super(NAME, new AggregateDefinition(), new FieldSelectorDefinition(), new FilterRowDefinition(), new NormalizeDefinition(), new PythonRowDefinition(), new ReplicateDefinition(), new TypeConverterDefinition(), new WindowDefinition()); }

Target:
public ProcessingFamilyDefinition() { super(NAME, new AggregateDefinition(), new FieldSelectorDefinition(), new FilterRowDefinition(), new LimitDefinition(), new NormalizeDefinition(), new PythonRowDefinition(), new ReplicateDefinition(), new TypeConverterDefinition(), new WindowDefinition()); }
Source:
protected Version getStoragePoolClusterLevel(Guid StoragePoolId) { StoragePool storagePool = DbFacade.getInstance().getStoragePoolDao().get(StoragePoolId); if (storagePool != null) { return storagePool.getcompatibility_version(); } else { log.errorFormat( "IrsBroker::getStoragePoolClusterLevel:: Could not find master domain for pool {0} !!!", getParameters().getStoragePoolId()); return null; } }

Target:
protected Version getStoragePoolClusterLevel(Guid StoragePoolId) { StoragePool storagePool = getStoragePoolDao().get(StoragePoolId); if (storagePool != null) { return storagePool.getcompatibility_version(); } else { log.errorFormat( "IrsBroker::getStoragePoolClusterLevel:: Could not find master domain for pool {0} !!!", getParameters().getStoragePoolId()); return null; } }
Source:
public HttpMethod getMethod() { HttpMethod method = HttpMethod.resolve(this.jettyRequest.getMethod()); Assert.notNull(method, "Method must not be null"); return method; }

Target:
public HttpMethod getMethod() { HttpMethod method = HttpMethod.resolve(this.jettyRequest.getMethod()); Assert.state(method != null, "Method must not be null"); return method; }
Source:
private Trigger postNewTriggerWithForm( @NonNull TriggeredCommandForm form, @NonNull Predicate predicate, @Nullable TriggerOptions options) throws ThingIFException { if (this.target == null) { throw new IllegalStateException("Can not perform this action before onboarding"); } if (form == null) { throw new IllegalArgumentException("form is null."); } if (predicate == null) { throw new IllegalArgumentException("predicate is null."); } JSONObject requestBody = options != null ? JsonUtils.newJson(this.gson.toJson(options)) : new JSONObject(); try { requestBody.put("triggersWhat", TriggersWhat.COMMAND.name()); requestBody.put("predicate", JsonUtils.newJson( this.gson.toJson(predicate, Predicate.class))); JSONObject command = JsonUtils.newJson( this.gson.toJson(form)); command.put("issuer", this.owner.getTypedID()); if (form.getTargetID() == null) { command.put("target", this.target.getTypedID().toString()); } requestBody.put("command", command); } catch (JSONException e) { throw new RuntimeException(e); } return postNewTrigger(requestBody); }

Target:
private Trigger postNewTriggerWithForm( @NonNull TriggeredCommandForm form, @NonNull Predicate predicate, @Nullable TriggerOptions options) throws ThingIFException { if (this.target == null) { throw new IllegalStateException("Can not perform this action before onboarding"); } if (form == null) { throw new IllegalArgumentException("form is null."); } if (predicate == null) { throw new IllegalArgumentException("predicate is null."); } JSONObject requestBody = options != null ? JsonUtils.newJson(this.gson.toJson(options)) : new JSONObject(); try { requestBody.put("triggersWhat", TriggersWhat.COMMAND.name()); requestBody.put("predicate", JsonUtils.newJson( this.gson.toJson(predicate, Predicate.class))); JSONObject command = JsonUtils.newJson( this.gson.toJson(form)); command.put("issuer", this.owner.getTypedID()); if (!command.has("target")) { command.put("target", this.target.getTypedID().toString()); } requestBody.put("command", command); } catch (JSONException e) { throw new RuntimeException(e); } return postNewTrigger(requestBody); }
Source:
private Ordering<Row> dimensionOrdering(final String dimension, final StringComparator comparator) { return Ordering.from(comparator) .nullsFirst() .onResultOf( new Function<Row, String>() { @Override public String apply(Row input) { final List<String> dimList = input.getDimension(dimension); return dimList.isEmpty() ? null : dimList.get(0); } } ); }

Target:
private Ordering<Row> dimensionOrdering(final String dimension, final StringComparator comparator) { return Ordering.from(Comparator.comparing((Row row) -> row.getDimension(dimension).isEmpty() ? null : row.getDimension(dimension).get(0), Comparator.nullsFirst(comparator))); }
Source:
public void scaleDownAndUp() throws Exception { int defaultNumInstancesperContainer = 4; topologyConfig.setComponentRam(BOLT_NAME, instanceDefaultResources.getRam()); topologyConfig.setComponentRam(SPOUT_NAME, instanceDefaultResources.getRam()); PackingPlan packingPlan = getFirstFitDecreasingPackingPlan(topology); Assert.assertEquals(packingPlan.getContainers().size(), 2); Assert.assertEquals(totalInstances, packingPlan.getInstanceCount()); int spoutScalingDown = -4; int boltScalingUp = 6; Map<String, Integer> componentChanges = new HashMap<>(); componentChanges.put(SPOUT_NAME, spoutScalingDown); componentChanges.put(BOLT_NAME, boltScalingUp); PackingPlan newPackingPlan = getFirstFitDecreasingPackingPlanRepack(topology, packingPlan, componentChanges); Assert.assertEquals(3, newPackingPlan.getContainers().size()); Assert.assertEquals((Integer) (totalInstances + spoutScalingDown + boltScalingUp), newPackingPlan.getInstanceCount()); AssertPacking.assertNumInstances(newPackingPlan.getContainers(), BOLT_NAME, 9); AssertPacking.assertNumInstances(newPackingPlan.getContainers(), SPOUT_NAME, 0); AssertPacking.assertContainerRam(newPackingPlan.getContainers(), defaultNumInstancesperContainer * instanceDefaultResources.getRam()); }

Target:
public void scaleDownAndUp() throws Exception { int defaultNumInstancesperContainer = 4; int spoutScalingDown = -4; int boltScalingUp = 6; Map<String, Integer> componentChanges = new HashMap<>(); componentChanges.put(SPOUT_NAME, spoutScalingDown); componentChanges.put(BOLT_NAME, boltScalingUp); int numContainersBeforeRepack = 2; PackingPlan newPackingPlan = doDefaultScalingTest(componentChanges, numContainersBeforeRepack); Assert.assertEquals(3, newPackingPlan.getContainers().size()); Assert.assertEquals((Integer) (totalInstances + spoutScalingDown + boltScalingUp), newPackingPlan.getInstanceCount()); AssertPacking.assertNumInstances(newPackingPlan.getContainers(), BOLT_NAME, 9); AssertPacking.assertNumInstances(newPackingPlan.getContainers(), SPOUT_NAME, 0); AssertPacking.assertContainerRam(newPackingPlan.getContainers(), defaultNumInstancesperContainer * instanceDefaultResources.getRam()); }
Source:
private void phaseTwo(final long seq, PaxosProposalId proposalId, PaxosValue proposalValue) throws PaxosRoundFailureException { final PaxosProposal proposal = new PaxosProposal(proposalId, proposalValue); PaxosResponses<PaxosResponse> responses = PaxosQuorumChecker.collectQuorumResponses( acceptors, acceptor -> acceptor.accept(seq, proposal), quorumSize, Duration.ofMillis(750)); if (!responses.hasQuorum()) { throw new PaxosRoundFailureException("failed to acquire quorum in paxos phase two"); } }

Target:
private void phaseTwo(final long seq, PaxosProposalId proposalId, PaxosValue proposalValue) throws PaxosRoundFailureException { final PaxosProposal proposal = new PaxosProposal(proposalId, proposalValue); PaxosResponses<PaxosResponse> responses = PaxosQuorumChecker.collectQuorumResponses( acceptors, acceptor -> acceptor.accept(seq, proposal), quorumSize, executor, PaxosQuorumChecker.DEFAULT_REMOTE_REQUESTS_TIMEOUT); if (!responses.hasQuorum()) { throw new PaxosRoundFailureException("failed to acquire quorum in paxos phase two"); } }
Source:
public void testCheckWrongArgumentForServerPassword() throws Exception { OracleExportAction.OracleExportActionConfig oracleExportActionConfig = new OracleExportAction.OracleExportActionConfig(sshServer.getHost(), sshServer.getPort(), USER, "wrongPassword", "system", "cask", "home", "sid", "/tmp/junit.csv", "select * from test;", "csv"); OracleExportAction oracleExportAction = new OracleExportAction(oracleExportActionConfig); MockActionContext mockActionContext = new MockActionContext(); try { oracleExportAction.run(mockActionContext); } catch (IOException e) { Assert.assertEquals("SSH authentication error when connecting to test@" + sshServer.getHost() + " on port " + sshServer.getPort(), e.getMessage()); } }

Target:
public void testCheckWrongArgumentForServerPassword() throws Exception { OracleExportAction.OracleExportActionConfig oracleExportActionConfig = new OracleExportAction.OracleExportActionConfig(sshServer.getHost(), sshServer.getPort(), USER, "Password", "wrongPassword", "", "", "system", "cask", "home", "sid", "/tmp/junit.csv", "select * from test;", "", "/tmp", "CSV"); OracleExportAction oracleExportAction = new OracleExportAction(oracleExportActionConfig); MockActionContext mockActionContext = new MockActionContext(); oracleExportAction.run(mockActionContext); }
Source:
? new OSSupportMacOSXCocoa.Cocoa64() : new OSSupportMacOSXCocoa.Cocoa32() : new OSSupportMacOSXCarbon(); private static final String OS_VERSION_PROPERTY = "os.version"; private static final String OS_VERSION = System.getProperties().get(OS_VERSION_PROPERTY).toString(); private static final Object flip_flag_is_set = System.getProperties().get(FLIP_FLAG_NAME); private static final int version = Integer.parseInt(OS_VERSION.split("\\.")[0]); private static final int mod = Integer.parseInt(OS_VERSION.split("\\.")[1]); private static final boolean isHighSierraOrMore = version > 10 || version == 10 && mod >= 13; private static final boolean mustFlipImage = flip_flag_is_set != null ? Boolean.getBoolean(FLIP_FLAG_NAME) : isHighSierraOrMore; protected OSSupportMacOSX() { }

Target:
? new OSSupportMacOSXCocoa.Cocoa64() : new OSSupportMacOSXCocoa.Cocoa32() : new OSSupportMacOSXCarbon(); private static boolean mustFlipImage; static { String osVersion = System.getProperties().get("os.version").toString(); Object flip_flag_is_set = System.getProperties().get(FLIP_FLAG); int version = Integer.parseInt(osVersion.split("\\.")[0]); int mod = Integer.parseInt(osVersion.split("\\.")[1]); boolean isHighSierraOrMore = version > 10 || version == 10 && mod >= 13; mustFlipImage = flip_flag_is_set != null ? Boolean.getBoolean(FLIP_FLAG) : isHighSierraOrMore; } protected OSSupportMacOSX() { }
Source:
public void writeIndex(final Path output) throws IOException { if (output == null) { throw new IllegalArgumentException("null output path"); } final int numberOfBlocksToWrite = getNumberOfBlocks() - 1; final ByteBuffer buffer = allocateBuffer(numberOfBlocksToWrite, true); buffer.putLong(Integer.toUnsignedLong(numberOfBlocksToWrite)); for (final IndexEntry entry : entries.subList(1, entries.size())) { buffer.putLong(entry.getCompressedOffset()); buffer.putLong(entry.getUncompressedOffset()); } Files.write(output, buffer.array()); }

Target:
public void writeIndex(final Path output) throws IOException { if (output == null) { throw new IllegalArgumentException("null output path"); } final int numberOfBlocksToWrite = entries.size(); final ByteBuffer buffer = allocateBuffer(numberOfBlocksToWrite, true); buffer.putLong(Integer.toUnsignedLong(numberOfBlocksToWrite)); for (final IndexEntry entry : entries) { buffer.putLong(entry.getCompressedOffset()); buffer.putLong(entry.getUncompressedOffset()); } Files.write(output, buffer.array()); }
Source:
private boolean isVirtualDevice() throws DeviceNotAvailableException { return getDevice().getSetting("global", "device_name").toLowerCase().contains("cuttlefish"); }

Target:
private boolean isVirtualDevice() throws DeviceNotAvailableException { return Objects.equals(getDevice().getProperty("ro.hardware.virtual_device"), "1"); }
Source:
public void restrictedLoginDialogNotShownAfterConfirmationTest() { onView(withId(android.R.id.button1)) .perform(click()); relaunchActivity(); onView(withText(R.string.dialog_restricted_login_title)) .check(doesNotExist()); }

Target:
public void restrictedLoginDialogNotShownAfterConfirmationTest() { onView(withId(android.R.id.button1)) .perform(click()); SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(baseActivityTestRule.getActivity()); assertTrue("Token has been set but shouldn't be!", sharedPreferences.getBoolean(Constants.RESTRICTED_LOGIN_ACCEPTED, false)); }
Source:
public static PostReceiveHook newChain(List<? extends PostReceiveHook> hooks) { PostReceiveHook[] newHooks = new PostReceiveHook[hooks.size()]; int i = 0; for (PostReceiveHook hook : hooks) { if (hook != PostReceiveHook.NULL) newHooks[i++] = hook; } if (i == 0) return PostReceiveHook.NULL; else if (i == 1) return newHooks[0]; else return new PostReceiveHookChain(newHooks); }

Target:
public static PostReceiveHook newChain( List<? extends PostReceiveHook> hooks) { PostReceiveHook[] newHooks = new PostReceiveHook[hooks.size()]; int i = 0; for (PostReceiveHook hook : hooks) if (hook != PostReceiveHook.NULL) newHooks[i++] = hook; if (i == 0) return PostReceiveHook.NULL; else if (i == 1) return newHooks[0]; else return new PostReceiveHookChain(newHooks, i); }
Source:
static protected List<Sample> getTimeOfDayAsMeasurement(final List<Sample> light, final double startNaturalLightForbiddedenHour, final double stopNaturalLightForbiddenHour) { List<Sample> minuteData = new ArrayList<>(); for (final Sample s : light) { final DateTime t = new DateTime(s.dateTime + s.offsetMillis, DateTimeZone.UTC); final float hour = ((float)t.hourOfDay().get()) + t.minuteOfHour().get() / 60.0f; float value = 0.0f; if (hour > startNaturalLightForbiddedenHour || hour < stopNaturalLightForbiddenHour) { value = 1.0f; } minuteData.add(new Sample(s.dateTime,value,s.offsetMillis)); } return minuteData; }

Target:
static protected List<Sample> getTimeOfDayAsMeasurement(final List<Sample> light, final double startNaturalLightForbiddedenHour, final double stopNaturalLightForbiddenHour) { final List<Sample> minuteData = Lists.newArrayList(); for (final Sample s : light) { final DateTime t = new DateTime(s.dateTime + s.offsetMillis, DateTimeZone.UTC); final float hour = ((float)t.hourOfDay().get()) + t.minuteOfHour().get() / 60.0f; float value = 0.0f; if (hour > startNaturalLightForbiddedenHour || hour < stopNaturalLightForbiddenHour) { value = 1.0f; } minuteData.add(new Sample(s.dateTime,value,s.offsetMillis)); } return minuteData; }
Source:
public boolean isChangedBy(ProductData dto) { if (dto == null) { throw new IllegalArgumentException("dto is null"); } if (dto.getId() != null && !dto.getId().equals(this.id)) { return true; } if (dto.getName() != null && !dto.getName().equals(this.name)) { return true; } if (dto.getMultiplier() != null && !dto.getMultiplier().equals(this.multiplier)) { return true; } Collection<String> dependentProductIds = dto.getDependentProductIds(); if (dependentProductIds != null && !Util.collectionsAreEqual(this.dependentProductIds, dependentProductIds)) { return true; } Collection<ProductAttributeData> attributes = dto.getAttributes(); if (attributes != null) { Comparator comparator = new Comparator<Object>() { public int compare(Object lhs, Object rhs) { return ((ProductAttribute) lhs).isChangedBy((ProductAttributeData) rhs) ? 1 : 0; } }; if (!Util.collectionsAreEqual( (Collection) this.attributes, (Collection) attributes, comparator)) { return true; } } Collection<ProductContentData> productContent = dto.getProductContent(); if (productContent != null) { Comparator comparator = new Comparator<Object>() { public int compare(Object lhs, Object rhs) { return ((ProductContent) lhs).isChangedBy((ProductContentData) rhs) ? 1 : 0; } }; if (!Util.collectionsAreEqual( (Collection) this.productContent, (Collection) productContent, comparator)) { return true; } } return false; }

Target:
public boolean isChangedBy(ProductData dto) { if (dto == null) { throw new IllegalArgumentException("dto is null"); } if (dto.getId() != null && !dto.getId().equals(this.id)) { return true; } if (dto.getName() != null && !dto.getName().equals(this.name)) { return true; } if (dto.getMultiplier() != null && !dto.getMultiplier().equals(this.multiplier)) { return true; } if (dto.isLocked() != null && !dto.isLocked().equals(this.locked)) { return true; } Collection<String> dependentProductIds = dto.getDependentProductIds(); if (dependentProductIds != null && !Util.collectionsAreEqual(this.dependentProductIds, dependentProductIds)) { return true; } Collection<ProductAttributeData> attributes = dto.getAttributes(); if (attributes != null) { Comparator comparator = new Comparator<Object>() { public int compare(Object lhs, Object rhs) { return ((ProductAttribute) lhs).isChangedBy((ProductAttributeData) rhs) ? 1 : 0; } }; if (!Util.collectionsAreEqual( (Collection) this.attributes, (Collection) attributes, comparator)) { return true; } } Collection<ProductContentData> productContent = dto.getProductContent(); if (productContent != null) { Comparator comparator = new Comparator<Object>() { public int compare(Object lhs, Object rhs) { return ((ProductContent) lhs).isChangedBy((ProductContentData) rhs) ? 1 : 0; } }; if (!Util.collectionsAreEqual( (Collection) this.productContent, (Collection) productContent, comparator)) { return true; } } return false; }
Source:
private ICPPExecution loopOverArray(IVariable rangeVar, ICPPEvaluation valueRange, ActivationRecord record, ConstexprEvaluationContext context) { ICPPEvaluation[] range = valueRange.getValue(null).getAll(); for(int i = 0; i < range.length; i++ ) { ICPPEvaluation value = new EvalFixed(range[i].getType(null), range[i].getValueCategory(null), range[i].getValue(null)); if(rangeVar.getType() instanceof ICPPReferenceType) { value = new EvalReference(record, new EvalCompositeAccess(valueRange, i), value.getTemplateDefinition()); } record.update(rangeVar, value); ICPPExecution result = EvalUtil.executeStatement(bodyExec, record, context); if(result instanceof ExecReturn) { return result; } else if(result instanceof ExecBreak) { break; } else if(result instanceof ExecContinue) { continue; } } return null; }

Target:
private ICPPExecution loopOverArray(IVariable rangeVar, ICPPEvaluation valueRange, ActivationRecord record, ConstexprEvaluationContext context) { ICPPEvaluation[] range = valueRange.getValue(context.getPoint()).getAll(); for(int i = 0; i < range.length; i++ ) { ICPPEvaluation value = new EvalFixed(range[i].getType(context.getPoint()), range[i].getValueCategory(context.getPoint()), range[i].getValue(context.getPoint())); if(rangeVar.getType() instanceof ICPPReferenceType) { value = new EvalReference(record, new EvalCompositeAccess(valueRange, i), value.getTemplateDefinition()); } record.update(rangeVar, value); ICPPExecution result = EvalUtil.executeStatement(bodyExec, record, context); if(result instanceof ExecReturn) { return result; } else if(result instanceof ExecBreak) { break; } else if(result instanceof ExecContinue) { continue; } } return null; }
Source:
protected boolean validate() { getParameter().setTable(ElasticsearchUtils.getValidTableName(getParameter().getTable())); try { return !(getParameter().getTable() == null || !getTableMetadataManager().exists(ElasticsearchUtils.getValidTableName(getParameter().getTable()))); } catch (Exception e) { logger.error("Error while checking table's existence.", e); return false; } }

Target:
protected void validate() throws QueryStoreException { String tableName = ElasticsearchUtils.getValidTableName(getParameter().getTable()); try { if (tableName == null) { throw new QueryStoreException(QueryStoreException.ErrorCode.INVALID_REQUEST, "Table cannot be null"); } else if (!getTableMetadataManager().exists(tableName)) { throw new QueryStoreException(QueryStoreException.ErrorCode.NO_SUCH_TABLE, "Table not found"); } } catch (QueryStoreException e) { logger.error("Table is null or not found.", getParameter().getTable()); throw e; } catch (Exception e) { logger.error("Error while checking table's existence.", e); throw new QueryStoreException(QueryStoreException.ErrorCode.QUERY_EXECUTION_ERROR, "Error while fetching metadata"); } }
Source:
public static long fsTick(File lastFile) throws InterruptedException, IOException { long sleepTime = 1; File tmp = File.createTempFile("FileTreeIteratorWithTimeControl", null); long startTime = (lastFile == null) ? tmp.lastModified() : lastFile .lastModified(); tmp.deleteOnExit(); long actTime = tmp.lastModified(); while (actTime <= startTime) { Thread.sleep(sleepTime); sleepTime *= 5; tmp.setLastModified(System.currentTimeMillis()); actTime = tmp.lastModified(); } return actTime; }

Target:
public static long fsTick(File lastFile) throws InterruptedException, IOException { long sleepTime = 1; File tmp = File.createTempFile("FileTreeIteratorWithTimeControl", null); try { long startTime = (lastFile == null) ? tmp.lastModified() : lastFile .lastModified(); long actTime = tmp.lastModified(); while (actTime <= startTime) { Thread.sleep(sleepTime); sleepTime *= 5; tmp.setLastModified(System.currentTimeMillis()); actTime = tmp.lastModified(); } return actTime; } finally { tmp.delete(); } }
Source:
public void testCreateCorrelationPropertyInfo() throws Exception { CorrelationKeyFactory factory = KieInternalServices.Factory.get().newCorrelationKeyFactory(); EntityManagerFactory emf = (EntityManagerFactory) context.get(EnvironmentName.ENTITY_MANAGER_FACTORY); UserTransaction ut = InitialContext.doLookup("java:comp/UserTransaction"); ut.begin(); try { EntityManager em = emf.createEntityManager(); em.persist(factory.newCorrelationKey(correlationKey)); ut.commit(); } catch (Exception ex) { ut.rollback(); Assert.fail("Exception thrown while trying to prepare correlation data."); } EntityManager em = emf.createEntityManager(); TypedQuery<CorrelationPropertyInfo> query = em.createQuery("SELECT o FROM CorrelationPropertyInfo o WHERE o.value = :ckey", CorrelationPropertyInfo.class); query.setParameter("ckey", correlationKey.substring(0, 255)); List<CorrelationPropertyInfo> keyInfo = query.getResultList(); for (CorrelationPropertyInfo key : keyInfo) { System.out.println(key); } em.close(); assertNotNull(keyInfo); assertEquals(1, keyInfo.size()); }

Target:
public void testCreateCorrelationPropertyInfo() throws Exception { CorrelationKeyFactory factory = KieInternalServices.Factory.get().newCorrelationKeyFactory(); EntityManagerFactory emf = (EntityManagerFactory) context.get(EnvironmentName.ENTITY_MANAGER_FACTORY); UserTransaction ut = InitialContext.doLookup("java:comp/UserTransaction"); ut.begin(); try { EntityManager em = emf.createEntityManager(); em.persist(factory.newCorrelationKey(correlationKey)); ut.commit(); } catch (Exception ex) { ut.rollback(); Assert.fail("Exception thrown while trying to prepare correlation data."); } EntityManager em = emf.createEntityManager(); TypedQuery<CorrelationPropertyInfo> query = em.createQuery("SELECT o FROM CorrelationPropertyInfo o WHERE o.value = :ckey", CorrelationPropertyInfo.class); query.setParameter("ckey", correlationKey.substring(0, 255)); List<CorrelationPropertyInfo> keyInfo = query.getResultList(); em.close(); assertNotNull(keyInfo); assertEquals(1, keyInfo.size()); }
Source:
public static String[] supportedResourcesPhoebus(){ String resources = getString(PHOEBUS_RESOURCES); if(resources == null || resources.trim().isEmpty()) resources = "bob"; try { return StringSplitter.splitIgnoreInQuotes(resources, ITEM_SEPARATOR, true); } catch (Exception e) { ErrorHandlerUtil.handleError("Failed to parse hidden_widgets preference", e); return null; } }

Target:
public static String[] supportedResourcesPhoebus(){ String resources = getString(PHOEBUS_RESOURCES); if(resources == null || resources.trim().isEmpty()) resources = "bob"; try { return StringSplitter.splitIgnoreInQuotes(resources, ITEM_SEPARATOR, true); } catch (Exception e) { ErrorHandlerUtil.handleError("Failed to parse phoebus_resources preference", e); return null; } }
Source:
private void completeDeployment(final BundleResourceDeployment resourceDeployment, BundleDeploymentStatus status, String message) { getBundleServerService().setBundleDeploymentStatus(resourceDeployment.getId(), status); BundleResourceDeploymentHistory.Status auditStatus = null; if(BundleDeploymentStatus.SUCCESS == status) { auditStatus = BundleResourceDeploymentHistory.Status.SUCCESS; inventoryManager.executeServiceScanDeferred(resourceDeployment.getResource().getId(), configuration.getChildResourceDiscoveryDelay() * 1000); } else { auditStatus = BundleResourceDeploymentHistory.Status.FAILURE; } auditDeployment(resourceDeployment, AUDIT_DEPLOYMENT_ENDED, resourceDeployment.getBundleDeployment().getName(), null, auditStatus, message, null); }

Target:
private void completeDeployment(final BundleResourceDeployment resourceDeployment, BundleDeploymentStatus status, String message) { getBundleServerService().setBundleDeploymentStatus(resourceDeployment.getId(), status); BundleResourceDeploymentHistory.Status auditStatus = null; if(BundleDeploymentStatus.SUCCESS == status) { auditStatus = BundleResourceDeploymentHistory.Status.SUCCESS; Integer discoveryDelay = resourceDeployment.getBundleDeployment().getDiscoveryDelay(); if(discoveryDelay == null) { discoveryDelay = Integer.valueOf(0); } if(!(discoveryDelay.intValue() < 0)) { inventoryManager.executeServiceScanDeferred(resourceDeployment.getResource().getId(), discoveryDelay * 1000); } } else { auditStatus = BundleResourceDeploymentHistory.Status.FAILURE; } auditDeployment(resourceDeployment, AUDIT_DEPLOYMENT_ENDED, resourceDeployment.getBundleDeployment().getName(), null, auditStatus, message, null); }