auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public int appendFromDirectly(byte[] byteArray, int offset, int length) throws IOException { rollOverIfRequired(length); return activeSegment.appendFromDirectly(byteArray, offset, length); }

Target:
int appendFromDirectly(byte[] byteArray, int offset, int length) throws IOException { rollOverIfRequired(length); return activeSegment.appendFromDirectly(byteArray, offset, length); }
Source:
public Model getCREATEModel(Representation rep) { return new ModelImpl() .property("fulfillerComment", new StringProperty()) .property("fulfillerStatus", new EnumProperty(null)); }

Target:
public Model getCREATEModel(Representation rep) { return new ModelImpl() .property("fulfillerComment", new StringProperty()) .property("fulfillerStatus", new EnumProperty(Order.FulfillerStatus.class)); }
Source:
public void execute(IProgressMonitor m) throws CoreException { SubMonitor progress = SubMonitor.convert(m, CoreText.ConnectProviderOperation_connecting, 100 * projects.size()); MultiStatus ms = new MultiStatus(Activator.getPluginId(), 0, CoreText.ConnectProviderOperation_ConnectErrors, null); for (Entry<IProject, File> entry : projects.entrySet()) { connectProject(entry, ms, progress.newChild(100)); } if (!ms.isOK()) { throw new CoreException(ms); } }

Target:
public void execute(IProgressMonitor m) throws CoreException { SubMonitor progress = SubMonitor.convert(m, CoreText.ConnectProviderOperation_connecting, projects.size()); MultiStatus ms = new MultiStatus(Activator.getPluginId(), 0, CoreText.ConnectProviderOperation_ConnectErrors, null); for (Entry<IProject, File> entry : projects.entrySet()) { connectProject(entry, ms, progress.newChild(1)); } if (!ms.isOK()) { throw new CoreException(ms); } }
Source:
public void testSetLocationNative() throws IOException { Assume.assumeTrue("Ignore tests for format: " + formatStringPair.get(mOutFormat), shouldRunTest(mOutFormat)); System.loadLibrary("ctsmediav2codec_jni"); Assume.assumeTrue( "mp4 and 3gpp fails this test. Bug: 146925201, delete this once fixed", mOutFormat != MediaMuxer.OutputFormat.MUXER_OUTPUT_MPEG_4 && mOutFormat != MediaMuxer.OutputFormat.MUXER_OUTPUT_3GPP); String inpPath = WorkDir.getMediaDirString() + mSrcFile; String outPath = File.createTempFile("MuxerTestsetLocNat", ".out").getAbsolutePath(); boolean status = nativeTestSetLocation(mOutFormat, inpPath, outPath); new File(outPath).delete(); assertTrue("testSetLocationNative failed for Format: " + mOutFormat, status); }

Target:
public void testSetLocationNative() { Assume.assumeTrue(shouldRunTest(mOutFormat)); Assume.assumeTrue("TODO(b/146925201)", mOutFormat != MediaMuxer.OutputFormat.MUXER_OUTPUT_MPEG_4 && mOutFormat != MediaMuxer.OutputFormat.MUXER_OUTPUT_3GPP); System.loadLibrary("ctsmediav2codec_jni"); assertTrue(nativeTestSetLocation(mOutFormat, mInpPath, mOutPath)); }
Source:
public boolean equals( Object obj ) { if ( this == obj ) { return true; } if ( obj == null ) { return false; } if ( getClass() != obj.getClass() ) { return false; } final pathObject other = (pathObject) obj; if ( node == null ) { return other.node == null; } else return node.equals(other.node); }

Target:
public boolean equals( Object obj ) { if ( this == obj ) { return true; } if ( obj == null ) { return false; } if ( getClass() != obj.getClass() ) { return false; } final pathObject other = (pathObject) obj; if ( node == null ) { return other.node == null; } return node.equals(other.node); }
Source:
DedupFunctionInfo getFilter() { if (filterField == null) { return null; } List<FunctionInfo> aggregates = parseAggregation(filterField); if (aggregates.size() != 1) { throw new IllegalArgumentException("Only one filter field is allowed!"); } FunctionInfo aggregate = aggregates.get(0); return new DedupFunctionInfo(aggregate.getName(), aggregate.getField(), aggregate.getFunction()); }

Target:
DedupFunctionInfo getFilter() { if (Strings.isNullOrEmpty(filterOperation)) { return null; } List<String> filterParts = new ArrayList<>(); for (String filterPart : Splitter.on(':').trimResults().split(filterOperation)) { filterParts.add(filterPart); } if (filterParts.size() != 2) { throw new IllegalArgumentException(String.format("Invalid filter operation. It should be of format " + "'fieldName:functionName'. But got : %s", filterOperation)); } Function function; String fieldName = filterParts.get(0); String functionStr = filterParts.get(1); try { function = Function.valueOf(functionStr.toUpperCase()); } catch (IllegalArgumentException e) { throw new IllegalArgumentException(String.format("Invalid function '%s'. Must be one of %s.", functionStr, Joiner.on(',').join(Function.values()))); } return new DedupFunctionInfo(fieldName, function); }
Source:
public List<Feature> parseJsonFiles(List<String> jsonFiles) { if (jsonFiles.isEmpty()) { throw new ValidationException("No report file was added!"); } List<Feature> featureResults = new ArrayList<>(jsonFiles.size() * 10); int jsonFileNo = 0; for (String jsonFile : jsonFiles) { Feature[] features = parseForFeature(jsonFile); LOG.info("File '{}' contain features", jsonFile, features.length); collectFeaturesAndSetMetadata(featureResults, features, jsonFile, jsonFileNo++); } if (featureResults.isEmpty()) { throw new ValidationException("Passed files have no features!"); } return featureResults; }

Target:
public List<Feature> parseJsonFiles(List<String> jsonFiles) { if (jsonFiles.isEmpty()) { throw new ValidationException("No report file was added!"); } List<Feature> featureResults = new ArrayList<>(); for (int i = 0; i < jsonFiles.size(); i++) { String jsonFile = jsonFiles.get(i); Feature[] features = parseForFeature(jsonFile); LOG.info("File '{}' contain features", jsonFile, features.length); collectFeaturesAndSetMetadata(featureResults, features, jsonFile, i); } if (featureResults.isEmpty()) { throw new ValidationException("Passed files have no features!"); } return featureResults; }
Source:
public static void tearDown () throws Exception { try { HttpUtils.stopSyncServer(); RealmLog.setLevel(LogLevel.WARN); } catch (Exception e) { RealmLog.error("Failed to stop Sync Server", e); } }

Target:
public static void tearDown () throws Exception { try { HttpUtils.stopSyncServer(); RealmLog.setLevel(originalLogLevel); } catch (Exception e) { RealmLog.error("Failed to stop Sync Server", e); } }
Source:
public InputStream handle(Request request, io.airlift.http.client.Response response) throws RuntimeException { try { if (response.getHeader(CONTENT_TYPE) != null && response.getHeader(CONTENT_TYPE).equals(APPLICATION_JSON)) { return response.getInputStream(); } throw new RuntimeException("Response received was not of type " + APPLICATION_JSON); } catch (IOException e) { throw new RuntimeException("Unable to read response from worker", e); } }

Target:
public InputStream handle(Request request, io.airlift.http.client.Response response) { try { if (APPLICATION_JSON.equals(response.getHeader(CONTENT_TYPE))) { return response.getInputStream(); } throw new RuntimeException("Response received was not of type " + APPLICATION_JSON); } catch (IOException e) { throw new RuntimeException("Unable to read response from worker", e); } }
Source:
protected void addProvider(Provider<E> provider) { if (!elementMap.containsKey(provider)) { Collection<E> elementsOfProvider = provider.getAll(); Collection<E> elements = new CopyOnWriteArraySet<E>(); provider.addProviderChangeListener(this); elementMap.put(provider, elements); for (E element : elementsOfProvider) { try { K uid = element.getUID(); if (uid != null && get(uid) != null) { logger.warn(String.format( "%s with Key \"%s\" already exists! Failed to add a second with the same UID!", element.getClass().getName(), uid)); continue; } onAddElement(element); elements.add(element); notifyListenersAboutAddedElement(element); } catch (Exception ex) { logger.warn("Could not add element: " + ex.getMessage(), ex); } } logger.debug("Provider '{}' has been added.", provider.getClass().getName()); } }

Target:
protected void addProvider(Provider<E> provider) { if (!elementMap.containsKey(provider)) { Collection<E> elementsOfProvider = provider.getAll(); Collection<E> elements = new CopyOnWriteArraySet<E>(); provider.addProviderChangeListener(this); elementMap.put(provider, elements); for (E element : elementsOfProvider) { try { K uid = element.getUID(); if (uid != null && get(uid) != null) { logger.warn("{} with key'{}' already exists! Failed to add a second with the same UID!", element.getClass().getName(), uid); continue; } onAddElement(element); elements.add(element); notifyListenersAboutAddedElement(element); } catch (Exception ex) { logger.warn("Could not add element: {}", ex.getMessage(), ex); } } logger.debug("Provider '{}' has been added.", provider.getClass().getName()); } }
Source:
public JsonObject json() throws IOException { final XML xml = this.storage.xml().nodes(this.xpath()).get(0); final String basebranch = xml.xpath("base/text()").get(0); final String head = xml.xpath("head/text()").get(0); final String[] headparts = head.split(MkPull.USER_BRANCH_SEP, 2); final List<String> patches = xml.xpath("patch/text()"); final String patch; if (patches.isEmpty()) { patch = ""; } else { patch = patches.get(0); } return Json.createObjectBuilder() .add( "number", Integer.parseInt(xml.xpath("number/text()").get(0)) ) .add( "user", Json.createObjectBuilder() .add("login", xml.xpath("user/login/text()").get(0)) .build() ) .add("patch", patch) .add( "head", Json.createObjectBuilder() .add(REF_PROP, headparts[1]) .add(LABEL_PROP, head) .build() ) .add( "base", Json.createObjectBuilder() .add(REF_PROP, basebranch) .add( LABEL_PROP, String.format( "%s:%s", this.coords.user(), basebranch ) ) .build() ) .add( "comments", this.storage.xml().nodes(this.comment()).size() ) .build(); }

Target:
public JsonObject json() throws IOException { final XML xml = this.storage.xml().nodes(this.xpath()).get(0); final String branch = xml.xpath("base/text()").get(0); final String head = xml.xpath("head/text()").get(0); final String[] parts = head.split(MkPull.USER_BRANCH_SEP, 2); final List<String> patches = xml.xpath("patch/text()"); final String patch; if (patches.isEmpty()) { patch = ""; } else { patch = patches.get(0); } return Json.createObjectBuilder() .add( "number", Integer.parseInt(xml.xpath("number/text()").get(0)) ) .add( "user", Json.createObjectBuilder() .add("login", xml.xpath("user/login/text()").get(0)) .build() ) .add("patch", patch) .add( "head", Json.createObjectBuilder() .add(MkPull.REF_PROP, parts[1]) .add(MkPull.LABEL_PROP, head) .build() ).add( "base", Json.createObjectBuilder() .add(MkPull.REF_PROP, branch) .add( MkPull.LABEL_PROP, String.format( "%s:%s", this.coords.user(), branch ) ).build() ).add( "comments", this.storage.xml().nodes(this.comment()).size() ).build(); }
Source:
public TmfResolvedSymbol getSymbolEntry(long address) { Entry<Long, TmfResolvedSymbol> floorEntry = fSymbolMapping.floorEntry(address); if (floorEntry == null) { return null; } TmfResolvedSymbol symbol = floorEntry.getValue(); long floorValue = symbol.getBaseAddress(); if (symbol.getSymbolName().endsWith(getEndSuffix()) && floorValue != address) { return null; } return symbol; }

Target:
public TmfResolvedSymbol getSymbolEntry(long address) { Entry<Long, TmfResolvedSymbol> floorEntry = fSymbolMapping.floorEntry(address); if (floorEntry == null) { return null; } TmfResolvedSymbol symbol = floorEntry.getValue(); long floorValue = symbol.getBaseAddress(); return (symbol.getSymbolName().endsWith(getEndSuffix()) && floorValue != address) ? null : symbol; }
Source:
public void before() { tester = new WicketTester(application); WebApplication webApplication = tester.getApplication(); webApplication.getWicketFilter().setFilterPath(""); }

Target:
public void before() { tester = new WicketTester(application); application.getWicketFilter().setFilterPath(""); }
Source:
public void check_disable_after_add_three_attempts_and_twenty_seconds() throws InterruptedException { InvalidLoginAttempts invalidLoginAttempts = new InvalidLoginAttempts(0, 0); invalidLoginAttempts.addFailedAttempts(); invalidLoginAttempts.addFailedAttempts(); invalidLoginAttempts.addFailedAttempts(); Thread.sleep(20000); assertThat(invalidLoginAttempts.isLoginEnabled(), is(false)); }

Target:
public void check_disable_after_add_three_attempts_and_twenty_seconds() throws InterruptedException, ActionNotAllowed { InvalidLoginAttempts invalidLoginAttempts = new InvalidLoginAttempts(0, 0); invalidLoginAttempts.setDisableTime(10); invalidLoginAttempts.addFailedAttempts(); invalidLoginAttempts.addFailedAttempts(); invalidLoginAttempts.addFailedAttempts(); Thread.sleep(5); assertThat(invalidLoginAttempts.isLoginEnabled(), is(false)); }
Source:
public void sendBatch() { ServiceBusSenderAsyncClient sender = new ServiceBusClientBuilder() .connectionString( "Endpoint={fully-qualified-namespace};SharedAccessKeyName={policy-name};SharedAccessKey={key}") .buildSenderClientBuilder() .entityName("<QUEUE-NAME>") .buildAsyncClient(); sender.createBatch().flatMap(batch -> { batch.tryAdd(new ServiceBusMessage("test-1".getBytes(UTF_8))); batch.tryAdd(new ServiceBusMessage("test-2".getBytes(UTF_8))); return sender.send(batch); }).subscribe(unused -> { }, error -> System.err.println("Error occurred while sending batch:" + error), () -> System.out.println("Send complete.")); END: com.azure.messaging.servicebus.servicebusasyncsenderclient.createBatch sender.close(); }

Target:
public void sendBatch() { ServiceBusSenderAsyncClient sender = new ServiceBusClientBuilder() .connectionString( "Endpoint={fully-qualified-namespace};SharedAccessKeyName={policy-name};SharedAccessKey={key}") .buildSenderClientBuilder() .entityName("<QUEUE OR TOPIC NAME>") .buildAsyncClient(); sender.createBatch().flatMap(batch -> { batch.tryAdd(new ServiceBusMessage("test-1".getBytes(UTF_8))); batch.tryAdd(new ServiceBusMessage("test-2".getBytes(UTF_8))); return sender.send(batch); }).subscribe(unused -> { }, error -> System.err.println("Error occurred while sending batch:" + error), () -> System.out.println("Send complete.")); END: com.azure.messaging.servicebus.servicebusasyncsenderclient.createBatch sender.close(); }
Source:
protected RegisteredService getRegisteredServiceFromFile(final File file) { val fileName = file.getName(); if (fileName.startsWith(".")) { LOGGER.debug("[{}] starts with ., ignoring", fileName); return null; } if (Arrays.stream(getExtensions()).noneMatch(fileName::endsWith)) { LOGGER.debug("[{}] doesn't end with valid extension, ignoring", fileName); return null; } val matcher = this.serviceFileNamePattern.matcher(fileName); if (matcher.find()) { val serviceId = matcher.group(2); if (NumberUtils.isCreatable(serviceId)) { val id = Long.parseLong(serviceId); return findServiceById(id); } val serviceName = matcher.group(1); return findServiceByExactServiceName(serviceName); } LOGGER.warn("Provided file [{}} does not match the recommended service definition file pattern [{}]", file.getName(), this.serviceFileNamePattern.pattern()); return null; }

Target:
protected RegisteredService getRegisteredServiceFromFile(final File file) { val fileName = file.getName(); if (fileName.startsWith(".")) { LOGGER.trace("[{}] starts with ., ignoring", fileName); return null; } if (Arrays.stream(getExtensions()).noneMatch(fileName::endsWith)) { LOGGER.trace("[{}] doesn't end with valid extension, ignoring", fileName); return null; } val matcher = this.serviceFileNamePattern.matcher(fileName); if (matcher.find()) { val serviceId = matcher.group(2); if (NumberUtils.isCreatable(serviceId)) { val id = Long.parseLong(serviceId); return findServiceById(id); } val serviceName = matcher.group(1); return findServiceByExactServiceName(serviceName); } LOGGER.warn("Provided file [{}} does not match the recommended service definition file pattern [{}]", file.getName(), this.serviceFileNamePattern.pattern()); return null; }
Source:
protected Tuple2<MutablePartitionId, PrestoSparkMutableRow> computeNext() { if (currentRow >= rowCount) { return endOfData(); } int rowSize = rowSizes[currentRow]; rowData.limit(currentOffset + rowSize); rowData.position(currentOffset); int partition = rowPartitions[currentRow]; if (partition < 0) { if (replicatePartition < 0) { replicatePartition = -partition; replicatePartition--; } mutablePartitionId.setPartition(replicatePartition); replicatePartition--; if (replicatePartition < 0) { currentRow++; currentOffset += rowSize; } } else { mutablePartitionId.setPartition(partition); currentRow++; currentOffset += rowSize; } return tuple; }

Target:
protected Tuple2<MutablePartitionId, PrestoSparkMutableRow> computeNext() { if (currentRow >= rowCount) { return endOfData(); } int rowSize = rowSizes[currentRow]; rowData.limit(currentOffset + rowSize); rowData.position(currentOffset); int partition = rowPartitions[currentRow]; if (partition == REPLICATED_ROW_PARTITION_ID) { if (remainingReplicasCount == 0) { remainingReplicasCount = partitionCount; } mutablePartitionId.setPartition(remainingReplicasCount - 1); remainingReplicasCount--; if (remainingReplicasCount == 0) { currentRow++; currentOffset += rowSize; } } else { mutablePartitionId.setPartition(partition); currentRow++; currentOffset += rowSize; } return tuple; }
Source:
protected void ensureConsoleAppenderIsDefined(Logger logger) { if (logger != null) { ConsoleAppender consoleAppender = null; for (Object appender : Collections.list(logger.getAllAppenders())) { if (appender instanceof ConsoleAppender) { consoleAppender = (ConsoleAppender) appender; break; } } if (consoleAppender == null) { consoleAppender = new ConsoleAppender(); consoleAppender.setWriter(new OutputStreamWriter(System.out)); consoleAppender.setLayout(new PatternLayout("%d{ABSOLUTE} %-5p [%c{1}] %m%n")); logger.addAppender(consoleAppender); } } }

Target:
protected void ensureConsoleAppenderIsDefined(Logger logger) { if (logger != null) { for (Object appender : Collections.list(logger.getAllAppenders())) { if (appender instanceof ConsoleAppender) { return; } } ConsoleAppender consoleAppender = new ConsoleAppender(); consoleAppender.setWriter(new OutputStreamWriter(System.out)); consoleAppender.setLayout(new PatternLayout("%d{ABSOLUTE} %-5p [%c{1}] %m%n")); logger.addAppender(consoleAppender); } }
Source:
public NamespaceListener(String token) { log.info("Creating NamespaceListener"); this.token = token; namespaces = new HashMap<String, String>(); log.info("Namespace listener starting"); new Thread(new Listener()).start(); }

Target:
public NamespaceListener(String token) { log.debug("Creating NamespaceListener"); this.token = token; namespaces = new HashMap<>(); log.debug("Namespace listener starting."); new Thread(new Listener()).start(); }
Source:
public boolean isDTS() { return getCodecA() != null && (getCodecA().startsWith("dts") || "dca".equals(getCodecA()) || "dca (dts)".equals(getCodecA())); }

Target:
public boolean isDTS() { return getCodecA() != null && (getCodecA().contains("dts") || getCodecA().contains("dca")); }
Source:
public void uploadWithResponse(InputStream data, long length, ParallelTransferOptions parallelTransferOptions, BlobHttpHeaders headers, Map<String, String> metadata, AccessTier tier, BlobRequestConditions requestConditions, Duration timeout, Context context) { BlockBlobClient blockBlobClient = this.getBlockBlobClient(); final ParallelTransferOptions validatedParallelTransferOptions = ModelHelper.populateAndApplyDefaults(parallelTransferOptions); if (length < validatedParallelTransferOptions.getMaxSingleUploadSize()) { blockBlobClient.uploadWithResponse(data, length, headers, metadata, tier, null, requestConditions, timeout, context); } else { BlobOutputStream blobOutputStream = BlobOutputStream.blockBlobOutputStream(client, validatedParallelTransferOptions, headers, metadata, tier, requestConditions); try { data.transferTo(blobOutputStream); blobOutputStream.close(); } catch (IOException e) { e.printStackTrace(); } } }

Target:
public void uploadWithResponse(InputStream data, long length, ParallelTransferOptions parallelTransferOptions, BlobHttpHeaders headers, Map<String, String> metadata, AccessTier tier, BlobRequestConditions requestConditions, Duration timeout, Context context) { BlockBlobClient blockBlobClient = this.getBlockBlobClient(); final ParallelTransferOptions validatedParallelTransferOptions = ModelHelper.populateAndApplyDefaults(parallelTransferOptions); if (length < validatedParallelTransferOptions.getMaxSingleUploadSize()) { blockBlobClient.uploadWithResponse(data, length, headers, metadata, tier, null, requestConditions, timeout, context); } else { BlobOutputStream blobOutputStream = BlobOutputStream.blockBlobOutputStream(client, validatedParallelTransferOptions, headers, metadata, tier, requestConditions); try { StorageImplUtils.copyToOutputStream(data, length, blobOutputStream); blobOutputStream.close(); } catch (IOException e) { e.printStackTrace(); } } }
Source:
public void should_canUserSeeProcessInstance_call_engine_api_false() throws Exception { final boolean expected = false; checkCanUserSeeProcessInstanceWhenApiReturn(expected); }

Target:
public void should_canUserSeeProcessInstance_call_engine_api_false() throws Exception { checkCanUserSeeProcessInstanceWhenApiReturn(false); }
Source:
public boolean isKnownFormat(CharSource charSource) { try (CsvIterator csv = CsvIterator.of(charSource, true)) { if (!csv.containsHeader(TENOR_HEADER) && !csv.containsHeader(DATE_HEADER)) { return false; } if (csv.containsHeader(REFERENCE_HEADER) || csv.containsHeader(TYPE_HEADER)) { return true; } else { return csv.headers().stream() .filter(header -> knownReference(header)) .findAny() .isPresent(); } } catch (RuntimeException ex) { return false; } }

Target:
public boolean isKnownFormat(CharSource charSource) { try (CsvIterator csv = CsvIterator.of(charSource, true)) { if (!csv.containsHeader(TENOR_HEADER) && !csv.containsHeader(DATE_HEADER)) { return false; } if (csv.containsHeader(REFERENCE_HEADER) || csv.containsHeader(TYPE_HEADER)) { return true; } else { return csv.headers().stream().anyMatch(SensitivityCsvLoader::knownReference); } } catch (RuntimeException ex) { return false; } }
Source:
void addThreadMetrics(List<MetricFamilySamples> sampleFamilies) { sampleFamilies.add( new GaugeMetricFamily( "jvm_threads_current", "Current thread count of a JVM", threadBean.getThreadCount())); sampleFamilies.add( new GaugeMetricFamily( "jvm_threads_daemon", "Daemon thread count of a JVM", threadBean.getDaemonThreadCount())); sampleFamilies.add( new GaugeMetricFamily( "jvm_threads_peak", "Peak thread count of a JVM", threadBean.getPeakThreadCount())); sampleFamilies.add( new CounterMetricFamily( "jvm_threads_started_total", "Started thread count of a JVM", threadBean.getTotalStartedThreadCount())); sampleFamilies.add( new GaugeMetricFamily( "jvm_threads_deadlocked", "Cycles of JVM-threads that are in deadlock waiting to acquire object monitors or ownable synchronizers", nullSafeArrayLength(threadBean.findDeadlockedThreads()))); sampleFamilies.add( new GaugeMetricFamily( "jvm_threads_deadlocked_monitor", "Cycles of JVM-threads that are in deadlock waiting to acquire object monitors", nullSafeArrayLength(threadBean.findMonitorDeadlockedThreads()))); Map<Thread.State, Integer> threadStateCounts = getThreadStateCountMap(); for (Map.Entry<Thread.State, Integer> entry : threadStateCounts.entrySet()) { String stateName = entry.getKey().toString().toLowerCase(); sampleFamilies.add( new GaugeMetricFamily( String.format("jvm_threads_%s", stateName), String.format("Current count of threads in state '%s'", stateName), entry.getValue().doubleValue())); } }

Target:
void addThreadMetrics(List<MetricFamilySamples> sampleFamilies) { sampleFamilies.add( new GaugeMetricFamily( "jvm_threads_current", "Current thread count of a JVM", threadBean.getThreadCount())); sampleFamilies.add( new GaugeMetricFamily( "jvm_threads_daemon", "Daemon thread count of a JVM", threadBean.getDaemonThreadCount())); sampleFamilies.add( new GaugeMetricFamily( "jvm_threads_peak", "Peak thread count of a JVM", threadBean.getPeakThreadCount())); sampleFamilies.add( new CounterMetricFamily( "jvm_threads_started_total", "Started thread count of a JVM", threadBean.getTotalStartedThreadCount())); sampleFamilies.add( new GaugeMetricFamily( "jvm_threads_deadlocked", "Cycles of JVM-threads that are in deadlock waiting to acquire object monitors or ownable synchronizers", nullSafeArrayLength(threadBean.findDeadlockedThreads()))); sampleFamilies.add( new GaugeMetricFamily( "jvm_threads_deadlocked_monitor", "Cycles of JVM-threads that are in deadlock waiting to acquire object monitors", nullSafeArrayLength(threadBean.findMonitorDeadlockedThreads()))); GaugeMetricFamily threadStateFamily = new GaugeMetricFamily( "jvm_threads_state", "Current count of threads by state", Collections.singletonList("state")); Map<Thread.State, Integer> threadStateCounts = getThreadStateCountMap(); for (Map.Entry<Thread.State, Integer> entry : threadStateCounts.entrySet()) { threadStateFamily.addMetric( Collections.singletonList(entry.getKey().toString()), entry.getValue() ); } }
Source:
private BlockRead getBlock(String _lookup, BlockCache cache, BlockLoader loader) throws IOException { BlockReader _currBlock; Lock loadLock = null; if (cache != null) { CacheEntry cb = null; cb = cache.getBlock(_lookup); if (cb != null) { return new CachedBlockRead(cb, cb.getBuffer()); } loadLock = cache.getLoadLock(_lookup); } try { if (loadLock != null) { loadLock.lock(); CacheEntry cb = null; cb = cache.getBlockNoStats(_lookup); if (cb != null) { return new CachedBlockRead(cb, cb.getBuffer()); } } _currBlock = loader.get(); return cacheBlock(_lookup, cache, _currBlock, loader.getInfo()); } finally { if (loadLock != null) loadLock.unlock(); } }

Target:
private BlockRead getBlock(String _lookup, BlockCache cache, BlockLoader loader) throws IOException { BlockReader _currBlock; Lock loadLock = null; if (cache != null) { CacheEntry cb = null; cb = cache.getBlock(_lookup); if (cb != null) { return new CachedBlockRead(cb, cb.getBuffer()); } loadLock = cache.getLoadLock(_lookup); } try { if (loadLock != null) { loadLock.lock(); CacheEntry cb = cache.getBlockNoStats(_lookup); if (cb != null) { return new CachedBlockRead(cb, cb.getBuffer()); } } _currBlock = loader.get(); return cacheBlock(_lookup, cache, _currBlock, loader.getInfo()); } finally { if (loadLock != null) loadLock.unlock(); } }
Source:
public SSLSession getSSLSession() { if (!hasSSLSupport()) { throw new IllegalStateException("This websocket does use ws instead of wss. No SSLSession available."); } return ((ISSLChannel) channel).getSSLEngine().getSession(); }

Target:
public SSLSession getSSLSession() { if (!hasSSLSupport()) { throw new IllegalArgumentException("This websocket uses ws instead of wss. No SSLSession available."); } return ((ISSLChannel) channel).getSSLEngine().getSession(); }
Source:
public static CacheHeader readHeader(InputStream is, boolean includeResponseHeaders) throws IOException { CacheHeader entry = new CacheHeader(); int magic = readInt(is); if (magic != CACHE_MAGIC) { throw new IOException(); } entry.key = readString(is); entry.etag = readString(is); if (entry.etag.equals("")) { entry.etag = null; } entry.serverDate = readLong(is); entry.ttl = readLong(is); entry.softTtl = readLong(is); Map<String, String> headers = readStringStringMap(is); if (includeResponseHeaders) { entry.responseHeaders = headers; } else { entry.responseHeaders = new HashMap<>(); } return entry; }

Target:
public static CacheHeader readHeader(InputStream is, boolean includeResponseHeaders) throws IOException { CacheHeader entry = new CacheHeader(); int magic = readInt(is); if (magic != CACHE_MAGIC) { throw new IOException(); } entry.key = readString(is); entry.etag = readString(is); if (entry.etag.equals("")) { entry.etag = null; } entry.serverDate = readLong(is); entry.ttl = readLong(is); entry.softTtl = readLong(is); if (includeResponseHeaders) { entry.responseHeaders = readStringStringMap(is); } else { entry.responseHeaders = new HashMap<>(); } return entry; }
Source:
public Operation operationDispatched(Request request, Operation operation) { if (!request.getHttpRequest().getServletPath().equals("/ogc") && request.getOutputFormat().equals(JSONLDGetFeatureResponse.MIME)) { FeatureTypeInfo typeInfo = null; GetFeatureRequest getFeature = null; getFeature = GetFeatureRequest.adapt(operation.getParameters()[0]); List<Query> queries = getFeature.getQueries(); if (getFeature != null && queries != null && queries.size() > 0) { for (int i = 0; i < queries.size(); i++) { Query q = queries.get(i); QName type = q.getTypeNames().get(0); typeInfo = catalog.getFeatureTypeByName( new NameImpl(type.getPrefix(), type.getLocalPart())); if (typeInfo != null) { try { RootBuilder root = configuration.getTemplate(typeInfo); JsonLdPathVisitor visitor = new JsonLdPathVisitor(typeInfo.getFeatureType()); if (q.getFilter() != null) { Filter newFilter = (Filter) q.getFilter().accept(visitor, root); q.setFilter(newFilter); } } catch (Exception e) { throw new RuntimeException(e); } } } } } return super.operationDispatched(request, operation); }

Target:
public Operation operationDispatched(Request request, Operation operation) { if ("WFS".equalsIgnoreCase(request.getService()) && request.getOutputFormat() != null && request.getOutputFormat().equals(JSONLDGetFeatureResponse.MIME)) { FeatureTypeInfo typeInfo = null; GetFeatureRequest getFeature = null; getFeature = GetFeatureRequest.adapt(operation.getParameters()[0]); List<Query> queries = getFeature.getQueries(); if (getFeature != null && queries != null && queries.size() > 0) { for (int i = 0; i < queries.size(); i++) { Query q = queries.get(i); QName type = q.getTypeNames().get(0); typeInfo = catalog.getFeatureTypeByName( new NameImpl(type.getPrefix(), type.getLocalPart())); if (typeInfo != null) { try { RootBuilder root = configuration.getTemplate(typeInfo); JsonLdPathVisitor visitor = new JsonLdPathVisitor(typeInfo.getFeatureType()); if (q.getFilter() != null) { Filter newFilter = (Filter) q.getFilter().accept(visitor, root); q.setFilter(newFilter); } } catch (Exception e) { throw new RuntimeException(e); } } } } } return super.operationDispatched(request, operation); }
Source:
public List<Credential> fromRequest(final HttpServletRequest request, final MultiValueMap<String, String> requestBody) { if (requestBody == null || requestBody.isEmpty()) { LOGGER.debug("Skipping because the requestBody is null or empty", this); return new ArrayList<>(0); } final String cert = requestBody.getFirst(CERTIFICATE); LOGGER.debug("Certificate in the request body: [{}]", cert); if (StringUtils.isBlank(cert)) { return new ArrayList<>(0); } try (InputStream is = new ByteArrayInputStream(cert.getBytes(StandardCharsets.UTF_8))) { final InputStreamSource iso = new InputStreamResource(is); final X509Certificate certificate = CertUtils.readCertificate(iso); final X509CertificateCredential credential = new X509CertificateCredential(new X509Certificate[]{certificate}); credential.setCertificate(certificate); return CollectionUtils.wrap(credential); } catch (final Exception e) { LOGGER.error(e.getMessage(), e); } return new ArrayList<>(0); }

Target:
public List<Credential> fromRequest(final HttpServletRequest request, final MultiValueMap<String, String> requestBody) { if (requestBody == null || requestBody.isEmpty()) { LOGGER.debug("Skipping because the requestBody is null or empty", getClass().getSimpleName()); return new ArrayList<>(0); } final String cert = requestBody.getFirst(CERTIFICATE); LOGGER.debug("Certificate in the request body: [{}]", cert); if (StringUtils.isBlank(cert)) { return new ArrayList<>(0); } try (InputStream is = new ByteArrayInputStream(cert.getBytes(StandardCharsets.UTF_8))) { final InputStreamSource iso = new InputStreamResource(is); final X509Certificate certificate = CertUtils.readCertificate(iso); final X509CertificateCredential credential = new X509CertificateCredential(new X509Certificate[]{certificate}); credential.setCertificate(certificate); return CollectionUtils.wrap(credential); } catch (final Exception e) { LOGGER.error(e.getMessage(), e); } return new ArrayList<>(0); }
Source:
public void store(Item item, String alias) { if (isAgentConnected()) { String hwid = SiteWhereConfigurationManager.getInstance() .getFieldMapper().getHardwareIdForItem(item.getName()); if (hwid == null) { LOGGER.warn("No mapping found for field: " + item.getName()); return; } try { State state = item.getState(); if (state instanceof PercentType) { addDeviceMeasurement(hwid, item, ((PercentType) state) .toBigDecimal().doubleValue()); } else if (state instanceof DecimalType) { addDeviceMeasurement(hwid, item, ((DecimalType) state) .toBigDecimal().doubleValue()); } else if (state instanceof DateTimeType) { addDeviceAlert(hwid, item, (DateTimeType) state); } else if (state instanceof OnOffType) { addDeviceAlert(hwid, item, (OnOffType) state); } else if (state instanceof OpenClosedType) { addDeviceAlert(hwid, item, (OpenClosedType) state); } else if (state instanceof StringType) { addDeviceAlert(hwid, item, (StringType) state); } else { LOGGER.warn("Unable to store item of type: " + item.getState().getClass().getSimpleName()); return; } } catch (SiteWhereAgentException e) { LOGGER.warn("Unable to store item: " + item.getName(), e); } } }

Target:
public void store(Item item, String alias) { if (isAgentConnected()) { String hwid = getConfiguration().getDefaultHardwareId(); try { State state = item.getState(); if (state instanceof PercentType) { addDeviceMeasurement(hwid, item, ((PercentType) state) .toBigDecimal().doubleValue()); } else if (state instanceof DecimalType) { addDeviceMeasurement(hwid, item, ((DecimalType) state) .toBigDecimal().doubleValue()); } else if (state instanceof DateTimeType) { addDeviceAlert(hwid, item, (DateTimeType) state); } else if (state instanceof OnOffType) { addDeviceAlert(hwid, item, (OnOffType) state); } else if (state instanceof OpenClosedType) { addDeviceAlert(hwid, item, (OpenClosedType) state); } else if (state instanceof StringType) { addDeviceAlert(hwid, item, (StringType) state); } else if (state instanceof PointType) { addDeviceLocation(hwid, item, (PointType) state); } else { LOGGER.debug("Unable to store item of type: " + item.getState().getClass().getSimpleName()); return; } } catch (SiteWhereAgentException e) { LOGGER.warn("Unable to store item: " + item.getName(), e); } } }
Source:
@Override public boolean equals(Object obj) { return obj == this || obj instanceof MutableScan && rel.getTable().equals(((MutableScan) obj).rel.getTable()); }

Target:
@Override public boolean equals(Object obj) { return obj == this || obj instanceof MutableScan && rel.getTable().getQualifiedName().equals(((MutableScan) obj).rel .getTable().getQualifiedName()); }
Source:
public void validate_shouldFailValidationIfDoseUnitsIsNullForDosingTypeSimple() throws Exception { DrugOrder order = new DrugOrder(); order.setDosingType(DrugOrder.DosingType.SIMPLE); order.setDoseUnits(null); Errors errors = new BindException(order, "order"); new DrugOrderValidator().validate(order, errors); Assert.assertTrue(errors.hasFieldErrors("dose")); }

Target:
public void validate_shouldFailValidationIfDoseUnitsIsNullForDosingTypeSimple() throws Exception { DrugOrder order = new DrugOrder(); order.setDosingType(DrugOrder.DosingType.SIMPLE); order.setDoseUnits(null); Errors errors = new BindException(order, "order"); new DrugOrderValidator().validate(order, errors); Assert.assertTrue(errors.hasFieldErrors("doseUnits")); }
Source:
public static Settings fromJson(JSONObject settingsObject) throws JSONException { Settings settings = new Settings(); settings.firstSurvey = settingsObject.optLong("first_survey"); settings.timeDelay = settingsObject.optInt("time_delay"); settings.userID = settingsObject.optLong("user_id"); if (settingsObject.has("account_id")) { settings.accountID = settingsObject.optLong("account_id"); } else { settings.accountID = (long) Constants.NOT_SET; } JSONObject localizedTextsJson = settingsObject.optJSONObject("localized_texts"); settings.localizedTexts = LocalizedTexts.fromJson(localizedTextsJson); JSONObject customMessagesJson = settingsObject.optJSONObject("messages"); settings.adminPanelCustomMessage = WootricCustomMessage.fromJson(customMessagesJson); return settings; }

Target:
public static Settings fromJson(JSONObject settingsObject) throws JSONException { Settings settings = new Settings(); settings.firstSurvey = settingsObject.optLong("first_survey"); settings.timeDelay = settingsObject.optInt("time_delay"); if (settingsObject.has("account_id")) { settings.accountID = settingsObject.optLong("account_id"); } else { settings.accountID = (long) Constants.NOT_SET; } if (settingsObject.has("user_id")) { settings.userID = settingsObject.optLong("user_id"); } else { settings.userID = (long) Constants.NOT_SET; } JSONObject localizedTextsJson = settingsObject.optJSONObject("localized_texts"); settings.localizedTexts = LocalizedTexts.fromJson(localizedTextsJson); JSONObject customMessagesJson = settingsObject.optJSONObject("messages"); settings.adminPanelCustomMessage = WootricCustomMessage.fromJson(customMessagesJson); return settings; }
Source:
public boolean provides(IOperation operation) { boolean provide = false; String currentDiagramType; EObject referenceElement = ((IEditPartOperation) operation).getView().getElement(); if ((operation instanceof CreateGraphicEditPartOperation) && (referenceElement instanceof Classifier) && (CapsuleUtils.isCapsule((Classifier) referenceElement))) { currentDiagramType = ((IEditPartOperation) operation).getView().getDiagram().getType(); if ((diagramType == null) || (!diagramType.equals(currentDiagramType))) { provide = false; } else { provide = super.provides(operation); } } if ((operation instanceof CreateGraphicEditPartOperation) && (referenceElement instanceof Property) && (CapsulePartUtils.isCapsulePart((Property) referenceElement))) { currentDiagramType = ((IEditPartOperation) operation).getView().getDiagram().getType(); if ((diagramType == null) || (!diagramType.equals(currentDiagramType))) { provide = false; } else { provide = super.provides(operation); } } if ((operation instanceof CreateGraphicEditPartOperation) && (RTPortUtils.isRTPort(referenceElement))) { currentDiagramType = ((IEditPartOperation) operation).getView().getDiagram().getType(); if ((diagramType == null) || (!diagramType.equals(currentDiagramType))) { provide = false; } else { provide = super.provides(operation); } } return provide; }

Target:
public boolean provides(IOperation operation) { boolean provide = false; String currentDiagramType; EObject referenceElement = ((IEditPartOperation) operation).getView().getElement(); if ((operation instanceof CreateGraphicEditPartOperation) && (referenceElement instanceof Classifier) && (CapsuleUtils.isCapsule((Classifier) referenceElement))) { currentDiagramType = ((IEditPartOperation) operation).getView().getDiagram().getType(); if ((diagramType == null) || (!diagramType.equals(currentDiagramType))) { provide = false; } else { provide = super.provides(operation); } } if ((operation instanceof CreateGraphicEditPartOperation) && (referenceElement instanceof Property) && (CapsulePartUtils.isCapsulePart((Property) referenceElement))) { currentDiagramType = ((IEditPartOperation) operation).getView().getDiagram().getType(); if ((null == diagramType) || (!diagramType.equals(currentDiagramType))) { provide = false; } else { provide = super.provides(operation); } } if ((operation instanceof CreateGraphicEditPartOperation) && (RTPortUtils.isRTPort(referenceElement))) { currentDiagramType = ((IEditPartOperation) operation).getView().getDiagram().getType(); if ((null == diagramType) || (!diagramType.equals(currentDiagramType))) { provide = false; } else { provide = super.provides(operation); } } return provide; }
Source:
SubscriberTask(@Nonnull StreamManager streamManager, @Nonnull StreamListener listener, @Nonnull String namespace, @Nonnull List<TableSchema<K, V, M>> tableSchemas, long startAddress) { this.streamManager = streamManager; this.listener = listener; this.namespace = namespace; this.tablesOfInterest = new HashMap<>(); this.shutdown = new AtomicBoolean(); tableSchemas.forEach(tableSchema -> tablesOfInterest.put( CorfuRuntime.getStreamID( TableRegistry.getFullyQualifiedTableName(namespace, tableSchema.getTableName()) ), tableSchema )); this.startAddress = startAddress; StreamOptions options = StreamOptions.builder() .cacheEntries(!runtime.getParameters().isCacheDisabled()) .build(); this.txnStream = runtime.getStreamsView() .get(ObjectsView.TRANSACTION_STREAM_ID, options); this.txnStream.seek(startAddress + 1); }

Target:
SubscriberTask(@Nonnull StreamManager streamManager, @Nonnull StreamListener listener, @Nonnull String namespace, @Nonnull List<TableSchema<K, V, M>> tableSchemas, long startAddress) { this.streamManager = streamManager; this.listener = listener; this.namespace = namespace; this.tablesOfInterest = new HashMap<>(); tableSchemas.forEach(tableSchema -> tablesOfInterest.put( CorfuRuntime.getStreamID( TableRegistry.getFullyQualifiedTableName(namespace, tableSchema.getTableName()) ), tableSchema )); StreamOptions options = StreamOptions.builder() .cacheEntries(false) .build(); this.txnStream = runtime.getStreamsView() .get(ObjectsView.TRANSACTION_STREAM_ID, options); this.txnStream.seek(startAddress + 1); }
Source:
public ExtractUnallocAction(String title, Volume volume) throws NoCurrentCaseException { super(title); isImage = false; OutputFileData outputFileData = new OutputFileData(volume); filesToExtract.add(outputFileData); }

Target:
public ExtractUnallocAction(String title, Volume volume){ super(title); isImage = false; try { OutputFileData outputFileData = new OutputFileData(volume); filesToExtract.add(outputFileData); } catch (NoCurrentCaseException ex) { logger.log(Level.SEVERE, "Exception while getting open case.", ex); setEnabled(false); } }
Source:
public boolean loadSegment(final DataSegment segment) throws SegmentLoadingException { final Segment adapter = getAdapter(segment); final DataSourceState computeResult = dataSources.compute( segment.getDataSource(), (k, v) -> { final DataSourceState dataSourceState = v == null ? new DataSourceState() : v; final VersionedIntervalTimeline<String, ReferenceCountingSegment> loadedIntervals = dataSourceState.getTimeline(); final PartitionHolder<ReferenceCountingSegment> entry = loadedIntervals.findEntry( segment.getInterval(), segment.getVersion() ); if ((entry != null) && (entry.getChunk(segment.getShardSpec().getPartitionNum()) != null)) { log.warn("Told to load a adapter for a segment[%s] that already exists", segment.getIdentifier()); return null; } else { loadedIntervals.add( segment.getInterval(), segment.getVersion(), segment.getShardSpec().createChunk(new ReferenceCountingSegment(adapter)) ); dataSourceState.addSegment(segment); return dataSourceState; } } ); return computeResult != null; }

Target:
public boolean loadSegment(final DataSegment segment) throws SegmentLoadingException { final Segment adapter = getAdapter(segment); final SettableSupplier<Boolean> resultSupplier = new SettableSupplier<>(); dataSources.compute( segment.getDataSource(), (k, v) -> { final DataSourceState dataSourceState = v == null ? new DataSourceState() : v; final VersionedIntervalTimeline<String, ReferenceCountingSegment> loadedIntervals = dataSourceState.getTimeline(); final PartitionHolder<ReferenceCountingSegment> entry = loadedIntervals.findEntry( segment.getInterval(), segment.getVersion() ); if ((entry != null) && (entry.getChunk(segment.getShardSpec().getPartitionNum()) != null)) { log.warn("Told to load a adapter for a segment[%s] that already exists", segment.getIdentifier()); resultSupplier.set(false); } else { loadedIntervals.add( segment.getInterval(), segment.getVersion(), segment.getShardSpec().createChunk(new ReferenceCountingSegment(adapter)) ); dataSourceState.addSegment(segment); resultSupplier.set(true); } return dataSourceState; } ); return resultSupplier.get(); }
Source:
public void testUrlParsing() { UrlParseRequest nullUrl = new UrlParseRequest(null); UrlParseRequest emptyUrl = new UrlParseRequest(""); UrlParseRequest noHost = new UrlParseRequest("http:/ UrlParseRequest badProtocol = new UrlParseRequest("bad:http://foo"); }

Target:
public void testUrlParsing() { UrlParseRequest nullUrl = new UrlParseRequest(null); assertEquals(0, nullUrl.getTrafficStatsTag()); UrlParseRequest emptyUrl = new UrlParseRequest(""); assertEquals(0, emptyUrl.getTrafficStatsTag()); UrlParseRequest noHost = new UrlParseRequest("http:/ assertEquals(0, noHost.getTrafficStatsTag()); UrlParseRequest badProtocol = new UrlParseRequest("bad:http://foo"); assertEquals(0, badProtocol.getTrafficStatsTag()); UrlParseRequest goodProtocol = new UrlParseRequest("http://foo"); assertFalse(0 == goodProtocol.getTrafficStatsTag()); }
Source:
public void handleError(HttpServletRequest request, HttpServletResponse response, HandlerContext context) { Object error = request.getAttribute(HandlerContext.ERROR_ATTRIBUTE); if (error instanceof AuthenticationException) { response.setHeader("Location", loginUri); try { PrintWriter writer = response.getWriter(); writer.println("<html><head>"); writer.println("<meta http-equiv=\"refresh\" content=\"0; url=" + loginUri + "\" />"); writer.println("</head><body>Redirecting to login page</body></html>"); writer.flush(); } catch (IOException e) { logger.warn("Couldn't generate or send client response", e); } } else { context.execute(request, response); } }

Target:
public void handleError(HttpServletRequest request, HttpServletResponse response, HandlerContext context) { Object error = request.getAttribute(HandlerContext.ERROR_ATTRIBUTE); if (response.getStatus() == 403 || response.getStatus() == 401) { return; } if (error instanceof AuthenticationException) { String redirectUri = loginUri + "?" + REDIRECT_PARAM_NAME + "=" + request.getRequestURI(); response.setHeader("Location", redirectUri); try { PrintWriter writer = response.getWriter(); writer.println("<html><head>"); writer.println("<meta http-equiv=\"refresh\" content=\"0; url=" + redirectUri + "\" />"); writer.println("</head><body>Redirecting to login page</body></html>"); writer.flush(); } catch (IOException e) { logger.warn("Couldn't generate or send client response", e); } } else { context.execute(request, response); } }
Source:
public void verticalTest() { Rectangle bounds = new Rectangle(0, 0, 1000, 1000); bounds.x = 0; bounds.y = 0; bounds.height = 1000; bounds.width = 1000; int x0 = 100; int y0 = -10000; int x1 = 100; int y1 = 10000; Rectangle rect = LineClipper.clip(bounds, x0, y0, x1, y1); assertEquals(new Rectangle(100, 0, 0, 1000), rect); }

Target:
public void verticalTest() { Rectangle bounds = new Rectangle(0, 0, 1000, 1000); int x0 = 100; int y0 = -10000; int x1 = 100; int y1 = 10000; Rectangle rect = LineClipper.clip(bounds, x0, y0, x1, y1); assertEquals(new Rectangle(100, 0, 0, 1000), rect); }
Source:
private void equalizeIrrelevantData(AccountAttributes expected, AccountAttributes actual) { expected.createdAt = actual.createdAt; if (actual.studentProfile == null) { expected.studentProfile = null; } else { if (expected.studentProfile == null) { expected.studentProfile = new StudentProfileAttributes(); expected.studentProfile.googleId = actual.googleId; } expected.studentProfile.modifiedDate = actual.studentProfile.modifiedDate; expected.sanitizeForSaving(); } }

Target:
private void equalizeIrrelevantData(AccountAttributes expected, AccountAttributes actual) { expected.createdAt = actual.createdAt; if (actual.studentProfile == null) { expected.studentProfile = null; } else { if (expected.studentProfile == null) { expected.studentProfile = new StudentProfileAttributes(); expected.studentProfile.googleId = actual.googleId; } expected.studentProfile.modifiedDate = actual.studentProfile.modifiedDate; } }