auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void assertRunning() { if ( stopped ) { throw new IllegalStateException( "Can't start new transaction with stopped " + getClass() ); } }

Target:
private void assertRunning() { if ( availabilityGuard.isShutdown() ) { throw new DatabaseShutdownException(); } if ( stopped ) { throw new IllegalStateException( "Can't start new transaction with stopped " + getClass() ); } }
Source:
public void getFreshTimestampShouldFail() { getIndividualTimestamps(20); goBackInTimeFor(10); assertThatThrownBy(timelockService::getFreshTimestamp) .isInstanceOf(AssertionError.class) .hasMessage(generateClocksWentBackwardsMessage(20, 11)); }

Target:
public void getFreshTimestampShouldFail() { when(rawTimelockService.getFreshTimestamp()).thenReturn(1L); assertThrowsOnSecondCall(timelockService::getFreshTimestamp); }
Source:
public Collection<PluginInfo> getDownloadedPlugins() { return listPlugins(this.downloadDir) .stream() .map(PluginInfo::create) .collect(Collectors.toList()); }

Target:
public Collection<PluginInfo> getDownloadedPlugins() { return listPlugins(this.downloadDir) .stream() .map(PluginInfo::create) .collect(MoreCollectors.toList()); }
Source:
private static File initKeystoreDir() { final File target = new File(System.getProperty("user.dir"), "target"); assertTrue(target.exists()); String dataTestDir = TEST_UTIL.getDataTestDir().toString(); File keystoreDir = new File(dataTestDir, TestRESTServerSSL.class.getSimpleName() + "_keys"); keystoreDir.mkdirs(); return keystoreDir; }

Target:
private static File initKeystoreDir() { String dataTestDir = TEST_UTIL.getDataTestDir().toString(); File keystoreDir = new File(dataTestDir, TestRESTServerSSL.class.getSimpleName() + "_keys"); keystoreDir.mkdirs(); return keystoreDir; }
Source:
public void propagate(int idxVarInProp, int mask) throws ContradictionException { sdm[idxVarInProp].freeze(); if (idxVarInProp < k) { SetVar intersection = vars[k]; sdm[idxVarInProp].forEach(j -> { if (!intersection.getUB().contains(j)) { SetVar uniqueSet = findUniqueSetThatDoesNotContainJInLB(j); if (uniqueSet != null) { uniqueSet.remove(j, this); } } }, SetEventType.ADD_TO_KER); } else { sdm[idxVarInProp].forEach(j -> { SetVar uniqueSet = findUniqueSetThatDoesNotContainJInLB(j); if (uniqueSet != null) { uniqueSet.remove(j, this); } }, SetEventType.REMOVE_FROM_ENVELOPE); } sdm[idxVarInProp].unfreeze(); }

Target:
public void propagate(int idxVarInProp, int mask) throws ContradictionException { sdm[idxVarInProp].freeze(); if (idxVarInProp < k) { sdm[idxVarInProp].forEach(onSetAddToKer, SetEventType.ADD_TO_KER); } else { sdm[idxVarInProp].forEach(onIntersectionRemoveFromEnv, SetEventType.REMOVE_FROM_ENVELOPE); } sdm[idxVarInProp].unfreeze(); }
Source:
public KafkaConnectorTask(KafkaConsumerFactory<?, ?> factory, Properties consumerProps, DatastreamTask task, long commitIntervalMillis, Duration retrySleepDuration, int retryCount) { LOG.info("Creating kafka connector task for datastream task with commit interval {}Ms", task, commitIntervalMillis); _consumerProps = consumerProps; VerifiableProperties properties = new VerifiableProperties(_consumerProps); _processingDelayLogThresholdMs = properties.containsKey(PROCESSING_DELAY_LOG_TRESHOLD_MS) ? properties.getLong(PROCESSING_DELAY_LOG_TRESHOLD_MS) : DEFAULT_PROCESSING_DELAY_LOG_TRESHOLD_MS; _consumerFactory = factory; _datastream = task.getDatastreams().get(0); _task = task; _retryCount = retryCount; _startOffsets = Optional.ofNullable(_datastream.getMetadata().get(DatastreamMetadataConstants.START_POSITION)) .map(json -> JsonUtils.fromJson(json, new TypeReference<Map<Integer, Long>>() { })); _offsetCommitInterval = commitIntervalMillis; _retrySleepDuration = retrySleepDuration; _datastreamName = task.getDatastreams().get(0).getName(); _consumerMetrics = new CommonConnectorMetrics(CLASS_NAME, _datastreamName); _consumerMetrics.createEventProcessingMetrics(); _consumerMetrics.createPollMetrics(); _consumerMetrics.createPartitionMetrics(); }

Target:
public KafkaConnectorTask(KafkaConsumerFactory<?, ?> factory, Properties consumerProps, DatastreamTask task, long commitIntervalMillis, Duration retrySleepDuration, int retryCount) { LOG.info("Creating kafka connector task for datastream task with commit interval {}Ms", task, commitIntervalMillis); _consumerProps = consumerProps; VerifiableProperties properties = new VerifiableProperties(_consumerProps); _processingDelayLogThresholdMs = properties.containsKey(PROCESSING_DELAY_LOG_TRESHOLD_MS) ? properties.getLong(PROCESSING_DELAY_LOG_TRESHOLD_MS) : DEFAULT_PROCESSING_DELAY_LOG_TRESHOLD_MS; _consumerFactory = factory; _datastream = task.getDatastreams().get(0); _task = task; _retryCount = retryCount; _startOffsets = Optional.ofNullable(_datastream.getMetadata().get(DatastreamMetadataConstants.START_POSITION)) .map(json -> JsonUtils.fromJson(json, new TypeReference<Map<Integer, Long>>() { })); _offsetCommitInterval = commitIntervalMillis; _retrySleepDuration = retrySleepDuration; _datastreamName = task.getDatastreams().get(0).getName(); _consumerMetrics = new CommonConnectorMetrics(CLASS_NAME, _datastreamName, LOG); _consumerMetrics.createEventProcessingMetrics(); _consumerMetrics.createPollMetrics(); _consumerMetrics.createPartitionMetrics(); }
Source:
private <T extends Tree> void checkStatements(List<T> statements) { Map<String, KeyWriteCollectionUsage> usedKeys = new HashMap<>(); Symbol collection = null; for (T statement : statements) { KeyWriteCollectionUsage keyWriteUsage = keyWriteUsage(statement); if (keyWriteUsage != null) { if (collection != null && keyWriteUsage.collectionSymbol != collection) { usedKeys.clear(); } KeyWriteCollectionUsage sameKeyWriteUsage = usedKeys.get(keyWriteUsage.indexOrKey); if (sameKeyWriteUsage != null) { this.addIssue(keyWriteUsage.tree, message(keyWriteUsage.indexOrKey, sameKeyWriteUsage.tree)); } usedKeys.put(keyWriteUsage.indexOrKey, keyWriteUsage); collection = keyWriteUsage.collectionSymbol; } else { usedKeys.clear(); } } }

Target:
private <T extends Tree> void checkStatements(List<T> statements) { Map<String, KeyWriteCollectionUsage> usedKeys = new HashMap<>(); Symbol collection = null; for (T statement : statements) { KeyWriteCollectionUsage keyWriteUsage = keyWriteUsage(statement); if (keyWriteUsage != null) { if (collection != null && keyWriteUsage.collectionSymbol != collection) { usedKeys.clear(); } KeyWriteCollectionUsage sameKeyWriteUsage = usedKeys.get(keyWriteUsage.indexOrKey); if (sameKeyWriteUsage != null) { addIssue(keyWriteUsage.tree, message(keyWriteUsage.indexOrKey, sameKeyWriteUsage.tree)).secondary(sameKeyWriteUsage.tree); } usedKeys.put(keyWriteUsage.indexOrKey, keyWriteUsage); collection = keyWriteUsage.collectionSymbol; } else { usedKeys.clear(); } } }
Source:
public SecureStore get() { String secureStore = getCurrentSecureStoreName(); if (DefaultSecureStore.NAME.equals(secureStore)) { return defaultSecureStore; } int separatorPosition = secureStore.lastIndexOf("/"); if (separatorPosition < 0) { throw new SecureStoreException(String.format( "Unsupported secure store format %s." + "Proper format is: $plugin_name/$secure_store_name", secureStore)); } String storeName = secureStore.substring(separatorPosition + 1); String pluginName = secureStore.substring(0, separatorPosition); Set<SecureStoreData> stores = getSecureStores(pluginName); for (SecureStoreData store : stores) { if (store.getStoreName().equals(secureStore)) { Class<? extends SecureStore> secureStoreImpl = store.load(); return new SecureStoreWrapper(injector.getInstance(secureStoreImpl)); } } throw new SecureStoreException(String.format( "Cannot find secure store with name %s in plugin %s", storeName, pluginName)); }

Target:
public SecureStore get() { String secureStore = getCurrentSecureStoreName(); if (DefaultSecureStore.NAME.equals(secureStore)) { log.debug("Default SecureStore was selected"); return defaultSecureStore; } int separatorPosition = secureStore.lastIndexOf("/"); if (separatorPosition < 0) { throw new SecureStoreException(String.format( "Unsupported secure store format %s." + "Proper format is: $plugin_name/$secure_store_name", secureStore)); } String storeName = secureStore.substring(separatorPosition + 1); String pluginName = secureStore.substring(0, separatorPosition); Set<SecureStoreData> stores = getSecureStores(pluginName); for (SecureStoreData store : stores) { if (store.getStoreName().equals(secureStore)) { Class<? extends SecureStore> secureStoreImpl = store.load(); log.info("Custom secure store '{}' was selected.", secureStore); return new SecureStoreWrapper(injector.getInstance(secureStoreImpl)); } } throw new SecureStoreException(String.format( "Cannot find secure store with name %s in plugin %s", storeName, pluginName)); }
Source:
public RuleProcessorRuntime(RuleProcessorRuntimeDependenciesBuilder builder) { this.rulesProcessor = builder.getRulesProcessor(); this.rulesRuntime = builder.getRulesRuntime(); buildStreamToRulesRuntime(); rulesProcessor.getConfig().getBoolean("flag"); this.processAll = rulesProcessor.getProcessAll(); }

Target:
public RuleProcessorRuntime(RuleProcessorRuntimeDependenciesBuilder builder) { this.rulesProcessor = builder.getRulesProcessor(); this.rulesRuntime = builder.getRulesRuntime(); buildStreamToRulesRuntime(); this.processAll = rulesProcessor.getProcessAll(); }
Source:
private void checkServerState(ControllableServerBehavior beh, String oldMode, String mode) { int state = pollState(); if (!Objects.equals(oldMode, mode)) { IModule[] modules = getServer().getModules(); for( int i = 0; i < modules.length; i++ ) { ((Server)getServer()).setModulePublishState(new IModule[]{modules[i]}, IServer.PUBLISH_STATE_FULL); } new Job("Publishing server " + getServer().getName()) { @Override protected IStatus run(IProgressMonitor monitor) { return getServer().publish(IServer.PUBLISH_INCREMENTAL, monitor); } }.schedule(3000); } if( state == IServer.STATE_STARTED) { beh.setServerStarted(); beh.setRunMode(mode); } else { beh.setServerStopped(); ((ControllableServerBehavior)getControllableBehavior()).setRunMode(null); } }

Target:
private void checkServerState(ControllableServerBehavior beh, String oldMode, String mode) { int state = pollState(); if (!Objects.equals(oldMode, mode)) { IModule[] modules = getServer().getModules(); for( int i = 0; i < modules.length; i++ ) { ((Server)getServer()).setModulePublishState(new IModule[]{modules[i]}, IServer.PUBLISH_STATE_FULL); } if( state == IServer.STATE_STARTED && Boolean.TRUE.equals(beh.getSharedData(OpenShiftServerBehaviour.CURRENTLY_RESTARTING))) { Job j = new Job("Publishing server " + getServer().getName()) { @Override protected IStatus run(IProgressMonitor monitor) { return getServer().publish(IServer.PUBLISH_INCREMENTAL, monitor); } }; j.schedule(3000); beh.putSharedData(OpenShiftServerBehaviour.CURRENTLY_RESTARTING, null); } } if( state == IServer.STATE_STARTED) { beh.setServerStarted(); beh.setRunMode(mode); } else { beh.setServerStopped(); ((ControllableServerBehavior)getControllableBehavior()).setRunMode(null); } }
Source:
public void removeAgent(String uuid) { agentInstanceMap.remove(uuid); }

Target:
public void removeAgent(String uuid) { uuidToAgentInstanceMap.remove(uuid); }
Source:
public Instant getDeletedAt() { if (this.deletedAt == null) { return Instant.EPOCH; } return deletedAt; }

Target:
public Instant getDeletedAt() { return deletedAt; }
Source:
public String getJavaString(final ExpressionOperatorParameter parameters) { final Type castFrom = getLeft().getOutputType(parameters); final Type castTo = getRight().getOutputType(parameters); switch (getCastType(castFrom, castTo)) { case NUMTOINT: return new StringBuilder().append("((int)(").append(getLeft().getJavaString(parameters)).append("))") .toString(); case NUMTOFLOAT: return new StringBuilder().append("((float)(").append(getLeft().getJavaString(parameters)).append("))") .toString(); case NUMTODOUBLE: return new StringBuilder().append("((double)(").append(getLeft().getJavaString(parameters)).append("))") .toString(); case NUMTOLONG: return new StringBuilder().append("((long)(").append(getLeft().getJavaString(parameters)).append("))") .toString(); case TOSTR: return new StringBuilder().append("String.valueOf(").append(getLeft().getJavaString(parameters)).append(")") .toString(); case STRTOINT: return new StringBuilder().append("Integer.parseInt(").append(getLeft().getJavaString(parameters)).append(")") .toString(); case STRTOFLOAT: return new StringBuilder().append("Float.parseFloat(").append(getLeft().getJavaString(parameters)).append(")") .toString(); case STRTODOUBLE: return new StringBuilder().append("Double.parseDouble(").append(getLeft().getJavaString(parameters)) .append(")").toString(); case STRTOLONG: return new StringBuilder().append("Long.parseLong(").append(getLeft().getJavaString(parameters)).append(")") .toString(); default: throw new IllegalStateException("should not reach here."); } }

Target:
public String getJavaString(final ExpressionOperatorParameter parameters) { final Type castFrom = getLeft().getOutputType(parameters); final Type castTo = getRight().getOutputType(parameters); switch (getCastType(castFrom, castTo)) { case NUMTOINT: return getPrimitiveTypeCastString("int", parameters); case NUMTOFLOAT: return getPrimitiveTypeCastString("float", parameters); case NUMTODOUBLE: return getPrimitiveTypeCastString("double", parameters); case NUMTOLONG: return getPrimitiveTypeCastString("long", parameters); case TOSTR: return getLeftFunctionCallString("String.valueOf", parameters); case STRTOINT: return getLeftFunctionCallString("Integer.parseInt", parameters); case STRTOFLOAT: return getLeftFunctionCallString("Float.parseFloat", parameters); case STRTODOUBLE: return getLeftFunctionCallString("Double.parseDouble", parameters); case STRTOLONG: return getLeftFunctionCallString("Long.parseLong", parameters); default: throw new IllegalStateException("should not reach here."); } }
Source:
public String describe() { return "DatasetVersion: " + version.getId() + " " + version.getDataset().getDisplayName() + ".v" + version.getFriendlyVersionNumber(); }

Target:
public String describe() { return super.describe() + "DatasetVersion: [" + version.getId() + " (v" + version.getFriendlyVersionNumber()+")]"; }
Source:
public SubscriptionHealthProblemIndicator laggingIndicator() { if (healthProperties.isLaggingIndicatorEnabled()) { return new LaggingIndicator(healthProperties.getMaxLagInSeconds()); } return new DisabledIndicator(); }

Target:
public SubscriptionHealthProblemIndicator laggingIndicator() { if (healthProperties.isLaggingIndicatorEnabled()) { return new LaggingIndicator(healthProperties.getMaxLagInSeconds()); } return DISABLED_INDICATOR; }
Source:
public BufferAggregator factorizeBuffered(final ColumnSelectorFactory columnSelectorFactory) { compiledScript = getCompiledScript(); return new JavaScriptBufferAggregator( fieldNames.stream().map(columnSelectorFactory::makeColumnValueSelector).collect(Collectors.toList()), compiledScript ); }

Target:
public BufferAggregator factorizeBuffered(final ColumnSelectorFactory columnSelectorFactory) { JavaScriptAggregator.ScriptAggregator compiledScript = getCompiledScript(); return new JavaScriptBufferAggregator( fieldNames.stream().map(columnSelectorFactory::makeColumnValueSelector).collect(Collectors.toList()), compiledScript ); }
Source:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append(getName()).append(": "); sb.append("(volume: ").append(getVolume()); sb.append("logicalVolume: ").append(getLogicalVolume()); sb.append("mount: ").append(getMount()); sb.append("description: ").append(getDescription()); sb.append("fileSystemType: ").append(getType()); sb.append("total space: ").append(getTotalSpace()); sb.append("free Space available: ").append(getFreeSpace()); sb.append("usable space available: ").append(getUsableSpace()); sb.append("total Inodes: ").append(getTotalInodes()); sb.append("free Inodes: ").append(getFreeInodes()); return sb.toString(); }

Target:
public String toString() { return String.format( " %s (%s) [%s] %s of %s free (%.1f%%), %s of %s files free (%.1f%%) is %s " + (getLogicalVolume() != null && getLogicalVolume().length() > 0 ? "[%s]" : "%s") + " and is mounted at %s", getName(), getDescription().isEmpty() ? "file system" : getDescription(), getType(), FormatUtil.formatBytes(getUsableSpace()), FormatUtil.formatBytes(getTotalSpace()), 100d * getUsableSpace() / getTotalSpace(), FormatUtil.formatValue(getFreeInodes(), ""), FormatUtil.formatValue(getTotalInodes(), ""), 100d * getFreeInodes() / getTotalInodes(), getVolume(), getLogicalVolume(), getMount()); }
Source:
public static String rangeParser(List<String> values) { return String.valueOf(ThreadLocalRandom.current().nextInt(Integer.valueOf(values.get(0)), Integer.valueOf(values.get(1))) ); }

Target:
public static String rangeParser(List<String> values) { if (values == null) { return "0"; } return String.valueOf(ThreadLocalRandom.current().nextInt(Integer.valueOf(values.get(0)), Integer.valueOf(values.get(1))) ); }
Source:
public void checkClientTrusted(X509Certificate[] certificates, String authType) throws CertificateException { if (certificates != null) { if (LOG.isDebugEnabled()) { for (int c = 0; c < certificates.length; c++) { X509Certificate cert = certificates[c]; LOG.debug(" Client certificate " + (c + 1) + ":"); LOG.debug(" Subject DN: " + cert.getSubjectDN()); LOG.debug(" Signature Algorithm: " + cert.getSigAlgName()); LOG.debug(" Valid from: " + cert.getNotBefore()); LOG.debug(" Valid until: " + cert.getNotAfter()); LOG.debug(" Issuer: " + cert.getIssuerDN()); } } defaultTrustManager.checkClientTrusted(certificates, authType); } }

Target:
public void checkClientTrusted(X509Certificate[] certificates, String authType) throws CertificateException { if (certificates != null) { if (LOGGER.isDebugEnabled()) { for (int c = 0; c < certificates.length; c++) { X509Certificate cert = certificates[c]; LOGGER.debug(" Client certificate " + (c + 1) + ":"); LOGGER.debug(" Subject DN: " + cert.getSubjectDN()); LOGGER.debug(" Signature Algorithm: " + cert.getSigAlgName()); LOGGER.debug(" Valid from: " + cert.getNotBefore()); LOGGER.debug(" Valid until: " + cert.getNotAfter()); LOGGER.debug(" Issuer: " + cert.getIssuerDN()); } } defaultTrustManager.checkClientTrusted(certificates, authType); } }
Source:
public Mono<Void> updateDigitalTwin(String digitalTwinId, List<Object> digitalTwinUpdateOperations) { return updateDigitalTwinWithResponse(digitalTwinId, digitalTwinUpdateOperations, new RequestOptions()) .flatMap(voidResponse -> Mono.empty()); }

Target:
public Mono<Void> updateDigitalTwin(String digitalTwinId, List<Object> digitalTwinUpdateOperations) { return updateDigitalTwinWithResponse(digitalTwinId, digitalTwinUpdateOperations, new UpdateDigitalTwinRequestOptions()) .flatMap(voidResponse -> Mono.empty()); }
Source:
public Void visit(Boolean inTailPosition, FieldGet fieldGet) { fieldGet.getObjectExpr().acceptVisitor(this, inTailPosition); return null; }

Target:
public Void visit(Boolean inTailPosition, FieldGet fieldGet) { fieldGet.getObjectExpr().acceptVisitor(this, false); return null; }
Source:
private CardDetailsEntity buildCardDetailsEntity(AuthCardDetails authCardDetails) { CardDetailsEntity detailsEntity = new CardDetailsEntity(); detailsEntity.setCardBrand(sanitize(authCardDetails.getCardBrand())); detailsEntity.setCardHolderName(sanitize(authCardDetails.getCardHolder())); detailsEntity.setExpiryDate(authCardDetails.getEndDate()); if (hasFullCardNumber(authCardDetails)) { detailsEntity.setFirstDigitsCardNumber(FirstDigitsCardNumber.of(StringUtils.left(authCardDetails.getCardNo(), 6))); } if (hasLastFourCharactersCardNumber(authCardDetails)) { detailsEntity.setLastDigitsCardNumber(LastDigitsCardNumber.of(StringUtils.right(authCardDetails.getCardNo(), 4))); } authCardDetails.getAddress().ifPresent(address -> { AddressEntity addressEntity = new AddressEntity(address); processRegionForCanadaOrUs(addressEntity); detailsEntity.setBillingAddress(addressEntity); }); detailsEntity.setCardType(PayersCardType.toCardType(authCardDetails.getPayersCardType())); return detailsEntity; }

Target:
private CardDetailsEntity buildCardDetailsEntity(AuthCardDetails authCardDetails) { CardDetailsEntity detailsEntity = new CardDetailsEntity(); detailsEntity.setCardBrand(sanitize(authCardDetails.getCardBrand())); detailsEntity.setCardHolderName(sanitize(authCardDetails.getCardHolder())); detailsEntity.setExpiryDate(authCardDetails.getEndDate()); if (hasFullCardNumber(authCardDetails)) { detailsEntity.setFirstDigitsCardNumber(FirstDigitsCardNumber.of(StringUtils.left(authCardDetails.getCardNo(), 6))); } if (hasLastFourCharactersCardNumber(authCardDetails)) { detailsEntity.setLastDigitsCardNumber(LastDigitsCardNumber.of(StringUtils.right(authCardDetails.getCardNo(), 4))); } authCardDetails.getAddress().ifPresent(address -> { var addressEntity = new AddressEntity(address); northAmericanRegionMapper.getNorthAmericanRegionForCountry(address) .map(NorthAmericaRegion::getAbbreviation) .ifPresent(stateOrProvinceAbbreviation -> { addressEntity.setStateOrProvince(stateOrProvinceAbbreviation); }); detailsEntity.setBillingAddress(addressEntity); }); detailsEntity.setCardType(PayersCardType.toCardType(authCardDetails.getPayersCardType())); return detailsEntity; }
Source:
public boolean test(final Node<? extends View<?>, ? extends Edge> node, final Node<? extends View<?>, ? extends Edge> node2) { checkNotNull("node", node); checkNotNull("node2", node2); if (!isCandidate.test(node) && !isCandidate.test(node2)) { return true; } boolean matchParent = isCandidate.test(node) ? Objects.equals(GraphUtils.getParent(node2), candidateParent.orElse(null)) : Objects.equals(GraphUtils.getParent(node), candidateParent.orElse(null)); return matchParent && parentsTypeMatchPredicate.test(node, node2); }

Target:
public boolean test(final Node<? extends View<?>, ? extends Edge> node, final Node<? extends View<?>, ? extends Edge> node2) { checkNotNull("node", node); checkNotNull("node2", node2); if (!isCandidate.test(node) && !isCandidate.test(node2)) { return true; } return parentsMatchPredicate.test(node, node2); }
Source:
public boolean hasTargets() { return !targets.isEmpty(); }

Target:
public boolean hasTargets() { return (targets != null && !targets.isEmpty()); }
Source:
public static void reopenTraceFromElement(final TmfCommonProjectElement traceElement, final IReusableEditor editor) { final IFile file; try { file = traceElement.createBookmarksFile(); } catch (final CoreException e) { Activator.getDefault().logError(Messages.TmfOpenTraceHelper_ErrorOpeningTrace + ' ' + traceElement.getName()); TraceUtils.displayErrorMsg(Messages.TmfOpenTraceHelper_OpenTrace, Messages.TmfOpenTraceHelper_ErrorTrace + ENDL + ENDL + e.getMessage()); return; } Thread thread = new Thread() { @Override public void run() { final ITmfTrace trace = openProjectElement(traceElement, file); if (trace == null) { return; } final IEditorInput editorInput = new TmfEditorInput(file, trace); Display.getDefault().asyncExec(new Runnable() { @Override public void run() { final IWorkbench wb = PlatformUI.getWorkbench(); final IWorkbenchPage activePage = wb.getActiveWorkbenchWindow().getActivePage(); activePage.reuseEditor(editor, editorInput); activePage.activate(editor); } }); } }; thread.start(); }

Target:
public static void reopenTraceFromElement(final TmfCommonProjectElement traceElement, final IReusableEditor editor) { final IFile file; try { file = traceElement.createBookmarksFile(); } catch (final CoreException e) { Activator.getDefault().logError(NLS.bind(Messages.TmfOpenTraceHelper_ErrorOpeningElement, traceElement.getTypeName()) + ' ' + traceElement.getName()); TraceUtils.displayErrorMsg(NLS.bind(Messages.TmfOpenTraceHelper_OpenElement, traceElement.getTypeName()), NLS.bind(Messages.TmfOpenTraceHelper_ErrorElement, traceElement.getTypeName()) + ENDL + ENDL + e.getMessage()); return; } Thread thread = new Thread() { @Override public void run() { final ITmfTrace trace = openProjectElement(traceElement, file); if (trace == null) { return; } final IEditorInput editorInput = new TmfEditorInput(file, trace); Display.getDefault().asyncExec(new Runnable() { @Override public void run() { final IWorkbench wb = PlatformUI.getWorkbench(); final IWorkbenchPage activePage = wb.getActiveWorkbenchWindow().getActivePage(); activePage.reuseEditor(editor, editorInput); activePage.activate(editor); } }); } }; thread.start(); }
Source:
AddImageTask(ImageDetails imageDetails, DataSourceProcessorProgressMonitor progressMonitor, AddDataSourceCallbacks addDataSourceCallbacks, AddImageTaskCallback addImageTaskCallback) { this.deviceId = imageDetails.deviceId; this.imagePath = imageDetails.imagePath; this.sectorSize = imageDetails.sectorSize; this.timeZone = imageDetails.timeZone; this.ignoreFatOrphanFiles = imageDetails.ignoreFatOrphanFiles; this.md5 = imageDetails.md5; this.sha1 = imageDetails.sha1; this.sha256 = imageDetails.sha256; this.imageWriterSettings = imageDetails.imageWriterSettings; this.addDataSourceCallbacks = addDataSourceCallbacks; this.addImageTaskCallback = addImageTaskCallback; this.progressMonitor = progressMonitor; tskAddImageProcessLock = new Object(); }

Target:
AddImageTask(ImageDetails imageDetails, DataSourceProcessorProgressMonitor progressMonitor, AddDataSourceCallbacks addDataSourceCallbacks, AddImageTaskCallback addImageTaskCallback) { this.imageDetails = imageDetails; this.addDataSourceCallbacks = addDataSourceCallbacks; this.addImageTaskCallback = addImageTaskCallback; this.progressMonitor = progressMonitor; tskAddImageProcessLock = new Object(); }
Source:
public int hashCode() { return definition.hashCode(); }

Target:
public int hashCode() { return HashUtil.combineHashCodes(definition == null ? 0 : definition.hashCode()); }
Source:
public void makeClass(IntCharSet set, boolean caseless) { if (caseless) set = set.getCaseless(scanner.getUnicodeProperties()); int oldSize = classes.size(); for (int i = 0; i < oldSize; i++) { IntCharSet x = classes.get(i); if (x.equals(set)) return; IntCharSet and = x.and(set); if (and.containsElements()) { if (x.equals(and)) { set.sub(and); continue; } else if (set.equals(and)) { x.sub(and); classes.add(and); return; } set.sub(and); x.sub(and); classes.add(and); } } }

Target:
public void makeClass(IntCharSet set, boolean caseless) { if (caseless) set = set.getCaseless(scanner.getUnicodeProperties()); if (DEBUG) { Out.debug("makeClass(" + set + ")"); debugDump(); } int oldSize = classes.size(); for (int i = 0; i < oldSize; i++) { IntCharSet x = classes.get(i); if (Objects.equals(x, set)) return; IntCharSet and = x.and(set); if (and.containsElements()) { if (Objects.equals(x, and)) { set.sub(and); continue; } else if (Objects.equals(set, and)) { x.sub(and); classes.add(and); if (DEBUG) { Out.debug("makeClass(..) finished"); debugDump(); } return; } set.sub(and); x.sub(and); classes.add(and); } } if (DEBUG) { Out.debug("makeClass(..) finished"); debugDump(); } }
Source:
public Tool getToolFromNamespaceAndRepo(String namespace, String repository) { try { String name = namespace + "/" + repository; QuayRepo repo = repositoryApi.getRepo(name, true); Tool tool = new Tool(); tool.setName(repo.getName()); tool.setNamespace(repo.getNamespace()); tool.setRegistry(Registry.QUAY_IO.toString()); tool.setMode(ToolMode.AUTO_DETECT_QUAY_TAGS_AUTOMATED_BUILDS); return tool; } catch (ApiException ex) { LOG.warn(quayToken.getUsername() + " Exception: {}", ex); throw new CustomWebApplicationException("Could not get repository from Quay.io", HttpStatus.SC_BAD_REQUEST); } }

Target:
public Tool getToolFromNamespaceAndRepo(String namespace, String repository) { try { String name = namespace + "/" + repository; QuayRepo repo = repositoryApi.getRepo(name, true); Tool tool = new Tool(); tool.setName(repo.getName()); tool.setNamespace(repo.getNamespace()); tool.setRegistry(Registry.QUAY_IO.getDockerPath()); tool.setMode(ToolMode.AUTO_DETECT_QUAY_TAGS_AUTOMATED_BUILDS); return tool; } catch (ApiException ex) { LOG.warn(quayToken.getUsername() + " Exception: {}", ex); throw new CustomWebApplicationException("Could not get repository from Quay.io", HttpStatus.SC_BAD_REQUEST); } }
Source:
public NetSocketImpl(VertxInternal vertx, ChannelHandlerContext channel, SocketAddress remoteAddress, ContextInternal context, SSLHelper helper, TCPMetrics metrics) { super(vertx, channel, context); this.helper = helper; this.writeHandlerID = EventbusAddresses.generateInternal("net"); this.remoteAddress = remoteAddress; this.metrics = metrics; }

Target:
public NetSocketImpl(VertxInternal vertx, ChannelHandlerContext channel, SocketAddress remoteAddress, ContextInternal context, SSLHelper helper, TCPMetrics metrics) { super(vertx, channel, context); this.helper = helper; this.writeHandlerID = "__vertx.net." + UUID.randomUUID().toString(); this.remoteAddress = remoteAddress; this.metrics = metrics; }
Source:
public IPinUpdater<? extends ActivityNode> instantiate(ActivityNode node){ IPinUpdater<? extends ActivityNode> updater = null; if(node instanceof CallBehaviorAction){ updater = new CallBehaviorActionPinUpdater(); }else if(node instanceof CallOperationAction){ updater = new CallOperationActionPinUpdater(); }else if(node instanceof SendSignalAction){ updater = new SendSignalActionPinUpdater(); } return updater; }

Target:
public <T extends ActivityNode> IPinUpdater<T> instantiate(ActivityNode node) { IPinUpdater<T> updater = null; if (node instanceof CallBehaviorAction) { updater = (IPinUpdater<T>) new CallBehaviorActionPinUpdater(); } else if (node instanceof CallOperationAction) { updater = (IPinUpdater<T>) new CallOperationActionPinUpdater(); } else if (node instanceof SendSignalAction) { updater = (IPinUpdater<T>) new SendSignalActionPinUpdater(); } return updater; }
Source:
void updateRefreshInterval() { interval = getRefreshIndexInterval(); setReschedule(interval > 0); if (doReschedule) { cancel(); schedule(interval); } }

Target:
private void updateRefreshInterval() { interval = getRefreshIndexInterval(); setReschedule(interval > 0); cancel(); schedule(interval); }
Source:
private void layoutPreview() { if (contents.getExtract().length() > 0) { extractText.setText(contents.getExtract()); } int placeholderResId = Utils.getThemedAttributeId(getContext(), R.attr.lead_image_drawable); if (!TextUtils.isEmpty(contents.getTitle().getThumbUrl()) && WikipediaApp.getInstance().isImageDownloadEnabled()) { String imageUrl = WikipediaApp.getInstance().getNetworkProtocol() + ":" + contents.getTitle().getThumbUrl(); Picasso.with(getActivity()) .load(imageUrl) .placeholder(placeholderResId) .error(placeholderResId) .into(leadImage); } else { Picasso.with(getActivity()) .load(placeholderResId) .into(leadImage); } }

Target:
private void layoutPreview() { if (!TextUtils.isEmpty(contents.getExtract())) { extractText.setText(contents.getExtract()); } int placeholderResId = ResourceUtil.getThemedAttributeId(getContext(), R.attr.lead_image_drawable); if (shouldDownloadLeadImage()) { Picasso.with(getActivity()) .load(contents.getTitle().getThumbUrl()) .placeholder(placeholderResId) .error(placeholderResId) .into(leadImage); } else { Picasso.with(getActivity()) .load(placeholderResId) .into(leadImage); } }
Source:
private String updateSchemeIdsForActions() { if (DbConnectionFactory.isMySql()) { return MYSQL_UPDATE_SCHEME_IDS_FOR_ACTIONS; } else if (DbConnectionFactory.isPostgres()) { return POSTGRES_UPDATE_SCHEME_IDS_FOR_ACTIONS; } else if (DbConnectionFactory.isMsSql()) { return MSSQL_UPDATE_SCHEME_IDS_FOR_ACTIONS; } else if (DbConnectionFactory.isOracle()) { return ORACLE_UPDATE_SCHEME_IDS_FOR_ACTIONS; } else { return null; } }

Target:
private String updateSchemeIdsForActions() { String sql = null; if (DbConnectionFactory.isMySql()) { sql = MYSQL_UPDATE_SCHEME_IDS_FOR_ACTIONS; } else if (DbConnectionFactory.isPostgres()) { sql = POSTGRES_UPDATE_SCHEME_IDS_FOR_ACTIONS; } else if (DbConnectionFactory.isMsSql()) { sql = MSSQL_UPDATE_SCHEME_IDS_FOR_ACTIONS; } else if (DbConnectionFactory.isOracle()) { sql = ORACLE_UPDATE_SCHEME_IDS_FOR_ACTIONS; } return sql; }
Source:
public Pixmap getPixmap(Format format, Color color) { int width = getWidth(); ByteBuffer src = getBuffer(); Pixmap pixmap; if (color == Color.WHITE) { pixmap = new Pixmap(width, getRows(), Format.Alpha); BufferUtils.copy(src, pixmap.getPixels(), pixmap.getPixels().capacity()); } else { pixmap = new Pixmap(width, getRows(), Format.RGBA8888); int srcPitch = getPitch(); int srcRGBA = Color.rgba8888(color); IntBuffer dst = pixmap.getPixels().asIntBuffer(); for (int y = 0; y < getRows(); y++) { int ySrcPitch = y * srcPitch; int yWidth = y * width; for (int x = 0; x < width; x++) { byte alpha = src.get(ySrcPitch + x); dst.put(yWidth + x, (srcRGBA & 0xffffff00) | (int)((srcRGBA & 0xff) * (alpha & 0xff)/255f)); } } } Pixmap converted = pixmap; if (format != Format.RGBA8888) { converted = new Pixmap(pixmap.getWidth(), pixmap.getHeight(), format); Blending blending = Pixmap.getBlending(); Pixmap.setBlending(Blending.None); converted.drawPixmap(pixmap, 0, 0); Pixmap.setBlending(blending); pixmap.dispose(); } return converted; }

Target:
public Pixmap getPixmap(Format format, Color color) { int width = getWidth(); ByteBuffer src = getBuffer(); Pixmap pixmap; if (color == Color.WHITE) { pixmap = new Pixmap(width, getRows(), Format.Alpha); BufferUtils.copy(src, pixmap.getPixels(), pixmap.getPixels().capacity()); } else { pixmap = new Pixmap(width, getRows(), Format.RGBA8888); int srcPitch = getPitch(); int srcRGBA = Color.rgba8888(color); IntBuffer dst = pixmap.getPixels().asIntBuffer(); for (int y = 0; y < getRows(); y++) { int ySrcPitch = y * srcPitch; int yWidth = y * width; for (int x = 0; x < width; x++) { byte alpha = src.get(ySrcPitch + x); dst.put(yWidth + x, (srcRGBA & 0xffffff00) | (int)((srcRGBA & 0xff) * (alpha & 0xff)/255f)); } } } Pixmap converted = pixmap; if (format != pixmap.getFormat()) { converted = new Pixmap(pixmap.getWidth(), pixmap.getHeight(), format); Blending blending = Pixmap.getBlending(); Pixmap.setBlending(Blending.None); converted.drawPixmap(pixmap, 0, 0); Pixmap.setBlending(blending); pixmap.dispose(); } return converted; }
Source:
public Object apply(RevisionResource rsrc, Input input) throws IOException, NoSuchChangeException, OrmException, PatchSetInfoNotAvailableException { final PatchSet updatedPatchSet = dbProvider.get().patchSets() .atomicUpdate(rsrc.getPatchSet().getId(), new AtomicUpdate<PatchSet>() { @Override public PatchSet update(PatchSet patchset) { patchset.setDraft(false); return patchset; } }); final Change updatedChange = dbProvider.get().changes() .atomicUpdate(rsrc.getChange().getId(), new AtomicUpdate<Change>() { @Override public Change update(Change change) { if (change.getStatus() == Change.Status.DRAFT) { change.setStatus(Change.Status.NEW); ChangeUtil.updated(change); } return change; } }); if (!updatedPatchSet.isDraft() || updatedChange.getStatus() == Change.Status.NEW) { indexer.index(updatedChange); hooks.doDraftPublishedHook(updatedChange, updatedPatchSet, dbProvider.get()); sender.send(rsrc.getChange().getStatus() == Change.Status.DRAFT, rsrc.getUser(), updatedChange, updatedPatchSet, rsrc.getControl().getLabelTypes()); } return Response.none(); }

Target:
public Object apply(RevisionResource rsrc, Input input) throws IOException, ResourceNotFoundException, ResourceConflictException, OrmException, AuthException { if (!rsrc.getPatchSet().isDraft()) { throw new ResourceConflictException("Patch set is not a draft"); } if (!rsrc.getControl().canPublish(dbProvider.get())) { throw new AuthException("Cannot publish this draft patch set"); } PatchSet updatedPatchSet = updateDraftPatchSet(rsrc); Change updatedChange = updateDraftChange(rsrc); try { if (!updatedPatchSet.isDraft() || updatedChange.getStatus() == Change.Status.NEW) { indexer.index(updatedChange); hooks.doDraftPublishedHook(updatedChange, updatedPatchSet, dbProvider.get()); sender.send(rsrc.getChange().getStatus() == Change.Status.DRAFT, rsrc.getUser(), updatedChange, updatedPatchSet, rsrc.getControl().getLabelTypes()); } } catch (PatchSetInfoNotAvailableException e) { throw new ResourceNotFoundException(e.getMessage()); } return Response.none(); }
Source:
void readBatch( int total, ColumnVector column, TypeInfo columnType) throws IOException { int rowId = 0; while (total > 0) { consume(); int leftInPage = (int) (endOfPageValueCount - valuesRead); int num = Math.min(total, leftInPage); if (isCurrentPageDictionaryEncoded) { LongColumnVector dictionaryIds = new LongColumnVector(); readIntegers(num, dictionaryIds, rowId, maxDefLevel, (VectorizedValuesReader) dataColumn); decodeDictionaryIds(rowId, num, column, dictionaryIds); } else { PrimitiveTypeInfo primitiveColumnType = (PrimitiveTypeInfo) columnType; switch (primitiveColumnType.getPrimitiveCategory()) { case INT: case BYTE: case SHORT: readIntegers(num, (LongColumnVector) column, rowId, maxDefLevel, (VectorizedValuesReader) dataColumn); break; case DATE: case INTERVAL_YEAR_MONTH: case LONG: readLongs(num, (LongColumnVector) column, rowId, maxDefLevel, (VectorizedValuesReader) dataColumn); break; case BOOLEAN: readBooleans(num, (LongColumnVector) column, rowId, maxDefLevel, (VectorizedValuesReader) dataColumn); break; case DOUBLE: readDoubles(num, (DoubleColumnVector) column, rowId, maxDefLevel, (VectorizedValuesReader) dataColumn); break; case BINARY: case STRING: case CHAR: case VARCHAR: readBinarys(num, (BytesColumnVector) column, rowId, maxDefLevel, (VectorizedValuesReader) dataColumn); break; case FLOAT: readFloats(num, (DoubleColumnVector) column, rowId, maxDefLevel, (VectorizedValuesReader) dataColumn); break; case DECIMAL: readDecimal(num, (DecimalColumnVector) column, rowId, maxDefLevel, (VectorizedValuesReader) dataColumn); case INTERVAL_DAY_TIME: case TIMESTAMP: break; default: throw new IOException("Unsupported"); } } rowId += num; total -= num; } }

Target:
void readBatch( int total, ColumnVector column, TypeInfo columnType) throws IOException { int rowId = 0; while (total > 0) { int leftInPage = (int) (endOfPageValueCount - valuesRead); if (leftInPage == 0) { readPage(); leftInPage = (int) (endOfPageValueCount - valuesRead); } int num = Math.min(total, leftInPage); if (isCurrentPageDictionaryEncoded) { LongColumnVector dictionaryIds = new LongColumnVector(); readDictionaryIDs(num, dictionaryIds, rowId); decodeDictionaryIds(rowId, num, column, dictionaryIds); } else { PrimitiveTypeInfo primitiveColumnType = (PrimitiveTypeInfo) columnType; switch (primitiveColumnType.getPrimitiveCategory()) { case INT: case BYTE: case SHORT: readIntegers(num, (LongColumnVector) column, rowId); break; case DATE: case INTERVAL_YEAR_MONTH: case LONG: readLongs(num, (LongColumnVector) column, rowId); break; case BOOLEAN: readBooleans(num, (LongColumnVector) column, rowId); break; case DOUBLE: readDoubles(num, (DoubleColumnVector) column, rowId); break; case BINARY: case STRING: case CHAR: case VARCHAR: readBinaries(num, (BytesColumnVector) column, rowId); break; case FLOAT: readFloats(num, (DoubleColumnVector) column, rowId); break; case DECIMAL: readDecimal(num, (DecimalColumnVector) column, rowId); break; case INTERVAL_DAY_TIME: case TIMESTAMP: default: throw new IOException( "Unsupported type category: " + primitiveColumnType.getPrimitiveCategory()); } } rowId += num; total -= num; } }
Source:
public void basicRefactoringTest() throws IOException { BugCheckerRefactoringTestHelper testHelper = BugCheckerRefactoringTestHelper .newInstance(new PublicConstructorForAbstractClass(), getClass()); testHelper.addInputLines( "in/Test.java", "public abstract class Test {", " public Test() { }", "}" ).addOutputLines( "out/Test.java", "public abstract class Test {", " protected Test() { }", "}" ).doTest(); }

Target:
public void basicRefactoringTest() throws IOException { BugCheckerRefactoringTestHelper testHelper = BugCheckerRefactoringTestHelper .newInstance(new PublicConstructorForAbstractClass(), getClass()); testHelper.addInputLines( "in/Test.java", "public abstract class Test {", " public Test() {", " }", "}" ).addOutputLines( "out/Test.java", "public abstract class Test {", " protected Test() {", " }", "}" ).doTest(); }
Source:
private static @NonNull Set<Long> getActiveThreads(TmfTimeRange winRange, @NonNull ITmfTrace trace) { ThreadStatusDataProvider threadStatusProvider = DataProviderManager.getInstance().getDataProvider(trace, ThreadStatusDataProvider.ID, ThreadStatusDataProvider.class); if (threadStatusProvider == null) { return Collections.emptySet(); } long beginTS = winRange.getStartTime().getValue(); long endTS = winRange.getEndTime().getValue(); TimeQueryFilter filter = new TimeQueryFilter(beginTS, endTS, 2); TmfModelResponse<TmfTreeModel<@NonNull ThreadEntryModel>> response = threadStatusProvider.fetchTree(FetchParametersUtils.timeQueryToMap(filter), null); TmfTreeModel<@NonNull ThreadEntryModel> model = response.getModel(); if (model == null) { return Collections.emptySet(); } return Sets.newHashSet(Iterables.transform(model.getEntries(), ThreadEntryModel::getId)); }

Target:
private static @NonNull Set<Long> getActiveThreads(TmfTimeRange winRange, @NonNull ITmfTrace trace) { ThreadStatusDataProvider threadStatusProvider = DataProviderManager.getInstance().getDataProvider(trace, ThreadStatusDataProvider.ID, ThreadStatusDataProvider.class); if (threadStatusProvider == null) { return Collections.emptySet(); } long beginTS = winRange.getStartTime().getValue(); long endTS = winRange.getEndTime().getValue(); TimeQueryFilter filter = new TimeQueryFilter(beginTS, endTS, 2); TmfModelResponse<TmfTreeModel<@NonNull ThreadEntryModel>> response = threadStatusProvider.fetchTree(FetchParametersUtils.timeQueryToMap(filter), null); TmfTreeModel<@NonNull ThreadEntryModel> model = response.getModel(); if (model == null) { return Collections.emptySet(); } HashSet<Long> activeThreads = Sets.newHashSet(Iterables.transform(model.getEntries(), ThreadEntryModel::getId)); return activeThreads == null ? Collections.emptySet() : activeThreads; }
Source:
public void testUnrecognizedInstallSourceIsParsedCorrectly() { final String unrecognizedInstallerPackageName = "com.unrecognized"; final InstallSource installSource = InstallSource.fromInstallerPackageName(unrecognizedInstallerPackageName); assertTrue(installSource instanceof UnrecognizedInstallSource); assertEquals(unrecognizedInstallerPackageName, installSource.toString()); }

Target:
public void testUnrecognizedInstallSourceIsParsedCorrectly() { final String unrecognizedInstallerPackageName = "com.unrecognized"; final InstallSource installSource = InstallSource.fromInstallerPackageName(unrecognizedInstallerPackageName); assertTrue( "Non-null package name is correctly identified as an unrecognized install source", installSource instanceof UnrecognizedInstallSource); assertEquals( "Unrecognized install source returns raw package name as description", unrecognizedInstallerPackageName, installSource.toString()); }
Source:
public Template saveTemplate(final IHTMLPage page, final User user, final PageForm pageForm) throws BadRequestException, DotDataException, DotSecurityException, IOException { try { final Host host = getHost(pageForm.getHostId(), user); final User systemUser = userAPI.getSystemUser(); final Template template = getTemplate(page, systemUser, pageForm); final boolean hasPermission = template.isAnonymous() ? permissionAPI.doesUserHavePermission(page, PermissionLevel.EDIT.getType(), user) : permissionAPI.doesUserHavePermission(template, PermissionLevel.EDIT.getType(), user); if (!hasPermission) { throw new DotSecurityException("The user don't have permission to EDIT"); } template.setDrawed(true); return this.templateAPI.saveTemplate(template, host, user, false); } catch (Exception e) { throw new DotRuntimeException(e); } }

Target:
public Template saveTemplate(final IHTMLPage page, final User user, final PageForm pageForm) throws BadRequestException, DotDataException, DotSecurityException, IOException { try { final Host host = getHost(pageForm.getHostId(), user); final User systemUser = userAPI.getSystemUser(); final Template template = getTemplate(page, systemUser, pageForm); final boolean hasPermission = template.isAnonymous() ? permissionAPI.doesUserHavePermission(page, PermissionLevel.EDIT.getType(), user) : permissionAPI.doesUserHavePermission(template, PermissionLevel.EDIT.getType(), user); if (!hasPermission) { throw new DotSecurityException("The user doesn't have permission to EDIT"); } template.setDrawed(true); return this.templateAPI.saveTemplate(template, host, user, false); } catch (Exception e) { throw new DotRuntimeException(e); } }
Source:
public void close() { this.executor.shutdown(); for (Future<?> future1 : this.expirationFutures.values()) { future1.cancel(false); } for (Future<?> future : this.expirationFutures.values()) { if (! future.isDone()) { try { future.get(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } catch (ExecutionException e) { } } } this.expirationFutures.clear(); }

Target:
public void close() { this.executor.shutdown(); for (Future<?> future : this.expirationFutures.values()) { future.cancel(false); } for (Future<?> future : this.expirationFutures.values()) { if (! future.isDone()) { try { future.get(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } catch (ExecutionException e) { } } } this.expirationFutures.clear(); }
Source:
public void test() { connect(); isCheckedButton = jq(".z-button:contains(isChecked)"); JQuery moldLocation = jq(".z-checkbox-mold"); String switchClass = ".z-checkbox-switch"; String toggleClass = ".z-checkbox-toggle"; String offClass = ".z-checkbox-off"; String onClass = ".z-checkbox-on"; verifyClassChange(jq(".z-button:contains(Switch)"), jq(switchClass + offClass)); Assert.assertFalse(jq(".z-checkbox > input").isVisible()); verifyChecked("false"); verifyClassChange(moldLocation, jq(switchClass + onClass)); verifyChecked("true"); verifyClassChange(jq(".z-button:contains(Toggle)"), jq(toggleClass + onClass)); verifyClassChange(moldLocation, jq(toggleClass + offClass)); verifyChecked("false"); click(jq(".z-button:contains(setDisabled)")); waitResponse(); Assert.assertEquals("0.5", moldLocation.css("opacity")); verifyClassChange(moldLocation, jq(toggleClass + offClass)); verifyChecked("false"); }

Target:
public void test() { connect(); isCheckedButton = findButtonContains("isChecked"); JQuery moldLocation = jq(".z-checkbox-mold"); String switchMold = ".z-checkbox-switch"; String toggleMold = ".z-checkbox-toggle"; String off = "-off"; String on = "-on"; verifyClassChange(findButtonContains("Switch"), jq(switchMold + off)); Assert.assertFalse(jq(".z-checkbox > input").isVisible()); verifyChecked("false"); verifyClassChange(moldLocation, jq(switchMold + on)); verifyChecked("true"); verifyClassChange(findButtonContains("Toggle"), jq(toggleMold + on)); verifyClassChange(moldLocation, jq(toggleMold + off)); verifyChecked("false"); verifyClassChange(findButtonContains("setDisabled"), jq(toggleMold + "-disabled")); verifyClassChange(moldLocation, jq(toggleMold + off)); verifyChecked("false"); }
Source:
public static VCFHeader readHeaderFrom(final SeekableStream in) throws IOException { FeatureCodecHeader headerCodec; final long initialPos = in.position(); try { BufferedInputStream bis = new BufferedInputStream(in); InputStream is = SamStreams.isGzippedSAMFile(bis) ? new GZIPInputStream(bis) : bis; headerCodec = new VCFCodec().readHeader(new AsciiLineReaderIterator(AsciiLineReader.from(is))); } catch (TribbleException e) { in.seek(initialPos); InputStream bin = new BufferedInputStream(in); if (BlockCompressedInputStream.isValidFile(bin)) { bin = new BlockCompressedInputStream(bin); } try { headerCodec = new BCF2Codec().readHeader(new PositionalBufferedStream(bin)); } catch (TribbleException e2) { throw new IOException("No VCF header found", e2); } } return (VCFHeader) headerCodec.getHeaderValue(); }

Target:
public static VCFHeader readHeaderFrom(final SeekableStream in) throws IOException { final long initialPos = in.position(); byte[] magicBytes = InputStreamUtils.readFully(bufferAndDecompressIfNecessary(in), BCFVersion.MAGIC_HEADER_START.length); in.seek(initialPos); if (magicBytes[0] == '#') { return readHeaderFrom(in, new VCFCodec()); } else if (Arrays.equals(magicBytes, BCFVersion.MAGIC_HEADER_START)) { return readHeaderFrom(in, new BCF2Codec()); } throw new IOException("No VCF header found"); }