auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Jar pack(String profile) throws Exception { List<String> ignore = new ExtList<>(BUNDLE_SPECIFIC_HEADERS); try (ProjectBuilder pb = getBuilder(null)) { List<Builder> subBuilders = pb.getSubBuilders(); if (subBuilders.size() != 1) { error("Project has multiple bnd files, please select one of the bnd files").header(EXPORT) .context(profile); return null; } try (Builder b = subBuilders.iterator() .next()) { ignore.remove(BUNDLE_SYMBOLICNAME); ignore.remove(BUNDLE_VERSION); ignore.add(SERVICE_COMPONENT); try (ProjectLauncher launcher = getProjectLauncher()) { launcher.getRunProperties() .put("profile", profile); launcher.getRunProperties() .put(PROFILE, profile); Jar jar = launcher.executable(); Manifest m = jar.getManifest(); Attributes main = m.getMainAttributes(); for (String key : this) { if (Character.isUpperCase(key.charAt(0)) && !ignore.contains(key)) { String value = getProperty(key); if (value == null) continue; Name name = new Name(key); String trimmed = value.trim(); if (trimmed.isEmpty()) main.remove(name); else if (EMPTY_HEADER.equals(trimmed)) main.put(name, ""); else main.put(name, value); } } if (main.getValue(BUNDLE_SYMBOLICNAME) == null) main.putValue(BUNDLE_SYMBOLICNAME, b.getBsn()); if (main.getValue(BUNDLE_SYMBOLICNAME) == null) main.putValue(BUNDLE_SYMBOLICNAME, getName()); if (main.getValue(BUNDLE_VERSION) == null) { main.putValue(BUNDLE_VERSION, Version.LOWEST.toString()); warning("No version set, uses 0.0.0"); } jar.setManifest(m); jar.calcChecksums(new String[] { "SHA1", "MD5" }); launcher.removeClose(jar); return jar; } } } }

Target:
public Jar pack(String profile) throws Exception { return ExecutableJarExporter.pack(this, profile); }
Source:
public List<ChoiceDTO> getChoices() { return super.choices; }

Target:
public List<ChoiceDTO> getChoices() { return super.getChoices(); }
Source:
private void addQuotaToVcpuQuotaList(QuotaPerUserUsageEntity quotaPerUserUsageEntity) { QuotaProgressBar vcpuQuotaProgressBar = new QuotaProgressBar(); if (quotaPerUserUsageEntity.isUnlimitedVcpu()) { vcpuQuotaProgressBar.setUnlimited(true); } else { vcpuQuotaProgressBar.setValueA((int) quotaPerUserUsageEntity.getOthersVcpuUsagePercentage()); vcpuQuotaProgressBar.setValueB((int) quotaPerUserUsageEntity.getUserVcpuUsagePercentage()); vcpuQuotaProgressBar.setTitle(messages.quotaFreeCpus(quotaPerUserUsageEntity.getFreeVcpu())); if (quotaPerUserUsageEntity.getVcpuTotalUsage() == 0) { vcpuQuotaProgressBar.setZeroValue(); } } VerticalPanel verticalPanel = new VerticalPanel(); Label quotaName = new Label(); quotaName.setText(quotaPerUserUsageEntity.getQuotaName()); verticalPanel.add(quotaName); verticalPanel.add(vcpuQuotaProgressBar); verticalPanel.setWidth("100%"); cpusQuotasList.add(verticalPanel); }

Target:
private void addQuotaToVcpuQuotaList(QuotaPerUserUsageEntity quotaPerUserUsageEntity) { QuotaProgressBar vcpuQuotaProgressBar = new QuotaProgressBar(); if (quotaPerUserUsageEntity.isUnlimitedVcpu()) { vcpuQuotaProgressBar.setUnlimited(true); } else { vcpuQuotaProgressBar.setValueA((int) quotaPerUserUsageEntity.getOthersVcpuUsagePercentage()); vcpuQuotaProgressBar.setValueB((int) quotaPerUserUsageEntity.getUserVcpuUsagePercentage()); vcpuQuotaProgressBar.setTitle(messages.quotaFreeCpus(quotaPerUserUsageEntity.getFreeVcpu())); if (quotaPerUserUsageEntity.getVcpuTotalUsage() == 0) { vcpuQuotaProgressBar.setZeroValue(); } } addQuotaRow(cpusQuotasList, quotaPerUserUsageEntity.getQuotaName(), vcpuQuotaProgressBar); }
Source:
private JXTable getNotesTable() { if (notesTable == null) { notesTable = new JXTable(); notesTable.setModel(getNotesTableModel()); notesTable.setColumnSelectionAllowed(false); notesTable.setCellSelectionEnabled(false); notesTable.setRowSelectionAllowed(true); notesTable.setAutoCreateRowSorter(true); notesTable.setColumnControlVisible(true); notesTable.setSortable(false); notesTable.getTableHeader().setReorderingAllowed(false); notesTable .getSelectionModel() .addListSelectionListener( new NotesTableSelectionHandler(notesTable, getExtensionHistory())); fillTable(); } return notesTable; }

Target:
private JXTable getNotesTable() { if (notesTable == null) { notesTable = new JXTable(); notesTable.setModel(getNotesTableModel()); notesTable.setColumnSelectionAllowed(false); notesTable.setCellSelectionEnabled(false); notesTable.setRowSelectionAllowed(true); notesTable.setAutoCreateRowSorter(true); notesTable.setColumnControlVisible(true); notesTable .getSelectionModel() .addListSelectionListener( new NotesTableSelectionHandler(notesTable, getExtensionHistory())); fillTable(); } return notesTable; }
Source:
public void setObjectId(ObjectId oid) { this.oid = oid; }

Target:
public DescribeCommand setObjectId(ObjectId oid) { this.oid = oid; return this; }
Source:
public GeoJsonObjectType deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException { String jsonValue = jsonParser.getText(); for (GeoJsonObjectType enumValue : GeoJsonObjectType.values()) { if (enumValue.getGeoJsonName().equals(jsonValue)) { return enumValue; } } throw new IOException("No such value."); }

Target:
public GeoJsonObjectType deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException { String jsonValue = jsonParser.getText(); for (GeoJsonObjectType enumValue : GeoJsonObjectType.values()) { if (enumValue.getGeoJsonName().equals(jsonValue)) { return enumValue; } } throw new IOException(jsonValue + " is not defined in GeoJsonObjectType"); }
Source:
private String buildUrl(GHGeocodingRequest request) { String url = routeServiceUrl + "?"; if (request.isReverse()) { url += "reverse=true"; url += "&point=" + request.getLat() + "," + request.getLon(); } else { url += "reverse=false"; url += "&q=" + request.getQuery(); if (!Double.isNaN(request.getLat())) url += "&point=" + request.getLat() + "," + request.getLon(); } url += "&limit=" + request.getLimit(); url += "&locale=" + request.getLocale(); url += "&provider=" + request.getProvider(); if (!key.isEmpty()) { url += "&key=" + WebHelper.encodeURL(key); } return url; }

Target:
private String buildUrl(GHGeocodingRequest request) { String url = routeServiceUrl + "?"; if (request.isReverse()) { if (!request.getPoint().isValid()) throw new IllegalArgumentException("For reverse geocoding you have to pass valid lat and long values"); url += "reverse=true"; } else { if (request.getQuery() == null) throw new IllegalArgumentException("For forward geocoding you have to a string for the query"); url += "reverse=false"; url += "&q=" + request.getQuery(); } if (request.getPoint().isValid()) url += "&point=" + request.getPoint().getLat() + "," + request.getPoint().getLon(); url += "&limit=" + request.getLimit(); url += "&locale=" + request.getLocale(); url += "&provider=" + request.getProvider(); if (!key.isEmpty()) { url += "&key=" + WebHelper.encodeURL(key); } return url; }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof ComponentImpl)) { return false; } ComponentImpl component = (ComponentImpl) o; return getMountSources() == component.getMountSources() && Objects.equals(id, component.id) && Objects.equals(name, component.name) && Objects.equals(type, component.type) && Objects.equals(componentId, component.componentId) && Objects.equals(reference, component.reference) && Objects.equals(referenceContent, component.referenceContent) && Objects.equals(getEntrypoints(), component.getEntrypoints()) && Objects.equals(image, component.image) && Objects.equals(memoryLimit, component.memoryLimit) && Objects.equals(command, component.command) && Objects.equals(getArgs(), component.getArgs()) && Objects.equals(getVolumes(), component.getVolumes()) && Objects.equals(getEnv(), component.getEnv()) && Objects.equals(getEndpoints(), component.getEndpoints()); }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof ComponentImpl)) { return false; } ComponentImpl component = (ComponentImpl) o; return getMountSources() == component.getMountSources() && Objects.equals(generatedId, component.generatedId) && Objects.equals(alias, component.alias) && Objects.equals(type, component.type) && Objects.equals(componentId, component.componentId) && Objects.equals(reference, component.reference) && Objects.equals(referenceContent, component.referenceContent) && Objects.equals(image, component.image) && Objects.equals(memoryLimit, component.memoryLimit) && Objects.equals(getSelector(), component.getSelector()) && Objects.equals(getEntrypoints(), component.getEntrypoints()) && Objects.equals(getCommand(), component.getCommand()) && Objects.equals(getArgs(), component.getArgs()) && Objects.equals(getVolumes(), component.getVolumes()) && Objects.equals(getEnv(), component.getEnv()) && Objects.equals(getEndpoints(), component.getEndpoints()); }
Source:
private static OGCGeometry geomFromBinary(Slice input) { requireNonNull(input, "input is null"); OGCGeometry geometry; try { geometry = OGCGeometry.fromBinary(input.toByteBuffer()); } catch (IllegalArgumentException | IndexOutOfBoundsException e) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "Invalid WKB: " + e.toString(), e); } geometry.setSpatialReference(null); return geometry; }

Target:
private static OGCGeometry geomFromBinary(Slice input) { requireNonNull(input, "input is null"); OGCGeometry geometry; try { geometry = OGCGeometry.fromBinary(input.toByteBuffer()); } catch (IllegalArgumentException | IndexOutOfBoundsException e) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "Invalid WKB", e); } geometry.setSpatialReference(null); return geometry; }
Source:
public static TraceTokenScope addTraceTokenProperties(String... properties) { TokenState tokenState = token.get(); checkState(tokenState != null, "no current trace token"); Map<String, String> map = new LinkedHashMap<>(tokenState.getToken()); checkArgument((properties.length % 2) == 0, "odd number of elements in properties"); for (int i = 0; i < properties.length; i += 2) { requireNonNull(properties[i], "property key is null"); requireNonNull(properties[i+1], "property value is null"); map.put(properties[i], properties[i+1]); } return registerTraceToken(new TraceToken(map)); }

Target:
public static TraceTokenScope addTraceTokenProperties(String... properties) { TokenState tokenState = token.get(); if (tokenState == null) { return new TraceTokenScope(null); } Map<String, String> map = new LinkedHashMap<>(tokenState.getToken()); checkArgument((properties.length % 2) == 0, "odd number of elements in properties"); for (int i = 0; i < properties.length; i += 2) { requireNonNull(properties[i], "property key is null"); requireNonNull(properties[i+1], "property value is null"); map.put(properties[i], properties[i+1]); } return registerTraceToken(new TraceToken(map)); }
Source:
public static RequestQueue newRequestQueue(Context context) { File cacheDir = new File(context.getCacheDir(), DEFAULT_CACHE_DIR); cacheDir.mkdirs(); String userAgent = "volley/0"; try { String packageName = context.getPackageName(); PackageInfo info = context.getPackageManager().getPackageInfo(packageName, 0); userAgent = packageName + "/" + info.versionCode; } catch (NameNotFoundException e) { } HttpStack stack; if (Build.VERSION.SDK_INT >= 9) { stack = new HurlStack(); } else { stack = new HttpClientStack(AndroidHttpClient.newInstance(userAgent)); } Network network = new BasicNetwork(stack); RequestQueue queue = new RequestQueue(new DiskBasedCache(cacheDir), network); queue.start(); return queue; }

Target:
public static RequestQueue newRequestQueue(Context context) { File cacheDir = new File(context.getCacheDir(), DEFAULT_CACHE_DIR); String userAgent = "volley/0"; try { String packageName = context.getPackageName(); PackageInfo info = context.getPackageManager().getPackageInfo(packageName, 0); userAgent = packageName + "/" + info.versionCode; } catch (NameNotFoundException e) { } HttpStack stack; if (Build.VERSION.SDK_INT >= 9) { stack = new HurlStack(); } else { stack = new HttpClientStack(AndroidHttpClient.newInstance(userAgent)); } Network network = new BasicNetwork(stack); RequestQueue queue = new RequestQueue(new DiskBasedCache(cacheDir), network); queue.start(); return queue; }
Source:
protected long download(T object, File outFile) throws IOException { try { openObjectFunction.open(object, outFile); } catch (Exception e) { throw new RuntimeException(e); } return outFile.length(); }

Target:
protected long download(T object, File outFile) throws IOException { openObjectFunction.open(object, outFile); return outFile.length(); }
Source:
public void testSnapshot() throws IOException { Admin admin = getConnection().getAdmin(); admin.createTable( new HTableDescriptor(tableName).addFamily(new HColumnDescriptor(COLUMN_FAMILY))); Map<String, Long> values = createTable(); admin.snapshot(snapshotName, tableName); List<SnapshotDescription> snapshots = admin.listSnapshots(snapshotName); Assert.assertEquals(1, snapshots.size()); admin.cloneSnapshot(snapshotName, clonedTableName); validateClone(values); admin.close(); }

Target:
public void testSnapshot() throws IOException { Admin admin = getConnection().getAdmin(); admin.createTable( new HTableDescriptor(tableName).addFamily(new HColumnDescriptor(COLUMN_FAMILY))); Map<String, Long> values = createAndPopulateTable(); Assert.assertEquals(0, admin.listSnapshots(snapshotName).size()); admin.snapshot(snapshotName, tableName); Assert.assertEquals(1, admin.listSnapshots(snapshotName).size()); admin.cloneSnapshot(snapshotName, clonedTableName); validateClone(values); Assert.assertEquals(1, admin.listSnapshots(snapshotName).size()); admin.deleteSnapshot(snapshotName); Assert.assertEquals(0, admin.listSnapshots(snapshotName).size()); admin.close(); }
Source:
public void checkEmptyFormGroupDisplay(){ Assert.assertEquals(testGroup.display(DisplayMode.Edit, new String[] { "phenotype", "negative_phenotype" }), ""); Assert.assertEquals(testGroup.display(DisplayMode.View, new String[] { "phenotype", "negative_phenotype" }), ""); }

Target:
public void checkEmptyFormGroupDisplay(){ Assert.assertEquals("", testGroup.display(DisplayMode.Edit, new String[] { "phenotype", "negative_phenotype" })); Assert.assertEquals("", testGroup.display(DisplayMode.View, new String[] { "phenotype", "negative_phenotype" })); }
Source:
protected void onSessionChange(String originalSessionId, HttpSession newSession, Authentication auth) { String newId = newSession.getId(); if(migrateSessionAttributes) { applicationEventPublisher.publishEvent(new SessionMigrationEvent(auth, originalSessionId, newId)); } else { applicationEventPublisher.publishEvent(new SessionIdChangedEvent(auth, originalSessionId, newId)); } }

Target:
protected void onSessionChange(String originalSessionId, HttpSession newSession, Authentication auth) { if(applicationEventPublisher != null) { applicationEventPublisher.publishEvent(new SessionFixationProtectionMigrationEvent( auth, originalSessionId, newSession.getId(), migrateSessionAttributes )); } }
Source:
public static synchronized SMSEventAdapter getSMSEventAdapter(Map<String, String> dynamicProperties) { if (smsAdapter == null) { OutputEventAdapterConfiguration configuration = new OutputEventAdapterConfiguration(); configuration.setName("smsNotification"); configuration.setType("sms"); configuration.setStaticProperties(dynamicProperties); configuration.setMessageFormat("text"); smsAdapter = new SMSEventAdapter(configuration, dynamicProperties); } try { smsAdapter.init(); } catch (OutputEventAdapterException e) { log.error("unable to initialize adapter"+ emailAdapter + e); } return smsAdapter; }

Target:
public static synchronized SMSEventAdapter getSMSEventAdapter(Map<String, String> dynamicProperties) { if (smsAdapter == null) { smsAdapter = new SMSEventAdapter(null, dynamicProperties); } try { smsAdapter.init(); } catch (OutputEventAdapterException e) { log.error("Unable to initialize sms adapter.", e); } return smsAdapter; }
Source:
private void startSubscription() { LOG.info("consumer {}, subscribes to ", this, topicPartitions2SSP.keySet()); try { synchronized (kafkaConsumer) { kafkaConsumer.assign(topicPartitions2SSP.keySet()); } } catch (Exception e) { LOG.warn("startSubscription failed.", e); throw new SamzaException(e); } }

Target:
private void startSubscription() { LOG.info("{}: Consumer subscribes to {}", this, topicPartitionsToSSP.keySet()); try { synchronized (kafkaConsumer) { kafkaConsumer.assign(topicPartitionsToSSP.keySet()); } } catch (Exception e) { throw new SamzaException("Consumer subscription failed for " + this, e); } }
Source:
public T get() { if (bean != null) { return getBeanInstance(bean); } else if (isUnsatisfied()) { throw BeanManagerLogger.LOG.injectionPointHasUnsatisfiedDependencies(ip, Formats.formatAnnotations(ip.getQualifiers()), Formats.formatInjectionPointType(ip.getType()), Formats.formatAsStackTraceElement(ip), InjectionPoints.getUnsatisfiedDependenciesAdditionalInfo(ip, getBeanManager())); } else { throw BeanManagerLogger.LOG.injectionPointHasAmbiguousDependencies(ip, Formats.formatAnnotations(ip.getQualifiers()), Formats.formatInjectionPointType(ip.getType()), Formats.formatAsStackTraceElement(ip), InjectionPoints.getUnsatisfiedDependenciesAdditionalInfo(ip, getBeanManager())); } }

Target:
public T get() { if (bean != null) { return getBeanInstance(bean); } else if (isUnsatisfied()) { throw BeanManagerLogger.LOG.injectionPointHasUnsatisfiedDependencies( Formats.formatAnnotations(ip.getQualifiers()), Formats.formatInjectionPointType(ip.getType()), InjectionPoints.getUnsatisfiedDependenciesAdditionalInfo(ip, getBeanManager())); } else { throw BeanManagerLogger.LOG.injectionPointHasAmbiguousDependencies( Formats.formatAnnotations(ip.getQualifiers()), Formats.formatInjectionPointType(ip.getType()), WeldCollections.toMultiRowString(allBeans)); } }
Source:
public boolean cancel(boolean mayInterruptIfRunning) { set(null); return true; }

Target:
public boolean cancel(boolean mayInterruptIfRunning) { if (canceled.compareAndSet(false, true)) { setException(EXCEPTION); return true; } return false; }
Source:
public UnavailableSolrException(Throwable cause) { super(ErrorCode.SERVICE_UNAVAILABLE, cause); }

Target:
public UnavailableSolrException(Throwable cause) { super(ErrorCode.SERVICE_UNAVAILABLE, cause.getMessage(), cause); }
Source:
public static String concat(String... args) { List<String> argList = Arrays.asList(args); StringBuilder str = new StringBuilder(argList.stream().mapToInt(String::length).sum()); argList.forEach(str::append); return str.toString(); }

Target:
public static String concat(String... args) { return String.join("", args); }
Source:
private String getTabWithCondition( java.util.function.Predicate<? super Pair<String, String>> condition) { Optional<String> newTab = driver .getWindowHandles() .stream() .map(handleName -> Pair.of(handleName, driver.switchTo().window(handleName).getTitle())) .filter(condition) .map(Pair::getKey) .findFirst(); return newTab.orElseThrow(() -> new NotFoundException( String.format("Tab with title %1$s doesn't exist", title))); }

Target:
private String getTabWithCondition( java.util.function.Predicate<? super Pair<String, String>> condition) { Optional<String> newTab = driver .getWindowHandles() .stream() .map(handleName -> Pair.of(handleName, driver.switchTo().window(handleName).getTitle())) .filter(condition) .map(Pair::getKey) .findFirst(); return newTab.orElseThrow(() -> new NotFoundException( String.format("Tab with title %s doesn't exist", title))); }
Source:
public void registerConnectorUis() { registerFromExtensionPoint(); registerConnetorToConnectorUi(); registerFromAdaptable(); }

Target:
public void registerConnectorUis() { registerFromExtensionPoint(); registerFromAdaptable(); registerConnetorToConnectorUi(); }
Source:
public void assertAll() { if (!m_errors.isEmpty()) { StringBuilder sb = new StringBuilder("The following asserts failed:"); boolean first = true; for (Map.Entry<AssertionError, IAssert<?>> ae : m_errors.entrySet()) { if (first) { first = false; } else { sb.append(","); } sb.append("\n\t"); AssertionError error = ae.getKey(); sb.append(error.getMessage()); Throwable cause = error.getCause(); if (cause != null) { sb.append(" ").append(cause.getMessage()); } } throw new AssertionError(sb.toString()); } }

Target:
public void assertAll() { if (!m_errors.isEmpty()) { StringBuilder sb = new StringBuilder("The following asserts failed:"); boolean first = true; for (AssertionError error : m_errors.keySet()) { if (first) { first = false; } else { sb.append(","); } sb.append("\n\t"); sb.append(error.getMessage()); Throwable cause = error.getCause(); while (cause != null) { sb.append(" ").append(cause.getMessage()); cause = cause.getCause(); } } throw new AssertionError(sb.toString()); } }
Source:
protected static void migrateV4FormRecords(Context c, SQLiteDatabase db) { SqlStorage<FormRecordV4> oldStorage = getFormRecordStorage(c, db, FormRecordV4.class); Vector<FormRecord> newRecords = new Vector<>(); for (FormRecordV4 oldRecord : oldStorage) { FormRecord newRecord = new FormRecord( oldRecord.getStatus(), oldRecord.getFormNamespace(), oldRecord.getAesKey(), oldRecord.getInstanceID(), oldRecord.lastModified(), oldRecord.getAppId()); String instanceUri = oldRecord.getInstanceURIString(); Cursor cursor = c.getContentResolver().query(Uri.parse(instanceUri), null, null, null, null); if (cursor != null && cursor.getCount() > 0) { cursor.moveToFirst(); newRecord.setDisplayName(cursor.getString(cursor.getColumnIndex(InstanceProviderAPI.InstanceColumns.DISPLAY_NAME))); newRecord.setFilePath(cursor.getString(cursor.getColumnIndex(InstanceProviderAPI.InstanceColumns.INSTANCE_FILE_PATH))); newRecord.setCanEditWhenComplete(cursor.getString(cursor.getColumnIndex(InstanceProviderAPI.InstanceColumns.CAN_EDIT_WHEN_COMPLETE))); cursor.close(); } newRecords.add(newRecord); } db.execSQL("DROP TABLE IF EXISTS " + FormRecord.STORAGE_KEY); TableBuilder builder = new TableBuilder(FormRecord.class); db.execSQL(builder.getTableCreateString()); SqlStorage<FormRecord> newStorage = getFormRecordStorage(c, db, FormRecord.class); for (FormRecord newRecord : newRecords) { newStorage.write(newRecord); } c.getContentResolver().delete(InstanceProviderAPI.InstanceColumns.CONTENT_URI, null, null); }

Target:
protected static Vector<Uri> migrateV4FormRecords(Context c, SQLiteDatabase db) { SqlStorage<FormRecordV4> oldStorage = getFormRecordStorage(c, db, FormRecordV4.class); Vector<Uri> migratedInstances = new Vector<>(); Vector<Pair<FormRecord, Uri>> newRecords = new Vector<>(); for (FormRecordV4 oldRecord : oldStorage) { FormRecord newRecord = new FormRecord( oldRecord.getStatus(), oldRecord.getFormNamespace(), oldRecord.getAesKey(), oldRecord.getInstanceID(), oldRecord.lastModified(), oldRecord.getAppId()); Uri instanceUri = Uri.withAppendedPath(Uri.parse(oldRecord.getInstanceURIString()), oldRecord.getAppId()); Cursor cursor = null; try { cursor = c.getContentResolver().query(instanceUri, null, null, null, null); if (cursor != null && cursor.getCount() > 0) { cursor.moveToFirst(); newRecord.setDisplayName(cursor.getString(cursor.getColumnIndex(InstanceProviderAPI.InstanceColumns.DISPLAY_NAME))); newRecord.setFilePath(cursor.getString(cursor.getColumnIndex(InstanceProviderAPI.InstanceColumns.INSTANCE_FILE_PATH))); newRecord.setCanEditWhenComplete(cursor.getString(cursor.getColumnIndex(InstanceProviderAPI.InstanceColumns.CAN_EDIT_WHEN_COMPLETE))); } } finally { if (cursor != null) { cursor.close(); } } newRecords.add(new Pair<>(newRecord, instanceUri)); } db.execSQL("DROP TABLE IF EXISTS " + FormRecord.STORAGE_KEY); TableBuilder builder = new TableBuilder(FormRecord.class); db.execSQL(builder.getTableCreateString()); SqlStorage<FormRecord> newStorage = getFormRecordStorage(c, db, FormRecord.class); for (Pair entry : newRecords) { newStorage.write(((FormRecord)entry.first)); migratedInstances.add(((Uri)entry.second)); } return migratedInstances; }
Source:
public void onMessageReceived(ThingUID bridge, LIRCResponse response) { String command = response.getCommand(); if ("LIST".equals(command) && response.isSuccess()) { boolean found = false; for (String remote : response.getData()) { if (remoteName.equals(remote)) { found = true; } } if (found) { updateStatus(ThingStatus.ONLINE); } else { logger.error("Remote {}: Remote was removed from LIRC server.", remoteName); updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR); } } else if (!response.isSuccess()) { String error = response.getData()[0]; Matcher m = UNKNOWN_REMOTE_PATTERN.matcher(error); if (m.matches() && remoteName.equals(m.group(1))) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR); } } }

Target:
public void onMessageReceived(ThingUID bridge, LIRCResponse response) { String command = response.getCommand(); if ("LIST".equals(command) && response.isSuccess()) { boolean found = false; for (String remote : response.getData()) { if (remoteName.equals(remote)) { found = true; } } if (found) { updateStatus(ThingStatus.ONLINE); } else { logger.error("Remote {}: Remote was removed from LIRC server.", remoteName); updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR); } } else if (!response.isSuccess()) { String error = response.getData()[0]; Matcher m = UNKNOWN_REMOTE_PATTERN.matcher(error); if (m.matches() && remoteName.equals(m.group(1))) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, "Unknown remote"); } } }
Source:
public CamusAvroWrapper(Record record) { this(record, null, null); }

Target:
public CamusAvroWrapper(Record record) { this(record, DEFAULT_TIMESTAMP_FIELD, UNIX_MILLISECONDS); }
Source:
public static void compute(Wrapper wrapper) { new CalculateWrapPressureInterest().calculate(wrapper, null); new CalculateMultiplyWithContainerInterest().calculate(wrapper, null); new CalculateSizeInterest().calculate(wrapper, null); new CalculateNInterest().calculate(wrapper, null); }

Target:
public static void compute(Wrapper wrapper) { pressureInterest.calculate(wrapper, null); multiplyInterest.calculate(wrapper, null); sizeInterest.calculate(wrapper, null); nInterest.calculate(wrapper, null); }
Source:
public void tearDown() { closeClient(this.client); try { testingServer.stop(); } catch (IOException e) { log.warn("Exception thrown while shutting down ZooKeeper: ", e); } testingServer.getTempDirectory().delete(); }

Target:
public void tearDown() throws Exception { CloseableUtils.closeQuietly(this.client); }
Source:
private static void checkConnectTag(Bundle b) { List<String> namespaces = Arrays.asList(IdentityNamespace.IDENTITY_NAMESPACE, HostNamespace.HOST_NAMESPACE, BundleNamespace.BUNDLE_NAMESPACE); namespaces.forEach(ns -> { List<String> tags = (List<String>) b.adapt(BundleRevision.class) .getCapabilities(ns).stream().findFirst() .get().getAttributes().get(IdentityNamespace.CAPABILITY_TAGS_ATTRIBUTE); assertNotNull("No tags found.", tags); assertEquals("Wrong number of tags.", 1, tags.size()); assertTrue("Connect tag not found.", tags.contains(ConnectContent.TAG_OSGI_CONNECT)); }); }

Target:
private static void checkConnectTag(Bundle b) { final List<String> namespaces = new ArrayList<>(Arrays.asList(BundleNamespace.BUNDLE_NAMESPACE, HostNamespace.HOST_NAMESPACE, IdentityNamespace.IDENTITY_NAMESPACE)); final AtomicReference<List<String>> tags = new AtomicReference<>(); b.adapt(BundleRevision.class).getCapabilities(null).stream().filter(i -> namespaces.contains(i.getNamespace())).forEach(c -> { tags.set(((List<String>) c.getAttributes().get(IdentityNamespace.CAPABILITY_TAGS_ATTRIBUTE))); assertNotNull("No tags found.", tags.get()); assertEquals("Wrong number of tags.", 1, tags.get().size()); assertTrue("Connect tag not found.", tags.get().contains(ConnectContent.TAG_OSGI_CONNECT)); namespaces.remove(c.getNamespace()); }); assertTrue("Connect tag namespaces were not removed completely. Found " + namespaces, namespaces.isEmpty()); }
Source:
private static boolean isBinaryFile(String fullPath) { byte[] firstBytes = new byte[8]; try (FileInputStream input = new FileInputStream(fullPath)) { input.read(firstBytes); } catch (IOException e) { Activator.getDefault().logInfo("Cannot read the file "+fullPath+" due to "+e.getMessage()); } for (byte[] header : BINARY_HEADERS) { if (firstBytes.length >= header.length && startsWith(header, firstBytes)) { return true; } } return false; }

Target:
private static boolean isBinaryFile(String fullPath) { byte[] firstBytes = new byte[8]; try (FileInputStream input = new FileInputStream(fullPath)) { input.read(firstBytes); } catch (IOException e) { Activator.getDefault().logError("Cannot read the file "+fullPath+" due to ", e); } for (byte[] header : BINARY_HEADERS) { if (firstBytes.length >= header.length && startsWith(header, firstBytes)) { return true; } } return false; }
Source:
public void close() { synchronized (offsetReadFutures) { closed.set(true); for (Future<Map<ByteBuffer, ByteBuffer>> offsetReadFuture : offsetReadFutures) { offsetReadFuture.cancel(true); } offsetReadFutures.clear(); } }

Target:
public void close() { if (!closed.getAndSet(true)) { synchronized (offsetReadFutures) { for (Future<Map<ByteBuffer, ByteBuffer>> offsetReadFuture : offsetReadFutures) { try { offsetReadFuture.cancel(true); } catch (Throwable t) { log.error("Failed to cancel offset read future", t); } } offsetReadFutures.clear(); } } }
Source:
public static void traceSignal(TmfSignal signal) { System.out.println(signal.getSource().toString() + ": " + signal.toString()); }

Target:
public void traceSignal(TmfSignal signal) { System.out.println(signal.getSource().toString() + ": " + signal.toString()); }
Source:
public Object[][] testSexDataProviderStr() { return new Object[][] { new Object[]{Sex.Male, "M", true}, new Object[]{Sex.Female, "Female", true}, new Object[]{Sex.Unknown, "Unknown", true}, new Object[]{Sex.NotReported, "NotReported", true}, new Object[]{Sex.Female, "M", false}, new Object[]{Sex.Unknown, "female", false} }; }

Target:
public Object[][] testSexDataProviderStr() { return new Object[][]{ {Sex.Female, "F"}, {Sex.Female, "f"}, {Sex.Female, "Female"}, {Sex.Female, "female"}, {Sex.Male, "M"}, {Sex.Male, "m"}, {Sex.Male, "Male"}, {Sex.Male, "male"}, {Sex.Unknown, "Unknown"}, {Sex.Unknown, "U"}, {Sex.Unknown, "unknown"}, {Sex.Unknown, "u"}, }; }
Source:
public void testGcsLazyConfigurationEnabled() throws IOException, URISyntaxException { GoogleHadoopFileSystem testInstance = new GoogleHadoopFileSystem(); ghfs = testInstance; ghfsFileSystemDescriptor = testInstance; ghfsHelper = new HadoopFileSystemIntegrationHelper(ghfs, ghfsFileSystemDescriptor); Configuration conf = loadConfig(); conf.set( GoogleHadoopFileSystemConfiguration.GCS_LAZY_INITIALIZATION_ENABLE.getKey(), "true"); URI initUri = new URI("gs://" + ghfsHelper.getUniqueBucketName("init")); ghfs.initialize(initUri, conf); Path filePath = new Path("testfile"); ghfsHelper.writeFile(filePath, "test", 1, true); assertThat(ghfsHelper.readTextFile(filePath)).isEqualTo("test"); ghfsHelper.delete(initUri,true); }

Target:
public void testGcsLazyConfigurationEnabled() throws IOException, URISyntaxException { GoogleHadoopFileSystem testInstance = new GoogleHadoopFileSystem(); ghfs = testInstance; ghfsFileSystemDescriptor = testInstance; ghfsHelper = new HadoopFileSystemIntegrationHelper(ghfs, ghfsFileSystemDescriptor); Configuration conf = loadConfig(); conf.setBoolean( GoogleHadoopFileSystemConfiguration.GCS_LAZY_INITIALIZATION_ENABLE.getKey(), true); URI initUri = new URI("gs://" + ghfsHelper.getUniqueBucketName("init")); ghfs.initialize(initUri, conf); Path filePath = new Path("testfile"); ghfsHelper.writeFile(filePath, "test", 1, true); assertThat(ghfsHelper.readTextFile(filePath)).isEqualTo("test"); ghfsHelper.delete(initUri, true); }
Source:
public void clearParagraphRuntimeInfo(InterpreterSetting setting) { Map<String, Set<String>> noteIdAndParaMap = setting.getNoteIdAndParaMap(); if (noteIdAndParaMap != null && !noteIdAndParaMap.isEmpty()) { for (String noteId : noteIdAndParaMap.keySet()) { Set<String> paraIdSet = noteIdAndParaMap.get(noteId); if (paraIdSet != null && !paraIdSet.isEmpty()) { for (String paraId : paraIdSet) { Note note = notebook().getNote(noteId); if (note != null) { Paragraph paragraph = note.getParagraph(paraId); if (paragraph != null) { paragraph.clearRuntimeInfo(); broadcast(noteId, new Message(OP.PARAGRAPH).put("paragraph", paragraph)); } } } } } } setting.clearNoteIdAndParaMap(); }

Target:
public void clearParagraphRuntimeInfo(InterpreterSetting setting) { Map<String, Set<String>> noteIdAndParaMap = setting.getNoteIdAndParaMap(); if (noteIdAndParaMap != null && !noteIdAndParaMap.isEmpty()) { for (String noteId : noteIdAndParaMap.keySet()) { Set<String> paraIdSet = noteIdAndParaMap.get(noteId); if (paraIdSet != null && !paraIdSet.isEmpty()) { for (String paraId : paraIdSet) { Note note = notebook().getNote(noteId); if (note != null) { Paragraph paragraph = note.getParagraph(paraId); if (paragraph != null) { paragraph.clearRuntimeInfo(setting.getId()); broadcast(noteId, new Message(OP.PARAGRAPH).put("paragraph", paragraph)); } } } } } } setting.clearNoteIdAndParaMap(); }
Source:
private CalculatedDesiredPoolSize calculateDesiredPoolSize(long currentPoolSize) { long now = System.currentTimeMillis(); WindowSummary downsizeSummary = recentDesiredResizes.summarizeWindow(getResizeDownStabilizationDelay().toMilliseconds()); WindowSummary upsizeSummary = recentDesiredResizes.summarizeWindow(getResizeUpStabilizationDelay().toMilliseconds()); long maxDesiredPoolSize = upsizeSummary.min; boolean stableForGrowing = upsizeSummary.stableForGrowth; long minDesiredPoolSize = downsizeSummary.max; boolean stableForShrinking = downsizeSummary.stableForShrinking; long desiredPoolSize; boolean stable; if (currentPoolSize < maxDesiredPoolSize) { desiredPoolSize = maxDesiredPoolSize; stable = stableForGrowing; } else if (currentPoolSize > minDesiredPoolSize) { desiredPoolSize = minDesiredPoolSize; stable = stableForShrinking; } else { desiredPoolSize = currentPoolSize; stable = stableForGrowing && stableForShrinking; } if (LOG.isTraceEnabled()) LOG.trace("{} calculated desired pool size: from to {}; minDesired {}, maxDesired {}; " + "stable {}; now {}; downsizeHistory {}; upsizeHistory {}", new Object[] {this, currentPoolSize, desiredPoolSize, minDesiredPoolSize, maxDesiredPoolSize, stable, now, downsizeSummary, upsizeSummary}); return new CalculatedDesiredPoolSize(desiredPoolSize, stable); }

Target:
private CalculatedDesiredPoolSize calculateDesiredPoolSize(long currentPoolSize) { long now = System.currentTimeMillis(); WindowSummary downsizeSummary = recentDesiredResizes.summarizeWindow(getResizeDownStabilizationDelay()); WindowSummary upsizeSummary = recentDesiredResizes.summarizeWindow(getResizeUpStabilizationDelay()); long maxDesiredPoolSize = upsizeSummary.min; boolean stableForGrowing = upsizeSummary.stableForGrowth; long minDesiredPoolSize = downsizeSummary.max; boolean stableForShrinking = downsizeSummary.stableForShrinking; long desiredPoolSize; boolean stable; if (currentPoolSize < maxDesiredPoolSize) { desiredPoolSize = maxDesiredPoolSize; stable = stableForGrowing; } else if (currentPoolSize > minDesiredPoolSize) { desiredPoolSize = minDesiredPoolSize; stable = stableForShrinking; } else { desiredPoolSize = currentPoolSize; stable = stableForGrowing && stableForShrinking; } if (LOG.isTraceEnabled()) LOG.trace("{} calculated desired pool size: from to {}; minDesired {}, maxDesired {}; " + "stable {}; now {}; downsizeHistory {}; upsizeHistory {}", new Object[] {this, currentPoolSize, desiredPoolSize, minDesiredPoolSize, maxDesiredPoolSize, stable, now, downsizeSummary, upsizeSummary}); return new CalculatedDesiredPoolSize(desiredPoolSize, stable); }
Source:
public void completeRequestWithDelayedCloseTest() throws Exception { Properties properties = new Properties(); properties.setProperty(NettyConfig.NETTY_SERVER_CLOSE_DELAY_TIMEOUT_MS, "500"); NettyConfig nettyConfig = new NettyConfig(new VerifiableProperties(properties)); MockNettyMessageProcessor processor = new MockNettyMessageProcessor(); processor.setNettyConfig(nettyConfig); ChunkedWriteHandler chunkedWriteHandler = new ChunkedWriteHandler(); EmbeddedChannel channel = new EmbeddedChannel(chunkedWriteHandler, processor); RestServiceErrorCode REST_ERROR_CODE = RestServiceErrorCode.BadRequest; String content = "@@randomContent@@@"; HttpHeaders httpHeaders = new DefaultHttpHeaders(); httpHeaders.set(MockNettyMessageProcessor.REST_SERVICE_ERROR_CODE_HEADER_NAME, REST_ERROR_CODE); httpHeaders.set(MockNettyMessageProcessor.INCLUDE_EXCEPTION_MESSAGE_IN_RESPONSE_HEADER_NAME, "true"); HttpRequest httpRequest = RestTestUtils.createFullRequest(HttpMethod.POST, TestingUri.OnResponseCompleteWithRestException.toString(), httpHeaders, content.getBytes()); channel.writeInbound(httpRequest); HttpResponse response = (HttpResponse) channel.readOutbound(); assertEquals("Unexpected response status", getExpectedHttpResponseStatus(REST_ERROR_CODE), response.status()); assertTrue("Channel closed on the server", channel.isActive()); }

Target:
public void completeRequestWithDelayedCloseTest() throws Exception { Properties properties = new Properties(); long delayMs = 500; properties.setProperty(NettyConfig.NETTY_SERVER_CLOSE_DELAY_TIMEOUT_MS, String.valueOf(delayMs)); NettyConfig nettyConfig = new NettyConfig(new VerifiableProperties(properties)); MockNettyMessageProcessor processor = new MockNettyMessageProcessor(); processor.setNettyConfig(nettyConfig); ChunkedWriteHandler chunkedWriteHandler = new ChunkedWriteHandler(); EmbeddedChannel channel = new EmbeddedChannel(chunkedWriteHandler, processor); RestServiceErrorCode REST_ERROR_CODE = RestServiceErrorCode.BadRequest; String content = "@@randomContent@@@"; HttpHeaders httpHeaders = new DefaultHttpHeaders(); httpHeaders.set(MockNettyMessageProcessor.REST_SERVICE_ERROR_CODE_HEADER_NAME, REST_ERROR_CODE); httpHeaders.set(MockNettyMessageProcessor.INCLUDE_EXCEPTION_MESSAGE_IN_RESPONSE_HEADER_NAME, "true"); HttpRequest httpRequest = RestTestUtils.createFullRequest(HttpMethod.POST, TestingUri.OnResponseCompleteWithRestException.toString(), httpHeaders, content.getBytes()); channel.writeInbound(httpRequest); HttpResponse response = channel.readOutbound(); assertEquals("Unexpected response status", getExpectedHttpResponseStatus(REST_ERROR_CODE), response.status()); assertTrue("Channel closed on the server", channel.isActive()); Thread.sleep(delayMs * 2); channel.runPendingTasks(); assertFalse("Channel not closed on the server", channel.isActive()); assertEquals("delayed close scheduled counter mismatch", 1, processor.getNettyMetrics().delayedCloseScheduledCount.getCount()); assertEquals("delayed close executed counter mismatch", 1, processor.getNettyMetrics().delayedCloseExecutedCount.getCount()); }
Source:
private void appendSASTokenToQuery(String path, String operation, AbfsUriQueryBuilder queryBuilder) throws SASTokenProviderException { try { LOG.trace("Fetch SAS token for {}", path); String sasToken = sasTokenProvider.getSASToken(this.accountName, this.filesystem, path, operation); queryBuilder.setSASToken(sasToken); LOG.trace("SAS token fetch complete for {}", path); } catch (Exception ex) { throw new SASTokenProviderException("Failed to acquire a SAS token.", ex); } }

Target:
private void appendSASTokenToQuery(String path, String operation, AbfsUriQueryBuilder queryBuilder) throws SASTokenProviderException { if (this.authType == AuthType.SAS) { try { LOG.trace("Fetch SAS token for on {}", operation, path); String sasToken = sasTokenProvider.getSASToken(this.accountName, this.filesystem, path, operation); if ((sasToken == null) || sasToken.isEmpty()) { throw new UnsupportedOperationException("SASToken received is empty or null"); } queryBuilder.setSASToken(sasToken); LOG.trace("SAS token fetch complete for on {}", operation, path); } catch (Exception ex) { throw new SASTokenProviderException(String.format("Failed to acquire a SAS token for %s on %s due to %s", operation, path, ex.toString())); } } }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_motion_tracking); Intent intent = getIntent(); mIsAutoReset = intent.getBooleanExtra("com.projecttango.motiontrackingjava.useautoreset", false); mPose = (TextView) findViewById(R.id.pose); mQuat = (TextView) findViewById(R.id.quat); mPoseCount =(TextView) findViewById(R.id.posecount); mDelta =(TextView) findViewById(R.id.deltatime); mTangoEvent =(TextView) findViewById(R.id.tangoevent); mFirstPersonButton = (Button) findViewById(R.id.first_person_button); mThirdPersonButton = (Button) findViewById(R.id.third_person_button); mTopDownButton = (Button) findViewById(R.id.top_down_button); mMotionReset = (Button) findViewById(R.id.resetmotion); mPoseStatus = (TextView) findViewById(R.id.status); mVersion = (TextView) findViewById(R.id.version); mGLView = (GLSurfaceView) findViewById(R.id.gl_surface_view); mMotionReset.setOnClickListener(this); mFirstPersonButton.setOnClickListener(this); mThirdPersonButton.setOnClickListener(this); mTopDownButton.setOnClickListener(this); mRenderer = new MTGLRenderer(); mGLView.setEGLContextClientVersion(2); mGLView.setRenderer(mRenderer); mGLView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY); mMotionReset.setVisibility(View.GONE); mTango = new Tango(this); startMotionTracking(); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_motion_tracking); Intent intent = getIntent(); mIsAutoReset = intent.getBooleanExtra(StartActivity.KEY_MOTIONTRACKING_AUTORESET, false); mPose = (TextView) findViewById(R.id.pose); mQuat = (TextView) findViewById(R.id.quat); mPoseCount =(TextView) findViewById(R.id.posecount); mDelta =(TextView) findViewById(R.id.deltatime); mTangoEvent =(TextView) findViewById(R.id.tangoevent); findViewById(R.id.first_person_button).setOnClickListener(this); findViewById(R.id.third_person_button).setOnClickListener(this); findViewById(R.id.top_down_button).setOnClickListener(this); mMotionReset = (Button) findViewById(R.id.resetmotion); mPoseStatus = (TextView) findViewById(R.id.status); mVersion = (TextView) findViewById(R.id.version); mGLView = (GLSurfaceView) findViewById(R.id.gl_surface_view); mMotionReset.setOnClickListener(this); mRenderer = new MTGLRenderer(); mGLView.setEGLContextClientVersion(2); mGLView.setRenderer(mRenderer); mGLView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY); mMotionReset.setVisibility(View.GONE); mTango = new Tango(this); startMotionTracking(); }
Source:
public void testGetQuestionDetails() { FeedbackQuestionAttributes fq = new FeedbackQuestionAttributes(); ______TS("Text question: new Json format"); fq.feedbackSessionName = "First Feedback Session"; fq.courseId = "CS1101"; fq.creatorEmail = "instructor1@course1.com"; fq.questionType = FeedbackQuestionType.TEXT; fq.giverType = FeedbackParticipantType.NONE; fq.recipientType = FeedbackParticipantType.RECEIVER; fq.showGiverNameTo = new ArrayList<FeedbackParticipantType>(); fq.showGiverNameTo.add(FeedbackParticipantType.SELF); fq.showRecipientNameTo = new ArrayList<FeedbackParticipantType>(); fq.showRecipientNameTo.add(FeedbackParticipantType.SELF); fq.showResponsesTo = new ArrayList<FeedbackParticipantType>(); fq.showResponsesTo.add(FeedbackParticipantType.SELF); fq.giverType = FeedbackParticipantType.TEAMS; fq.recipientType = FeedbackParticipantType.TEAMS; fq.showGiverNameTo = new ArrayList<FeedbackParticipantType>(); fq.showGiverNameTo.add(FeedbackParticipantType.RECEIVER); fq.showRecipientNameTo = new ArrayList<FeedbackParticipantType>(); fq.showRecipientNameTo.add(FeedbackParticipantType.RECEIVER); fq.showResponsesTo = new ArrayList<FeedbackParticipantType>(); fq.showResponsesTo.add(FeedbackParticipantType.RECEIVER); FeedbackTextQuestionDetails questionDetails = new FeedbackTextQuestionDetails("New format text question"); fq.setQuestionDetails(questionDetails); assertTrue(fq.isValid()); assertEquals(fq.getQuestionDetails().getQuestionText(), "New format text question"); ______TS("Text question: old string format"); fq = typicalBundle.feedbackQuestions.get("qn2InSession1InCourse1"); assertEquals(fq.getQuestionDetails().getQuestionText(), "Rate 1 other student's product"); }

Target:
public void testGetQuestionDetails() { ______TS("Text question: new Json format"); FeedbackQuestionAttributes fq = typicalBundle.feedbackQuestions.get("qn5InSession1InCourse1"); FeedbackTextQuestionDetails questionDetails = new FeedbackTextQuestionDetails("New format text question"); fq.setQuestionDetails(questionDetails); assertTrue(fq.isValid()); assertEquals(fq.getQuestionDetails().getQuestionText(), "New format text question"); ______TS("Text question: old string format"); fq = typicalBundle.feedbackQuestions.get("qn2InSession1InCourse1"); assertEquals(fq.getQuestionDetails().getQuestionText(), "Rate 1 other student's product"); }
Source:
public final void testValidate() { SqliteTableSchemaValidator validator = new SqliteTableSchemaValidator(); TableInfo metaData = mock(TableInfo.class); assertNotNull(validator); Table<TestObject> table = mock(Table.class); Mockito.when(table.getTableInfo()).thenReturn(metaData); try { assertEquals(true, validator.validate(table)); } catch (ValidationException e) { e.printStackTrace(); } }

Target:
public final void testValidate() { SqliteTableSchemaValidator validator = new SqliteTableSchemaValidator(); TableInfo metaData = mock(TableInfo.class); assertNotNull(validator); Table<TestObject> table = mock(Table.class); Mockito.when(table.getTableInfo()).thenReturn(metaData); try { assertTrue(validator.validate(table)); } catch (ValidationException e) { fail("Validation should not fail"); } }
Source:
public static <T> Lazy<Seq<T>> sequence(Iterable<? extends Lazy<? extends T>> values) { Objects.requireNonNull(values, "values is null"); return Lazy.of(() -> List.ofAll(values).map(l -> l.get())); }

Target:
public static <T> Lazy<Seq<T>> sequence(Iterable<? extends Lazy<? extends T>> values) { Objects.requireNonNull(values, "values is null"); return Lazy.of(() -> Vector.ofAll(values).map(Lazy::get)); }
Source:
public static String convertSmpToHtmlEntity(String text) { StringBuffer sb = new StringBuffer(); Matcher m = Pattern.compile("([^\u0000-\uFFFF])").matcher(text); while (m.find()) { String a = "&#x" + Integer.toHexString(m.group(1).codePointAt(0)) + ";"; m.appendReplacement(sb, Matcher.quoteReplacement(a)); } m.appendTail(sb); return sb.toString(); }

Target:
public static String convertSmpToHtmlEntity(String text) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { return text; } StringBuffer sb = new StringBuffer(); Matcher m = Pattern.compile("([^\u0000-\uFFFF])").matcher(text); while (m.find()) { String a = "&#x" + Integer.toHexString(m.group(1).codePointAt(0)) + ";"; m.appendReplacement(sb, Matcher.quoteReplacement(a)); } m.appendTail(sb); return sb.toString(); }
Source:
public boolean isWrapperFor(Class<?> iface) { if (gridCoverage instanceof Wrapper) return ((Wrapper) gridCoverage).isWrapperFor(iface); else if (iface.isInstance(gridCoverage)) return true; else return false; }

Target:
public boolean isWrapperFor(Class<?> iface) { if (gridCoverage instanceof Wrapper) { return ((Wrapper) gridCoverage).isWrapperFor(iface); } return iface.isInstance(gridCoverage); }
Source:
public void downloadExists(URL url, File file) { if (observer == null) return; observer.update(this, new RipStatusMessage(STATUS.DOWNLOAD_WARN, url + " already saved as " + file)); checkIfComplete(); }

Target:
public void downloadExists(URL url, File file) { if (observer == null) { return; } observer.update(this, new RipStatusMessage(STATUS.DOWNLOAD_WARN, url + " already saved as " + file)); checkIfComplete(); }
Source:
protected String maskSensitiveElements(final Message message, String originalLogString) { return (new MaskSensitiveHelper(sensitiveElementNames)) .maskSensitiveElements(message, originalLogString); }

Target:
protected String maskSensitiveElements(final Message message, String originalLogString) { return maskSensitiveHelper.maskSensitiveElements(message, originalLogString); }
Source:
public OwaspDiffRunner(Runtime runTime, Invoker invoker) { setRuntime(runTime); setInvoker(invoker); }

Target:
OwaspDiffRunner(Runtime runTime, Invoker invoker) { this.runTime = runTime; this.invoker = invoker; }