auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private JExpression getExitMessage(ExecutableElement element, JMethod method, JVar result, JVar duration) throws ClassNotFoundException { JInvocation format = refClass(String.class).staticInvoke("format"); String returnType = element.getReturnType().toString(); String simpleName = element.getSimpleName().toString(); String methodName = returnType + " " + simpleName; List<JVar> params = method.params(); StringBuilder paramStr = new StringBuilder(); for (int i = 0; i < params.size(); i++) { if (i > 0) { paramStr.append(", "); } JVar var = params.get(i); paramStr.append(var.type().name()); } methodName += "(" + paramStr.toString() + ")"; if (result == null) { format.arg("Exiting [" + methodName + "], duration in ms: %d"); } else { format.arg("Exiting [" + methodName + " returning: %s], duration in ms: %d"); if (method.type().isArray()) { JClass arraysClass = refClass(Arrays.class); format.arg(arraysClass.staticInvoke("toString").arg(JExpr.cast(boxify(method.type()), result))); } else { format.arg(result); } } return format.arg(duration); }

Target:
private JExpression getExitMessage(ExecutableElement element, JMethod method, JVar result, JVar duration) throws ClassNotFoundException { String methodName = getMethodName(element); List<JVar> params = method.params(); StringBuilder paramStr = new StringBuilder(); for (int i = 0; i < params.size(); i++) { if (i > 0) { paramStr.append(", "); } JVar var = params.get(i); paramStr.append(var.type().name()); } methodName += "(" + paramStr.toString() + ")"; JInvocation format = refClass(String.class).staticInvoke("format"); if (result == null) { format.arg("Exiting [" + methodName + "], duration in ms: %d"); } else { format.arg("Exiting [" + methodName + " returning: %s], duration in ms: %d"); if (method.type().isArray()) { JClass arraysClass = refClass(Arrays.class); format.arg(arraysClass.staticInvoke("toString").arg(JExpr.cast(boxify(method.type()), result))); } else { format.arg(result); } } return format.arg(duration); }
Source:
public static byte[] bigIntegerToBytes(BigInteger b, int numBytes) { checkArgument(b.signum()>1, "We assume only positive numbers"); byte[] src = b.toByteArray(); byte[] dest = new byte[numBytes]; checkArgument((src[0]==0) ? src.length-1<=numBytes : src.length<=numBytes, "The given number does not fit in "+numBytes); int srcPos = (src[0]==0) ? 1 : 0; int destPos = numBytes - src.length; System.arraycopy(src, srcPos, dest, destPos, src.length); return dest; }

Target:
public static byte[] bigIntegerToBytes(BigInteger b, int numBytes) { checkArgument(b.signum() >= 0, "b must be positive or zero"); checkArgument(numBytes > 0, "numBytes must be positive"); byte[] src = b.toByteArray(); byte[] dest = new byte[numBytes]; boolean isFirstByteOnlyForSign = src[0] == 0; int length = isFirstByteOnlyForSign ? src.length - 1 : src.length; checkArgument(length <= numBytes, "The given number does not fit in " + numBytes); int srcPos = isFirstByteOnlyForSign ? 1 : 0; int destPos = numBytes - length; System.arraycopy(src, srcPos, dest, destPos, length); return dest; }
Source:
public DnsClient createDnsClient() { InetSocketAddress address = DefaultDnsServerAddressStreamProvider.defaultAddresses() .stream() .next(); return new DnsClientImpl(this, address.getPort(), address.getAddress().getHostAddress(), DnsClientOptions.DEFAULT_QUERY_TIMEOUT); }

Target:
public DnsClient createDnsClient() { DnsResolverProvider provider = new DnsResolverProvider(this, addressResolverOptions); InetSocketAddress address = provider.nameServerAddresses().get(0); return new DnsClientImpl(this, address.getPort(), address.getAddress().getHostAddress(), DnsClientOptions.DEFAULT_QUERY_TIMEOUT); }
Source:
private int checkAllPillData(final long lastTimestampMillis) { long timestampDiff = lastTimestampMillis - this.lastRecordDTMillis; if (timestampDiff > 0 && timestampDiff < this.dateMinuteBucketMillis) { return 0; } if (timestampDiff > 0) { this.lastRecordDTMillis = lastTimestampMillis; } int added = 0; for (final String pillID : this.pillAccountID.keySet()) { if (!this.toProccessedIDs.contains(pillID)) { final SensorSample lastSample = this.pillData.get(pillID).last(); if (this.lastRecordDTMillis - lastSample.dateTime.getMillis() > this.tooOldThreshold) { this.toProccessedIDs.add(pillID); } } } return added; }

Target:
private int checkAllPillData(final long lastTimestampMillis) { final long timestampDiff = lastTimestampMillis - this.lastRecordDTMillis; if (timestampDiff > 0 && timestampDiff < this.dateMinuteBucketMillis) { return 0; } if (timestampDiff > 0) { this.lastRecordDTMillis = lastTimestampMillis; } int added = 0; for (final String pillID : this.pillAccountID.keySet()) { if (!this.toProccessedIDs.contains(pillID)) { final PillSample lastSample = this.pillData.get(pillID).last(); if (this.lastRecordDTMillis - lastSample.dateTime.getMillis() > this.tooOldThreshold) { this.toProccessedIDs.add(pillID); } } } return added; }
Source:
public void onPartitionsAssigned(Collection<TopicPartition> partitions) { _consumerMetrics.updateRebalanceRate(1); LOG.info("Partition ownership assigned for {}.", partitions); _flushlessProducer.clear(); }

Target:
public void onPartitionsAssigned(Collection<TopicPartition> partitions) { _consumerMetrics.updateRebalanceRate(1); LOG.info("Partition ownership assigned for {}.", partitions); }
Source:
public void testConvertToDataModelTypeEmptyIds() { mongoVariant.put(uk.ac.ebi.eva.commons.models.converters.data.DBObjectToVariantConverter.IDS_FIELD, new HashSet<String>()); uk.ac.ebi.eva.commons.models.converters.data.DBObjectToVariantConverter converter = new uk.ac.ebi.eva.commons.models.converters.data.DBObjectToVariantConverter(); Variant converted = converter.convert(mongoVariant); assertNotNull(converted.getIds()); assertTrue(converted.getIds().isEmpty()); variant.setIds(new HashSet<String>()); assertEquals(variant, converted); }

Target:
public void testConvertToDataModelTypeEmptyIds() { mongoVariant.put(DBObjectToVariantConverter.IDS_FIELD, new HashSet<String>()); DBObjectToVariantConverter converter = new DBObjectToVariantConverter(); Variant converted = converter.convert(mongoVariant); assertNotNull(converted.getIds()); assertTrue(converted.getIds().isEmpty()); variant.setIds(new HashSet<String>()); assertEquals(variant, converted); }
Source:
public static void setTrace(TraceState state) { STATE.get().clear(); STATE.get().push(state); }

Target:
public static void setTrace(TraceState state) { STATE.remove(); STATE.get().push(state); }
Source:
public Protocol getProtocol(Class iface) { Protocol protocol = new Protocol(iface.getSimpleName(), iface.getPackage() == null ? "" : iface.getPackage().getName()); Map<String, Schema> names = new LinkedHashMap<>(); Map<String, Message> messages = protocol.getMessages(); Map<TypeVariable<?>, Type> genericTypeVariableMap = ReflectionUtil.resolveTypeVariables(iface); for (Method method : iface.getMethods()) if ((method.getModifiers() & Modifier.STATIC) == 0) { String name = method.getName(); if (messages.containsKey(name)) throw new AvroTypeException("Two methods with same name: " + name); messages.put(name, getMessage(method, protocol, names, genericTypeVariableMap)); } List<Schema> types = new ArrayList<>(names.values()); Collections.reverse(types); protocol.setTypes(types); return protocol; }

Target:
public Protocol getProtocol(Class iface) { Protocol protocol = new Protocol(iface.getSimpleName(), iface.getPackage() == null ? "" : iface.getPackage().getName()); Map<String, Schema> names = new LinkedHashMap<>(); Map<String, Message> messages = protocol.getMessages(); Map<TypeVariable<?>, Type> genericTypeVariableMap = ReflectionUtil.resolveTypeVariables(iface); for (Method method : iface.getMethods()) { if ((method.getModifiers() & Modifier.STATIC) == 0) { String name = method.getName(); if (messages.containsKey(name)) throw new AvroTypeException("Two methods with same name: " + name); messages.put(name, getMessage(method, protocol, names, genericTypeVariableMap)); } } List<Schema> types = new ArrayList<>(names.values()); Collections.reverse(types); protocol.setTypes(types); return protocol; }
Source:
public void unretireProvider_shouldUnretireAProvider() throws Exception { Provider provider = service.getProvider(2); service.unretireProvider(provider); assertFalse(provider.isRetired()); assertNull(provider.getRetireReason()); }

Target:
public void unretireProvider_shouldUnretireAProvider() { Provider provider = service.getProvider(2); service.unretireProvider(provider); assertFalse(provider.getRetired()); assertNull(provider.getRetireReason()); }
Source:
private void loadUefiProperties() throws FileNotFoundException { if (_uefiProperties != null && _uefiProperties.getProperty("guest.loader.legacy") != null) return; final File file = PropertiesUtil.findConfigFile("uefi.properties"); if (file == null) { throw new FileNotFoundException("Unable to find uefi.properties."); } s_logger.info("uefi.properties found at " + file.getAbsolutePath()); try { PropertiesUtil.loadFromFile(_uefiProperties, file); s_logger.info("guest.nvram.template.legacy = " + _uefiProperties.getProperty("guest.nvram.template.legacy")); s_logger.info("guest.loader.legacy = " + _uefiProperties.getProperty("guest.loader.legacy")); } catch (final FileNotFoundException ex) { throw new CloudRuntimeException("Cannot find the file: " + file.getAbsolutePath(), ex); } catch (final IOException ex) { throw new CloudRuntimeException("IOException in reading " + file.getAbsolutePath(), ex); } }

Target:
private void loadUefiProperties() throws FileNotFoundException { if (_uefiProperties != null && _uefiProperties.getProperty("guest.loader.legacy") != null) { return; } final File file = PropertiesUtil.findConfigFile("uefi.properties"); if (file == null) { throw new FileNotFoundException("Unable to find file uefi.properties."); } s_logger.info("uefi.properties file found at " + file.getAbsolutePath()); try { PropertiesUtil.loadFromFile(_uefiProperties, file); s_logger.info("guest.nvram.template.legacy = " + _uefiProperties.getProperty("guest.nvram.template.legacy")); s_logger.info("guest.loader.legacy = " + _uefiProperties.getProperty("guest.loader.legacy")); s_logger.info("guest.nvram.template.secure = " + _uefiProperties.getProperty("guest.nvram.template.secure")); s_logger.info("guest.loader.secure =" + _uefiProperties.getProperty("guest.loader.secure")); s_logger.info("guest.nvram.path = " + _uefiProperties.getProperty("guest.nvram.path")); } catch (final FileNotFoundException ex) { throw new CloudRuntimeException("Cannot find the file: " + file.getAbsolutePath(), ex); } catch (final IOException ex) { throw new CloudRuntimeException("IOException in reading " + file.getAbsolutePath(), ex); } }
Source:
public void updateUsage(List<Quota> quotaList) { List<Quota> needToCache = new ArrayList<Quota>(); lock.readLock().lock(); try { for (Quota quotaExternal : quotaList) { Quota quota = null; for (Map<Guid, Quota> quotaMap : storagePoolQuotaMap.values()) { quota = quotaMap.get(quotaExternal.getId()); if (quota != null) { break; } } if (quota == null) { needToCache.add(quotaExternal); } else { copyUsageData(quota, quotaExternal); } } } finally { lock.readLock().unlock(); } if (!needToCache.isEmpty()) { lock.writeLock().lock(); try { for (Quota quotaExternal : needToCache) { Quota quota = null; for (Map<Guid, Quota> quotaMap : storagePoolQuotaMap.values()) { quota = quotaMap.get(quotaExternal.getId()); if (quota != null) { break; } } if (quota == null) { quota = getQuotaDAO().getById(quotaExternal.getId()); if (quota != null) { if (!storagePoolQuotaMap.containsKey(quota.getStoragePoolId())) { storagePoolQuotaMap.put(quota.getStoragePoolId(), new HashMap<Guid, Quota>()); } storagePoolQuotaMap.get(quota.getStoragePoolId()).put(quota.getId(), quota); } } copyUsageData(quota, quotaExternal); } } finally { lock.writeLock().unlock(); } } }

Target:
public void updateUsage(List<Quota> quotaList) { List<Quota> needToCache = new ArrayList<Quota>(); if (quotaList == null) { return; } lock.readLock().lock(); try { for (Quota quotaExternal : quotaList) { Map<Guid, Quota> quotaMap = storagePoolQuotaMap.get(quotaExternal.getStoragePoolId()); Quota quota = null; if (quotaMap != null) { quota = quotaMap.get(quotaExternal.getId()); } if (quota == null) { needToCache.add(quotaExternal); } else { copyUsageData(quota, quotaExternal); } } } finally { lock.readLock().unlock(); } if (!needToCache.isEmpty()) { lock.writeLock().lock(); try { for (Quota quotaExternal : needToCache) { if (!storagePoolQuotaMap.containsKey(quotaExternal.getStoragePoolId())) { storagePoolQuotaMap.put(quotaExternal.getStoragePoolId(), new HashMap<Guid, Quota>()); } Quota quota = fetchQuotaFromCache(quotaExternal.getId(), quotaExternal.getStoragePoolId()); if (quota != null) { copyUsageData(quota, quotaExternal); } } } finally { lock.writeLock().unlock(); } } }
Source:
public void namespaceAwareUpsert(SQLiteDatabase db, T obj, String tableName, String primaryKeySelection, String[] primaryKeySelectionArgs) { Cursor existingEntries = namespaceAwareSelect(db, tableName, primaryKeySelection, primaryKeySelectionArgs); if (existingEntries.getCount() == 0) { WikipediaApp.getInstance().getPersister(obj.getClass()).persist(obj); } else { ContentValues cv = toContentValues(obj); if (cv.containsKey("timestamp")) { updateDbEntryTimestamp(db, tableName, primaryKeySelection, primaryKeySelectionArgs, getTimestampString(cv)); } } WikipediaApp.getInstance().getContentResolver().notifyChange(getBaseContentURI(), null); }

Target:
public void namespaceAwareUpsert(SQLiteDatabase db, T obj, String tableName, String primaryKeySelection, String[] primaryKeySelectionArgs) { Cursor existingEntries = namespaceAwareSelect(db, tableName, primaryKeySelection, primaryKeySelectionArgs); if (existingEntries.getCount() == 0) { WikipediaApp.getInstance().getPersister(obj.getClass()).persist(obj); } else { ContentValues cv = toContentValues(obj); if (cv.containsKey("timestamp")) { updateDbEntryTimestamp(db, tableName, primaryKeySelection, primaryKeySelectionArgs, getTimestampString(cv)); } } notifyAdapters(); }
Source:
protected synchronized void modified(Map<String, Object> config) { logger.info("Modifying the configuration of the firmware update service."); if (!isValid(config)) { return; } cancelFirmwareUpdateStatusInfoJob(); firmwareStatusInfoJobPeriod = config.containsKey(PERIOD_CONFIG_KEY) ? (Integer) config.get(PERIOD_CONFIG_KEY) : firmwareStatusInfoJobPeriod; firmwareStatusInfoJobDelay = config.containsKey(DELAY_CONFIG_KEY) ? (Integer) config.get(DELAY_CONFIG_KEY) : firmwareStatusInfoJobDelay; firmwareStatusInfoJobTimeUnit = config.containsKey(TIME_UNIT_CONFIG_KEY) ? TimeUnit.valueOf((String) config.get(TIME_UNIT_CONFIG_KEY)) : firmwareStatusInfoJobTimeUnit; if (!firmwareUpdateHandlers.isEmpty()) { createFirmwareUpdateStatusInfoJob(); } }

Target:
protected synchronized void modified(Map<String, Object> config) { logger.debug("Modifying the configuration of the firmware update service."); if (!isValid(config)) { return; } cancelFirmwareUpdateStatusInfoJob(); firmwareStatusInfoJobPeriod = config.containsKey(PERIOD_CONFIG_KEY) ? (Integer) config.get(PERIOD_CONFIG_KEY) : firmwareStatusInfoJobPeriod; firmwareStatusInfoJobDelay = config.containsKey(DELAY_CONFIG_KEY) ? (Integer) config.get(DELAY_CONFIG_KEY) : firmwareStatusInfoJobDelay; firmwareStatusInfoJobTimeUnit = config.containsKey(TIME_UNIT_CONFIG_KEY) ? TimeUnit.valueOf((String) config.get(TIME_UNIT_CONFIG_KEY)) : firmwareStatusInfoJobTimeUnit; if (!firmwareUpdateHandlers.isEmpty()) { createFirmwareUpdateStatusInfoJob(); } }
Source:
public void setFinal(boolean ffinal) { this._final = ffinal; }

Target:
public void setFinal(boolean ffinal) { this.ffinal = ffinal; }
Source:
public void transform(StructuredRecord input, Emitter<StructuredRecord> emitter) { try { InputSource source = new InputSource(new StringReader((String) input.get(config.inputField))); source.setEncoding(config.encoding); DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder documentBuilder = builderFactory.newDocumentBuilder(); Document document = documentBuilder.parse(source); XPathFactory xpathFactory = XPathFactory.newInstance(); XPath xpath = xpathFactory.newXPath(); StructuredRecord.Builder builder = StructuredRecord.builder(outSchema); for (Schema.Field field : outSchema.getFields()) { String fieldName = field.getName(); NodeList nodeList = (NodeList) xpath.compile(xPathMapping.get(fieldName)).evaluate(document, XPathConstants.NODESET); if (nodeList.getLength() > 1) { throw new IllegalArgumentException("Cannot specify an XPath that is an array"); } Node node = nodeList.item(0); Schema.Type type = field.getSchema().getNonNullable().getType(); String value = getValue(node, type, fieldName); if (value == null) { builder.set(fieldName, null); } else { builder.set(fieldName, TypeConvertor.get(value, type)); } } emitter.emit(builder.build()); } catch (Exception e) { switch (config.processOnError) { case EXIT_ON_ERROR: throw new IllegalStateException("Terminating process on error: " + e.getMessage()); case WRITE_ERROR_DATASET: emitter.emitError(new InvalidEntry<>(31, e.getStackTrace()[0].toString() + " : " + e.getMessage(), input)); break; default: break; } } }

Target:
public void transform(StructuredRecord input, Emitter<StructuredRecord> emitter) { try { InputSource source = new InputSource(new StringReader((String) input.get(config.inputField))); source.setEncoding(config.encoding); DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder documentBuilder = builderFactory.newDocumentBuilder(); Document document = documentBuilder.parse(source); XPathFactory xpathFactory = XPathFactory.newInstance(); XPath xpath = xpathFactory.newXPath(); StructuredRecord.Builder builder = StructuredRecord.builder(outSchema); for (Schema.Field field : outSchema.getFields()) { String fieldName = field.getName(); NodeList nodeList = (NodeList) xpath.compile(xPathMapping.get(fieldName)).evaluate(document, XPathConstants.NODESET); if (nodeList.getLength() > 1) { throw new IllegalArgumentException("Cannot specify an XPath that is an array"); } Node node = nodeList.item(0); Schema.Type type = field.getSchema().getNonNullable().getType(); String value = getValue(node, type, fieldName); if (value == null) { builder.set(fieldName, null); } else { builder.set(fieldName, TypeConvertor.get(value, type)); } } emitter.emit(builder.build()); } catch (Exception e) { switch (config.processOnError) { case EXIT_ON_ERROR: throw new IllegalStateException("Terminating process on error: " + e.getMessage(), e); case WRITE_ERROR_DATASET: emitter.emitError(new InvalidEntry<>(31, e.getStackTrace()[0].toString() + " : " + e.getMessage(), input)); break; default: break; } } }
Source:
private JerseyRequest<ReportInputControlsListWrapper> buildRequest(){ JerseyRequest<ReportInputControlsListWrapper> request = JerseyRequest.buildRequest(sessionStorage, ReportInputControlsListWrapper.class, new String[]{"/reports", containerUri, "/inputControls"}, new DefaultErrorHandler()); if (excludeState) { request.addParam("exclude", "state"); } return request; }

Target:
private JerseyRequest<ReportInputControlsListWrapper> buildRequest(){ if (containerUri == null) { throw new MandatoryParameterNotFoundException("Uri of container should be specified"); } JerseyRequest<ReportInputControlsListWrapper> request = JerseyRequest.buildRequest(sessionStorage, ReportInputControlsListWrapper.class, new String[]{"/reports", containerUri, "/inputControls"}, new DefaultErrorHandler()); if (excludeState) { request.addParam("exclude", "state"); } return request; }
Source:
protected String[] getElementMetadata(int recordId, String[] metaFields, QueryContext context) { if (context == null || this.parent.getStorageCacheName() == null) { return parent.storage.getMetaDataForRecord(recordId, metaFields); } RecordSetResultCache recordSetCache = context.getQueryCacheOrNull(RecordSetResultCache.class); String recordSetKey = parent.getStorageCacheName(); String recordObjectKey = parent.getStorageCacheName() + "_partial"; RecordObjectCache<String[]> recordObjectCache = StorageInstanceTreeElement.getRecordObjectCacheIfRelevant( context); if (recordObjectCache != null) { if (recordObjectCache.isLoaded(recordObjectKey, recordId)) { return recordObjectCache.getLoadedRecordObject(recordObjectKey, recordId); } if (StorageInstanceTreeElement.canLoadRecordFromGroup(recordSetCache, recordSetKey, recordId)) { Pair<String, LinkedHashSet<Integer>> tranche = recordSetCache.getRecordSetForRecordId(recordSetKey, recordId); EvaluationTrace loadTrace = new EvaluationTrace(String.format("Model [%s]: Limited Scope Partial Bulk Load [%s}", recordObjectKey,tranche.first)); LinkedHashSet<Integer> body = tranche.second; parent.getStorage().bulkReadMetadata(body, metaFields, recordObjectCache.getLoadedCaseMap(recordObjectKey)); loadTrace.setOutcome("Loaded: " + body.size()); context.reportTrace(loadTrace); return recordObjectCache.getLoadedRecordObject(recordObjectKey, recordId); } } return parent.storage.getMetaDataForRecord(recordId, metaFields); }

Target:
protected String[] getElementMetadata(int recordId, String[] metaFields, QueryContext context) { if (context == null || this.parent.getStorageCacheName() == null) { return readSingleRecordMetadataFromStorage(recordId, metaFields); } RecordObjectCache<String[]> recordObjectCache = StorageInstanceTreeElement.getRecordObjectCacheIfRelevant( context); String recordObjectKey = parent.getStorageCacheName() + "_partial"; if (recordObjectCache == null) { return readSingleRecordMetadataFromStorage(recordId, metaFields); } if (recordObjectCache.isLoaded(recordObjectKey, recordId)) { return recordObjectCache.getLoadedRecordObject(recordObjectKey, recordId); } RecordSetResultCache recordSetCache = context.getQueryCacheOrNull(RecordSetResultCache.class); String recordSetKey = parent.getStorageCacheName(); if (!StorageInstanceTreeElement.canLoadRecordFromGroup(recordSetCache, recordSetKey, recordId)) { return readSingleRecordMetadataFromStorage(recordId, metaFields); } return populateMetaDataCacheAndReadForRecord(recordSetCache, recordSetKey, recordObjectCache, recordObjectKey, metaFields, context); }
Source:
public LamiTableContentProvider() { fCurrentEntries = checkNotNull(Collections.emptyList()); }

Target:
public LamiTableContentProvider() { fCurrentEntries = Collections.emptyList(); }
Source:
public void testAppFromOnlyConfigPackage() throws Exception { ApexCli.LaunchCommandLineInfo commandLineInfo = ApexCli .getLaunchCommandLineInfo(new String[]{"-conf", configFile.getAbsolutePath(), appFile.getAbsolutePath(), "-useConfigApps", "exclusive"}); ApexCli apexCli = new ApexCli(); apexCli.init(); Assert.assertEquals("configApps", "exclusive", commandLineInfo.useConfigApps); apexCli.getLaunchAppPackageArgs(ap, cp, commandLineInfo, new ConsoleReader()); Assert.assertEquals(ap.getApplications().size(), 1); }

Target:
public void testAppFromOnlyConfigPackage() throws Exception { ApexCli.LaunchCommandLineInfo commandLineInfo = ApexCli .getLaunchCommandLineInfo(new String[]{"-conf", configFile.getAbsolutePath(), appFile.getAbsolutePath(), "-useConfigApps", "exclusive"}); ApexCli apexCli = new ApexCli(); apexCli.init(); Assert.assertEquals("configApps", "exclusive", commandLineInfo.useConfigApps); apexCli.getLaunchAppPackageArgs(ap, cp, commandLineInfo, new ConsoleReader()); Assert.assertEquals(ap.getApplications().size(), 1); Assert.assertEquals(ap.getApplications().get(0).displayName, "testApp"); Assert.assertEquals(ap.getApplications().get(0).type, "json"); }
Source:
public void endToEndReplicationWithMultiNodeMultiPartitionTest() throws InterruptedException, IOException, InstantiationException { DataNodeId firstDataNode = nonSSLCluster.getClusterMap().getDataNodeIds().get(0); List<DataNodeId> dataNodes = nonSSLCluster.getThreeDataNodesFromDifferentDatacenters(); endToEndReplicationWithMultiNodeMultiPartitionTest(nonSSLCluster, firstDataNode.getPort(), new Port(dataNodes.get(0).getPort(), PortType.PLAINTEXT), new Port(dataNodes.get(1).getPort(), PortType.PLAINTEXT), new Port(dataNodes.get(2).getPort(), PortType.PLAINTEXT)); }

Target:
public void endToEndReplicationWithMultiNodeMultiPartitionTest() throws InterruptedException, IOException, InstantiationException { cluster = new MockCluster(notificationSystem); DataNodeId dataNode = cluster.getClusterMap().getDataNodeIds().get(0); ArrayList<String> dataCenterList = Utils.splitString("DC1,DC2,DC3", ","); List<DataNodeId> dataNodes = cluster.getOneDataNodeFromEachDatacenter(dataCenterList); endToEndReplicationWithMultiNodeMultiPartitionTest(dataNode.getPort(), new Port(dataNodes.get(0).getPort(), PortType.PLAINTEXT), new Port(dataNodes.get(1).getPort(), PortType.PLAINTEXT), new Port(dataNodes.get(2).getPort(), PortType.PLAINTEXT)); }
Source:
public void testGetEmptyBodyAndHeader() throws Exception { GreenMail greenMail = new GreenMail(ServerSetupTest.SMTP_IMAP); try { greenMail.start(); String subject = GreenMailUtil.random(); String body = ""; String to = "test@localhost"; final byte[] gifAttachment = {0, 1, 2}; GreenMailUtil.sendAttachmentEmail(to, "from@localhost", subject, body, gifAttachment, "image/gif", "testimage_filename", "testimage_description", greenMail.getSmtp().getServerSetup()); greenMail.waitForIncomingEmail(5000, 1); try (Retriever retriever = new Retriever(greenMail.getImap())) { MimeMultipart mp = (MimeMultipart) retriever.getMessages(to)[0].getContent(); BodyPart bp; bp = mp.getBodyPart(0); assertThat(GreenMailUtil.getBody(bp).trim()).isEqualTo(body); assertThat( "Content-Type: text/plain; charset=us-ascii\r\n" + "Content-Transfer-Encoding: 7bit").isEqualTo( GreenMailUtil.getHeaders(bp).trim()); bp = mp.getBodyPart(1); assertThat(GreenMailUtil.getBody(bp).trim()).isEqualTo("AAEC"); assertThat( "Content-Type: image/gif; name=testimage_filename\r\n" + "Content-Transfer-Encoding: base64\r\n" + "Content-Disposition: attachment; filename=testimage_filename\r\n" + "Content-Description: testimage_description").isEqualTo(GreenMailUtil.getHeaders(bp).trim()); ByteArrayOutputStream bout = new ByteArrayOutputStream(); GreenMailUtil.copyStream(bp.getInputStream(), bout); assertThat(bout.toByteArray()).isEqualTo(gifAttachment); } } finally { greenMail.stop(); } }

Target:
public void testGetEmptyBodyAndHeader() throws Exception { GreenMail greenMail = new GreenMail(ServerSetupTest.SMTP_IMAP); try { greenMail.start(); String subject = GreenMailUtil.random(); String body = ""; String to = "test@localhost"; final byte[] gifAttachment = {0, 1, 2}; GreenMailUtil.sendAttachmentEmail(to, "from@localhost", subject, body, gifAttachment, "image/gif", "testimage_filename", "testimage_description", greenMail.getSmtp().getServerSetup()); greenMail.waitForIncomingEmail(5000, 1); try (Retriever retriever = new Retriever(greenMail.getImap())) { MimeMultipart mp = (MimeMultipart) retriever.getMessages(to)[0].getContent(); BodyPart bp; bp = mp.getBodyPart(0); assertThat(body).isEqualTo(GreenMailUtil.getBody(bp).trim()); assertThat( "Content-Type: text/plain; charset=us-ascii\r\n" + "Content-Transfer-Encoding: 7bit").isEqualTo( GreenMailUtil.getHeaders(bp).trim()); bp = mp.getBodyPart(1); assertThat("AAEC").isEqualTo(GreenMailUtil.getBody(bp).trim()); assertThat( "Content-Type: image/gif; name=testimage_filename\r\n" + "Content-Transfer-Encoding: base64\r\n" + "Content-Disposition: attachment; filename=testimage_filename\r\n" + "Content-Description: testimage_description").isEqualTo(GreenMailUtil.getHeaders(bp).trim()); ByteArrayOutputStream bout = new ByteArrayOutputStream(); GreenMailUtil.copyStream(bp.getInputStream(), bout); assertThat(bout.toByteArray()).isEqualTo(gifAttachment); } } finally { greenMail.stop(); } }
Source:
public String getCollectionOutput() { MultiInstanceLoopCharacteristics loopCharacteristics = getMultiInstanceLoopCharacteristics(); ItemAwareElement ieDataOutput = loopCharacteristics.getLoopDataOutputRef(); return process.getDataOutputAssociations().stream() .filter(doa -> doa.getSourceRef().get(0).equals(ieDataOutput)) .map(doa -> doa.getTargetRef().getId()) .findFirst() .get(); }

Target:
public String getCollectionOutput() { ItemAwareElement ieDataOutput = getMultiInstanceLoopCharacteristics() .map(MultiInstanceLoopCharacteristics::getLoopDataOutputRef) .orElse(null); return process.getDataOutputAssociations().stream() .filter(doa -> doa.getSourceRef().get(0).getId().equals(ieDataOutput.getId())) .map(doa -> ProcessVariableReader.getProcessVariableName((Property) doa.getTargetRef())) .findFirst() .orElse(null); }
Source:
protected void onProgressUpdateInternal(final Integer status) { if (activity != null) { setMessage(activity.getString(status == STATUS_UPLOAD ? R.string.export_fieldnotes_uploading : R.string.export_persnotes_creating) + " (" + persNotesCount + ')'); } }

Target:
protected void onProgressUpdateInternal(final Integer status) { if (activity != null) { setMessage(activity.getString(R.string.export_persnotes_uploading, persNotesCount)); } }
Source:
public static Long getSplitsPerNode(ConnectorSession session) { return session.getProperty(SPLITS_PER_NODE, Long.class); }

Target:
public static Optional<Long> getSplitsPerNode(ConnectorSession session) { return Optional.ofNullable(session.getProperty(SPLITS_PER_NODE, Long.class)); }
Source:
private JPanel getInstalledAddOnsPanel() { if (installedAddOnsPanel == null) { installedAddOnsPanel = new JPanel(); installedAddOnsPanel.setLayout(new GridBagLayout()); installedAddOnsPanel.setBorder( BorderFactory.createTitledBorder( null, Constant.messages.getString("cfu.label.addons.border"), TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, FontUtils.getFont(FontUtils.Size.standard), java.awt.Color.black)); getInstalledAddOnsTable(); JScrollPane scrollPane = new JScrollPane(); scrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setViewportView(getInstalledAddOnsTable()); JPanel searchPanel = getSearchPanel(getInstalledAddOnsTable()); int row = 0; installedAddOnsPanel.add(searchPanel, LayoutHelper.getGBC(0, row++, 5, 0.0D)); installedAddOnsPanel.add(scrollPane, LayoutHelper.getGBC(0, row++, 5, 1.0D, 1.0D)); installedAddOnsPanel.add(new JLabel(""), LayoutHelper.getGBC(0, row++, 1, 1.0D)); installedAddOnsPanel.add(getUninstallButton(), LayoutHelper.getGBC(1, row, 1, 0.0D)); installedAddOnsPanel.add(getUpdateButton(), LayoutHelper.getGBC(2, row, 1, 0.0D)); installedAddOnsPanel.add(getUpdateAllButton(), LayoutHelper.getGBC(3, row, 1, 0.0D)); installedAddOnsPanel.add(getClose1Button(), LayoutHelper.getGBC(4, row, 1, 0.0D)); } return installedAddOnsPanel; }

Target:
private JPanel getInstalledAddOnsPanel() { if (installedAddOnsPanel == null) { installedAddOnsPanel = new JPanel(); installedAddOnsPanel.setLayout(new GridBagLayout()); installedAddOnsPanel.setBorder( BorderFactory.createTitledBorder( null, Constant.messages.getString("cfu.label.addons.border"), TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, FontUtils.getFont(FontUtils.Size.standard), java.awt.Color.black)); getInstalledAddOnsTable(); JScrollPane scrollPane = new JScrollPane(); scrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setViewportView(getInstalledAddOnsTable()); installedAddOnsFilterPanel = createFilterPanel(getInstalledAddOnsTable()); int row = 0; installedAddOnsPanel.add(installedAddOnsFilterPanel, LayoutHelper.getGBC(0, row++, 5, 0.0D)); installedAddOnsPanel.add(scrollPane, LayoutHelper.getGBC(0, row++, 5, 1.0D, 1.0D)); installedAddOnsPanel.add(new JLabel(""), LayoutHelper.getGBC(0, row, 1, 1.0D)); installedAddOnsPanel.add(getUninstallButton(), LayoutHelper.getGBC(1, row, 1, 0.0D)); installedAddOnsPanel.add(getUpdateButton(), LayoutHelper.getGBC(2, row, 1, 0.0D)); installedAddOnsPanel.add(getUpdateAllButton(), LayoutHelper.getGBC(3, row, 1, 0.0D)); installedAddOnsPanel.add(getClose1Button(), LayoutHelper.getGBC(4, row, 1, 0.0D)); } return installedAddOnsPanel; }
Source:
public BeanValidatingItemProcessor(LocalValidatorFactoryBean localValidatorFactoryBean) throws Exception { super(); Assert.notNull(localValidatorFactoryBean, "localValidatorFactoryBean must not be null"); localValidatorFactoryBean.afterPropertiesSet(); Validator validator = localValidatorFactoryBean.getValidator(); SpringValidatorAdapter springValidatorAdapter = new SpringValidatorAdapter(validator); SpringValidator<T> springValidator = new SpringValidator<>(); springValidator.setValidator(springValidatorAdapter); springValidator.afterPropertiesSet(); setValidator(springValidator); }

Target:
public BeanValidatingItemProcessor(LocalValidatorFactoryBean localValidatorFactoryBean) { Assert.notNull(localValidatorFactoryBean, "localValidatorFactoryBean must not be null"); this.validator = localValidatorFactoryBean.getValidator(); }
Source:
public Object getValueAt(int rowIdx, int colIdx) { if (0 == nodeKeys.size()) { return Bundle.OtherOccurrencesFilesTableModel_noData(); } return FilenameUtils.getName(((OtherOccurrenceNodeInstanceData) nodeMap.get(nodeKeys.get(rowIdx)).get(0)).getFilePath()); }

Target:
public Object getValueAt(int rowIdx, int colIdx) { if (nodeMap.isEmpty() || nodeKeys.isEmpty() || rowIdx < 0 || rowIdx >= nodeKeys.size() || nodeKeys.get(rowIdx) == null || nodeMap.get(nodeKeys.get(rowIdx)) == null || nodeMap.get(nodeKeys.get(rowIdx)).isEmpty()) { return Bundle.OtherOccurrencesFilesTableModel_noData(); } return FilenameUtils.getName(((OtherOccurrenceNodeInstanceData) nodeMap.get(nodeKeys.get(rowIdx)).get(0)).getFilePath()); }
Source:
private void addSubmitRecordLabels(SubmitRecord submitRecord, SubmitRecordAttribute sa) throws IllegalStateException { if (submitRecord.labels != null && !submitRecord.labels.isEmpty()) { sa.labels = new ArrayList<SubmitLabelAttribute>(); for (SubmitRecord.Label lbl : submitRecord.labels) { SubmitLabelAttribute la = new SubmitLabelAttribute(); la.label = lbl.label; switch (lbl.status) { case OK: la.status = "OK"; break; case REJECT: la.status = "REJECT"; break; case NEED: la.status = "NEED"; break; case MAY: la.status = "MAY"; break; case IMPOSSIBLE: la.status = "IMPOSSIBLE"; break; default: throw new IllegalStateException( "Unsupported SubmitRecord.Label.status (" + lbl.status + ")"); } if(lbl.appliedBy != null) { Account a = accountCache.get(lbl.appliedBy).getAccount(); la.by = asAccountAttribute(a); } sa.labels.add(la); } } }

Target:
private void addSubmitRecordLabels(SubmitRecord submitRecord, SubmitRecordAttribute sa) { if (submitRecord.labels != null && !submitRecord.labels.isEmpty()) { sa.labels = new ArrayList<SubmitLabelAttribute>(); for (SubmitRecord.Label lbl : submitRecord.labels) { SubmitLabelAttribute la = new SubmitLabelAttribute(); la.label = lbl.label; la.status = lbl.status.name(); if(lbl.appliedBy != null) { Account a = accountCache.get(lbl.appliedBy).getAccount(); la.by = asAccountAttribute(a); } sa.labels.add(la); } } }
Source:
private Path generateTempDir(IMethodInvocation invocation) throws IOException { String prefix = TEMP_DIR_PREFIX + "_" + ((invocation.getIteration() == null) ? invocation.getSpec().getName() : invocation.getIteration().getName()) .replaceAll("[^a-zA-Z0-9_.-]++", "_") + "_" + fieldInfo.getName(); if (parentDir == null) { return Files.createTempDirectory(prefix); } return Files.createTempDirectory(parentDir, prefix); }

Target:
private Path generateTempDir(IMethodInvocation invocation) throws IOException { String prefix = dirPrefix(invocation); if (parentDir == null) { return Files.createTempDirectory(prefix); } return Files.createTempDirectory(parentDir, prefix); }
Source:
public static FluidTagInput deserialize(JsonElement input) { Preconditions.checkArgument(input instanceof JsonObject, "FluidTagWithSize can only be deserialized from a JsonObject"); JsonObject jsonObject = input.getAsJsonObject(); ResourceLocation resourceLocation = new ResourceLocation(JSONUtils.getString(jsonObject, "tag")); if(!JSONUtils.hasField(jsonObject, "nbt")) return new FluidTagInput(resourceLocation, JSONUtils.getInt(jsonObject, "amount")); try { CompoundNBT nbt = JsonToNBT.getTagFromJson(JSONUtils.getString(jsonObject, "nbt")); return new FluidTagInput(resourceLocation, JSONUtils.getInt(jsonObject, "amount"), nbt); } catch(CommandSyntaxException e) { throw new RuntimeException(e); } }

Target:
public static FluidTagInput deserialize(JsonElement input) { Preconditions.checkArgument(input instanceof JsonObject, "FluidTagWithSize can only be deserialized from a JsonObject"); JsonObject jsonObject = input.getAsJsonObject(); ResourceLocation resourceLocation = new ResourceLocation(JSONUtils.getString(jsonObject, "tag")); if(!JSONUtils.hasField(jsonObject, "nbt")) return new FluidTagInput(resourceLocation, JSONUtils.getInt(jsonObject, "amount")); try { CompoundNBT nbt = ItemUtils.parseNbtFromJson(jsonObject.get("nbt")); return new FluidTagInput(resourceLocation, JSONUtils.getInt(jsonObject, "amount"), nbt); } catch(CommandSyntaxException e) { throw new JsonParseException(e); } }
Source:
public void networkNull() throws Exception { validator = spy(new NetworkValidator(null)); assertEquals(new ValidationResult(VdcBllMessages.NETWORK_NOT_EXISTS), validator.networkExists()); }

Target:
public void networkNull() throws Exception { validator = new NetworkValidator(null); assertEquals(new ValidationResult(VdcBllMessages.NETWORK_NOT_EXISTS), validator.networkExists()); }
Source:
public TextureAtlas(FileHandle packFile, FileHandle imagesDir){ String[] lines; try { lines = packFile.readAllLines(); } catch (IOException e) { throw new MdxException(e.toString()); } int i = 1; Texture packTexture; while (i < lines.length){ packTexture = Mdx.graphics.newTexture(imagesDir.child(lines[i])); i+=5; while (i < lines.length && !lines[i].isEmpty()){ int index, x, y, width, height, originalWidth, originalHeight, offsetX, offsetY; String name = lines[i]; boolean rotate = Boolean.parseBoolean(lines[i + 1].split(":")[1].trim()); int[] xyTuple = readTuple(lines[i + 2]); x = xyTuple[0]; y = xyTuple[1]; int[] whTuple = readTuple(lines[i + 3]); width = whTuple[0]; height = whTuple[1]; int[] originalWhTuple = readTuple(lines[i + 4]); originalWidth = originalWhTuple[0]; originalHeight = originalWhTuple[1]; int[] offsetTuple = readTuple(lines[i + 5]); offsetX = offsetTuple[0]; offsetY = offsetTuple[1]; index = Integer.parseInt(lines[i + 6].split(":")[1].trim()); atlasRegions.add(Mdx.graphics.newTextureAtlasRegion(packTexture, name, index, x, y, width, height, rotate, originalWidth, originalHeight, offsetX, offsetY)); i += 7; } i++; } }

Target:
public TextureAtlas(FileHandle packFile, FileHandle imagesDir){ TextureAtlasConfig config = new TextureAtlasConfig(packFile, imagesDir); for (String texturePath : config.getDependencies()){ config.textures.replace(texturePath, Mdx.graphics.newTexture(Mdx.files.internal(texturePath))); } initFromConfig(config); }
Source:
public void onSubscribe(Subscription inner) { SubscriptionHelper.setOnce(this, inner); o.onSubscribe(this); inner.request(Long.MAX_VALUE); }

Target:
public void onSubscribe(Subscription inner) { this.inner = inner; o.onSubscribe(this); inner.request(Long.MAX_VALUE); }
Source:
public synchronized void doHandleClusterView(int viewId) { if (currentTopology == null) return; List<Address> newClusterMembers = transport.getMembers(); int newViewId = transport.getViewId(); if (newViewId != viewId) { log.debugf("Cache %s skipping members update for view %d after receiving view %d", cacheName, viewId, newViewId); return; } if (trace) log.tracef("Cache %s updating members for view %d: %s", cacheName, viewId, newClusterMembers); boolean cacheMembersModified = retainMembers(newClusterMembers); availabilityStrategy.onClusterViewChange(this, newClusterMembers); if (cacheMembersModified) { updateMembers(); } }

Target:
public synchronized void doHandleClusterView(int viewId) { if (currentTopology == null) return; List<Address> newClusterMembers = transport.getMembers(); int newViewId = transport.getViewId(); if (newViewId != viewId) { log.debugf("Cache %s skipping members update for view %d, newer view received: %d", cacheName, viewId, newViewId); return; } if (trace) log.tracef("Cache %s updating members for view %d: %s", cacheName, viewId, newClusterMembers); boolean cacheMembersModified = retainMembers(newClusterMembers); availabilityStrategy.onClusterViewChange(this, newClusterMembers); if (cacheMembersModified) { updateMembers(); } }
Source:
public void session_should_detect_cluster_close() { ScassandraCluster scassandraCluster = ScassandraCluster.builder().withIpPrefix(TestUtils.IP_PREFIX).build(); Cluster cluster = Cluster.builder() .addContactPoints(scassandraCluster.address(1).getAddress()) .withPort(scassandraCluster.getBinaryPort()) .withNettyOptions(nonQuietClusterCloseOptions) .build(); try { scassandraCluster.init(); Session session = cluster.connect(); cluster.close(); try { session.execute("SELECTS * FROM system.peers"); fail( "This error when session.execute is called on session associated with closed cluster."); } catch (IllegalStateException e) { assertThat( e.getMessage().equals("Parent cluster is closed. This session is no longer valid.")); } } finally { scassandraCluster.stop(); } }

Target:
public void session_should_detect_cluster_close() { ScassandraCluster scassandraCluster = ScassandraCluster.builder().withIpPrefix(TestUtils.IP_PREFIX).build(); Cluster cluster = Cluster.builder() .addContactPoints(scassandraCluster.address(1).getAddress()) .withPort(scassandraCluster.getBinaryPort()) .withNettyOptions(nonQuietClusterCloseOptions) .build(); try { scassandraCluster.init(); Session session = cluster.connect(); cluster.close(); try { session.execute("SELECTS * FROM system.peers"); fail("Should have failed when session.execute was called on cluster that was closed"); } catch (DriverInternalError e) { assertThat(e.getCause()).isInstanceOf(IllegalStateException.class); assertThat(e.getCause()).hasMessage("Could not send request, session is closed"); } } finally { scassandraCluster.stop(); } }
Source:
PredicateArgs(String args) throws QueryParseException { positional = Lists.newArrayList(); keyValue = Maps.newHashMap(); String[] splitArgs = args.split(","); for (String arg : splitArgs) { String splitKeyValue[] = arg.split("="); if (splitKeyValue.length == 1) { positional.add(splitKeyValue[0]); } else if (splitKeyValue.length == 2) { if (!keyValue.containsKey(splitKeyValue[0])) { keyValue.put(splitKeyValue[0], splitKeyValue[1]); } else { throw new QueryParseException("Duplicate key " + splitKeyValue[0]); } } else { throw new QueryParseException("invalid arg " + arg); } } }

Target:
PredicateArgs(String args) throws QueryParseException { positional = Lists.newArrayList(); keyValue = Maps.newHashMap(); String[] splitArgs = args.split(","); for (String arg : splitArgs) { String[] splitKeyValue = arg.split("="); if (splitKeyValue.length == 1) { positional.add(splitKeyValue[0]); } else if (splitKeyValue.length == 2) { if (!keyValue.containsKey(splitKeyValue[0])) { keyValue.put(splitKeyValue[0], splitKeyValue[1]); } else { throw new QueryParseException("Duplicate key " + splitKeyValue[0]); } } else { throw new QueryParseException("invalid arg " + arg); } } }
Source:
private void checkOcServer() { String uri = mHostUrlInput.getText().toString().trim(); mServerIsValid = false; mServerIsChecked = false; mLoginButton.setVisibility(View.GONE); mServerInfo = new GetServerInfoOperation.ServerInfo(); showRefreshButton(false); if (uri.length() != 0) { uri = stripIndexPhpOrAppsFiles(uri, mHostUrlInput); uri = subdomainToLower(uri, mHostUrlInput); try { uri = DisplayUtils.convertIdn(uri, true); } catch (IllegalArgumentException ex) { } mServerStatusText = getResources().getString(R.string.auth_testing_connection); mServerStatusIcon = R.drawable.progress_small; showServerStatus(); SharedPreferences.Editor editor = PreferenceManager .getDefaultSharedPreferences(this).edit(); editor.putString("server_url", normalizeUrlSuffix(uri)); editor.apply(); Intent getServerInfoIntent = new Intent(); getServerInfoIntent.setAction(OperationsService.ACTION_GET_SERVER_INFO); getServerInfoIntent.putExtra(OperationsService.EXTRA_SERVER_URL, normalizeUrlSuffix(uri)); if (mOperationsServiceBinder != null) { mWaitingForOpId = mOperationsServiceBinder.queueNewOperation(getServerInfoIntent); } else { Timber.e("Server check tried with OperationService unbound!"); } } else { mServerStatusText = ""; mServerStatusIcon = 0; showServerStatus(); } }

Target:
private void checkOcServer() { String uri = mHostUrlInput.getText().toString().trim(); mServerIsValid = false; mServerIsChecked = false; mLoginButton.setVisibility(View.GONE); mServerInfo = new GetServerInfoOperation.ServerInfo(); showRefreshButton(false); if (uri.length() != 0) { uri = stripIndexPhpOrAppsFiles(uri, mHostUrlInput); uri = subdomainToLower(uri, mHostUrlInput); try { uri = DisplayUtils.convertIdn(uri, true); } catch (IllegalArgumentException ex) { } mServerStatusText = getResources().getString(R.string.auth_testing_connection); mServerStatusIcon = R.drawable.progress_small; showServerStatus(); Intent getServerInfoIntent = new Intent(); getServerInfoIntent.setAction(OperationsService.ACTION_GET_SERVER_INFO); getServerInfoIntent.putExtra(OperationsService.EXTRA_SERVER_URL, normalizeUrlSuffix(uri)); if (mOperationsServiceBinder != null) { mWaitingForOpId = mOperationsServiceBinder.queueNewOperation(getServerInfoIntent); } else { Timber.e("Server check tried with OperationService unbound!"); } } else { mServerStatusText = ""; mServerStatusIcon = 0; showServerStatus(); } }
Source:
public void testConstructorFailForUnsupportedRequireStable() { builder = new OffsetFetchRequest.Builder(groupId, true, null); for (short version = 0; version <= ApiKeys.OFFSET_FETCH.latestVersion(); version++) { short finalVersion = version; if (version < 2) { assertThrows(UnsupportedVersionException.class, () -> builder.build(finalVersion)); } else { OffsetFetchRequest request = builder.build(finalVersion); assertEquals(groupId, request.groupId()); assertNull(request.partitions()); assertTrue(request.isAllPartitions()); if (version < 7) { assertFalse(request.requireStable()); } else { assertTrue(request.requireStable()); } } } }

Target:
public void testConstructorFailForUnsupportedRequireStable() { for (short version = 0; version <= ApiKeys.OFFSET_FETCH.latestVersion(); version++) { builder = new OffsetFetchRequest.Builder(groupId, true, null); final short finalVersion = version; if (version < 2) { assertThrows(UnsupportedVersionException.class, () -> builder.build(finalVersion)); } else { OffsetFetchRequest request = builder.build(finalVersion); assertEquals(groupId, request.groupId()); assertNull(request.partitions()); assertTrue(request.isAllPartitions()); if (version < 7) { assertFalse(request.requireStable()); } else { assertTrue(request.requireStable()); } } } }
Source:
private void notifyCallbackWithSuccess() { callback.onSuccess(); activeTasks.remove(this); }

Target:
void notifyCallbackWithSuccess() { callback.onSuccess(); activeTasks.remove(this); }
Source:
public void testCorrectDialogTitle() { openNewDataDialog(variableBrickPosition, R.id.set_variable_spinner); onView(withText(R.string.formula_editor_variable_dialog_title)) .noActivity(); clickCancel(); openNewDataDialog(listBrickPosition, R.id.add_item_to_userlist_spinner); onView(withText(R.string.formula_editor_list_dialog_title)) .noActivity(); }

Target:
public void testCorrectDialogTitle() { clickOnEmptySpinner(variableBrickPosition, R.id.set_variable_spinner); onView(withText(R.string.formula_editor_variable_dialog_title)) .check(matches(isDisplayed())); clickCancel(); clickOnEmptySpinner(listBrickPosition, R.id.add_item_to_userlist_spinner); onView(withText(R.string.formula_editor_list_dialog_title)) .check(matches(isDisplayed())); }