auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
void testMapPasswordBase64EncodedTrue() { CustomLdapUserDetailsMapper userDetailsMapper = new CustomLdapUserDetailsMapper(); userDetailsMapper.setBase64EncodedPassword(true); String encodedPassword = userDetailsMapper.mapPassword("{MD5}X03MO1qnZdYdgyfeuILPmQ=="); assertThat(encodedPassword).isEqualTo("{MD5}5f4dcc3b5aa765d61d8327deb882cf99"); encodedPassword = userDetailsMapper.mapPassword("e2JjcnlwdH0kMmEkMTAkbHB3bHh5anZYS3pOMWNjQ3J3MlBCdVp4LmVWZXNXYmZtVGJzckNib01VLmdzTldWY1pXTWk="); assertThat(encodedPassword).isEqualTo("{bcrypt}$2a$10$lpwlxyjvXKzN1ccCrw2PBuZx.eVesWbfmTbsrCboMU.gsNWVcZWMi"); }

Target:
public void testMapPasswordBase64EncodedTrue() { CustomLdapUserDetailsMapper userDetailsMapper = new CustomLdapUserDetailsMapper(); userDetailsMapper.setUserPasswordEncoded(true); String encodedPassword = userDetailsMapper.mapPassword("{MD5}X03MO1qnZdYdgyfeuILPmQ=="); assertThat(encodedPassword).isEqualTo("{MD5}5f4dcc3b5aa765d61d8327deb882cf99"); encodedPassword = userDetailsMapper.mapPassword("e2JjcnlwdH0kMmEkMTAkbHB3bHh5anZYS3pOMWNjQ3J3MlBCdVp4LmVWZXNXYmZtVGJzckNib01VLmdzTldWY1pXTWk="); assertThat(encodedPassword).isEqualTo("{bcrypt}$2a$10$lpwlxyjvXKzN1ccCrw2PBuZx.eVesWbfmTbsrCboMU.gsNWVcZWMi"); }
Source:
public boolean getNextBatch(ResultWriter writer, int batchSize) { try { response = searchBuilder .setSize(batchSize) .setFrom(pos) .execute() .actionGet(); } catch (Exception e) { e.printStackTrace(); return false; } SearchHits hits = response.getHits(); SearchHit[] res = hits.hits(); int amount = Math.min(batchSize, res.length); for (int i = 0; i < amount; i++) { SearchHit hit = hits.getAt(i); writer.add(new NodeKey(hit.getId()), hit.getScore()); } pos += amount; return pos < hits.getTotalHits(); }

Target:
public boolean getNextBatch(ResultWriter writer, int batchSize) { query.put("from", pos); query.put("size", batchSize); try { EsResponse res = client.search(index, type, query); Document hits = (Document) res.get("hits"); totalHits = hits.getInteger("total"); List items = hits.getArray("hits"); for (Object doc : items) { Document hit = (Document) doc; String nodeKey = hit.getString("_id"); float score = (hit.getDouble("_score").floatValue()); writer.add(new NodeKey(nodeKey), score); pos++; } return pos < totalHits; } catch (IOException e) { return false; } }
Source:
public Collection<Object> get() { return emptyList(); }

Target:
public Collection<Object> get() { return keys; }
Source:
protected void addToQueue(Exchange exchange, boolean copy) throws SedaConsumerNotAvailableException { BlockingQueue<Exchange> queue = null; QueueReference queueReference = endpoint.getQueueReference(); if (queueReference != null) { queue = queueReference.getQueue(); } if (queue == null) { throw new SedaConsumerNotAvailableException("No queue available on endpoint: " + endpoint, exchange); } boolean empty = !queueReference.hasConsumers(); if (empty) { if (endpoint.isFailIfNoConsumers()) { throw new SedaConsumerNotAvailableException("No consumers available on endpoint: " + endpoint, exchange); } else if (endpoint.isDiscardIfNoConsumers()) { log.debug("Discard message as no active consumers on endpoint: {}", endpoint); return; } } Exchange target = exchange; if (copy) { target = prepareCopy(exchange, true); } log.trace("Adding Exchange to queue: {}", target); if (blockWhenFull && offerTimeout == 0) { try { queue.put(target); } catch (InterruptedException e) { log.debug("Put interrupted, are we stopping? {}", isStopping() || isStopped()); } } else if(blockWhenFull && offerTimeout > 0) { try { queue.offer(target, offerTimeout, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { log.debug("offer interrupted, are we stopping? {}", isStopping() || isStopped()); } } else { queue.add(target); } }

Target:
protected void addToQueue(Exchange exchange, boolean copy) throws SedaConsumerNotAvailableException { boolean offerTime; BlockingQueue<Exchange> queue = null; QueueReference queueReference = endpoint.getQueueReference(); if (queueReference != null) { queue = queueReference.getQueue(); } if (queue == null) { throw new SedaConsumerNotAvailableException("No queue available on endpoint: " + endpoint, exchange); } boolean empty = !queueReference.hasConsumers(); if (empty) { if (endpoint.isFailIfNoConsumers()) { throw new SedaConsumerNotAvailableException("No consumers available on endpoint: " + endpoint, exchange); } else if (endpoint.isDiscardIfNoConsumers()) { log.debug("Discard message as no active consumers on endpoint: {}", endpoint); return; } } Exchange target = exchange; if (copy) { target = prepareCopy(exchange, true); } log.trace("Adding Exchange to queue: {}", target); if (blockWhenFull && offerTimeout == 0) { try { queue.put(target); } catch (InterruptedException e) { log.debug("Put interrupted, are we stopping? {}", isStopping() || isStopped()); } } else if (blockWhenFull && offerTimeout > 0) { try { offerTime = queue.offer(target, offerTimeout, TimeUnit.MILLISECONDS); if (!offerTime) { throw new IllegalStateException("Fails to insert element into queue, " + "after timeout of" + offerTimeout + "milliseconds"); } } catch (InterruptedException e) { log.debug("Offer interrupted, are we stopping? {}", isStopping() || isStopped()); } } else { queue.add(target); } }
Source:
static <K, V> java.util.Map<K, Collection<V>> toJavaMap(Multimap<K, V> multimap) { final java.util.Map<K, Collection<V>> javaMap = new java.util.HashMap<>(); final Supplier<Collection<V>> javaContainerSupplier; final ContainerType containerType = multimap.getContainerType(); if (containerType == ContainerType.SEQ) { javaContainerSupplier = java.util.ArrayList::new; } else if (containerType == ContainerType.SET) { javaContainerSupplier = java.util.HashSet::new; } else if (containerType == ContainerType.SORTED_SET) { javaContainerSupplier = java.util.TreeSet::new; } else { throw new IllegalStateException("Unknown ContainerType: " + containerType); } for (Tuple2<K, V> t : multimap) { javaMap.computeIfAbsent(t._1, k -> javaContainerSupplier.get()).add(t._2); } return javaMap; }

Target:
static <K, V> java.util.Map<K, Collection<V>> toJavaMap(Multimap<K, V> multimap) { final java.util.Map<K, Collection<V>> javaMap = new java.util.HashMap<>(); final Supplier<Collection<V>> javaContainerSupplier = multimap.getContainerType().getJavaContainerSupplier(); for (Tuple2<K, V> t : multimap) { javaMap.computeIfAbsent(t._1, k -> javaContainerSupplier.get()).add(t._2); } return javaMap; }
Source:
private void initGlusterPeerProcess() { List<VDS> vdsList = getVdsDAO().getAllForVdsGroupWithStatus(getVdsGroupId(), VDSStatus.Up); if (vdsList != null && vdsList.size() > 1) { VDS upServer = null; for (VDS vds : vdsList) { if (!Guid.OpEquality(getVdsId(), vds.getId()) && vds.getstatus() == VDSStatus.Up) { upServer = vds; break; } } if (upServer != null) { if (!hostExists(getGlusterPeers(upServer.getId()), getVds())) { String newServerName = getVds().gethost_name().isEmpty() ? getVds().getManagmentIp() : getVds().gethost_name(); glusterPeerProbe(upServer.getId(), newServerName); } } } }

Target:
private void initGlusterPeerProcess() { List<VDS> vdsList = getVdsDAO().getAllForVdsGroupWithStatus(getVdsGroupId(), VDSStatus.Up); if (vdsList != null && vdsList.size() > 1) { VDS upServer = null; for (VDS vds : vdsList) { if (!Guid.OpEquality(getVdsId(), vds.getId())) { upServer = vds; break; } } if (upServer != null) { if (!hostExists(getGlusterPeers(upServer.getId()), getVds())) { try { glusterPeerProbe(upServer.getId(), getVds().gethost_name()); } catch (Exception e) { log.errorFormat("Could not peer probe the gluster server {0}. Error: {1}", getVds().getvds_name(), e.getMessage()); } } } } }
Source:
private String transform(String word) { int wordLength = word.length(); if (wordLength < transformations.minLen) { return word; } for (int i = Math.min(wordLength, 9); i >= 3; i--) { String wordEnding = word.substring(wordLength - i); if (transformations.map.containsKey(wordEnding)) { return word.replace(wordEnding, transformations.map.get(wordEnding)); } } return word; }

Target:
private String transform(String word) { int wordLength = word.length(); if (wordLength < transformations.minLen) { return word; } for (int i = Math.min(wordLength, transformations.maxLen); i >= transformations.minLen; i--) { String wordEnding = word.substring(wordLength - i); String replacement = transformations.map.get(wordEnding); if (replacement != null) { return word.replace(wordEnding, replacement); } } return word; }
Source:
private void parametersPrecondition(String title, String url) { if ((invalidParam(title)) || invalidParam(url)) { throw new RuntimeException("Invalid arguments: need URL and TITLE"); } }

Target:
private void parametersPrecondition(String title, String url) { if ((invalidParam(title)) || invalidParam(url)) { throw new IllegalArgumentException("Invalid arguments: need URL and TITLE"); } }
Source:
private void pausePartitions() { Validate.isTrue(_consumer != null); LOG.info("List of partitions to pause changed for datastream: {}. The list is: {}", _datastream.getName(), _pausedSourcePartitions); Set<TopicPartition> partitionsToPause = new HashSet<>(); Set<TopicPartition> pausedPartitions = _consumer.paused(); Set<TopicPartition> assignedPartitions = _consumer.assignment(); for (String source : _pausedSourcePartitions.keySet()) { for (String partition : _pausedSourcePartitions.get(source)) { partitionsToPause.add(new TopicPartition(source, Integer.parseInt(partition))); } } partitionsToPause.retainAll(assignedPartitions); _consumer.resume(pausedPartitions); LOG.info("Resumed these partitions: {}", pausedPartitions); _consumer.pause(partitionsToPause); LOG.info("Paused these partitions: {}", partitionsToPause); _pausedPartitionsUpdatedCount++; }

Target:
private void pausePartitions() { _pausedPartitionsUpdatedCount++; Validate.isTrue(_consumer != null); LOG.info("List of partitions to pause changed for datastream: {}. The list is: {}", _datastream.getName(), _pausedSourcePartitions); Set<TopicPartition> partitionsToPause = new HashSet<>(); Set<TopicPartition> pausedPartitions = _consumer.paused(); Set<TopicPartition> assignedPartitions = _consumer.assignment(); for (String source : _pausedSourcePartitions.keySet()) { for (String partition : _pausedSourcePartitions.get(source)) { partitionsToPause.add(new TopicPartition(source, Integer.parseInt(partition))); } } partitionsToPause.retainAll(assignedPartitions); if (partitionsToPause.equals(pausedPartitions)) { return; } _consumer.resume(pausedPartitions); LOG.info("Resumed these partitions: {}", pausedPartitions); _consumer.pause(partitionsToPause); LOG.info("Paused these partitions: {}", partitionsToPause); }
Source:
private boolean shouldBeApplied(Connection connection, Collection<Map.Entry<Address, List<Integer>>> partitions, int partitionStateVersion, boolean partitionStateVersionExist, PartitionTable current) { if (partitions.isEmpty()) { if (logger.isFinestEnabled()) { logFailure(connection, partitionStateVersion, partitionStateVersionExist, current, "response is empty"); } return false; } if (!current.connection.equals(connection)) { if (logger.isFinestEnabled()) { logFailure(connection, partitionStateVersion, partitionStateVersionExist, current, "response is from old connection"); } return false; } if (partitionStateVersionExist && partitionStateVersion <= current.partitionSateVersion) { if (logger.isFinestEnabled()) { logFailure(connection, partitionStateVersion, partitionStateVersionExist, current, "response state version is old"); } return false; } return true; }

Target:
private boolean shouldBeApplied(Connection connection, Collection<Map.Entry<Address, List<Integer>>> partitions, int partitionStateVersion, boolean partitionStateVersionExist, PartitionTable current) { if (partitions.isEmpty()) { if (logger.isFinestEnabled()) { logFailure(connection, partitionStateVersion, partitionStateVersionExist, current, "response is empty"); } return false; } if (!connection.equals(current.connection)) { if (logger.isFinestEnabled()) { logFailure(connection, partitionStateVersion, partitionStateVersionExist, current, "response is from old connection"); } return false; } if (partitionStateVersionExist && partitionStateVersion <= current.partitionSateVersion) { if (logger.isFinestEnabled()) { logFailure(connection, partitionStateVersion, partitionStateVersionExist, current, "response state version is old"); } return false; } return true; }
Source:
public void tearDown(ITestDevice device, IBuildInfo buildInfo, Throwable e) throws DeviceNotAvailableException { if (e instanceof DeviceNotAvailableException) { CLog.e("Device %s is not available. Teardown() skipped.", device.getSerialNumber()); return; } else { for (String apkPkgName : mApkInstalled) { super.uninstallPackage(device, apkPkgName); } if (!mTestApexInfoList.isEmpty()) { device.deleteFile(APEX_DATA_DIR + "*"); device.deleteFile(STAGING_DATA_DIR + "*"); device.deleteFile(SESSION_DATA_DIR + "*"); device.reboot(); } } }

Target:
public void tearDown(ITestDevice device, IBuildInfo buildInfo, Throwable e) throws DeviceNotAvailableException { if (e instanceof DeviceNotAvailableException) { CLog.e("Device %s is not available. Teardown() skipped.", device.getSerialNumber()); return; } else { if (mTestApexInfoList.isEmpty()) { super.tearDown(device, buildInfo, e); } else { for (String apkPkgName : mApkInstalled) { super.uninstallPackage(device, apkPkgName); } if (!mTestApexInfoList.isEmpty()) { device.deleteFile(APEX_DATA_DIR + "*"); device.deleteFile(STAGING_DATA_DIR + "*"); device.deleteFile(SESSION_DATA_DIR + "*"); device.reboot(); } } } }
Source:
public void setMetadataAccessRestrictionEnabled() { String metadataRestriction = SIDriver.driver().getConfiguration().getMetadataRestrictionEnabled(); metadataAccessRestrictionEnabled = metadataRestriction.equals(SQLConfiguration.METADATA_RESTRICTION_NATIVE) || metadataRestriction.equals(SQLConfiguration.METADATA_RESTRICTION_RANGER); SpliceLogUtils.trace(LOG,"metadataAccessRestritionEnabled=%b",metadataAccessRestrictionEnabled); }

Target:
public void setMetadataAccessRestrictionEnabled() { String metadataRestriction = SIDriver.driver().getConfiguration().getMetadataRestrictionEnabled(); metadataAccessRestrictionEnabled = metadataRestriction.equals(SQLConfiguration.METADATA_RESTRICTION_NATIVE) || metadataRestriction.equals(SQLConfiguration.METADATA_RESTRICTION_RANGER); SpliceLogUtils.info(LOG,"metadataAccessRestritionEnabled=%s",metadataRestriction); }
Source:
public void init() throws Exception { setupUserData(); apiPublisher = new APIPublisherRestClient(publisherURL); apiPublisher.login(SUPER_USER, SUPER_USER_LOGIN_PW); apiPublisherAdmin = new APIPublisherRestClient(publisherURL); apiPublisherAdmin.login(ADMIN_LOGIN_USERNAME, ADMIN_LOGIN_PW); String swaggerFilePath = resourceLocation + "swaggerFiles" + File.separator + "APIScopeTest1.json"; File swaggerFile = new File(swaggerFilePath); String swaggerContent = readFromFile(swaggerFile.getAbsolutePath()); JSONObject swaggerJson = new JSONObject(swaggerContent); String apiContext = swaggerJson.get("basePath").toString(); APIRequest apiRequest = new APIRequest(apiName, apiContext, apiVisibility, apiVersion, "", "Gold", new URL(backendEndPoint)); HttpResponse serviceResponse = apiPublisher.addAPI(apiRequest); verifyResponse(serviceResponse); APILifeCycleStateRequest updateRequest = new APILifeCycleStateRequest(apiName, SUPER_USER, APILifeCycleState.PUBLISHED); serviceResponse = apiPublisher.changeAPILifeCycleStatus(updateRequest); verifyResponse(serviceResponse); }

Target:
public void init() throws Exception { setupUserData(); apiPublisher = new APIPublisherRestClient(publisherURL); apiPublisher.login(SUPER_USER, SUPER_USER_LOGIN_PW); apiPublisherAdmin = new APIPublisherRestClient(publisherURL); apiPublisherAdmin.login(ADMIN_LOGIN_USERNAME, ADMIN_LOGIN_PW); String swaggerFilePath = resourceLocation + "swaggerFiles" + File.separator + "APIScopeTest1.json"; File swaggerFile = new File(swaggerFilePath); String swaggerContent = readFromFile(swaggerFile.getAbsolutePath()); JSONObject swaggerJson = new JSONObject(swaggerContent); String apiContext = swaggerJson.get("basePath").toString(); APIRequest apiRequest = new APIRequest(apiName, apiContext, apiVisibility, apiVersion, "", "Gold", new URL(backendEndPoint)); HttpResponse serviceResponse = apiPublisher.addAPI(apiRequest); verifyResponse(serviceResponse); APILifeCycleStateRequest updateRequest = new APILifeCycleStateRequest(apiName, SUPER_USER, APILifeCycleState.PUBLISHED); serviceResponse = apiPublisher.changeAPILifeCycleStatus(updateRequest); verifyResponse(serviceResponse); waitForAPIDeploymentSync(SUPER_USER, apiName, apiVersion, APIMIntegrationConstants.IS_API_EXISTS); }
Source:
private void checkThreadsSanity() { int tableCount = m_catalogContext.tables.size(); int hostcount = m_config.m_hostCount; int partitions = m_iv2Initiators.size() - 1; int replicates = m_configuredReplicationFactor; int importPartitions = ImportManager.getPartitionsCount(); int exportTableCount = ExportManager.instance().getExportTablesCount(); int exportNonceCount = ExportManager.instance().getConnCount(); int expThreadsCount = computeThreadsCount(tableCount, partitions, replicates, importPartitions, exportTableCount, exportNonceCount, hostcount); String[] command = {"bash", "-c" ,"ulimit -u"}; String cmd_rst = ShellTools.local_cmd(command); int maxThreadsCount = 0; try { maxThreadsCount = Integer.parseInt(cmd_rst.substring(0, cmd_rst.length() - 1)); } catch(Exception e) { maxThreadsCount = Integer.MAX_VALUE; } if (maxThreadsCount < expThreadsCount) { StringBuilder builder = new StringBuilder(); builder.append(String.format("The configuration of %d tables, %d partitions, %d replicates \n", tableCount, partitions, replicates)); builder.append(String.format("with importer configuration of %d importer partitions \n", importPartitions)); builder.append(String.format("with exporter configuration of %d export tables %d partitions %d replicates \n", exportTableCount, partitions, replicates)); builder.append(String.format("The maximum number of threads to the system is %d", maxThreadsCount)); builder.append("Please increase the maximum system threads number or reduce the number of threads in your program, and then restart VoltDB."); consoleLog.warn(builder.toString()); } }

Target:
private void checkThreadsSanity() { int tableCount = m_catalogContext.tables.size(); int partitions = m_iv2Initiators.size() - 1; int replicates = m_configuredReplicationFactor; int importPartitions = ImportManager.getPartitionsCount(); int exportTableCount = ExportManager.instance().getExportTablesCount(); int exportNonceCount = ExportManager.instance().getConnCount(); int expThreadsCount = computeThreadsCount(tableCount, partitions, replicates, importPartitions, exportTableCount, exportNonceCount); if (m_maxThreadsCount < expThreadsCount) { updateMaxThreadsLimit(); } if (m_maxThreadsCount < expThreadsCount) { StringBuilder builder = new StringBuilder(); builder.append(String.format("The configuration of %d tables, %d partitions, %d replicates, ", tableCount, partitions, replicates)); builder.append(String.format("with importer configuration of %d importer partitions, ", importPartitions)); builder.append(String.format("with exporter configuration of %d export tables %d partitions %d replicates, ", exportTableCount, partitions, replicates)); builder.append(String.format("approximately requires %d threads.", expThreadsCount)); builder.append(String.format("The maximum number of threads to the system is %d. \n", m_maxThreadsCount)); builder.append("Please increase the maximum system threads number or reduce the number of threads in your program, and then restart VoltDB. \n"); consoleLog.warn(builder.toString()); } }
Source:
protected void onGetStyles(View element, StyleAccumulator styles) { for (Method method : getViewGetters()) { boolean caught = false; try { @Nullable ViewDebug.ExportedProperty annotation = getExportedAnnotation(method); final Object returnedValue = method.invoke(element); final String cssName = convertGetterNameToCssName(method.getName()); if (method.getName().equals("getId")) { @Nullable String id = getIdAttribute(element); if (id == null) { styles.store("id", "(none)", false); } else { styles.store("id", id, false); } } else { if (method.getReturnType() == int.class) { int intValue = (int) returnedValue; if (canIntBeMappedToString(annotation)) { styles.store( cssName, intValue + "(" + mapIntToStringUsingAnnotations(intValue, annotation) + ")", false); } else { styles.store(cssName, String.valueOf(intValue), isDefaultValue(intValue, annotation)); } } else if (method.getReturnType() == float.class) { float floatValue = (float) returnedValue; styles.store(cssName, String.valueOf(floatValue), isDefaultValue(floatValue, annotation)); } } } catch (IllegalAccessException e) { caught = true; } catch (InvocationTargetException e) { caught = true; } finally { if (caught) { LogUtil.w("(THIS SHOULD NOT HAPPEN) failed to get the style of element id=" + getIdAttribute(element)); } } } }

Target:
protected void onGetStyles(View element, StyleAccumulator styles) { List<ViewCSSProperty> properties = getViewProperties(); for (int i = 0, size = properties.size(); i < size; i++) { ViewCSSProperty property = properties.get(i); try { getStyleFromValue( element, property.getCSSName(), property.getValue(element), property.getAnnotation(), styles); } catch (IllegalAccessException | InvocationTargetException e) { LogUtil.e(e, "failed to get style property " + property.getCSSName() + " of element= " + element.toString()); } } }
Source:
private static void fixProperty(FixReport entity, BasicSchema schema, InfoDictionary info, String metaValue, String infoValue, String attribute) { String key = attributes.get(attribute); if (metaValue == null && infoValue != null) { doSaveAction(schema, attribute, infoValue); entity.addFix("Add '" + key + "' to metadata from info dictionary"); } else if (metaValue != null && infoValue != null && !metaValue.equals(infoValue)) { doSaveAction(info, attribute, metaValue); entity.addFix("Add '" + attribute + "' to info dictionary from metadata"); } }

Target:
private static void fixProperty(FixReport entity, BasicSchema schema, InfoDictionary info, String metaValue, String infoValue, String attribute) { String key = attributes.get(attribute); if (metaValue == null && infoValue != null) { doSaveAction(schema, attribute, infoValue); entity.addFix("Added '" + key + "' to metadata from info dictionary"); } else if (metaValue != null && infoValue != null && !metaValue.equals(infoValue)) { doSaveAction(info, attribute, metaValue); entity.addFix("Added '" + attribute + "' to info dictionary from metadata"); } }
Source:
private void cleanUp() { mDOMProvider.postAndWait(new Runnable() { @Override public void run() { mDOMProvider.setListener(null); mShadowDOM = null; mObjectIdMapper.clear(); mDOMProvider.dispose(); } }); mDOMProvider = null; }

Target:
private void cleanUp() { mDocumentProvider.postAndWait(new Runnable() { @Override public void run() { mDocumentProvider.setListener(null); mShadowDocument = null; mObjectIdMapper.clear(); mDocumentProvider.dispose(); mDocumentProvider = null; } }); mUpdateListeners.clear(); }
Source:
public void setColor(String newColor) throws IOException { repo.root.retrieve().method("PATCH") .with("name", name) .with("color", newColor) .with("description", description) .to(url); }

Target:
public void setColor(String newColor) throws IOException { repo.root.retrieve().method("PATCH") .withPreview(SYMMETRA) .with("name", name) .with("color", newColor) .with("description", description) .to(url); }
Source:
protected boolean drawChild(@NonNull Canvas canvas, @NonNull View child, long drawingTime) { if (mDisappearingFragmentChildren != null && mDisappearingFragmentChildren.size() > 0 && getChildCount() > 1) { if (child == mHoldView) { boolean more = false; for (int i = mDisappearingFragmentChildren.size() - 1; i >= 0; i--) { more |= super.drawChild( canvas, mDisappearingFragmentChildren.get(i), drawingTime); } return more; } else if (mDisappearingFragmentChildren.contains(child)) { return false; } } return super.drawChild(canvas, child, drawingTime); }

Target:
protected boolean drawChild(@NonNull Canvas canvas, @NonNull View child, long drawingTime) { if (mDisappearingFragmentChildren != null && mDisappearingFragmentChildren.size() > 0) { if (mDisappearingFragmentChildren.contains(child)) { return false; } } return super.drawChild(canvas, child, drawingTime); }
Source:
private void persistEngineSession(String sessionId) { SessionInfo sessionInfo = getSessionInfo(sessionId); if (sessionInfo != null) { EngineSession engineSession = new EngineSession(); engineSession.setEngineSessionId(sessionId); DbUser user = getUser(sessionId, false); engineSession.setUserId(user.getId()); engineSession.setUserName(user.getLoginName()); engineSession.setGroupIds(user.getGroupIds()); engineSession.setRoleIds(getSystemRolesForUser(user.getId(), user.isAdmin() ? false : true)); getDbFacade().getEngineSessionDao().save(engineSession); } }

Target:
private void persistEngineSession(String sessionId) { SessionInfo sessionInfo = getSessionInfo(sessionId); if (sessionInfo != null) { EngineSession engineSession = new EngineSession(); engineSession.setEngineSessionId(sessionId); DbUser user = getUser(sessionId, false); engineSession.setUserId(user.getId()); engineSession.setUserName(user.getLoginName()); engineSession.setGroupIds(user.getGroupIds()); sessionToIdMap.put(sessionId, getDbFacade().getEngineSessionDao().save(engineSession)); } }
Source:
private Boolean containsEntryInternal(V value) { return cache.entrySet().stream().anyMatch(kCollectionEntry -> kCollectionEntry.getValue().contains(value)); }

Target:
private Boolean containsEntryInternal(V value) { return cache.entrySet().parallelStream().anyMatch(entry -> entry.getValue().contains(value)); }
Source:
public void switchToTab(String tabName) { if (GitHubURL.isPullRequestLoaded(getCurrentUrl())) { int tabIndex = 0; switch(tabName) { case GithubPageElements.DISCUSSION_TAB: tabIndex = 1; break; case GithubPageElements.COMMITS_TAB: tabIndex = 2; break; case GithubPageElements.FILES_TAB: tabIndex = 3; break; default: return; } String xpath = " driver.findElement(By.xpath(String.format(xpath, tabIndex))).click(); } }

Target:
public void switchToTab(String tabName) { if (GitHubURL.isPullRequestLoaded(getCurrentUrl())) { int tabIndex = 0; switch(tabName) { case GithubPageElements.DISCUSSION_TAB: tabIndex = 1; break; case GithubPageElements.COMMITS_TAB: tabIndex = 2; break; case GithubPageElements.FILES_TAB: tabIndex = 3; break; default: assert false; return; } String xpath = " clickElementByXpath(String.format(xpath, tabIndex)); } }
Source:
protected void parse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { Element report = DomUtils.getChildElementByTagName(element, XMLConstants.REPORT); if (report!=null) { BeanDefinition bean = parserContext.getDelegate().parseCustomElement(report, builder.getBeanDefinition()); parserContext.getRegistry().registerBeanDefinition(XMLConstants.CUSTOM_REPORTING_SERVICE,bean); } initListeners(element,parserContext, builder); Element testPlan = DomUtils.getChildElementByTagName(element, XMLConstants.TEST_PLAN); BeanDefinitionBuilder generator = BeanDefinitionBuilder.genericBeanDefinition(UserTaskGenerator.class); parserContext.getRegistry().registerBeanDefinition(XMLConstants.GENERATOR, generator.getBeanDefinition()); if (!element.getAttribute(XMLConstants.MONITORING_ENABLE).isEmpty()){ generator.addPropertyValue(XMLConstants.MONITORING_ENABLE, element.getAttribute(XMLConstants.MONITORING_ENABLE)); } setBeanProperty(XMLConstants.CONFIG, testPlan, parserContext, generator.getBeanDefinition()); builder.addPropertyValue(XMLConstants.TASKS, XMLConstants.GENERATOR_GENERATE); }

Target:
protected void parse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { Element report = DomUtils.getChildElementByTagName(element, XMLConstants.REPORT); String reportName = element.getAttribute(XMLConstants.ID)+"-report"; if (report!=null) { BeanDefinition bean = parserContext.getDelegate().parseCustomElement(report, builder.getBeanDefinition()); parserContext.getRegistry().registerBeanDefinition(reportName,bean); }else{ parserContext.getRegistry().registerAlias(reportName, XMLConstants.DEFAULT_REPORTING_SERVICE); } initListeners(element,parserContext, builder); Element testPlan = DomUtils.getChildElementByTagName(element, XMLConstants.TEST_PLAN); BeanDefinitionBuilder generator = BeanDefinitionBuilder.genericBeanDefinition(UserTaskGenerator.class); parserContext.getRegistry().registerBeanDefinition(XMLConstants.GENERATOR, generator.getBeanDefinition()); if (!element.getAttribute(XMLConstants.MONITORING_ENABLE).isEmpty()){ generator.addPropertyValue(XMLConstants.MONITORING_ENABLE, element.getAttribute(XMLConstants.MONITORING_ENABLE)); } generator.addPropertyValue(XMLConstants.CONFIG, parseCustomElement(testPlan, parserContext, generator.getBeanDefinition())); builder.addPropertyValue(XMLConstants.TASKS, XMLConstants.GENERATOR_GENERATE); }
Source:
public int getMaxEnergyStored() { int total = 0; try { for( PartP2PFEPower t : PartP2PFEPower.this.getOutputs() ) { total += t.getOutput().getMaxEnergyStored(); } } catch( GridAccessException e ) { return 0; } return total; }

Target:
public int getMaxEnergyStored() { int total = 0; try { for( PartP2PFEPower t : PartP2PFEPower.this.getOutputs() ) { total += t.getAttachedEnergyStorage().getMaxEnergyStored(); } } catch( GridAccessException e ) { return 0; } return total; }
Source:
public static void main(String[] args) { BasicConfigurator.configure(); final String streamName = "test"; StreamClient streamClient = new RestStreamClient.Builder("localhost", 10000) .build(); try { streamClient.create(streamName); long currentTTL = streamClient.getTTL(streamName); LOG.info("Get TTL for stream: {}", currentTTL, streamName); long newTTL = 10009907; streamClient.setTTL(streamName, newTTL); LOG.info("Set new TTL for stream: {}", newTTL, streamName); currentTTL = streamClient.getTTL(streamName); LOG.info("Was TTL updated successfully? {}", currentTTL == newTTL ? "YES" : "NO"); StreamWriter streamWriter = streamClient.createWriter(streamName); String log = "192.0.2.0 - - [09/Apr/2012:08:40:43 -0400] \"GET /NoteBook/ HTTP/1.0\" 201 809 \"-\" " + "\"Example v0.0.0 (www.example.org)\""; ListenableFuture<Void> future = streamWriter.write(log, null); LOG.info("Future {}", future.get()); Futures.addCallback(future, new FutureCallback<Void>() { @Override public void onSuccess(Void contents) { LOG.info("Success write stream {}", streamName); } @Override public void onFailure(Throwable throwable) { LOG.error("Exception in stream write process", throwable); } }); streamWriter.close(); streamClient.close(); } catch (Exception e) { LOG.error(e.getMessage(), e); } }

Target:
public static void main(String[] args) { final String streamName = "streamName"; try { StreamClient streamClient = RestStreamClient.builder("localhost", 10000).build(); StreamWriter streamWriter = streamClient.createWriter(streamName); try { streamClient.create(streamName); long currentTTL = streamClient.getTTL(streamName); LOG.info("Get TTL for stream: {}", currentTTL, streamName); long newTTL = 18000; streamClient.setTTL(streamName, newTTL); LOG.info("Set new TTL for stream: {}", newTTL, streamName); currentTTL = streamClient.getTTL(streamName); LOG.info("Was TTL updated successfully? {}", currentTTL == newTTL ? "YES" : "NO"); String log = "192.0.2.0 - - [09/Apr/2012:08:40:43 -0400] \"GET /NoteBook/ HTTP/1.0\" 201 809 \"-\" " + "\"Example v0.0.0 (www.example.org)\""; ListenableFuture<Void> future = streamWriter.write(log, null); LOG.info("Future {}", future.get()); Futures.addCallback(future, new FutureCallback<Void>() { @Override public void onSuccess(Void contents) { LOG.info("Success write stream {}", streamName); } @Override public void onFailure(Throwable throwable) { LOG.error("Exception in stream write process", throwable); } }); } finally { streamWriter.close(); streamClient.close(); } } catch (Exception e) { LOG.error(e.getMessage(), e); } }
Source:
public void testExplain() throws Exception { createTable("explain_test"); insertData("explain_test"); try { String query1 = "SELECT * FROM explain_test"; driver.explain(query1,baseConf); String query2 = "SELECT * FROM explain_test1"; driver.explain(query2,baseConf); } catch(GrillException ex) { System.out.println("Error : " + ex); } }

Target:
public void testExplain() throws Exception { createTable("explain_test"); insertData("explain_test"); String query1 = "SELECT * FROM explain_test"; String query2 = "SELECT * FROM explain_test1"; driver.explain(query1,baseConf); try { driver.explain(query2,baseConf); Assert.fail("Running explain on a non existing table."); } catch(GrillException ex) { System.out.println("Error : " + ex); } }
Source:
private void startPlayerActivity() { Intent intent = new Intent(this, OoyalaPlayerTokenPlayerActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); intent.putExtra("embed_code", embedCode); intent.putExtra("pcode", pCode); intent.putExtra("domain", "<LINK_0>"); intent.putExtra("autoPlay", autoPlay); intent.putExtra("apikey", apiKey); intent.putExtra("secret", secret); intent.putExtra("accountid", accountId); startActivityForResult(intent,1); }

Target:
private void startPlayerActivity() { Intent intent = new Intent(this, OoyalaPlayerTokenPlayerActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); intent.putExtra("embed_code", embedCode); intent.putExtra("className",this.getClass().getSimpleName()); intent.putExtra("pcode", pCode); intent.putExtra("domain", "<LINK_0>"); intent.putExtra("autoPlay", autoPlay); intent.putExtra("apikey", apiKey); intent.putExtra("secret", secret); intent.putExtra("accountid", accountId); startActivity(intent); }
Source:
public float getPrefHeight () { layout = new GlyphLayout(style.font, model.getValue().toString()); return Float.max(style.background.getMinHeight(), style.background.getTopHeight() + style.background.getBottomHeight() + layout.height); }

Target:
public float getPrefHeight () { return Math.max(style.background.getMinHeight(), style.background.getTopHeight() + style.background.getBottomHeight() + layout.height); }
Source:
public void lock(Object owner) { if (owner == null) { throw new IllegalArgumentException("owner cannot be null"); } synchronized (this.lock) { if (owner.equals(this.owner)) { lockCount++; } else if (this.owner == null) { this.owner = owner; lockCount ++; } else { while (this.owner != null) { try { waiters++; try { lock.wait(); } finally { --waiters; } } catch (InterruptedException e) { throw new RuntimeException(e); } } this.owner = owner; lockCount ++; } } }

Target:
public void lock(Object owner) { Assert.checkNotNullParam("owner", owner); synchronized (this.lock) { if (Objects.equals(owner, this.owner)) { lockCount++; } else if (this.owner == null) { this.owner = owner; lockCount ++; } else { while (this.owner != null) { try { waiters++; try { lock.wait(); } finally { --waiters; } } catch (InterruptedException e) { throw new RuntimeException(e); } } this.owner = owner; lockCount ++; } } }
Source:
private void update(Username username, HttpLocalizedOperationResult result, EntityConfigUpdateCommand command, PackageRepository repository) { try { goConfigService.updateConfig(command, username); } catch (Exception e) { if (e instanceof GoConfigInvalidException && !result.hasMessage()) { result.unprocessableEntity(entityConfigValidationFailed(repository.getClass().getAnnotation(ConfigTag.class).value(), repository.getId(), e.getMessage())); } else if (e instanceof RulesViolationException || e instanceof SecretResolutionFailureException) { LOGGER.error(e.getMessage(), e); result.unprocessableEntity(saveFailedWithReason(e.getMessage())); } else { if (!result.hasMessage()) { LOGGER.error(e.getMessage(), e); result.internalServerError(saveFailedWithReason("An error occurred while saving the package repository config. Please check the logs for more information.")); } } } }

Target:
private void update(Username username, HttpLocalizedOperationResult result, EntityConfigUpdateCommand command, PackageRepository repository) { try { goConfigService.updateConfig(command, username); } catch (Exception e) { if (e instanceof GoConfigInvalidException && !result.hasMessage()) { result.unprocessableEntity(entityConfigValidationFailed(repository.getClass().getAnnotation(ConfigTag.class).value(), repository.getId(), e.getMessage())); } else if (e instanceof RulesViolationException || e instanceof SecretResolutionFailureException) { result.unprocessableEntity(saveFailedWithReason(e.getMessage())); } else { if (!result.hasMessage()) { LOGGER.error(e.getMessage(), e); result.internalServerError(saveFailedWithReason("An error occurred while saving the package repository config. Please check the logs for more information.")); } } } }
Source:
private void checkResponse(Response.StatusType statusType, String subject, String response) { switch (statusType.getFamily()) { case SUCCESSFUL: logger.info("Successful write to schema repo for subject {}", subject); break; case CLIENT_ERROR: logger.warn("Invalid schema for subject {}. Details: {}", subject, response); throw new InvalidSchemaException("Invalid schema. For more details see schema-repo logs."); case SERVER_ERROR: logger.error("Failure write to schema repo for subject {}. Reason: {}", subject, response); throw new SchemaRepoException("Failure write to schema-repo."); default: break; } }

Target:
private void checkResponse(Response.StatusType statusType, String subject, String response) { switch (statusType.getFamily()) { case SUCCESSFUL: logger.info("Successful write to schema repo for subject {}", subject); break; case CLIENT_ERROR: logger.warn("Invalid schema for subject {}. Details: {}", subject, response); throw new InvalidSchemaException("Invalid schema. For more details see schema-repo logs."); case SERVER_ERROR: logger.error("Failure write to schema repo for subject {}. Reason: {}", subject, response); throw new SchemaRepoException("Failure write to schema-repo."); default: logger.error("Unknown response from schema-repo. Subject {}, http status {}, Details: {}", subject, statusType.getStatusCode(), response); throw new SchemaRepoException("Unknown response from schema-repo"); } }
Source:
public void onAgreeClicked() { WatchExpression expression = new WatchExpressionImpl(view.getValue(), ""); debuggerPresenter.onAddExpressionBtnClicked(expression); view.close(); }

Target:
public void onAgreeClicked() { WatchExpression expression = new WatchExpressionImpl(view.getValue()); debuggerPresenter.onAddExpressionBtnClicked(expression); view.close(); }
Source:
public synchronized void addSegmentChangeRequests(List<DataSegmentChangeRequest> requests) { for (DataSegmentChangeRequest request : requests) { if (changes.size() >= maxSize) { changes.remove(0); } changes.add(new Holder(request, getLastCounter().inc())); } singleThreadedExecutor.execute(resolveWaitingFuturesRunnable); }

Target:
public synchronized void addSegmentChangeRequests(List<DataSegmentChangeRequest> requests) { for (DataSegmentChangeRequest request : requests) { changes.add(new Holder(request, getLastCounter().inc())); } singleThreadedExecutor.execute(resolveWaitingFuturesRunnable); }
Source:
public JSONObject getOperationSummary() { String operationSummaryJson = artifact.getSoleAttributeAsString(DispoConstants.OperationSummary, "{}"); try { JSONObject toReturn = new JSONObject(operationSummaryJson); return toReturn; } catch (JSONException ex) { throw new OseeCoreException("Could not parse Notes Json", ex); } }

Target:
public JSONObject getOperationSummary() { String operationSummaryJson = artifact.getSoleAttributeAsString(DispoConstants.OperationSummary, "{}"); try { JSONObject toReturn = new JSONObject(operationSummaryJson); return toReturn; } catch (JSONException ex) { throw new OseeCoreException("Could not parse Operation Sumary Json", ex); } }
Source:
public String getQuestionWithExistingResponseSubmissionFormHtml( boolean sessionIsOpen, int qnIdx, int responseIdx, String courseId, int totalNumRecipients, FeedbackResponseDetails existingResponseDetails) { FeedbackNumericalScaleResponseDetails numscaleResponseDetails = (FeedbackNumericalScaleResponseDetails) existingResponseDetails; return Templates.populateTemplate( FormTemplates.NUMSCALE_SUBMISSION_FORM, Slots.QUESTION_INDEX, Integer.toString(qnIdx), Slots.DISABLED, sessionIsOpen ? "" : "disabled", Slots.RESPONSE_INDEX, Integer.toString(responseIdx), Slots.MIN_SCALE, Integer.toString(minScale), Slots.MAX_SCALE, Integer.toString(maxScale), Slots.STEP, StringHelper.toDecimalFormatString(step), "${existingAnswer}", numscaleResponseDetails.getAnswerString(), "${possibleValuesString}", getPossibleValuesStringSubmit(), Slots.FEEDBACK_RESPONSE_TEXT, Const.ParamsNames.FEEDBACK_RESPONSE_TEXT, Slots.NUMSCALE_MIN, Const.ParamsNames.FEEDBACK_QUESTION_NUMSCALE_MIN, Slots.NUMSCALE_MAX, Const.ParamsNames.FEEDBACK_QUESTION_NUMSCALE_MAX, Slots.NUMSCALE_STEP, Const.ParamsNames.FEEDBACK_QUESTION_NUMSCALE_STEP); }

Target:
public String getQuestionWithExistingResponseSubmissionFormHtml( boolean sessionIsOpen, int qnIdx, int responseIdx, String courseId, int totalNumRecipients, FeedbackResponseDetails existingResponseDetails) { FeedbackNumericalScaleResponseDetails numscaleResponseDetails = (FeedbackNumericalScaleResponseDetails) existingResponseDetails; return Templates.populateTemplate( FormTemplates.NUMSCALE_SUBMISSION_FORM, Slots.QUESTION_INDEX, Integer.toString(qnIdx), Slots.DISABLED, sessionIsOpen ? "" : "disabled", Slots.RESPONSE_INDEX, Integer.toString(responseIdx), Slots.MIN_SCALE, Integer.toString(minScale), Slots.MAX_SCALE, Integer.toString(maxScale), Slots.STEP, StringHelper.toDecimalFormatString(step), Slots.EXISTING_ANSWER, numscaleResponseDetails.getAnswerString(), Slots.POSSIBLE_VALUES_STRING, getPossibleValuesStringSubmit(), Slots.FEEDBACK_RESPONSE_TEXT, Const.ParamsNames.FEEDBACK_RESPONSE_TEXT, Slots.NUMSCALE_MIN, Const.ParamsNames.FEEDBACK_QUESTION_NUMSCALE_MIN, Slots.NUMSCALE_MAX, Const.ParamsNames.FEEDBACK_QUESTION_NUMSCALE_MAX, Slots.NUMSCALE_STEP, Const.ParamsNames.FEEDBACK_QUESTION_NUMSCALE_STEP); }
Source:
public VmSnapshotListModel() { setTitle(ConstantsManager.getInstance().getConstants().snapshotsTitle()); setHelpTag(HelpTag.snapshots); setHashName("snapshots"); setNewCommand(new UICommand("New", this)); setPreviewCommand(new UICommand("Preview", this)); setCustomPreviewCommand(new UICommand("CustomPreview", this)); setCommitCommand(new UICommand("Commit", this)); setUndoCommand(new UICommand("Undo", this)); setRemoveCommand(new UICommand("Remove", this)); setCloneVmCommand(new UICommand("CloneVM", this)); setCloneTemplateCommand(new UICommand("CloneTemplate", this)); setCanSelectSnapshot(new EntityModel()); getCanSelectSnapshot().setEntity(true); setSnapshotsMap(new HashMap<Guid, SnapshotModel>()); setVmDisks(new ArrayList<DiskImage>()); setComparator(new Comparator<Snapshot>() { @Override public int compare(Snapshot s1, Snapshot s2) { int typeCompare = Boolean.compare( s1.getType() == SnapshotType.ACTIVE || s1.getType() == SnapshotType.PREVIEW, s2.getType() == SnapshotType.ACTIVE || s2.getType() == SnapshotType.PREVIEW); if (typeCompare != 0) { return typeCompare; } return s2.getCreationDate().compareTo(s1.getCreationDate()); } }); }

Target:
public VmSnapshotListModel() { setTitle(ConstantsManager.getInstance().getConstants().snapshotsTitle()); setHelpTag(HelpTag.snapshots); setHashName("snapshots"); setNewCommand(new UICommand("New", this)); setPreviewCommand(new UICommand("Preview", this)); setCustomPreviewCommand(new UICommand("CustomPreview", this)); setCommitCommand(new UICommand("Commit", this)); setUndoCommand(new UICommand("Undo", this)); setRemoveCommand(new UICommand("Remove", this)); setCloneVmCommand(new UICommand("CloneVM", this)); setCloneTemplateCommand(new UICommand("CloneTemplate", this)); setCanSelectSnapshot(new EntityModel()); getCanSelectSnapshot().setEntity(true); setSnapshotsMap(new HashMap<Guid, SnapshotModel>()); setVmDisks(new ArrayList<DiskImage>()); setComparator(new Comparator<Snapshot>() { @Override public int compare(Snapshot s1, Snapshot s2) { int typeCompare = Boolean.compare( s1.getType() == SnapshotType.ACTIVE || s1.getType() == SnapshotType.PREVIEW, s2.getType() == SnapshotType.ACTIVE || s2.getType() == SnapshotType.PREVIEW); if (typeCompare != 0) { return -1 * typeCompare; } return s2.getCreationDate().compareTo(s1.getCreationDate()); } }); }
Source:
public void testSSLFactory() throws Exception { SSLConfig sslConfig = TestSSLUtils.createSSLConfig(); SSLFactory sslFactory = new SSLFactory(sslConfig); SSLContext sslContext = sslFactory.getSSLContext(); SSLSocketFactory socketFactory = sslContext.getSocketFactory(); Assert.assertNotNull(socketFactory); SSLServerSocketFactory serverSocketFactory = sslContext.getServerSocketFactory(); Assert.assertNotNull(serverSocketFactory); SSLEngine clientSSLEngine = sslFactory.createSSLEngine("localhost", 9095, SSLFactory.Mode.CLIENT); Assert.assertEquals(sslContext.getProtocol(), "TLS"); Assert.assertEquals(sslContext.getProvider().getName(), "SunJSSE"); String[] enabledProtocols = clientSSLEngine.getEnabledProtocols(); Assert.assertEquals(enabledProtocols.length, 1); Assert.assertEquals(enabledProtocols[0], "TLSv1.2"); Assert.assertEquals(clientSSLEngine.getSSLParameters().getEndpointIdentificationAlgorithm(), "HTTPS"); Assert.assertEquals(clientSSLEngine.getNeedClientAuth(), false); Assert.assertEquals(clientSSLEngine.getUseClientMode(), true); Assert.assertEquals(clientSSLEngine.getWantClientAuth(), false); String[] enabledCipherSuites = clientSSLEngine.getEnabledCipherSuites(); Assert.assertEquals(enabledCipherSuites.length, 1); Assert.assertEquals(enabledCipherSuites[0], "TLS_RSA_WITH_AES_128_CBC_SHA256"); SSLEngine serverSSLEngine = sslFactory.createSSLEngine("localhost", 9095, SSLFactory.Mode.SERVER); enabledProtocols = serverSSLEngine.getEnabledProtocols(); Assert.assertEquals(enabledProtocols.length, 1); Assert.assertEquals(enabledProtocols[0], "TLSv1.2"); Assert.assertEquals(serverSSLEngine.getSSLParameters().getEndpointIdentificationAlgorithm(), null); Assert.assertEquals(serverSSLEngine.getNeedClientAuth(), true); Assert.assertEquals(serverSSLEngine.getUseClientMode(), false); Assert.assertEquals(serverSSLEngine.getWantClientAuth(), false); enabledCipherSuites = serverSSLEngine.getEnabledCipherSuites(); Assert.assertEquals(enabledCipherSuites.length, 1); Assert.assertEquals(enabledCipherSuites[0], "TLS_RSA_WITH_AES_128_CBC_SHA256"); }

Target:
public void testSSLFactory() throws Exception { SSLConfig sslConfig = TestSSLUtils.createSSLConfig("DC1,DC2,DC3"); SSLFactory sslFactory = new SSLFactory(sslConfig); SSLContext sslContext = sslFactory.getSSLContext(); SSLSocketFactory socketFactory = sslContext.getSocketFactory(); Assert.assertNotNull(socketFactory); SSLServerSocketFactory serverSocketFactory = sslContext.getServerSocketFactory(); Assert.assertNotNull(serverSocketFactory); SSLEngine clientSSLEngine = sslFactory.createSSLEngine("localhost", 9095, SSLFactory.Mode.CLIENT); SSLEngine serverSSLEngine = sslFactory.createSSLEngine("localhost", 9095, SSLFactory.Mode.SERVER); TestSSLUtils.verifySSLConfig(sslContext, clientSSLEngine, true); TestSSLUtils.verifySSLConfig(sslContext, serverSSLEngine, false); }
Source:
private TaskData doInBackgroundDeleteDeck(TaskData... params) { Timber.d("doInBackgroundDeleteDeck"); Collection col = CollectionHelper.getInstance().getCol(mContext); long did = params[0].getLong(); col.getDecks().rem(did, true); final AlarmManager alarmManager = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE); final PendingIntent reminderIntent = PendingIntent.getBroadcast( mContext, (int) did, new Intent(mContext, ReminderReceiver.class).putExtra(ReminderService.EXTRA_DECK_ID, did), 0 ); alarmManager.cancel(reminderIntent); return new TaskData(true); }

Target:
private TaskData doInBackgroundDeleteDeck(TaskData... params) { Timber.d("doInBackgroundDeleteDeck"); Collection col = CollectionHelper.getInstance().getCol(mContext); long did = params[0].getLong(); col.getDecks().rem(did, true); return new TaskData(true); }