auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void load() { HdfsConfiguration.init(); OptionBuilder<DatasetRepository> builder = new URIBuilder(); Registration.register( new URIPattern("file:/*path?absolute=true"), new URIPattern("file:/*path/:namespace/:dataset?absolute=true"), builder); Registration.register( new URIPattern("file:*path"), new URIPattern("file:*path/:namespace/:dataset"), builder); Registration.register( new URIPattern("hdfs:/*path?absolute=true"), new URIPattern("hdfs:/*path/:namespace/:dataset?absolute=true"), builder); Registration.register( new URIPattern("hdfs:*path"), new URIPattern("hdfs:*path/:namespace/:dataset"), builder); Registration.register( new URIPattern("webhdfs:/*path?absolute=true"), new URIPattern("webhdfs:/*path/:namespace/:dataset?absolute=true"), builder); }

Target:
public void load() { try { FileSystem.getLocal(DefaultConfiguration.get()); } catch (IOException e) { throw new DatasetIOException("Cannot load default config", e); } OptionBuilder<DatasetRepository> builder = new URIBuilder(); Registration.register( new URIPattern("file:/*path?absolute=true"), new URIPattern("file:/*path/:namespace/:dataset?absolute=true"), builder); Registration.register( new URIPattern("file:*path"), new URIPattern("file:*path/:namespace/:dataset"), builder); Registration.register( new URIPattern("hdfs:/*path?absolute=true"), new URIPattern("hdfs:/*path/:namespace/:dataset?absolute=true"), builder); Registration.register( new URIPattern("hdfs:*path"), new URIPattern("hdfs:*path/:namespace/:dataset"), builder); Registration.register( new URIPattern("webhdfs:/*path?absolute=true"), new URIPattern("webhdfs:/*path/:namespace/:dataset?absolute=true"), builder); }
Source:
public void testHangingFileExpires() throws Exception { System.setProperty("org.codice.ddf.catalog.content.monitor.expirationTime", "100"); doAnswer( (InvocationOnMock e) -> { sleep(1000); return null; }) .when(fileListener) .onFileCreate(any(File.class), any(Synchronization.class)); observer = new AsyncFileAlterationObserver(monitoredDirectory, store); observer.initialize(); observer.setListener(fileListener); observer.initializePeriodicProcessing(); File[] files = initFiles(1, monitoredDirectory, "file00"); observer.checkAndNotify(); verify(fileListener, times(files.length)) .onFileCreate(any(File.class), any(Synchronization.class)); assertThat(observer.expiredFiles.size(), is(1)); observer.checkAndNotify(); assertThat(observer.expiredFiles.size(), is(1)); }

Target:
public void testHangingFileExpires() throws Exception { System.setProperty("org.codice.ddf.catalog.content.monitor.expirationTime", "100"); doAnswer( (InvocationOnMock e) -> { sleep(500); return null; }) .when(fileListener) .onFileCreate(any(File.class), any(Synchronization.class)); observer = new AsyncFileAlterationObserver(monitoredDirectory, store); observer.initialize(); observer.setListener(fileListener); observer.initializePeriodicProcessing(); File[] files = initFiles(1, monitoredDirectory, "file00"); observer.checkAndNotify(); verify(fileListener, times(files.length)) .onFileCreate(any(File.class), any(Synchronization.class)); assertThat(observer.expiredFiles.size(), is(1)); observer.checkAndNotify(); assertThat(observer.expiredFiles.size(), is(1)); }
Source:
public List<String> getAllDatabases() { try { return retry() .stopOnIllegalExceptions() .run("getAllDatabases", stats.getGetAllDatabases().wrap(() -> wrapHMSCallable((HiveMetastoreClient client, ThriftHiveMetastoreStats stat) -> stat.getGetAllDatabases().wrapCall(client::getAllDatabases)))); } catch (TException e) { throw new PrestoException(HIVE_METASTORE_ERROR, e); } catch (Exception e) { throw propagate(e); } }

Target:
public List<String> getAllDatabases() { try { return retry() .stopOnIllegalExceptions() .run("getAllDatabases", stats.getGetAllDatabases().wrap(() -> wrapMetastoreCallable((HiveMetastoreClient client, ThriftHiveMetastoreStats stat) -> stat.getGetAllDatabases().wrapCall(client::getAllDatabases)))); } catch (TException e) { throw new PrestoException(HIVE_METASTORE_ERROR, e); } catch (Exception e) { throw propagate(e); } }
Source:
public boolean hitEntity(ItemStack itemStack, EntityLivingBase target, EntityLivingBase attacker) { if (attacker instanceof EntityPlayer && attacker.getRNG().nextFloat() < .15) { if(!attacker.world.isRemote) { String[] options = new String[] {"Your blood shall fuel our machinations.", "They stir in your subconscious.", "Your suffering grants us strength.", "Our will is your will.", "It is done.", "You are a tool. A tool through which we we exert our conspiracies."}; Random rand = new Random(); int num = rand.nextInt(5); ITextComponent message = new TextComponentTranslation(options[num]); message.getStyle().setColor(TextFormatting.DARK_PURPLE); attacker.sendMessage(message); } attacker.addPotionEffect(new PotionEffect(MobEffects.WITHER, 100, 2)); } return super.hitEntity(itemStack, target, attacker); }

Target:
public boolean hitEntity(ItemStack itemStack, EntityLivingBase target, EntityLivingBase attacker) { if (attacker instanceof EntityPlayer && attacker.getRNG().nextFloat() < .15) { if(!attacker.world.isRemote) { String[] options = new String[] {"item.clawOfNrubyiglith.message.machinations", "item.clawOfNrubyiglith.message.stir", "item.clawOfNrubyiglith.message.suffering", "item.clawOfNrubyiglith.message.will", "item.clawOfNrubyiglith.message.done", "item.clawOfNrubyiglith.message.conspiracies"}; Random rand = new Random(); int num = rand.nextInt(options.length); ITextComponent message = new TextComponentTranslation(options[num]); message.getStyle().setColor(TextFormatting.DARK_PURPLE); attacker.sendMessage(message); } attacker.addPotionEffect(new PotionEffect(MobEffects.WITHER, 100, 2)); } return super.hitEntity(itemStack, target, attacker); }
Source:
private Champ copyAndMigrateFromInlineToNode(final int bitpos, final Pair<Champ, Multihash> node) { final int oldIndex = index(dataMap, bitpos); final int newIndex = this.contents.length - 1 - index(nodeMap, bitpos); final HashPrefixPayload[] src = this.contents; final HashPrefixPayload[] dst = new HashPrefixPayload[src.length]; assert oldIndex <= newIndex; System.arraycopy(src, 0, dst, 0, oldIndex); System.arraycopy(src, oldIndex + 1, dst, oldIndex, newIndex - oldIndex); dst[newIndex] = new HashPrefixPayload(null, MaybeMultihash.of(node.right)); System.arraycopy(src, newIndex + 1, dst, newIndex + 1, src.length - newIndex - 1); BitSet newNodeMap = BitSet.valueOf(nodeMap.toByteArray()); newNodeMap.set(bitpos); BitSet newDataMap = BitSet.valueOf(dataMap.toByteArray()); newDataMap.set(bitpos, false); return new Champ(newDataMap, newNodeMap, dst); }

Target:
private Champ copyAndMigrateFromInlineToNode(final int bitpos, final Pair<Champ, Multihash> node) { final int oldIndex = getIndex(dataMap, bitpos); final int newIndex = this.contents.length - 1 - getIndex(nodeMap, bitpos); final HashPrefixPayload[] src = this.contents; final HashPrefixPayload[] dst = new HashPrefixPayload[src.length]; if (oldIndex > newIndex) throw new IllegalStateException("Invalid champ!"); System.arraycopy(src, 0, dst, 0, oldIndex); System.arraycopy(src, oldIndex + 1, dst, oldIndex, newIndex - oldIndex); dst[newIndex] = new HashPrefixPayload(MaybeMultihash.of(node.right)); System.arraycopy(src, newIndex + 1, dst, newIndex + 1, src.length - newIndex - 1); BitSet newNodeMap = BitSet.valueOf(nodeMap.toByteArray()); newNodeMap.set(bitpos); BitSet newDataMap = BitSet.valueOf(dataMap.toByteArray()); newDataMap.set(bitpos, false); return new Champ(newDataMap, newNodeMap, dst); }
Source:
ListenableFuture<AnviltopServices.MutateRowResponse> issueDeleteRequest(Delete delete) { AnviltopData.RowMutation.Builder mutationBuilder = deleteAdapter.adapt(delete); AnviltopServices.MutateRowRequest.Builder requestBuilder = AnviltopServices.MutateRowRequest.newBuilder(); requestBuilder.setMutation(mutationBuilder); AnviltopServices.MutateRowRequest request = requestBuilder .setTableName(tableName.getQualifierAsString()) .setProjectId(options.getProjectId()) .build(); try { return client.mutateAtomicAsync(request); } catch (ServiceException e) { return Futures.immediateFailedFuture(e); } }

Target:
ListenableFuture<AnviltopServices.MutateRowResponse> issueDeleteRequest(Delete delete) { AnviltopData.RowMutation.Builder mutationBuilder = deleteAdapter.adapt(delete); AnviltopServices.MutateRowRequest.Builder requestBuilder = makeMutateRowRequest(mutationBuilder); try { return client.mutateAtomicAsync(requestBuilder.build()); } catch (ServiceException e) { return Futures.immediateFailedFuture(e); } }
Source:
private HTTPEndpointManager() { super(); internalInboundPort = ConfigurationLoader.getInternalInboundHttpPort(); internalInboundHttpsPort = ConfigurationLoader.getInternalInboundHttpsPort(); if (internalInboundPort != -1) { int portOffset = PersistenceUtils.getPortOffset(); internalInboundPort += portOffset; internalInboundHttpsPort += portOffset; ConfigurationLoader.loadInternalApis(Constants.INTERNAL_APIS_FILE); List<InternalAPI> httpInternalAPIList = ConfigurationLoader.getHttpInternalApis(); internalHttpAPIDispatcher = new InternalAPIDispatcher(httpInternalAPIList); internalHttpApiEnabled = !httpInternalAPIList.isEmpty(); List<InternalAPI> httpsInternalAPIList = ConfigurationLoader.getHttpsInternalApis(); internalHttpsAPIDispatcher = new InternalAPIDispatcher(httpsInternalAPIList); internalHttpsApiEnabled = !httpsInternalAPIList.isEmpty(); } }

Target:
private HTTPEndpointManager() { super(); if (ConfigurationLoader.isInternalApiEnabled()) { internalInboundHttpPort = ConfigurationLoader.getInternalInboundHttpPort(); internalInboundHttpsPort = ConfigurationLoader.getInternalInboundHttpsPort(); ConfigurationLoader.loadInternalApis(Constants.INTERNAL_APIS_FILE); List<InternalAPI> httpInternalAPIList = ConfigurationLoader.getHttpInternalApis(); internalHttpApiDispatcher = new InternalAPIDispatcher(httpInternalAPIList); internalHttpApiEnabled = !httpInternalAPIList.isEmpty(); List<InternalAPI> httpsInternalAPIList = ConfigurationLoader.getHttpsInternalApis(); internalHttpsApiDispatcher = new InternalAPIDispatcher(httpsInternalAPIList); internalHttpsApiEnabled = !httpsInternalAPIList.isEmpty(); } }
Source:
public User(String userID) { super.setId(userID); }

Target:
public User(String userID) { super(userID); }
Source:
public void run() { synchronized (_syncRoot) { if (_cancelled || _badEndPoints.get(_endPoint) != this) { return; } } HealthCheckResult result = checkHealth(_endPoint); synchronized (_syncRoot) { _count += 1; if (result.isHealthy()) { _badEndPoints.remove(_endPoint, this); this.cancel(false); } else { long delayMillis = _healthCheckRetryPolicy.retry(_count, result); if (_future != null) { _future.cancel(false); } _future = _healthCheckExecutor.schedule(this, Math.max(0, delayMillis), TimeUnit.MILLISECONDS); } } }

Target:
public void run() { synchronized (_syncRoot) { if (_cancelled || _badEndPoints.get(_endPoint) != this) { return; } } HealthCheckResult result = checkHealth(_endPoint); synchronized (_syncRoot) { _count += 1; if (result.isHealthy()) { _badEndPoints.remove(_endPoint, this); this.cancel(false); } else { long delayMillis = _healthCheckRetryDelay.getDelay(_count, result); if (_future != null) { _future.cancel(false); } _future = _healthCheckExecutor.schedule(this, Math.max(0, delayMillis), TimeUnit.MILLISECONDS); } } }
Source:
public static Map<String, Set<XmlOutputElement>> getXmlOutputElements() { return ImmutableMap.copyOf(XML_OUTPUT_ELEMENTS); }

Target:
public static Multimap<String, XmlOutputElement> getXmlOutputElements() { return fCachedOutputElement; }
Source:
protected void check( Value value, StringBuilder pathBuilder ) throws TypeCheckingException { if ( checkNativeType( value, nativeType ) == false ) { throw new TypeCheckingException( "Invalid native type for node " + pathBuilder.toString() + ": expected " + nativeType + ", found " + (( value.valueObject() == null ) ? "void" : value.valueObject().getClass().getName()) ); } if ( subTypes != null ) { for( Entry< String, Type > entry : subTypes.entrySet() ) { checkSubType( entry.getKey(), entry.getValue(), value, new StringBuilder( pathBuilder ) ); } for( String childName : value.children().keySet() ) { if ( subTypes.containsKey( childName ) == false ) { throw new TypeCheckingException( "Unexpected child node: " + pathBuilder.toString() + "." + childName ); } } } }

Target:
protected void check( Value value, StringBuilder pathBuilder ) throws TypeCheckingException { if ( checkNativeType( value, nativeType ) == false ) { throw new TypeCheckingException( "Invalid native type for node " + pathBuilder.toString() + ": expected " + nativeType + ", found " + (( value.valueObject() == null ) ? "void" : value.valueObject().getClass().getName()) ); } if ( subTypes != null ) { final int l = pathBuilder.length(); for( Entry< String, Type > entry : subTypes.entrySet() ) { checkSubType( entry.getKey(), entry.getValue(), value, pathBuilder ); pathBuilder.setLength( l ); } for( String childName : value.children().keySet() ) { if ( subTypes.containsKey( childName ) == false ) { throw new TypeCheckingException( "Unexpected child node: " + pathBuilder.toString() + "." + childName ); } } } }
Source:
public List<Attribute> getRequiredAttributes(PerunSession sess, List<Service> services, Resource resource, Group group) throws InternalErrorException { if(!CacheManager.isCacheDisabled() && !perun.getCacheManager().wasCacheUpdatedInTransaction()) { List<Integer> attrIds = new ArrayList<>(); for (Service service : services) { attrIds.addAll(getRequiredAttributeIds(service)); } List<Attribute> attrs = perun.getCacheManager().getAttributesByIds(attrIds, new Holder(group.getId(), Holder.HolderType.GROUP), new Holder(resource.getId(), Holder.HolderType.RESOURCE)); return this.setValuesOfAttributes(sess, attrs, group, resource); } try { return jdbc.query("select " + getAttributeMappingSelectQuery("grp_res") + " from attr_names " + "join service_required_attrs on id=service_required_attrs.attr_id and service_required_attrs.service_id " + Compatibility.getStructureForInClause() + "left join group_resource_attr_values grp_res on id=grp_res.attr_id and group_id=? and resource_id=? " + "where namespace in (?,?,?)", new GroupResourceAttributeRowMapper(sess, this, group, resource), services.stream().map(Service::getId).collect(Collectors.toList()), group.getId(), resource.getId(), AttributesManager.NS_GROUP_RESOURCE_ATTR_DEF, AttributesManager.NS_GROUP_RESOURCE_ATTR_OPT, AttributesManager.NS_GROUP_RESOURCE_ATTR_VIRT); } catch (EmptyResultDataAccessException ex) { return new ArrayList<>(); } catch (RuntimeException ex) { throw new InternalErrorException(ex); } }

Target:
public List<Attribute> getRequiredAttributes(PerunSession sess, List<Service> services, Resource resource, Group group) { if(!CacheManager.isCacheDisabled() && !perun.getCacheManager().wasCacheUpdatedInTransaction()) { Set<Integer> attrIds = new HashSet<>(); for (Service service : services) { attrIds.addAll(getRequiredAttributeIds(service)); } List<Attribute> attrs = perun.getCacheManager().getAttributesByIds(new ArrayList<>(attrIds), new Holder(group.getId(), Holder.HolderType.GROUP), new Holder(resource.getId(), Holder.HolderType.RESOURCE)); return this.setValuesOfAttributes(sess, attrs, group, resource); } try { return jdbc.query("select " + getAttributeMappingSelectQuery("grp_res") + " from attr_names " + "join service_required_attrs on id=service_required_attrs.attr_id and service_required_attrs.service_id " + Compatibility.getStructureForInClause() + "left join group_resource_attr_values grp_res on id=grp_res.attr_id and group_id=? and resource_id=? " + "where namespace in (?,?,?)", new GroupResourceAttributeRowMapper(sess, this, group, resource), services.stream().map(Service::getId).collect(Collectors.toList()), group.getId(), resource.getId(), AttributesManager.NS_GROUP_RESOURCE_ATTR_DEF, AttributesManager.NS_GROUP_RESOURCE_ATTR_OPT, AttributesManager.NS_GROUP_RESOURCE_ATTR_VIRT); } catch (EmptyResultDataAccessException ex) { return new ArrayList<>(); } catch (RuntimeException ex) { throw new InternalErrorException(ex); } }
Source:
public SessionDataStore getSessionDataStore(SessionHandler handler) { AttributeSharingSessionDataStore dataStore = new AttributeSharingSessionDataStore(); return dataStore; }

Target:
public SessionDataStore getSessionDataStore(SessionHandler handler) { return new AttributeSharingSessionDataStore(); }
Source:
public Widget getWidget(Sitemap sitemap, String id) { if (id.length() > 0) { Widget w = getWidget(id); if (w == null) { w = getDefaultWidget(null, id); } if (w != null) { w.setItem(id); } else { try { w = sitemap.getChildren().get(Integer.valueOf(id.substring(0, 2))); for (int i = 2; i < id.length(); i += 2) { w = ((LinkableWidget) w).getChildren().get(Integer.valueOf(id.substring(i, i + 2))); } } catch (NumberFormatException | IndexOutOfBoundsException e) { } } return resolveDefault(w); } logger.warn("Cannot find page for id '{}'.", id); return null; }

Target:
public Widget getWidget(Sitemap sitemap, String id) { if (id.length() > 0) { Widget w = getWidget(id); if (w == null) { w = getDefaultWidget(null, id); } if (w != null) { w.setItem(id); } else { try { int widgetID = Integer.valueOf(id.substring(0, 2)); if (widgetID < sitemap.getChildren().size()) { w = sitemap.getChildren().get(widgetID); for (int i = 2; i < id.length(); i += 2) { int childWidgetID = Integer.valueOf(id.substring(i, i + 2)); if (childWidgetID < ((LinkableWidget) w).getChildren().size()) { w = ((LinkableWidget) w).getChildren().get(childWidgetID); } } } } catch (NumberFormatException e) { } } return resolveDefault(w); } logger.warn("Cannot find page for id '{}'.", id); return null; }
Source:
private boolean promptRun(CDK3Server cdk3) { String home = cdk3.getMinishiftHome(); final int[] retmain = new int[1]; if (new File(home).exists()) { Display.getDefault().syncExec(() -> { if( shell == null ) shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); MessageBox messageBox = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK | SWT.CANCEL); String msgText = "Setup CDK will delete all existing contents of {0}. Are you sure you want to continue?"; String msg = NLS.bind(msgText, home); messageBox.setMessage(msg); messageBox.setText("Warning: Folder already exists!"); retmain[0] = messageBox.open(); }); if (retmain[0] != SWT.OK) { return false; } } return true; }

Target:
private boolean promptRun(CDK3Server cdk3) { String home = cdk3.getMinishiftHome(); final int[] retmain = new int[1]; if (new File(home).exists()) { Display.getDefault().syncExec(() -> { if( shell == null ) shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); String title = "Warning: Folder already exists!"; String msgText = "Setup CDK will delete all existing contents of {0}. Are you sure you want to continue?"; String msg = NLS.bind(msgText, home); MessageDialog messageDialog = new MessageDialog(shell, title, null, msg, MessageDialog.WARNING, new String[] {IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL}, 0); retmain[0] = messageDialog.open(); }); if (retmain[0] != IDialogConstants.OK_ID) { return false; } } return true; }
Source:
public void testCountrySearch() throws Exception { System.out.println("testCountrySearch"); ELFGeoLocatorCountries countries = new ELFGeoLocatorCountries(); String response = IOHelper.readString(getClass().getResourceAsStream("ASDIService.xml")); countries.parseCountryMap(response); String adminNames = countries.getAdminNamesForFilter("no"); assertTrue(adminNames.equals("Norway polar - GN<OR>Norway - GN")); String countryName = countries.getAdminCountry(new Locale("en"), "Norway polar - GN", true); assertTrue(countryName.equals("Norway")); }

Target:
public void testCountrySearch() throws Exception { ELFGeoLocatorCountries countries = new ELFGeoLocatorCountries(); String response = IOHelper.readString(getClass().getResourceAsStream("ASDIService.xml")); countries.parseCountryMap(response); String adminNames = countries.getAdminNamesFilter("no"); String countryName = countries.getAdminCountry(new Locale("en"), "Norway polar - GN", true); assertTrue(countryName.equals("Norway")); }
Source:
public void testBulkEditBeforeUpdate() { List<DocumentModel> docs = createTestDocuments(); DocumentModel sourceDoc = buildSimpleDocumentModel(); bulkEditService.updateDocuments(session, sourceDoc, docs); TagService tagService = Framework.getService(TagService.class); String username = session.getPrincipal().getName(); for (DocumentModel doc : docs) { tagService.tag(session, doc.getId(), "tag", username); } TransactionHelper.commitOrRollbackTransaction(); TransactionHelper.startTransaction(); DocumentModel doc = session.getDocument(docs.get(0).getRef()); assertEquals("new title", doc.getPropertyValue("dc:title")); assertEquals("new creator", doc.getProperty("dc:creator").getValue()); assertFalse("new description".equals(doc.getPropertyValue("dc:description"))); assertFalse("new source".equals(doc.getPropertyValue("dc:source"))); List<Tag> tags = tagService.getDocumentTags(session, doc.getId(), username); assertEquals(1, tags.size()); assertEquals("tag", tags.get(0).getLabel()); assertEquals("0.1+", doc.getVersionLabel()); DocumentModel version = session.getLastDocumentVersion(doc.getRef()); assertEquals("doc1", version.getPropertyValue("dc:title")); assertEquals("0.1", version.getVersionLabel()); tags = tagService.getDocumentTags(session, version.getId(), username); assertEquals(0, tags.size()); }

Target:
public void testBulkEditBeforeUpdate() { List<DocumentModel> docs = createTestDocuments(); DocumentModel sourceDoc = buildSimpleDocumentModel(); bulkEditService.updateDocuments(session, sourceDoc, docs); String username = session.getPrincipal().getName(); for (DocumentModel doc : docs) { tagService.tag(session, doc.getId(), "tag", username); } TransactionHelper.commitOrRollbackTransaction(); TransactionHelper.startTransaction(); DocumentModel doc = session.getDocument(docs.get(0).getRef()); assertEquals("new title", doc.getPropertyValue("dc:title")); assertEquals("new creator", doc.getProperty("dc:creator").getValue()); assertFalse("new description".equals(doc.getPropertyValue("dc:description"))); assertFalse("new source".equals(doc.getPropertyValue("dc:source"))); List<Tag> tags = tagService.getDocumentTags(session, doc.getId(), username); assertEquals(1, tags.size()); assertEquals("tag", tags.get(0).getLabel()); assertEquals("0.1+", doc.getVersionLabel()); DocumentModel version = session.getLastDocumentVersion(doc.getRef()); assertEquals("doc1", version.getPropertyValue("dc:title")); assertEquals("0.1", version.getVersionLabel()); tags = tagService.getDocumentTags(session, version.getId(), username); assertEquals(0, tags.size()); }
Source:
public Object doInHibernate(Session session) throws HibernateException, XWikiException { XWikiContext context = R54693PhenoTips1500DataMigration.this.getXWikiContext(); DocumentReference classReference = new DocumentReference(context.getDatabase(), "PhenoTips", "PatientClass"); Query q = session.createQuery("select distinct o.name from BaseObject o, StringProperty p where o.className = '" + R54693PhenoTips1500DataMigration.this.serializer.serialize(classReference) + "and p.id.id = o.id and p.id.name =" + this.propertyName + "'"); @SuppressWarnings("unchecked") List<StringProperty> properties = q.list(); R54693PhenoTips1500DataMigration.this.logger.debug("Found global mode of inheritance properties", properties.size()); for (StringProperty oldProperty : properties) { try { DBStringListProperty newProperty = new DBStringListProperty(); newProperty.setName(oldProperty.getName()); newProperty.setId(oldProperty.getId()); List<String> newValue = new ArrayList<String>(); if (oldProperty.getValue() != null) { newValue.add(oldProperty.getValue()); newProperty.setValue(newValue); } session.delete(oldProperty); session.save(newProperty); } catch (Exception e) { R54693PhenoTips1500DataMigration.this.logger .warn("Failed to update a global mode of inheritance property. Exception message: {}", e.getMessage()); } } return null; }

Target:
public Object doInHibernate(Session session) throws HibernateException, XWikiException { XWikiContext context = R54693PhenoTips1500DataMigration.this.getXWikiContext(); DocumentReference classReference = new DocumentReference(context.getDatabase(), "PhenoTips", "PatientClass"); Query q = session.createQuery("select distinct o.name from BaseObject o, StringProperty p where o.className = '" + R54693PhenoTips1500DataMigration.this.serializer.serialize(classReference) + "'and p.id.id = o.id and p.id.name = '" + this.propertyName + "'"); @SuppressWarnings("unchecked") List<StringProperty> properties = q.list(); R54693PhenoTips1500DataMigration.this.logger.debug("Found global mode of inheritance properties", properties.size()); for (StringProperty oldProperty : properties) { try { DBStringListProperty newProperty = new DBStringListProperty(); newProperty.setName(oldProperty.getName()); newProperty.setId(oldProperty.getId()); List<String> newValue = new ArrayList<String>(); if (oldProperty.getValue() != null) { newValue.add(oldProperty.getValue()); newProperty.setValue(newValue); } session.delete(oldProperty); session.save(newProperty); } catch (Exception e) { R54693PhenoTips1500DataMigration.this.logger .warn("Failed to update a global mode of inheritance property. Exception message: {}", e.getMessage()); } } return null; }
Source:
public double getRate() { double rate = super.getRate(); if (Math.abs(rate / lastYawRate) > NavX.MAX_RATE_INCREASE_FACTOR_PER_TICK) { return lastYawRate; } lastYawRate = rate; return rate; }

Target:
public double getRate() { double rate = super.getRate(); if (Math.abs(rate - lastYawRate) > NavX.MAX_DEGREES_PER_SECOND_PER_TICK) { return lastYawRate; } lastYawRate = rate; return rate; }
Source:
public V putIfAbsent(final K key, final V value) throws CacheWriterException { putObserver.begin(); getObserver.begin(); statusTransitioner.checkAvailable(); checkNonNull(key, value); final AtomicBoolean installed = new AtomicBoolean(false); final Function<K, V> mappingFunction = memoize(new Function<K, V>() { @Override public V apply(final K k) { if (cacheWriter != null) { try { cacheWriter.write(k, null, value); } catch (Exception e) { throw newCacheWriterException(e); } } installed.set(true); return value; } }); try { ValueHolder<V> inCache = store.computeIfAbsent(key, mappingFunction); if (installed.get()) { return null; } else { return inCache.value(); } } catch (CacheAccessException e) { V computedValue = null; putObserver.end(PutOutcome.FAILURE); try { computedValue = mappingFunction.apply(key); if (cacheWriter != null) { store.remove(key); } else { final Store.ValueHolder<V> holder = store.get(key); if (holder == null) { resilienceStrategy.possiblyInconsistent(key, e); } else { return holder.value(); } } } catch (CacheAccessException e1) { resilienceStrategy.possiblyInconsistent(key, e, e1); } return installed.get() ? null : computedValue; } finally { if (installed.get()) { putObserver.end(PutOutcome.ADDED); getObserver.end(GetOutcome.MISS_NO_LOADER); } else { getObserver.end(GetOutcome.HIT_NO_LOADER); } } }

Target:
public V putIfAbsent(final K key, final V value) throws CacheWriterException { putIfAbsentObserver.begin(); statusTransitioner.checkAvailable(); checkNonNull(key, value); final AtomicBoolean installed = new AtomicBoolean(false); final Function<K, V> mappingFunction = memoize(new Function<K, V>() { @Override public V apply(final K k) { if (cacheWriter != null) { try { cacheWriter.write(k, null, value); } catch (Exception e) { throw newCacheWriterException(e); } } installed.set(true); return value; } }); try { ValueHolder<V> inCache = store.computeIfAbsent(key, mappingFunction); if (installed.get()) { return null; } else { return inCache.value(); } } catch (CacheAccessException e) { V computedValue = null; putIfAbsentObserver.end(PutIfAbsentOutcome.FAILURE); try { computedValue = mappingFunction.apply(key); if (cacheWriter != null) { store.remove(key); } else { final Store.ValueHolder<V> holder = store.get(key); if (holder == null) { resilienceStrategy.possiblyInconsistent(key, e); } else { return holder.value(); } } } catch (CacheAccessException e1) { resilienceStrategy.possiblyInconsistent(key, e, e1); } return installed.get() ? null : computedValue; } finally { if (installed.get()) { putIfAbsentObserver.end(PutIfAbsentOutcome.PUT); } else { putIfAbsentObserver.end(PutIfAbsentOutcome.HIT); } } }
Source:
public void testAddNewerBlock() { CachedBlockQueue queue = new CachedBlockQueue(10000L, 1000L); CachedBlock cb1 = new CachedBlock(5000L, "cb1", 1L); cb1.recordSize(new AtomicLong(5000L)); CachedBlock cb2 = new CachedBlock(5000, "cb2", 2L); cb2.recordSize(new AtomicLong(5000L)); CachedBlock cb3 = new CachedBlock(5000, "cb3", 3L); cb3.recordSize(new AtomicLong(5000L)); assertTrue(queue.add(cb1)); assertTrue(queue.add(cb2)); assertFalse(queue.add(cb3)); assertEquals(2, queue.size()); }

Target:
public void testAddNewerBlock() { CachedBlockQueue queue = new CachedBlockQueue(10000L, 1000L); CachedBlock cb1 = new CachedBlock(5000L, "cb1", 1L); CachedBlock cb2 = new CachedBlock(5000, "cb2", 2L); CachedBlock cb3 = new CachedBlock(5000, "cb3", 3L); assertTrue(queue.add(cb1)); assertTrue(queue.add(cb2)); assertFalse(queue.add(cb3)); assertEquals(2, queue.size()); assertEquals(Arrays.asList("cb1", "cb2"), queue.getBlocks().stream().map(cb -> cb.getName()).collect(Collectors.toList())); }
Source:
public ConvertedEntity convert(Object entity) { if (!appliesTo(entity)) { return null; } ProtobufValueWrapper valueWrapper = (ProtobufValueWrapper) entity; WrappedMessageTagHandler tagHandler = new WrappedMessageTagHandler(valueWrapper, serializationContext); try { Descriptor wrapperDescriptor = serializationContext.getMessageDescriptor(WrappedMessage.PROTOBUF_TYPE_NAME); ProtobufParser.INSTANCE.parse(tagHandler, wrapperDescriptor, valueWrapper.getBinary()); } catch (IOException e) { throw new CacheException(e); } String entityName = valueWrapper.getMessageDescriptor().getFullName(); boolean skip = !indexedMessageTypes.contains(entityName); byte[] messageBytes = tagHandler.getMessageBytes(); return new ProtobufConvertedEntity(skip, entityName, messageBytes); }

Target:
public ConvertedEntity convert(Object entity) { ProtobufValueWrapper valueWrapper = (ProtobufValueWrapper) entity; WrappedMessageTagHandler tagHandler = new WrappedMessageTagHandler(valueWrapper, serializationContext); try { Descriptor wrapperDescriptor = serializationContext.getMessageDescriptor(WrappedMessage.PROTOBUF_TYPE_NAME); ProtobufParser.INSTANCE.parse(tagHandler, wrapperDescriptor, valueWrapper.getBinary()); } catch (IOException e) { throw new CacheException(e); } Descriptor messageDescriptor = valueWrapper.getMessageDescriptor(); if (messageDescriptor == null) { return new ProtobufConvertedEntity(true, null, null); } String entityName = messageDescriptor.getFullName(); boolean skip = !indexedMessageTypes.contains(entityName); byte[] messageBytes = tagHandler.getMessageBytes(); return new ProtobufConvertedEntity(skip, entityName, messageBytes); }
Source:
public void cleanup() throws IOException { try { LOGGER.info("stopping mesosDriver.."); Main.getInjector().getInstance(MyriadDriverManager.class).stopDriver(false); LOGGER.info("stopped mesosDriver.."); } catch (Exception e) { throw new RuntimeException("Failed to stop myriad", e); } LOGGER.info("Stopped myriad."); }

Target:
public void cleanup() throws IOException { try { LOGGER.info("stopping mesosDriver.."); Status status = Main.getInjector().getInstance(MyriadDriverManager.class) .stopDriver(false); if (status.getNumber() != Status.DRIVER_STOPPED_VALUE) { throw new IllegalStateException("Error occurred while stopping MyriadDirver: " + "Unexpected driver status: " + status.name()); } LOGGER.info("stopped mesosDriver.."); } catch (Exception e) { throw new IOException("Failed to stop myriad", e); } LOGGER.info("Stopped myriad."); }
Source:
void appendDetailText(IStatus status, StringBuffer buffer, int indent, boolean includeTopLevelMessage) { if (includeTopLevelMessage) { for (int i = 0; i < indent; i++) buffer.append(NESTING_INDENT); if (status.getMessage() != null) buffer.append(status.getMessage()); } Throwable t = status.getException(); if (t != null) { buffer.append('\n'); for (int i = 0; i <= indent; i++) buffer.append(NESTING_INDENT); if (t instanceof CoreException) { IStatus exceptionStatus = ((CoreException) t).getStatus(); if (exceptionStatus != null && exceptionStatus.getMessage() != null) buffer.append(exceptionStatus.getMessage()); else { String details = t.getLocalizedMessage(); if (details != null) buffer.append(details); } } else { String details = t.getLocalizedMessage(); if (details != null) buffer.append(details); } } IStatus[] children = status.getChildren(); for (IStatus children1 : children) { if (buffer.length() > 0) buffer.append('\n'); appendDetailText(children1, buffer, indent + 1, true); } }

Target:
void appendDetailText(IStatus status, StringBuffer buffer, int indent, boolean includeTopLevelMessage) { if (includeTopLevelMessage) { for (int i = 0; i < indent; i++) buffer.append(NESTING_INDENT); if (status.getMessage() != null) buffer.append(status.getMessage()); } Throwable t = status.getException(); if (t != null) { buffer.append('\n'); for (int i = 0; i <= indent; i++) buffer.append(NESTING_INDENT); if (t instanceof CoreException) { IStatus exceptionStatus = ((CoreException) t).getStatus(); if (exceptionStatus != null && exceptionStatus.getMessage() != null) buffer.append(exceptionStatus.getMessage()); else { String details = t.getLocalizedMessage(); if (details != null) buffer.append(details); } } else { String details = t.getLocalizedMessage(); if (details != null) buffer.append(details); } } IStatus[] children = status.getChildren(); for (IStatus child : children) { if (buffer.length() > 0) buffer.append('\n'); appendDetailText(child, buffer, indent + 1, true); } }
Source:
private void destructElements(Nd nd, long nextElementAddress, int count) { ITypeFactory<T> factory = this.elementType.getFactory(); int size = getElementSize(); for (; count > 0; count--) { factory.destruct(nd, nextElementAddress); nextElementAddress += size; } }

Target:
private void destructElements(Nd nd, long nextElementAddress, int count) { ITypeFactory<T> factory = this.elementType.getFactory(); int size = getElementSize(); while (--count >= 0) { factory.destruct(nd, nextElementAddress); nextElementAddress += size; } }
Source:
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); trace(this, "Starting XWalk webview..."); this.simprints = new SimprintsSupport(this); this.photoGrabber = new PhotoGrabber(this); this.mrdt = new MrdtSupport(this); try { this.smsSender = new SmsSender(this); } catch(Exception ex) { warn(ex, "Failed to create SmsSender."); } this.settings = SettingsStore.in(this); this.requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.main); if(settings.allowsConfiguration() && settings.getAppUrl().contains("app.medicmobile.org")) { View webviewContainer = findViewById(R.id.lytWebView); webviewContainer.setPadding(10, 10, 10, 10); webviewContainer.setBackgroundColor(R.drawable.warning_background); } container = (XWalkView) findViewById(R.id.wbvMain); configureUseragent(); enableLocationUpdates(); setUpUiClient(container); enableRemoteChromeDebugging(); enableJavascript(container); enableStorage(container); enableUrlHandlers(container); browseToRoot(); if(settings.allowsConfiguration()) { toast(redactUrl(settings.getAppUrl())); } }

Target:
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); trace(this, "Starting XWalk webview..."); this.simprints = new SimprintsSupport(this); this.photoGrabber = new PhotoGrabber(this); this.mrdt = new MrdtSupport(this); try { this.smsSender = new SmsSender(this); } catch(Exception ex) { error(ex, "Failed to create SmsSender."); } this.settings = SettingsStore.in(this); this.requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.main); if(settings.allowsConfiguration() && settings.getAppUrl().contains("app.medicmobile.org")) { View webviewContainer = findViewById(R.id.lytWebView); webviewContainer.setPadding(10, 10, 10, 10); webviewContainer.setBackgroundColor(R.drawable.warning_background); } container = (XWalkView) findViewById(R.id.wbvMain); configureUseragent(); enableLocationUpdates(); setUpUiClient(container); enableRemoteChromeDebugging(); enableJavascript(container); enableStorage(container); enableUrlHandlers(container); browseToRoot(); if(settings.allowsConfiguration()) { toast(redactUrl(settings.getAppUrl())); } }
Source:
public Optional<ConstructorDeclaration> getDefaultConstructor() { for (BodyDeclaration<?> bd : getMembers()) { if (bd instanceof ConstructorDeclaration) { ConstructorDeclaration cd = (ConstructorDeclaration) bd; if (cd.getParameters().isEmpty()) { return Optional.of(cd); } } } return Optional.empty(); }

Target:
public Optional<ConstructorDeclaration> getDefaultConstructor() { return getMembers().stream() .filter(bd -> bd instanceof ConstructorDeclaration) .map(bd -> (ConstructorDeclaration) bd) .filter(cd -> cd.getParameters().isEmpty()) .findFirst(); }
Source:
private void resetConfig() { mySqlConfigProps.setProperty(DB_URL, ""); mySqlConfigProps.setProperty(DB_USER, ""); mySqlConfigProps.setProperty(DB_PASSWORD, ""); mySqlConfigProps.setProperty(UPDATER_POLLING_INTERVAL_SECONDS, "0"); mySqlConfigProps.setProperty(UPDATE_DISABLED, "false"); }

Target:
public void resetConfig() { mySqlConfigProps.setProperty(DB_URL, ""); mySqlConfigProps.setProperty(DB_USER, ""); mySqlConfigProps.setProperty(DB_PASSWORD, ""); mySqlConfigProps.setProperty(UPDATER_POLLING_INTERVAL_SECONDS, "0"); mySqlConfigProps.setProperty(UPDATE_DISABLED, "false"); }
Source:
public static boolean fastpassBinaryExists(@NotNull VirtualFile file) { Optional<VirtualFile> buildRoot2 = PantsUtil.findBuildRoot(file); return buildRoot2.map(b -> Paths.get(b.getPath()) .resolve("fastpass/bin/fastpass").toFile().exists()) .orElse(false); }

Target:
public static boolean fastpassBinaryExists(@NotNull VirtualFile file) { Optional<VirtualFile> buildRoot = PantsUtil.findBuildRoot(file); return buildRoot.map(b -> Paths.get(b.getPath()) .resolve("fastpass/bin/fastpass").toFile().exists()) .orElse(false); }
Source:
public Maintainable toMaintenance() { final StatusTransitioner.Transition st = internalToMaintenance(); try { final Maintainable maintainable = new Maintainable() { @Override public void create() { PersistentUserManagedEhcache.this.create(); } @Override public void destroy() { PersistentUserManagedEhcache.this.destroy(); } @Override public void close() { internalExitMaintenance().succeeded(); } }; st.succeeded(); return maintainable; } catch (RuntimeException e) { st.failed(e); } throw new AssertionError("Should not reach this line... ever!"); }

Target:
public Maintainable toMaintenance() { final StatusTransitioner.Transition st = statusTransitioner.maintenance(); try { final Maintainable maintainable = new Maintainable() { @Override public void create() { PersistentUserManagedEhcache.this.create(); } @Override public void destroy() { PersistentUserManagedEhcache.this.destroy(); } @Override public void close() { statusTransitioner.exitMaintenance().succeeded(); } }; st.succeeded(); return maintainable; } catch (RuntimeException e) { throw st.failed(e); } }
Source:
public void touchSession() { if (hasTimedOut()) { logSessionData(); sessionData = new SessionData(); sessionData.setStartTime(System.currentTimeMillis()); } sessionData.setLastTouchTime(System.currentTimeMillis()); }

Target:
public void touchSession() { long now = System.currentTimeMillis(); if (hasTimedOut()) { logSessionData(); sessionData = new SessionData(); sessionData.setStartTime(now); } sessionData.setLastTouchTime(now); }
Source:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; BlacklistStatus that = (BlacklistStatus) o; return blacklisted == that.blacklisted; }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } BlacklistStatus that = (BlacklistStatus) o; return blacklisted == that.blacklisted; }
Source:
public void testCreateNewFileWithOutMatchingToMountDirOrFallbackDirPath() throws Exception { Configuration conf = new Configuration(); ConfigUtil.addLink(conf, "/user1/hive/warehouse/partition-0", new Path(targetTestRoot.toString()).toUri()); Path fallbackTarget = new Path(targetTestRoot, "fallbackDir"); fsTarget.mkdirs(fallbackTarget); ConfigUtil.addLinkFallback(conf, fallbackTarget.toUri()); try (FileSystem vfs = FileSystem.get(viewFsDefaultClusterUri, conf)) { Path p = new Path("/user2/test.file"); Path test = Path.mergePaths(fallbackTarget, p); assertFalse(fsTarget.exists(test)); assertFalse(fsTarget.exists(test.getParent())); vfs.createNewFile(p); assertTrue(fsTarget.exists(test)); } }

Target:
public void testCreateNewFileWithOutMatchingToMountDirOrFallbackDirPath() throws Exception { Configuration conf = new Configuration(); ConfigUtil.addLink(conf, "/user1/hive/warehouse/partition-0", new Path(targetTestRoot.toString()).toUri()); Path fallbackTarget = new Path(targetTestRoot, "fallbackDir"); fsTarget.mkdirs(fallbackTarget); ConfigUtil.addLinkFallback(conf, fallbackTarget.toUri()); try (FileSystem vfs = FileSystem.get(viewFsDefaultClusterUri, conf)) { Path vfsTestFile = new Path("/user2/test.file"); Path testFileInFallback = Path.mergePaths(fallbackTarget, vfsTestFile); assertFalse(fsTarget.exists(testFileInFallback)); assertFalse(fsTarget.exists(testFileInFallback.getParent())); vfs.create(vfsTestFile).close(); assertTrue(fsTarget.exists(testFileInFallback)); } }
Source:
public Map<String, Supplier<URI>> get() { Map<String, URI> regionToUris = api.getAvailabilityZoneAndRegionApi().get().describeRegions(); Map<String, Supplier<URI>> result = Maps.transformValues(regionToUris, Suppliers2.<URI>ofInstanceFunction()); if (whitelistedRegionIds.isEmpty()) { return result; } return Maps.filterKeys(result, Predicates.in(whitelistedRegionIds)); }

Target:
public Map<String, Supplier<URI>> get() { ImmutableMap.Builder<String, Supplier<URI>> result = ImmutableMap.builder(); for (Entry<String, URI> regionUrl : api.getAvailabilityZoneAndRegionApi().get().describeRegions().entrySet()) { if (whitelistedRegionIds.isEmpty() || whitelistedRegionIds.contains(regionUrl.getKey())) { result.put(regionUrl.getKey(), Suppliers.ofInstance(regionUrl.getValue())); } } return result.build(); }
Source:
public String getMethod() { return METHOD_PATCH; }

Target:
public String getMethod() { return IRequest.Method.PATCH; }
Source:
public String getType(@NotNull Uri uri) { final int match = URI_MATCHER.match(uri); String cachedMimeType = sMimeTypeCache.get(match); if (cachedMimeType != null) { return cachedMimeType; } final Class<? extends Model> type = getModelType(uri); final boolean single = ((match % 2) == 0); StringBuilder mimeType = new StringBuilder(); mimeType.append(Resources.getSystem().getString(R.string.MIME_type_vendor_specific)); mimeType.append("."); mimeType.append(sAuthority); mimeType.append("."); mimeType.append(single ? "item" : "dir"); mimeType.append("/"); mimeType.append(Resources.getSystem().getString(R.string.MIME_type_vendor_specific)); mimeType.append("."); mimeType.append(sAuthority); mimeType.append("."); mimeType.append(Cache.getTableName(type)); sMimeTypeCache.append(match, mimeType.toString()); return mimeType.toString(); }

Target:
public String getType(@NotNull Uri uri) { final int match = URI_MATCHER.match(uri); String cachedMimeType = sMimeTypeCache.get(match); if (cachedMimeType != null) { return cachedMimeType; } final Class<? extends Model> type = getModelType(uri); final boolean single = ((match % 2) == 0); StringBuilder mimeType = new StringBuilder(); mimeType.append(ApplicationConstants.MIME_TYPE_VND); mimeType.append("."); mimeType.append(sAuthority); mimeType.append("."); mimeType.append(single ? "item" : "dir"); mimeType.append("/"); mimeType.append(ApplicationConstants.MIME_TYPE_VND); mimeType.append("."); mimeType.append(sAuthority); mimeType.append("."); mimeType.append(Cache.getTableName(type)); sMimeTypeCache.append(match, mimeType.toString()); return mimeType.toString(); }
Source:
public void setUp() { formatter = DateTimeFormat.forPattern("dd/MM/yyyy HH:mm:ss"); aliasA = new Alias("namespaceA", "valueA"); aliasB = new Alias("namespaceB", "valueB"); aliases.add(aliasA); aliases.add(aliasB); aliasMap = new HashMap<>(); aliasMap.put(AVAILABILITY_TIME, formatter.parseDateTime(DATE_A)); aliasMap.put(AVAILABILITY_END_TIME, formatter.parseDateTime(DATE_B)); aliasMap.put(ALIASES, aliases.stream().collect(MoreCollectors.toImmutableSet())); Map<String, Object> aliasesAsHashMap = Maps.newHashMap(); Map<String, String> aliasAMap = Maps.newHashMap(); aliasAMap.put("namespace", "namespaceA"); aliasAMap.put("value", "valueA"); Map<String, String> aliasBMap = Maps.newHashMap(); aliasBMap.put("namespace", "namespaceB"); aliasBMap.put("value", "valueB"); hashMapMap = new HashMap<>(); hashMapMap.put(AVAILABILITY_TIME, formatter.parseDateTime(DATE_A)); hashMapMap.put(AVAILABILITY_END_TIME, formatter.parseDateTime(DATE_B)); hashMapMap.put(ALIASES, Lists.newArrayList(aliasAMap, aliasBMap)); expectedEsLocation = new EsLocation(); expectedEsLocation.availabilityTime(formatter.parseDateTime(DATE_A).toDate()); expectedEsLocation.availabilityEndTime(formatter.parseDateTime(DATE_B).toDate()); expectedEsLocation.aliases(aliases); expectedMap = expectedEsLocation.toMap(); }

Target:
public void setUp() { formatter = DateTimeFormat.forPattern("dd/MM/yyyy HH:mm:ss"); aliasA = new Alias("namespaceA", "valueA"); aliasB = new Alias("namespaceB", "valueB"); aliases.add(aliasA); aliases.add(aliasB); Map<String, String> aliasAMap = ImmutableMap.of( "namespace", "namespaceA", "value", "valueA" ); Map<String, String> aliasBMap = ImmutableMap.of( "namespace", "namespaceB", "value", "valueB" ); locationMap = ImmutableMap.of( AVAILABILITY_TIME, formatter.parseDateTime(DATE_A), AVAILABILITY_END_TIME, formatter.parseDateTime(DATE_B), ALIASES, Lists.newArrayList(aliasAMap, aliasBMap) ); EsLocation expectedEsLocation = new EsLocation() .availabilityTime(formatter.parseDateTime(DATE_A).toDate()) .availabilityEndTime(formatter.parseDateTime(DATE_B).toDate()) .aliases(aliases); expectedMap = expectedEsLocation.toMap(); }
Source:
public Map<Cell, byte[]> get(TableReference tableRef, Set<Cell> cells) { if (cells.isEmpty()) { log.info("Attempted get on '{}' table with empty cells argument", tableRef); return ImmutableMap.of(); } try { return getColCacheForTable(tableRef).getAll(cells).entrySet() .stream() .filter(entry -> entry.getValue().length > 0) .collect(Collectors.toConcurrentMap(entry -> entry.getKey(), entry -> entry.getValue())); } catch (ExecutionException | UncheckedExecutionException e) { throw Throwables.throwUncheckedException(e.getCause()); } }

Target:
public Map<Cell, byte[]> get(TableReference tableRef, Set<Cell> cells) { if (cells.isEmpty()) { log.info("Attempted get on '{}' table with empty cells argument", tableRef); return ImmutableMap.of(); } try { return getColCacheForTable(tableRef).getAll(cells).entrySet() .stream() .filter(entry -> entry.getValue().length > 0) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); } catch (ExecutionException | UncheckedExecutionException e) { throw Throwables.throwUncheckedException(e.getCause()); } }
Source:
private static Object handleGenericRecord(GenericData.Record record) { return record.get(0); }

Target:
private static Object handleGenericRecord(GenericData.Record record) { List<Field> fields = record.getSchema().getFields(); if (fields.isEmpty()) { return null; } Map<Object, Object> convertedMap = new HashMap<>(); for (Field field : fields) { String fieldName = field.name(); convertedMap.put(fieldName, convert(record.get(fieldName))); } return convertedMap; }
Source:
default <R> SortedSet<R> collect(PartialFunction<? super T, ? extends R> partialFunction) { Objects.requireNonNull(partialFunction, "partialFunction is null"); return filter(partialFunction::isDefinedAt).map(partialFunction::apply); }

Target:
default <R> SortedSet<R> collect(PartialFunction<? super T, ? extends R> partialFunction) { Objects.requireNonNull(partialFunction, "partialFunction is null"); return TreeSet.ofAll(naturalComparator(), iterator().collect(partialFunction)); }