auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void calculateAndUpdateBaseline(ClusterModel clusterModel, RebalanceAlgorithm algorithm, boolean shouldSchedulePartialRebalance, String clusterName) throws HelixRebalanceException { LOG.info("Start calculating the new baseline."); _baselineCalcCounter.increment(1L); _baselineCalcLatency.startMeasuringLatency(); boolean isBaselineChanged = false; Map<String, ResourceAssignment> newBaseline = calculateAssignment(clusterModel, algorithm); if (_assignmentMetadataStore != null) { try { _writeLatency.startMeasuringLatency(); isBaselineChanged = _assignmentMetadataStore.persistBaseline(newBaseline); _writeLatency.endMeasuringLatency(); } catch (Exception ex) { throw new HelixRebalanceException("Failed to persist the new baseline assignment.", HelixRebalanceException.Type.INVALID_REBALANCER_STATUS, ex); } } else { LOG.debug("Assignment Metadata Store is null. Skip persisting the baseline assignment."); } _baselineCalcLatency.endMeasuringLatency(); LOG.info("Global baseline calculation completed and has been persisted into metadata store."); if (isBaselineChanged && shouldSchedulePartialRebalance) { LOG.info("Schedule a new rebalance after the new baseline calculated."); RebalanceUtil.scheduleOnDemandPipeline(clusterName, 0L, false); } }

Target:
private void calculateAndUpdateBaseline(ClusterModel clusterModel, RebalanceAlgorithm algorithm, boolean shouldSchedulePartialRebalance, String clusterName) throws HelixRebalanceException { LOG.info("Start calculating the new baseline."); _baselineCalcCounter.increment(1L); _baselineCalcLatency.startMeasuringLatency(); boolean isBaselineChanged = false; Map<String, ResourceAssignment> newBaseline = calculateAssignment(clusterModel, algorithm); if (_assignmentMetadataStore != null) { try { _writeLatency.startMeasuringLatency(); isBaselineChanged = _assignmentMetadataStore.persistBaseline(newBaseline); _writeLatency.endMeasuringLatency(); } catch (Exception ex) { throw new HelixRebalanceException("Failed to persist the new baseline assignment.", HelixRebalanceException.Type.INVALID_REBALANCER_STATUS, ex); } } else { LOG.debug("Assignment Metadata Store is null. Skip persisting the baseline assignment."); } _baselineCalcLatency.endMeasuringLatency(); LOG.info("Global baseline calculation completed and has been persisted into metadata store."); if (isBaselineChanged && shouldSchedulePartialRebalance) { LOG.info("Schedule a new rebalance after the new baseline calculation has finished."); RebalanceUtil.scheduleOnDemandPipeline(clusterName, 0L, false); } }
Source:
private JSONObject processJSONResponse(SocketChannel sc, String remoteAddress, Set<String> activeVersions, boolean checkVersion) throws IOException, JSONException { JSONObject jsonResponse = readJSONObjFromWire(sc, remoteAddress); if (checkVersion) { VersionChecker versionChecker = m_acceptor.getVersionChecker(); String remoteVersionString = jsonResponse.getString(VERSION_STRING); String remoteBuildString = jsonResponse.getString(BUILD_STRING); boolean remoteAcceptsLocalVersion = jsonResponse.getBoolean(VERSION_COMPATIBLE); if (remoteVersionString.equals(versionChecker.getVersionString())) { if (!versionChecker.getBuildString().equals(remoteBuildString)) { if (!versionChecker.getBuildString().equals("VoltDB") && !remoteBuildString.equals("VoltDB")) { org.voltdb.VoltDB.crashLocalVoltDB("For VoltDB version " + versionChecker.getVersionString() + " git tag/hash is not identical across the cluster. Node join failed.\n" + " joining build string: " + versionChecker.getBuildString() + "\n" + " existing build string: " + remoteBuildString, false, null); return null; } } } else if (!remoteAcceptsLocalVersion) { if (!versionChecker.isCompatibleVersionString(remoteVersionString)) { org.voltdb.VoltDB.crashLocalVoltDB("Cluster contains nodes running VoltDB version " + remoteVersionString + " which is incompatibile with local version " + versionChecker.getVersionString() + ".\n", false, null); return null; } } activeVersions.add(remoteVersionString); } return jsonResponse; }

Target:
private JSONObject processJSONResponse(SocketChannel sc, String remoteAddress, Set<String> activeVersions, boolean checkVersion) throws IOException, JSONException { JSONObject jsonResponse = readJSONObjFromWire(sc, remoteAddress); if (!checkVersion) { return jsonResponse; } VersionChecker versionChecker = m_acceptor.getVersionChecker(); String remoteVersionString = jsonResponse.getString(VERSION_STRING); String remoteBuildString = jsonResponse.getString(BUILD_STRING); boolean remoteAcceptsLocalVersion = jsonResponse.getBoolean(VERSION_COMPATIBLE); if (remoteVersionString.equals(versionChecker.getVersionString())) { if (!versionChecker.getBuildString().equals(remoteBuildString)) { if (!versionChecker.getBuildString().equals("VoltDB") && !remoteBuildString.equals("VoltDB")) { org.voltdb.VoltDB.crashLocalVoltDB("For VoltDB version " + versionChecker.getVersionString() + " git tag/hash is not identical across the cluster. Node join failed.\n" + " joining build string: " + versionChecker.getBuildString() + "\n" + " existing build string: " + remoteBuildString, false, null); return null; } } } else if (!remoteAcceptsLocalVersion) { if (!versionChecker.isCompatibleVersionString(remoteVersionString)) { org.voltdb.VoltDB.crashLocalVoltDB("Cluster contains nodes running VoltDB version " + remoteVersionString + " which is incompatibile with local version " + versionChecker.getVersionString() + ".\n", false, null); return null; } } activeVersions.add(remoteVersionString); return jsonResponse; }
Source:
public MysqlSchemaStore(MaxwellContext context, Position initialPosition) throws SQLException { this( context, context.getServerID(), initialPosition, context.getFilter(), context.getReplayMode() ); }

Target:
public MysqlSchemaStore(MaxwellContext context, Position initialPosition) throws SQLException { this( context.getMaxwellConnectionPool(), context.getReplicationConnectionPool(), context.getSchemaConnectionPool(), context.getServerID(), initialPosition, context.getCaseSensitivity(), context.getFilter(), context.getConfig().schemaChainMaxLength, context.getReplayMode() ); }
Source:
public void banExecServiceOnFacility(PerunSession sess, ExecService execService, Facility facility) throws InternalErrorException { execServiceDenialDao.banExecServiceOnFacility(execService.getId(), facility.getId()); sess.getPerun().getAuditer().logWithoutTransaction(sess, BAN_EXECSERVICE + "{} on ", execService, facility); }

Target:
public void banExecServiceOnFacility(PerunSession sess, ExecService execService, Facility facility) throws InternalErrorException { execServiceDenialDao.banExecServiceOnFacility(execService.getId(), facility.getId()); sess.getPerun().getAuditer().log(sess, "{} on {}", BAN_SERVICE, execService, facility); }
Source:
public static Map<IPluginModelBase, String> getTargetBundleMap(ILaunchConfiguration configuration, Set<String> set, String attribute) throws CoreException { List<String> selected = configuration.getAttribute(attribute, new ArrayList<>()); Map<IPluginModelBase, String> map = new LinkedHashMap<>(); for (String token : selected) { int index = token.indexOf('@'); if (index < 0) { token = token.concat("@default:default"); index = token.indexOf('@'); } String idVersion = token.substring(0, index); int versionIndex = idVersion.indexOf(VERSION_SEPARATOR); String id = (versionIndex > 0) ? idVersion.substring(0, versionIndex) : idVersion; String version = (versionIndex > 0) ? idVersion.substring(versionIndex + 1) : null; if (set != null && set.contains(id)) continue; ModelEntry entry = PluginRegistry.findEntry(id); if (entry != null) { IPluginModelBase[] models = entry.getExternalModels(); for (IPluginModelBase model : models) { if (model.isEnabled()) { IPluginBase base = model.getPluginBase(); if (base.getVersion().equals(version) || version == null || models.length == 1) addBundleToMap(map, model, token.substring(index + 1)); } } } } return map; }

Target:
public static Map<IPluginModelBase, String> getTargetBundleMap(ILaunchConfiguration configuration, Set<String> set, String attribute) throws CoreException { Set<String> selected = configuration.getAttribute(attribute, Collections.emptySet()); Map<IPluginModelBase, String> map = new LinkedHashMap<>(); for (String token : selected) { int index = token.indexOf('@'); if (index < 0) { token = token.concat("@default:default"); index = token.indexOf('@'); } String idVersion = token.substring(0, index); int versionIndex = idVersion.indexOf(VERSION_SEPARATOR); String id = (versionIndex > 0) ? idVersion.substring(0, versionIndex) : idVersion; String version = (versionIndex > 0) ? idVersion.substring(versionIndex + 1) : null; if (set != null && set.contains(id)) continue; ModelEntry entry = PluginRegistry.findEntry(id); if (entry != null) { IPluginModelBase[] models = entry.getExternalModels(); for (IPluginModelBase model : models) { if (model.isEnabled()) { IPluginBase base = model.getPluginBase(); if (base.getVersion().equals(version) || version == null || models.length == 1) addBundleToMap(map, model, token.substring(index + 1)); } } } } return map; }
Source:
public boolean send(CarbonMessage msg, CarbonCallback callback) throws ClientConnectorException { if (msg instanceof TextCarbonMessage) { TextCarbonMessage textCarbonMessage = (TextCarbonMessage) msg; sendText(textCarbonMessage); } else if (msg instanceof ControlCarbonMessage) { ControlCarbonMessage controlCarbonMessage = (ControlCarbonMessage) msg; handleControlMessage(controlCarbonMessage); } else if (msg instanceof BinaryCarbonMessage) { BinaryCarbonMessage binaryCarbonMessage = (BinaryCarbonMessage) msg; sendBinary(binaryCarbonMessage); } return true; }

Target:
public boolean send(CarbonMessage msg, CarbonCallback callback) throws ClientConnectorException { throw new ClientConnectorException("Method not supported for WebSocket. Use session to send messages."); }
Source:
private int deltaSizeLimit(DeltaWindowEntry src) { if (bestBase == null) { int n = res.size() >>> 1; return n - (n * src.depth() / maxDepth); } int d = bestBase.depth(); int n = (int) bestDelta.length(); return n * (maxDepth - src.depth()) / (maxDepth - d); }

Target:
private int deltaSizeLimit(DeltaWindowEntry src) { if (bestBase == null) { int n = res.size() >>> 1; return n * (maxDepth - src.depth()) / maxDepth; } int d = bestBase.depth(); int n = (int) bestDelta.length(); return n * (maxDepth - src.depth()) / (maxDepth - d); }
Source:
protected void addSeriesMeta(String key, boolean value) { addSeriesMeta(key, new Boolean(value)); }

Target:
protected void addSeriesMeta(String key, boolean value) { addSeriesMeta(key, Boolean.valueOf(value)); }
Source:
public static boolean testRepositoryState(Repository repository, String property) { if ("isShared".equals(property)) return repository != null; if (repository != null) { RepositoryState state = repository.getRepositoryState(); if (property.length() > 3 && property.startsWith("is")) { String lookFor = property.substring(2,3) + property.substring(3).replaceAll("([A-Z])","_$1").toUpperCase(); if (state.toString().equals(lookFor)) return true; } try { Method method = RepositoryState.class.getMethod(property, (Class[])null); if (method.getReturnType() == boolean.class) { Boolean ret = (Boolean) method.invoke(state, (Object[])null); return ret.booleanValue(); } } catch (Exception e) { } } return false; }

Target:
public static boolean testRepositoryState(Repository repository, String property) { if ("isShared".equals(property)) return repository != null; if (repository != null) { RepositoryState state = repository.getRepositoryState(); if (property.length() > 3 && property.startsWith("is")) { String lookFor = property.substring(2,3) + property.substring(3).replaceAll("([A-Z])","_$1").toUpperCase(); if (state.toString().equals(lookFor)) return true; } try { Method method = RepositoryState.class.getMethod(property); if (method.getReturnType() == boolean.class) { Boolean ret = (Boolean) method.invoke(state); return ret.booleanValue(); } } catch (Exception e) { } } return false; }
Source:
public void setUp() { assumeTrue(CameraUtil.deviceHasCamera()); assumeTrue(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M); Context context = ApplicationProvider.getApplicationContext(); AppConfig appConfig = Camera2AppConfig.create(context); CameraX.init(context, appConfig); mLifecycleOwner = new FakeLifecycleOwner(); mLifecycleOwner.startAndResume(); mImageCaptureConfigBuilder = new ImageCaptureConfig.Builder(); mPreviewConfigBuilder = new PreviewConfig.Builder(); mCameraStatusCallback = new CameraDevice.StateCallback() { @Override public void onOpened(@NonNull CameraDevice camera) { mLatch = new CountDownLatch(1); } @Override public void onDisconnected(@NonNull CameraDevice camera) { } @Override public void onError(@NonNull CameraDevice camera, int error) { } @Override public void onClosed(@NonNull CameraDevice camera) { mLatch.countDown(); } }; new Camera2Config.Extender(mImageCaptureConfigBuilder).setDeviceStateCallback( mCameraStatusCallback); }

Target:
public void setUp() { assumeTrue(CameraUtil.deviceHasCamera()); Context context = ApplicationProvider.getApplicationContext(); AppConfig appConfig = Camera2AppConfig.create(context); CameraX.init(context, appConfig); mLifecycleOwner = new FakeLifecycleOwner(); mLifecycleOwner.startAndResume(); mImageCaptureConfigBuilder = new ImageCaptureConfig.Builder(); mPreviewConfigBuilder = new PreviewConfig.Builder(); mCameraStatusCallback = new CameraDevice.StateCallback() { @Override public void onOpened(@NonNull CameraDevice camera) { mLatch = new CountDownLatch(1); } @Override public void onDisconnected(@NonNull CameraDevice camera) { } @Override public void onError(@NonNull CameraDevice camera, int error) { } @Override public void onClosed(@NonNull CameraDevice camera) { mLatch.countDown(); } }; new Camera2Config.Extender(mImageCaptureConfigBuilder).setDeviceStateCallback( mCameraStatusCallback); }
Source:
@Override public boolean isEmpty() { try { return grp.mvccEnabled() ? dataTree.isEmpty() : storageSize.get() == 0; } catch (IgniteCheckedException e) { U.error(grp.shared().logger(IgniteCacheOffheapManagerImpl.class), "Failed to perform operation.", e); return false; } }

Target:
@Override public boolean isEmpty() { try { return grp.mvccEnabled() ? dataTree.isEmpty() : storageSize.get() == 0; } catch (IgniteCheckedException e) { U.error(log, "Failed to perform operation.", e); return false; } }
Source:
void fixMissingStoreKeys(ConnectedChannel connectedChannel, List<RemoteReplicaInfo> replicasToReplicatePerNode, List<ExchangeMetadataResponse> exchangeMetadataResponseList, boolean remoteColoGetRequestForStandby) throws IOException, ReplicationException { long fixMissingStoreKeysStartTimeInMs = time.milliseconds(); try { if (exchangeMetadataResponseList.size() != replicasToReplicatePerNode.size() || replicasToReplicatePerNode.size() == 0) { throw new IllegalArgumentException("ExchangeMetadataResponseList size " + exchangeMetadataResponseList.size() + " and replicasToReplicatePerNode size " + replicasToReplicatePerNode.size() + " should be the same and greater than zero"); } DataNodeId remoteNode = replicasToReplicatePerNode.get(0).getReplicaId().getDataNodeId(); GetResponse getResponse = getMessagesForMissingKeys(connectedChannel, exchangeMetadataResponseList, replicasToReplicatePerNode, remoteNode, remoteColoGetRequestForStandby); if (remoteColoGetRequestForStandby) { batchConvertGetResponseKeys(getResponse); } writeMessagesToLocalStoreAndAdvanceTokens(exchangeMetadataResponseList, getResponse, replicasToReplicatePerNode, remoteNode, remoteColoGetRequestForStandby); } finally { long fixMissingStoreKeysTime = time.milliseconds() - fixMissingStoreKeysStartTimeInMs; replicationMetrics.updateFixMissingStoreKeysTime(fixMissingStoreKeysTime, replicatingFromRemoteColo, replicatingOverSsl, datacenterName); } }

Target:
void fixMissingStoreKeys(ConnectedChannel connectedChannel, List<RemoteReplicaInfo> replicasToReplicatePerNode, List<ExchangeMetadataResponse> exchangeMetadataResponseList, boolean remoteColoGetRequestForStandby) throws IOException, ReplicationException { long fixMissingStoreKeysStartTimeInMs = time.milliseconds(); try { if (exchangeMetadataResponseList.size() != replicasToReplicatePerNode.size() || replicasToReplicatePerNode.size() == 0) { throw new IllegalArgumentException("ExchangeMetadataResponseList size " + exchangeMetadataResponseList.size() + " and replicasToReplicatePerNode size " + replicasToReplicatePerNode.size() + " should be the same and greater than zero"); } DataNodeId remoteNode = replicasToReplicatePerNode.get(0).getReplicaId().getDataNodeId(); GetResponse getResponse = getMessagesForMissingKeys(connectedChannel, exchangeMetadataResponseList, replicasToReplicatePerNode, remoteNode, remoteColoGetRequestForStandby); writeMessagesToLocalStoreAndAdvanceTokens(exchangeMetadataResponseList, getResponse, replicasToReplicatePerNode, remoteNode, remoteColoGetRequestForStandby); } finally { long fixMissingStoreKeysTime = time.milliseconds() - fixMissingStoreKeysStartTimeInMs; replicationMetrics.updateFixMissingStoreKeysTime(fixMissingStoreKeysTime, replicatingFromRemoteColo, replicatingOverSsl, datacenterName); } }
Source:
public static NetworkSecurityGroup create(final String id, final String name, final String location, final Map<String, String> tags, final NetworkSecurityGroupProperties properties, final String etag) { return new AutoValue_NetworkSecurityGroup(id, name, location, (tags == null) ? ImmutableMap.<String, String>of() : ImmutableMap.copyOf(tags), properties, etag); }

Target:
public static NetworkSecurityGroup create(final String id, final String name, final String location, final Map<String, String> tags, final NetworkSecurityGroupProperties properties, final String etag) { return new AutoValue_NetworkSecurityGroup(id, name, location, (tags == null) ? null : ImmutableMap.copyOf(tags), properties, etag); }
Source:
protected void parseSplitSampleData(Variant variant, String fileId, String studyId, String[] fields, String[] alternateAlleles, String[] secondaryAlternates, int alternateAlleleIdx) throws NonStandardCompliantSampleField { String[] formatFields = variant.getSourceEntry(fileId, studyId).getFormat().split(":"); for (int i = 9; i < fields.length; i++) { Map<String, String> map = new TreeMap<>(); String[] sampleFields = fields[i].split(":"); for (int j = 0; j < sampleFields.length; j++) { if(formatFields[j].equals("GT")) { if(sampleFields[j].equals("0|0") || sampleFields[j].equals("0/0") || sampleFields[j].equals("./.")) { ctr++; } } String formatField = formatFields[j]; String sampleField = processSampleField(alternateAlleleIdx, formatField, sampleFields[j]); map.put(formatField, sampleField); } if(ctr==sampleFields.length) { throw new NotAVariantException; } else { variant.getSourceEntry(fileId, studyId).addSampleData(map); } } }

Target:
protected void parseSplitSampleData(Variant variant, String fileId, String studyId, String[] fields, String[] alternateAlleles, String[] secondaryAlternates, int alternateAlleleIdx) throws NonStandardCompliantSampleField, NotAVariantException { String[] formatFields = variant.getSourceEntry(fileId, studyId).getFormat().split(":"); for (int i = 9; i < fields.length; i++) { int numReferenceGenotypes=0; Map<String, String> map = new TreeMap<>(); String[] sampleFields = fields[i].split(":"); for (int j = 0; j < sampleFields.length; j++) { String formatField = formatFields[j]; if ((sampleFields[j].equals("0|0") || sampleFields[j].equals("0/0") || sampleFields[j].equals("./.")) && formatField.equals("GT")) { numReferenceGenotypes++; } String sampleField = processSampleField(alternateAlleleIdx, formatField, sampleFields[j]); map.put(formatField, sampleField); } if (numReferenceGenotypes==sampleFields.length) { throw new NotAVariantException("All the sample genotypes are non-variant"); } else { variant.getSourceEntry(fileId, studyId).addSampleData(map); } } }
Source:
public Hash(HashType type){ this.type = type; try { digest = type.get(); } finally { type.recycle(digest); } }

Target:
public Hash(HashType type){ this.type = type; digest = type.get(); }
Source:
private AuditLogCleanupManager() { log.info("Start initializing " + this.getClass().getSimpleName()); Calendar calendar = new GregorianCalendar(); Date mAuditLogCleanupTime = Config.<DateTime> GetValue(ConfigValues.AuditLogCleanupTime); calendar.setTimeInMillis(mAuditLogCleanupTime.getTime()); String cronExpression = String.format("%d %d %d * * ?", calendar.get(Calendar.SECOND), calendar.get(Calendar.MINUTE), calendar.get(Calendar.HOUR_OF_DAY)); log.info("Setting audit clean up manager to run at: " + cronExpression); SchedulerUtilQuartzImpl.getInstance().scheduleACronJob(this, "OnTimer", new Class[] {}, new Object[] {}, cronExpression); log.info("Finished initializing " + this.getClass().getSimpleName()); }

Target:
private AuditLogCleanupManager() { log.info("Start initializing audit cleanup manager"); Calendar calendar = new GregorianCalendar(); Date mAuditLogCleanupTime = Config.<DateTime> GetValue(ConfigValues.AuditLogCleanupTime); calendar.setTimeInMillis(mAuditLogCleanupTime.getTime()); String cronExpression = String.format("%d %d %d * * ?", calendar.get(Calendar.SECOND), calendar.get(Calendar.MINUTE), calendar.get(Calendar.HOUR_OF_DAY)); log.info("Setting audit cleanup manager to run at: " + cronExpression); SchedulerUtilQuartzImpl.getInstance().scheduleACronJob(this, "OnTimer", new Class[] {}, new Object[] {}, cronExpression); log.info("Finished initializing audit cleanup manager"); }
Source:
public void loginDropDown(String username, String password) { triggerLoginDropDown(); typeInUserNameAndPassword(username, password); loginButton.click(); waitForElementByElement(avatar); PageObjectLogging.log("login", "user logged in successfully", true, driver); }

Target:
public void loginDropDown(String username, String password) { triggerLoginDropDown(); typeInUserNameAndPassword(username, password); loginButton.click(); waitForElementByElement(avatar); PageObjectLogging.log("loginDropDown", "user logged in successfully", true, driver); }
Source:
public final void validate(final List<Throwable> validationErrors, final Configuration config) { this.accessAssertion.validate(validationErrors, config); int numberOfTableConfigurations = this.tableDataKey == null ? 0 : 1; numberOfTableConfigurations += this.jdbcUrl == null ? 0 : 1; if (numberOfTableConfigurations > 1) { validationErrors.add(new ConfigurationException("Only one of 'iterValue' or 'tableData' or 'jdbcUrl' should be defined.")); } for (Processor processor : this.processors) { processor.validate(validationErrors, config); } for (Attribute attribute : this.attributes.values()) { attribute.validate(validationErrors, config); } try { getProcessorGraph(); } catch (Throwable t) { validationErrors.add(t); } if (getJdbcUrl() != null) { Connection connection = null; try { if (getJdbcUser() != null) { connection = DriverManager.getConnection(getJdbcUrl(), getJdbcUser(), getJdbcPassword()); } else { connection = DriverManager.getConnection(getJdbcUrl()); } } catch (SQLException e) { validationErrors.add(e); } finally { if (connection != null) { try { connection.close(); } catch (SQLException e) { validationErrors.add(e); } } } } if (this.mapExport) { int count = 0; for (Processor<?, ?> processor : getProcessors()) { if (processor instanceof CreateMapProcessor) { count++; } } if (count != 1) { validationErrors.add(new ConfigurationException("When using MapExport, exactly one CreateMapProcessor should be defined.")); } } }

Target:
public final void validate(final List<Throwable> validationErrors, final Configuration config) { this.accessAssertion.validate(validationErrors, config); int numberOfTableConfigurations = this.tableDataKey == null ? 0 : 1; numberOfTableConfigurations += this.jdbcUrl == null ? 0 : 1; if (numberOfTableConfigurations > 1) { validationErrors.add(new ConfigurationException("Only one of 'iterValue' or 'tableData' or 'jdbcUrl' should be defined.")); } for (Processor processor : this.processors) { processor.validate(validationErrors, config); } for (Attribute attribute : this.attributes.values()) { attribute.validate(validationErrors, config); } try { getProcessorGraph(); } catch (Throwable t) { validationErrors.add(t); } if (getJdbcUrl() != null) { Connection connection = null; try { if (getJdbcUser() != null) { connection = DriverManager.getConnection(getJdbcUrl(), getJdbcUser(), getJdbcPassword()); } else { connection = DriverManager.getConnection(getJdbcUrl()); } } catch (SQLException e) { validationErrors.add(e); } finally { if (connection != null) { try { connection.close(); } catch (SQLException e) { validationErrors.add(e); } } } } if (this.mapExport) { int count = 0; for (Processor<?, ?> processor : getProcessors()) { if (processor instanceof CreateMapProcessor) { count++; } if (count > 1) { break; } } if (count != 1) { validationErrors.add(new ConfigurationException("When using MapExport, exactly one CreateMapProcessor should be defined.")); } } }
Source:
public int onStartCommand(Intent intent, int flags, int startId) { LogUtils.LOGD(TAG, "onStartCommand"); HostConnectionObserver connectionObserver = HostManager.getInstance(this) .getHostConnectionObserver(); if (mHostConnectionObserver == connectionObserver) { LogUtils.LOGD(TAG, "Already initialized"); stopForeground(true); stopSelf(); return START_NOT_STICKY; } createObservers(); if (mConnectionObservers.isEmpty()) { stopForeground(true); stopSelf(); return START_NOT_STICKY; } startForeground(NotificationObserver.NOTIFICATION_ID, mNotificationObserver.getNothingPlayingNotification()); if (mHostConnectionObserver != null) { mHostConnectionObserver.unregisterPlayerObserver(this); } mHostConnectionObserver = connectionObserver; mHostConnectionObserver.registerPlayerObserver(this, true); return START_STICKY; }

Target:
public int onStartCommand(Intent intent, int flags, int startId) { LogUtils.LOGD(TAG, "onStartCommand"); if (observers.isEmpty()) { createObservers(); } startForeground(NotificationObserver.NOTIFICATION_ID, notificationObserver.getCurrentNotification()); HostConnectionObserver connectionObserver = HostManager.getInstance(this).getHostConnectionObserver(); if (hostConnectionObserver == null) { hostConnectionObserver = connectionObserver; hostConnectionObserver.registerPlayerObserver(this, true); } else if (hostConnectionObserver != connectionObserver) { hostConnectionObserver.unregisterPlayerObserver(this); hostConnectionObserver = connectionObserver; hostConnectionObserver.registerPlayerObserver(this, true); } return START_STICKY; }
Source:
OnheapIncrementalIndex( IncrementalIndexSchema incrementalIndexSchema, boolean deserializeComplexMetrics, boolean reportParseExceptions, boolean concurrentEventAdd, boolean sortFacts, int maxRowCount, long maxBytesInMemory ) { super(incrementalIndexSchema, deserializeComplexMetrics, reportParseExceptions, concurrentEventAdd); this.maxRowCount = maxRowCount; this.maxBytesInMemory = maxBytesInMemory == 0 ? defaultMaxBytesInMemory : maxBytesInMemory; this.facts = incrementalIndexSchema.isRollup() ? new RollupFactsHolder(sortFacts, dimsComparator(), getDimensions()) : new PlainFactsHolder(sortFacts); if (maxBytesInMemory != -1) { maxBytesPerRowForAggregators = getMaxBytesPerRowForAggregators(incrementalIndexSchema); } }

Target:
OnheapIncrementalIndex( IncrementalIndexSchema incrementalIndexSchema, boolean deserializeComplexMetrics, boolean reportParseExceptions, boolean concurrentEventAdd, boolean sortFacts, int maxRowCount, long maxBytesInMemory ) { super(incrementalIndexSchema, deserializeComplexMetrics, reportParseExceptions, concurrentEventAdd); this.maxRowCount = maxRowCount; this.maxBytesInMemory = maxBytesInMemory == 0 ? -1 : maxBytesInMemory; this.facts = incrementalIndexSchema.isRollup() ? new RollupFactsHolder(sortFacts, dimsComparator(), getDimensions()) : new PlainFactsHolder(sortFacts); maxBytesPerRowForAggregators = getMaxBytesPerRowForAggregators(incrementalIndexSchema); }
Source:
public void setUp() { MockitoAnnotations.initMocks(this); BigtableClusterName clusterName = new BigtableClusterName("project", "zone", "cluster"); Configuration configuration = new Configuration(); HeapSizeManager heapsiManager = new HeapSizeManager(AsyncExecutor.ASYNC_MUTATOR_MAX_MEMORY_DEFAULT, AsyncExecutor.MAX_INFLIGHT_RPCS_DEFAULT) { @Override public <T> FutureCallback<T> addCallback(ListenableFuture<T> future, Long id) { FutureCallback<T> callback = super.addCallback(future, id); callbacks.add(callback); return callback; } }; HBaseRequestAdapter adapter = new HBaseRequestAdapter(clusterName, TableName.valueOf("TABLE"), configuration); underTest = new BigtableBufferedMutator(client, adapter, configuration, null, listener, heapsiManager); }

Target:
public void setUp() { MockitoAnnotations.initMocks(this); BigtableClusterName clusterName = new BigtableClusterName("project", "zone", "cluster"); Configuration configuration = new Configuration(); HeapSizeManager heapSizeManager = new HeapSizeManager(AsyncExecutor.ASYNC_MUTATOR_MAX_MEMORY_DEFAULT, AsyncExecutor.MAX_INFLIGHT_RPCS_DEFAULT) { @Override public <T> FutureCallback<T> addCallback(ListenableFuture<T> future, Long id) { FutureCallback<T> callback = super.addCallback(future, id); callbacks.add(callback); return callback; } }; HBaseRequestAdapter adapter = new HBaseRequestAdapter(clusterName, TableName.valueOf("TABLE"), configuration); underTest = new BigtableBufferedMutator( client, adapter, configuration, null, listener, heapSizeManager); }
Source:
private final void parseRecord() { Object value = null; if (consumerRecord.value() instanceof GenericRecord) { GenericRecord genericRecord = (GenericRecord)consumerRecord.value(); Object properties = genericRecord.get(KafkaForkliftProducer.SCHEMA_FIELD_NAME_PROPERTIES); if (properties != null) { this.setProperties(KeyValueParser.parse(properties.toString())); } value = genericRecord.get(KafkaForkliftProducer.SCHEMA_FIELD_NAME_VALUE); if (value == null) { String jsonValue = genericRecord.toString(); value = jsonValue != null && jsonValue.startsWith("{") ? jsonValue : null; } } if (value == null) { this.setFlagged(true); this.setWarning("Unable to parse message for topic: " + consumerRecord.topic() + " with value: " + consumerRecord.value()); } else { this.setMsg(value.toString()); } }

Target:
private final String parseRecord(){ Object value = null; if (consumerRecord.value() instanceof GenericRecord) { GenericRecord genericRecord = (GenericRecord)consumerRecord.value(); Object properties = genericRecord.get(KafkaForkliftProducer.SCHEMA_FIELD_NAME_PROPERTIES); if (properties != null) { this.setProperties(KeyValueParser.parse(properties.toString())); } value = genericRecord.get(KafkaForkliftProducer.SCHEMA_FIELD_NAME_VALUE); if (value == null) { String jsonValue = genericRecord.toString(); value = jsonValue != null && jsonValue.startsWith("{") ? jsonValue : null; } } return value == null?null:value.toString(); }
Source:
public void queryDocumentsArrayValue(){ FeedOptions options = new FeedOptions(); options.setEnableCrossPartitionQuery(true); options.setMaxDegreeOfParallelism(2); List<List<Integer>> expectedValues = new ArrayList<>(); ArrayList<Integer> a1 = new ArrayList<Integer>(); ArrayList<Integer> a2 = new ArrayList<Integer>(); a1.add(6519456); a1.add(1471916863); a2.add(2498434); a2.add(1455671440); expectedValues.add(a1); expectedValues.add(a2); String query = "Select top 2 value c.sgmts from c"; Flux<FeedResponse<List>> queryObservable = createdCollection.queryItems(query, options, List.class); List<List> fetchedResults = new ArrayList<>(); queryObservable.map(feedResponse -> fetchedResults.addAll(feedResponse.getResults())).blockLast(); }

Target:
public void queryDocumentsArrayValue(){ FeedOptions options = new FeedOptions(); options.setEnableCrossPartitionQuery(true); options.setMaxDegreeOfParallelism(2); Collection<List<List<Integer>>> expectedValues = new ArrayList<>(); List<List<Integer>> lists = new ArrayList<>(); List<Integer> a1 = new ArrayList<>(); ArrayList<Integer> a2 = new ArrayList<>(); a1.add(6519456); a1.add(1471916863); a2.add(2498434); a2.add(1455671440); lists.add(a1); lists.add(a2); expectedValues.add(lists); expectedValues.add(lists); expectedValues.add(lists); expectedValues.add(lists); String query = "Select top 2 value c.sgmts from c"; Flux<FeedResponse<List>> queryObservable = createdCollection.queryItems(query, options, List.class); List<List> fetchedResults = new ArrayList<>(); queryObservable.map(feedResponse -> fetchedResults.addAll(feedResponse.getResults())).blockLast(); assertThat(fetchedResults).containsAll(expectedValues); }
Source:
private TDigest(double compression) { checkArgument(!isNaN(compression)); checkArgument(compression <= MAX_COMPRESSION_FACTOR, "Compression factor cannot exceed %s", MAX_COMPRESSION_FACTOR); this.publicCompression = max(compression, 10); this.compression = 2 * publicCompression; maxBufferSize = 5 * (int) ceil(this.publicCompression + sizeFudge); maxCentroidCount = (int) ceil(this.compression + sizeFudge); weight = new double[1]; mean = new double[1]; tempWeight = new double[1]; tempMean = new double[1]; order = new int[1]; activeCentroids = 0; }

Target:
private TDigest(double compression) { checkArgument(!isNaN(compression)); checkArgument(compression <= MAX_COMPRESSION_FACTOR, "Compression factor cannot exceed %s", MAX_COMPRESSION_FACTOR); this.publicCompression = max(compression, 10); this.compression = 2 * this.publicCompression; this.maxBufferSize = 5 * (int) ceil(this.publicCompression + sizeFudge); this.maxCentroidCount = (int) ceil(this.compression + sizeFudge); this.weight = new double[1]; this.mean = new double[1]; this.tempWeight = new double[1]; this.tempMean = new double[1]; this.order = new int[1]; this.activeCentroids = 0; }
Source:
private static Set<Account.Id> getAccountSources(final ReviewDb db, final String userName) throws OrmException { AccountAccess dbAccounts = db.accounts(); ResultSet<Account>[] allAccounts = new ResultSet[] { dbAccounts.suggestBySshUserName(userName, userName + "\u9fa5", 10), dbAccounts.suggestByFullName(userName, userName + "\u9fa5", 10), db.accountExternalIds().suggestByEmailAddress(userName, userName + "\u9fa5", 10), }; Set<Account.Id> result = new HashSet<Account.Id>(); for (ResultSet<Account> rs : allAccounts) { for (Iterator<Account> it = rs.iterator(); it.hasNext();) { result.add(it.next().getId()); } } return result; }

Target:
private static Set<Account.Id> getAccountSources(final ReviewDb db, final String userName) throws OrmException { AccountAccess dbAccounts = db.accounts(); ResultSet<Account>[] allAccounts = new ResultSet[] { dbAccounts.suggestBySshUserName(userName, userName + "\u9fa5", 10), dbAccounts.suggestByFullName(userName, userName + "\u9fa5", 10), db.accountExternalIds().suggestByEmailAddress(userName, userName + "\u9fa5", 10), }; Set<Account.Id> result = new HashSet<Account.Id>(); for (ResultSet<Account> rs : allAccounts) { for (Account account : rs) { result.add(account.getId()); } } return result; }
Source:
public List<VDS> filter(List<VDS> hosts, VM vm, Map<String, String> parameters, List<String> messages) { List<VDS> toRemoveHostList = new ArrayList<VDS>(); List<VmNetworkInterface> vmNICs; List<Network> clusterNetworks; Map<String, Network> networksByName; if (hosts != null && hosts.size() > 0) { clusterNetworks = getNetworkDAO().getAllForCluster(hosts.get(0).getVdsGroupId()); networksByName = Entities.entitiesByName(clusterNetworks); vmNICs = getVmNetworkInterfaceDao().getAllForVm(vm.getId()); } else { return null; } Map<Guid, List<VdsNetworkInterface>> allInterfacesForVdsMap = getAllInterfacesForVdsGroupMap(hosts.get(0).getVdsGroupId()); for (VDS host : hosts) { VdcBllMessages returnValue = validateRequiredNetworksAvailable(host, vm, vmNICs, clusterNetworks, networksByName, allInterfacesForVdsMap.get(host.getId())); if (VdcBllMessages.ACTION_TYPE_FAILED_VDS_VM_NETWORKS == returnValue) { StringBuilder sbBuilder = new StringBuilder(); sbBuilder.append(Entities.vmInterfacesByNetworkName(vmNICs).keySet()); log.debugFormat("host {0} is missing networks required by VM nics {1}", host.getName(), sbBuilder.toString()); } else if (VdcBllMessages.ACTION_TYPE_FAILED_MISSING_DISPLAY_NETWORK == returnValue) { log.debugFormat("host {0} is missing the cluster's display network", host.getName()); } if (returnValue != null) { messages.add(returnValue.toString()); toRemoveHostList.add(host); } } hosts.removeAll(toRemoveHostList); return hosts; }

Target:
public List<VDS> filter(List<VDS> hosts, VM vm, Map<String, String> parameters, List<String> messages) { List<VDS> toRemoveHostList = new ArrayList<VDS>(); List<VmNetworkInterface> vmNICs; List<Network> clusterNetworks; Map<String, Network> networksByName; if (hosts != null && hosts.size() > 0) { clusterNetworks = getNetworkDAO().getAllForCluster(hosts.get(0).getVdsGroupId()); networksByName = Entities.entitiesByName(clusterNetworks); vmNICs = getVmNetworkInterfaceDao().getAllForVm(vm.getId()); } else { return null; } Map<Guid, List<VdsNetworkInterface>> hostNics = getAllInterfacesForVdsGroupMap(hosts.get(0).getVdsGroupId()); for (VDS host : hosts) { VdcBllMessages returnValue = validateRequiredNetworksAvailable(host, vm, vmNICs, clusterNetworks, networksByName, hostNics.get(host.getId())); if (VdcBllMessages.ACTION_TYPE_FAILED_VDS_VM_NETWORKS == returnValue) { StringBuilder sbBuilder = new StringBuilder(); sbBuilder.append(Entities.vmInterfacesByNetworkName(vmNICs).keySet()); log.debugFormat("host {0} is missing networks required by VM nics {1}", host.getName(), sbBuilder.toString()); } else if (VdcBllMessages.ACTION_TYPE_FAILED_MISSING_DISPLAY_NETWORK == returnValue) { log.debugFormat("host {0} is missing the cluster's display network", host.getName()); } if (returnValue != null) { messages.add(returnValue.toString()); toRemoveHostList.add(host); } } hosts.removeAll(toRemoveHostList); return hosts; }
Source:
private void setupVCFWriter() { vcfWriter = createVCFWriter(outputFile); vcfWriter.writeHeader(OrientationBiasFilterer.createVCFHeader(getHeaderForVariants(), getCommandLine(), artifactModes)); }

Target:
private void setupVCFWriter() { vcfWriter = createVCFWriter(outputFile); vcfWriter.writeHeader(OrientationBiasFilterer.createVCFHeader(getHeaderForVariants(), getCommandLine(), transitions)); }
Source:
public static Double sphericalDistance(Geometry leftGeometry, Geometry rightGeometry) { if (leftGeometry.isEmpty() || rightGeometry.isEmpty()) { return null; } validateGeographyType("ST_Distance", leftGeometry, EnumSet.of(GeometryType.POINT)); validateGeographyType("ST_Distance", rightGeometry, EnumSet.of(GeometryType.POINT)); Point leftPoint = (Point) leftGeometry; Point rightPoint = (Point) rightGeometry; return greatCircleDistance(leftPoint.getY(), leftPoint.getX(), rightPoint.getY(), rightPoint.getX()) * 1000; }

Target:
private static double sphericalDistance(Geometry leftGeometry, Geometry rightGeometry) { Preconditions.checkArgument(leftGeometry instanceof Point, "The left argument must be a point"); Preconditions.checkArgument(rightGeometry instanceof Point, "The right argument must be a point"); Point leftPoint = (Point) leftGeometry; Point rightPoint = (Point) rightGeometry; return greatCircleDistance(leftPoint.getY(), leftPoint.getX(), rightPoint.getY(), rightPoint.getX()); }
Source:
public void testWithProvisioningConfig() throws Exception { boolean isRasberryPiSharedWithTenants = (rasberrypiDeviceConfiguration.getProvisioningConfig() != null) && rasberrypiDeviceConfiguration .getProvisioningConfig().isSharedWithAllTenants(); setProvisioningConfig.invoke(androidDeviceTypeManagerService, "carbon.super", androidDeviceConfiguration); ProvisioningConfig provisioningConfig = androidDeviceTypeManagerService.getProvisioningConfig(); Assert.assertEquals(provisioningConfig.isSharedWithAllTenants(), androidDeviceConfiguration.getProvisioningConfig().isSharedWithAllTenants(), "Provisioning configs " + "are not correctly set as per the configuration file provided"); setProvisioningConfig.invoke(rasberrypiDeviceTypeManagerService, "carbon.super", rasberrypiDeviceConfiguration); provisioningConfig = rasberrypiDeviceTypeManagerService.getProvisioningConfig(); Assert.assertEquals(provisioningConfig.isSharedWithAllTenants(), isRasberryPiSharedWithTenants, "Provisioning configs are not correctly set as per the configuration file provided."); }

Target:
public void testWithProvisioningConfig() throws Exception { boolean isRasberryPiSharedWithTenants = (rasberrypiDeviceConfiguration.getProvisioningConfig() != null) && rasberrypiDeviceConfiguration .getProvisioningConfig().isSharedWithAllTenants(); setProvisioningConfig.invoke(androidDeviceTypeManagerService, MultitenantConstants.SUPER_TENANT_DOMAIN_NAME, androidDeviceConfiguration); ProvisioningConfig provisioningConfig = androidDeviceTypeManagerService.getProvisioningConfig(); Assert.assertEquals(provisioningConfig.isSharedWithAllTenants(), androidDeviceConfiguration.getProvisioningConfig().isSharedWithAllTenants(), "Provisioning configs " + "are not correctly set as per the configuration file provided"); setProvisioningConfig.invoke(rasberrypiDeviceTypeManagerService, MultitenantConstants.SUPER_TENANT_DOMAIN_NAME, rasberrypiDeviceConfiguration); provisioningConfig = rasberrypiDeviceTypeManagerService.getProvisioningConfig(); Assert.assertEquals(provisioningConfig.isSharedWithAllTenants(), isRasberryPiSharedWithTenants, "Provisioning configs are not correctly set as per the configuration file provided."); }
Source:
public void setUp() { MockitoAnnotations.initMocks(this); translator = new StandardTranslator(this.consumerTypeCurator, this.environmentCurator, this.ownerCurator, this.entitlementCurator); InputStream is = this.getClass().getResourceAsStream(RulesCurator.DEFAULT_RULES_FILE); Rules rules = new Rules(Util.readFile(is)); Locale locale = new Locale("en_US"); when(rulesCuratorMock.getUpdated()).thenReturn(new Date()); when(rulesCuratorMock.getRules()).thenReturn(rules); when(cacheProvider.get()).thenReturn(cache); this.provider = new JsRunnerProvider(rulesCuratorMock, cacheProvider); i18n = I18nFactory.getI18n(getClass(), "org.candlepin.i18n.Messages", locale, I18nFactory.FALLBACK); RulesObjectMapper objectMapper = new RulesObjectMapper(new ProductCachedSerializationModule(productCurator)); this.complianceRules = new ComplianceRules(provider.get(), this.entCurator, new StatusReasonMessageGenerator(i18n), eventSink, this.consumerCurator, this.consumerTypeCurator, objectMapper, translator); this.consumerEnricher = new ConsumerEnricher(this.complianceRules, this.ownerProductCurator); }

Target:
public void setUp() { MockitoAnnotations.initMocks(this); translator = new StandardTranslator(this.consumerTypeCurator, this.environmentCurator, this.ownerCurator); InputStream is = this.getClass().getResourceAsStream(RulesCurator.DEFAULT_RULES_FILE); Rules rules = new Rules(Util.readFile(is)); Locale locale = new Locale("en_US"); when(rulesCuratorMock.getUpdated()).thenReturn(new Date()); when(rulesCuratorMock.getRules()).thenReturn(rules); when(cacheProvider.get()).thenReturn(cache); this.provider = new JsRunnerProvider(rulesCuratorMock, cacheProvider); i18n = I18nFactory.getI18n(getClass(), "org.candlepin.i18n.Messages", locale, I18nFactory.FALLBACK); RulesObjectMapper objectMapper = new RulesObjectMapper(new ProductCachedSerializationModule(productCurator)); this.complianceRules = new ComplianceRules(provider.get(), this.entCurator, new StatusReasonMessageGenerator(i18n), eventSink, this.consumerCurator, this.consumerTypeCurator, objectMapper, translator); this.consumerEnricher = new ConsumerEnricher(this.complianceRules, this.ownerProductCurator); }
Source:
public WebElement forElementPresent(By by) { changeImplicitWait(250, TimeUnit.MILLISECONDS); try { return wait.until(ExpectedConditions.presenceOfElementLocated(by)); } catch(TimeoutException e) { PageObjectLogging.log( ELEMENT_PRESENT_MESSAGE, String.format(ELEMENT_PRESENT_ERROR_FORMAT, by.toString()), true ); throw e; } finally { restoreDeaultImplicitWait(); } }

Target:
public WebElement forElementPresent(By by) { changeImplicitWait(250, TimeUnit.MILLISECONDS); try { return wait.until(ExpectedConditions.presenceOfElementLocated(by)); } catch(TimeoutException e) { PageObjectLogging.log( ELEMENT_PRESENT_MESSAGE, String.format(ELEMENT_PRESENT_ERROR_FORMAT, by.toString()), false ); throw e; } finally { restoreDeaultImplicitWait(); } }
Source:
public void beforeAll(ExtensionContext extensionContext) throws Exception { LOGGER.debug("initializing"); ClusterConnection clusterConnection = getClusterConnection(extensionContext); Class<?> testClass = extensionContext.getRequiredTestClass(); AnnotationSupport.findAnnotatedFields(testClass, SpringDataElasticsearch.class).forEach(field -> { if (field.getType().isAssignableFrom(ClusterConnectionInfo.class)) { field.setAccessible(true); try { field.set(null, clusterConnection.getClusterConnectionInfo()); } catch (IllegalAccessException e) { LOGGER.warn("could not set value in field of class {}", field.getName(), testClass.getName(), e); } } }); }

Target:
public void beforeAll(ExtensionContext extensionContext) throws Exception { initLock.lock(); try { ExtensionContext.Store store = getStore(extensionContext); ClusterConnection clusterConnection = store.getOrComputeIfAbsent(STORE_KEY_CLUSTER_CONNECTION, key -> { LOGGER.debug("creating ClusterConnection"); return createClusterConnection(); }, ClusterConnection.class); store.getOrComputeIfAbsent(STORE_KEY_CLUSTER_CONNECTION_INFO, key -> clusterConnection.getClusterConnectionInfo()); } finally { initLock.unlock(); } }
Source:
protected void launchDeployCommand(final IServer server, final MBeanServerConnection connection, final ObjectName objectName, final String methodName, IProgressMonitor monitor) throws Exception { final Exception[] e = new Exception[1]; final Object waitObject = new Object(); final Boolean[] subtaskComplete = new Boolean[1]; subtaskComplete[0] = new Boolean(false); Thread t = new Thread() { public void run() { Exception exception = null; try { executeDeploymentCommand(connection, objectName, methodName); } catch( Exception ex ) { exception = ex; } synchronized(waitObject) { e[0] = exception; subtaskComplete[0] = new Boolean(true); waitObject.notifyAll(); } } }; t.start(); int count = 0; while(t.isAlive() && !monitor.isCanceled() && count <= 4000) { count+= 1000; synchronized(waitObject) { if( subtaskComplete[0].booleanValue() ) break; waitObject.wait(1000); } } synchronized(waitObject) { if( !subtaskComplete[0].booleanValue()) { t.interrupt(); IStatus status = new Status(IStatus.WARNING, JBossServerCorePlugin.PLUGIN_ID, IEventCodes.DEPLOYMENT_SCANNER_TRANSITION_CANCELED, Messages.JMXScannerCanceled, null); ServerLogger.getDefault().log(server, status); } else if( e[0] != null ) { String error = methodName.equals(IJBossRuntimeConstants.START) ? Messages.JMXResumeScannerError : Messages.JMXPauseScannerError; IStatus status = new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, IEventCodes.DEPLOYMENT_SCANNER_TRANSITION_FAILED, error, e[0]); ServerLogger.getDefault().log(server, status); } } }

Target:
protected void launchDeployCommand(final IServer server, final MBeanServerConnection connection, final ObjectName objectName, final String methodName, IProgressMonitor monitor) throws Exception { final Exception[] e = new Exception[1]; final Object waitObject = new Object(); final Boolean[] subtaskComplete = new Boolean[1]; subtaskComplete[0] = Boolean.FALSE; Thread t = new Thread() { public void run() { Exception exception = null; try { executeDeploymentCommand(connection, objectName, methodName); } catch( Exception ex ) { exception = ex; } synchronized(waitObject) { e[0] = exception; subtaskComplete[0] = Boolean.TRUE; waitObject.notifyAll(); } } }; t.start(); int count = 0; while(t.isAlive() && !monitor.isCanceled() && count <= 4000) { count+= 1000; synchronized(waitObject) { if( subtaskComplete[0].booleanValue() ) break; waitObject.wait(1000); } } synchronized(waitObject) { if( !subtaskComplete[0].booleanValue()) { t.interrupt(); IStatus status = new Status(IStatus.WARNING, JBossServerCorePlugin.PLUGIN_ID, IEventCodes.DEPLOYMENT_SCANNER_TRANSITION_CANCELED, Messages.JMXScannerCanceled, null); ServerLogger.getDefault().log(server, status); } else if( e[0] != null ) { String error = methodName.equals(IJBossRuntimeConstants.START) ? Messages.JMXResumeScannerError : Messages.JMXPauseScannerError; IStatus status = new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, IEventCodes.DEPLOYMENT_SCANNER_TRANSITION_FAILED, error, e[0]); ServerLogger.getDefault().log(server, status); } } }