auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public IFileRevision[] getTargets(final IFileRevision ifr) { String path = null; RevCommit commit = null; if (ifr instanceof CommitFileRevision) { final CommitFileRevision rev = (CommitFileRevision) ifr; path = rev.getGitPath(); commit = rev.getRevCommit(); } else if (ifr instanceof IAdaptable) { final IResourceVariant variant = (IResourceVariant) ((IAdaptable) ifr) .getAdapter(IResourceVariant.class); if (variant instanceof GitRemoteResource) { final GitRemoteResource gitVariant = (GitRemoteResource) variant; path = gitVariant.getPath(); try { commit = walk.parseCommit(gitVariant.getCommitId()); } catch (IOException e) { } } } if (path != null && commit instanceof KidCommit) { final KidCommit c = (KidCommit) commit; final IFileRevision[] r = new IFileRevision[c.children.length]; for (int i = 0; i < r.length; i++) r[i] = new CommitFileRevision(db, c.children[i], path); return r; } return NO_REVISIONS; }

Target:
public IFileRevision[] getTargets(final IFileRevision ifr) { String path = getGitPath(ifr); RevCommit commit = getRevCommit(ifr); if (path != null && commit instanceof KidCommit) { final KidCommit c = (KidCommit) commit; final IFileRevision[] r = new IFileRevision[c.children.length]; for (int i = 0; i < r.length; i++) r[i] = new CommitFileRevision(db, c.children[i], path); return r; } return NO_REVISIONS; }
Source:
private boolean contentCheck(DirCacheEntry entry) { if (getEntryObjectId().equals(entry.getObjectId())) { try { entry.setLength((int) getEntryLength()); } catch (UnsupportedOperationException e) { } return false; } else { return true; } }

Target:
private boolean contentCheck(DirCacheEntry entry) { if (getEntryObjectId().equals(entry.getObjectId())) { if (!(entry instanceof UnmodifiableDirCacheEntry)) entry.setLength((int) getEntryLength()); return false; } else { return true; } }
Source:
public String getRemoteHost() { return null; }

Target:
public String getRemoteHost() { return hostName; }
Source:
public void increment(long inc) { if (value == null) { throw new IllegalArgumentException("Attempt to increment a null valued MutableRealmInteger"); } value = Long.valueOf(value + inc); }

Target:
public void increment(long inc) { if (value == null) { throw new IllegalStateException("Attempt to increment a null valued MutableRealmInteger"); } value = Long.valueOf(value + inc); }
Source:
private boolean checkAndFetchQuota(QuotaConsumptionParametersWrapper parameters, QuotaConsumptionParameter param) { if(param.getQuotaGuid() == null || Guid.Empty.equals(param.getQuotaGuid())) { parameters.getCanDoActionMessages().add(VdcBllMessages.ACTION_TYPE_FAILED_QUOTA_IS_NO_LONGER_AVAILABLE_IN_SYSTEM.toString()); log.errorFormat("No Quota id passed from command: {0}",parameters.getAuditLogable().getClass().getName()); return false; } Quota quota = fetchQuotaFromDB(param.getQuotaGuid()); if (quota == null) { parameters.getCanDoActionMessages().add(VdcBllMessages.ACTION_TYPE_FAILED_QUOTA_IS_NO_LONGER_AVAILABLE_IN_SYSTEM.toString()); log.errorFormat("The quota id {0} is not found in backend and DB.", param.getQuotaGuid().toString()); return false; } else { param.setQuota(quota); } return true; }

Target:
private boolean checkAndFetchQuota(QuotaConsumptionParametersWrapper parameters, QuotaConsumptionParameter param) { if(param.getQuotaGuid() == null || Guid.Empty.equals(param.getQuotaGuid())) { parameters.getCanDoActionMessages().add(VdcBllMessages.ACTION_TYPE_FAILED_QUOTA_IS_NO_LONGER_AVAILABLE_IN_SYSTEM.toString()); log.errorFormat("No Quota id passed from command: {0}",parameters.getAuditLogable().getClass().getName()); return false; } Quota quota = fetchQuotaFromDB(param.getQuotaGuid()); if (quota == null) { parameters.getCanDoActionMessages().add(VdcBllMessages.ACTION_TYPE_FAILED_QUOTA_IS_NO_LONGER_AVAILABLE_IN_SYSTEM.toString()); log.errorFormat("The quota id {0} is not found in backend and DB.", param.getQuotaGuid().toString()); return false; } else { param.setQuota(quota); } if (!quota.getStoragePoolId().equals(parameters.getStoragePoolGuid())) { throw new InvalidQuotaParametersException("The Quota storage pool id does not match the passed storage pool"); } return true; }
Source:
protected void onCreate(Bundle savedInstanceState) { AndroidInjection.inject(this); super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.settings_preferences); mPreferenceThumbnailSize = (ListPreference) getPreferenceScreen().findPreference(PreferencesRepository.KEY_PREF_THUMBNAIL_SIZE); mPreferencePhotosPerRow = (ListPreference) getPreferenceScreen().findPreference(PreferencesRepository.KEY_PREF_PHOTOS_PER_ROW); String photosPerRowValue = preferencesRepository.getStringPreference(PreferencesRepository.KEY_PREF_PHOTOS_PER_ROW, "4"); String thumbnailSizeValue = preferencesRepository.getStringPreference(PreferencesRepository.KEY_PREF_THUMBNAIL_SIZE, "medium"); mPreferenceThumbnailSize.setSummary(thumbnailSizeValue); mPreferencePhotosPerRow.setSummary(photosPerRowValue); mPreferencePhotosPerRow.setOnPreferenceChangeListener((preference, value) -> { mPreferencePhotosPerRow.setSummary(value.toString()); return true; }); mPreferenceThumbnailSize.setOnPreferenceChangeListener((preference, value) -> { mPreferenceThumbnailSize.setSummary(value.toString()); return true; }); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_settings); setSupportActionBar(findViewById(R.id.toolbar)); ActionBar bar = getSupportActionBar(); if (bar != null) bar.setDisplayHomeAsUpEnabled(true); getSupportFragmentManager() .beginTransaction() .replace(R.id.settings_container, new SettingsFragment()) .commit(); }
Source:
public void testSLSBInvocation() { Assert.assertEquals("echo system property exists", System.getProperty("echo"), null); Affinity expectedStrongAffinity = Affinity.NONE; final StatelessEJBLocator<Echo> statelessEJBLocator = StatelessEJBLocator.create(Echo.class, STATELESS_IDENTIFIER, expectedStrongAffinity); Echo proxy = EJBClient.createProxy(statelessEJBLocator); Assert.assertNotNull("Received a null proxy", proxy); logger.info("Invoking on proxy..."); final String message = "hello!"; try { proxy.echo(message); } catch (RuntimeException e) { } Assert.assertEquals("method echo not in error message", System.getProperty("echo"), "true"); }

Target:
public void testSLSBInvocation() { Assert.assertEquals("echo system property exists", null, System.getProperty("echo")); Affinity expectedStrongAffinity = Affinity.NONE; final StatelessEJBLocator<Echo> statelessEJBLocator = StatelessEJBLocator.create(Echo.class, STATELESS_IDENTIFIER, expectedStrongAffinity); Echo proxy = EJBClient.createProxy(statelessEJBLocator); Assert.assertNotNull("Received a null proxy", proxy); logger.info("Invoking on proxy..."); final String message = "hello!"; try { proxy.echo(message); } catch (RuntimeException e) { } Assert.assertEquals("method echo not in error message", "true", System.getProperty("echo")); }
Source:
BytesConverter getByteConverterForAvroDelegate(Schema schema, Properties tbl) { String avroBytesConverterProperty = tbl.getProperty(AvroSerdeUtils .AvroTableProperties.AVRO_SERDE_TYPE .getPropName(), BytesConverterType.NONE.toString()); BytesConverterType avroByteConverterType = BytesConverterType.fromString(avroBytesConverterProperty); Integer avroSkipBytes = Integer.getInteger(tbl.getProperty(AvroSerdeUtils.AvroTableProperties.AVRO_SERDE_SKIP_BYTES .getPropName())); switch (avroByteConverterType) { case CONFLUENT: return new AvroSkipBytesConverter(schema, 5); case SKIP: return new AvroSkipBytesConverter(schema, avroSkipBytes); default: return new AvroBytesConverter(schema); } }

Target:
BytesConverter getByteConverterForAvroDelegate(Schema schema, Properties tbl) throws SerDeException { String avroBytesConverterPropertyName = AvroSerdeUtils.AvroTableProperties.AVRO_SERDE_TYPE.getPropName(); String avroBytesConverterProperty = tbl.getProperty(avroBytesConverterPropertyName, BytesConverterType.NONE.toString()); BytesConverterType avroByteConverterType = BytesConverterType.fromString(avroBytesConverterProperty); switch (avroByteConverterType) { case SKIP: String avroSkipBytesPropertyName = AvroSerdeUtils.AvroTableProperties.AVRO_SERDE_SKIP_BYTES.getPropName(); Integer avroSkipBytes = 0; try { avroSkipBytes = Integer.parseInt(tbl.getProperty(avroSkipBytesPropertyName)); } catch (NumberFormatException e) { String message = "Value of " + avroSkipBytesPropertyName + " could not be parsed into an integer properly."; throw new SerDeException(message, e); } return new AvroSkipBytesConverter(schema, avroSkipBytes); case NONE: return new AvroBytesConverter(schema); default: throw new SerDeException("Value of " + avroBytesConverterPropertyName + " was invalid."); } }
Source:
private void inlineSheet(final String namespaceURI, String s) throws Exception { InputStream inputStream = null; String withoutExtension = s.substring(0, s.indexOf(LibraryType.CSS.extension)); HtmlLibrary library = htmlLibraryManager.getLibrary(LibraryType.CSS, withoutExtension); if (library != null) { inputStream = library.getInputStream(); } else { Resource resource = slingRequest.getResourceResolver().getResource(s); if (resource != null) { inputStream = resource.adaptTo(InputStream.class); } } if (inputStream != null) { InputStreamReader isr = new InputStreamReader(inputStream); CharArrayWriter caw = new CharArrayWriter(inputStream.available()); caw.write(NEWLINE); int read = -1; while ((read = isr.read()) > -1) { caw.write(read); } getContentHandler().startElement(namespaceURI, STYLE, null, new AttributesImpl()); getContentHandler().characters(caw.toCharArray(), 0, caw.size()); super.endElement(namespaceURI, STYLE, null); } }

Target:
private void inlineSheet(final String namespaceURI, String s) throws Exception { InputStream inputStream = null; String withoutExtension = s.substring(0, s.indexOf(LibraryType.CSS.extension)); HtmlLibrary library = htmlLibraryManager.getLibrary(LibraryType.CSS, withoutExtension); if (library != null) { inputStream = library.getInputStream(); } else { Resource resource = slingRequest.getResourceResolver().getResource(s); if (resource != null) { inputStream = resource.adaptTo(InputStream.class); } } if (inputStream != null) { char[] chars = IOUtils.toCharArray(inputStream); getContentHandler().startElement(namespaceURI, STYLE, null, new AttributesImpl()); getContentHandler().characters(NEWLINE, 0, 1); getContentHandler().characters(chars, 0, chars.length); getContentHandler().endElement(namespaceURI, STYLE, null); } }
Source:
public String fetchContent(String fileName) throws IOException { URI fileUrl = devfileLocation.resolve(fileName); try { return urlFetcher.fetch(fileUrl.toString()); } catch (IOException e) { throw new IOException( format( "Failed to fetch a file %s as relative to devfile %s from URL %s. Make sure the" + " location of the devfile points to the raw content of it (e.g. on Github or other" + " git repository make sure to use a link to the raw content of the devfile, not" + " a link to the webpage showing it). If obtaining such URL is not possible, make" + " sure you have installed a factory resolver plugin for given repository type" + " to your Che server instance.", fileName, devfileLocation, fileUrl), e); } }

Target:
public String fetchContent(String fileName) throws IOException { URI fileUrl = devfileLocation.resolve(fileName); try { return urlFetcher.fetch(fileUrl.toString()); } catch (IOException e) { throw new IOException( format( "Failed to fetch a file %s as relative to devfile %s from URL %s. Make sure the URL" + " of the devfile points to the raw content of it (e.g. not to the webpage" + " showing it but really just its contents). Additionally, make sure the" + " referenced files are actually stored relative to the devfile on the same" + " host. If none of that is possible, try to host your devfile on some other" + " location together with the referenced files in such a way that resolving the" + " \"local\" name of a tool as a relative path against the devfile location" + " gives a true downloadable URL for that file. The current attempt to download" + " the file failed with the following error message: %s", fileName, devfileLocation, fileUrl, e.getMessage()), e); } }
Source:
public void registerBeanDefinitions(BeanDefinitionRegistry registry) { ClassLoader pluginClassLoader = getClass().getClassLoader(); BeanDefinition springLoaderBeanDefinition = BeanDefinitionBuilder.genericBeanDefinition(SpringLoader.class) .setScope(BeanDefinition.SCOPE_SINGLETON) .setAutowireMode(AutowireCapableBeanFactory.AUTOWIRE_NO) .addConstructorArgValue(pluginContext) .addConstructorArgValue(pluginClassLoader) .addConstructorArgValue(getPackagesToScan()) .addConstructorArgValue(getClassesToRegister()) .getBeanDefinition(); try { registerBean(springLoaderBeanDefinition, registry); } catch (ClassNotFoundException e) { throw new IllegalStateException(e); } registry .getBeanDefinition("requestMappingHandlerMapping") .setDependsOn("com.netflix.spinnaker.kork.plugins.api.spring.SpringLoader"); }

Target:
public void registerBeanDefinitions(BeanDefinitionRegistry registry) { final String springLoaderBeanName = wrapper.getPluginId() + "." + SpringLoader.class.getName(); ClassLoader pluginClassLoader = getClass().getClassLoader(); BeanDefinition springLoaderBeanDefinition = BeanDefinitionBuilder.genericBeanDefinition(SpringLoader.class) .setScope(BeanDefinition.SCOPE_SINGLETON) .setAutowireMode(AutowireCapableBeanFactory.AUTOWIRE_NO) .addConstructorArgValue(pluginContext) .addConstructorArgValue(pluginClassLoader) .addConstructorArgValue(getPackagesToScan()) .addConstructorArgValue(getClassesToRegister()) .getBeanDefinition(); registry.registerBeanDefinition(springLoaderBeanName, springLoaderBeanDefinition); final BeanDefinition requestMappingHandlerMapping = registry.getBeanDefinition("requestMappingHandlerMapping"); final String[] mappingDependsOnArray = requestMappingHandlerMapping.getDependsOn(); final List<String> mappingDependsOn; if (mappingDependsOnArray == null) { mappingDependsOn = new ArrayList<>(); } else { mappingDependsOn = new ArrayList<>(Arrays.asList(mappingDependsOnArray)); } mappingDependsOn.add(springLoaderBeanName); requestMappingHandlerMapping.setDependsOn( mappingDependsOn.toArray(new String[mappingDependsOn.size()])); }
Source:
public FullyQualifiedInfo getQualifiedInfo() { return null; }

Target:
public FullyQualifiedInfo getQualifiedInfo() { if (getDeclaringClass() != null && isStatic() && isPublic()) { FullyQualifiedInfo containerInfo = getDeclaringClass().getQualifiedInfo(); if (containerInfo != null) { return new FullyQualifiedInfo(containerInfo.packagePath, containerInfo.fileName, containerInfo.className, getName()); } } return null; }
Source:
public DefaultMapperReference(Type type, TypeFactory typeFactory) { this.type = type; isAnnotatedMapper = type.isAnnotatedMapper(); importTypes = Collections.asSet( type ); if ( isAnnotatedMapper() ) { importTypes.add( typeFactory.getType( Mappers.class ) ); } }

Target:
public DefaultMapperReference(Type type, TypeFactory typeFactory) { this.type = type; isAnnotatedMapper = type.isAnnotatedWith( "org.mapstruct.ap.model.Mapper" ); importTypes = Collections.asSet( type ); if ( isAnnotatedMapper() ) { importTypes.add( typeFactory.getType( "org.mapstruct.factory.Mappers" ) ); } }
Source:
public void finishCell() { if (!Objects.equals(this.family, this.previousFamily)) { previousFamily = this.family; currentFamilyCells = new TreeSet<>(compareCells()); cells.put(this.family, this.currentFamilyCells); } FlatRow.Cell cell = new FlatRow.Cell(this.family, this.qualifier, this.timestamp, this.value, this.labels); this.currentFamilyCells.add(cell); totalCellCount++; }

Target:
public void finishCell() { if (!Objects.equals(this.family, this.previousFamily)) { previousFamily = this.family; currentFamilyCells = new ArrayList<>(); cells.put(this.family, this.currentFamilyCells); } FlatRow.Cell cell = new FlatRow.Cell(this.family, this.qualifier, this.timestamp, this.value, this.labels); this.currentFamilyCells.add(cell); totalCellCount++; }
Source:
public SalesforceSession(SalesforceHttpClient httpClient, long timeout, SalesforceLoginConfig config) { ObjectHelper.notNull(httpClient, "httpClient"); ObjectHelper.notNull(config, "SalesforceLoginConfig"); ObjectHelper.notNull(config.getLoginUrl(), "loginUrl"); ObjectHelper.notNull(config.getClientId(), "clientId"); ObjectHelper.notNull(config.getClientSecret(), "clientSecret"); if (config.getRefreshToken() == null) { ObjectHelper.notNull(config.getUserName(), "userName"); ObjectHelper.notNull(config.getPassword(), "password"); } else { ObjectHelper.notNull(config.getRefreshToken(), "refreshToken"); } this.httpClient = httpClient; this.timeout = timeout; this.config = config; String loginUrl = config.getLoginUrl(); config.setLoginUrl(loginUrl.endsWith("/") ? loginUrl.substring(0, loginUrl.length() - 1) : loginUrl); this.objectMapper = JsonUtils.createObjectMapper(); this.listeners = new CopyOnWriteArraySet<SalesforceSessionListener>(); }

Target:
public SalesforceSession(SalesforceHttpClient httpClient, long timeout, SalesforceLoginConfig config) { ObjectHelper.notNull(httpClient, "httpClient"); ObjectHelper.notNull(config, "SalesforceLoginConfig"); ObjectHelper.notNull(config.getLoginUrl(), "loginUrl"); ObjectHelper.notNull(config.getClientId(), "clientId"); ObjectHelper.notNull(config.getClientSecret(), "clientSecret"); if (ObjectHelper.isEmpty(config.getRefreshToken())) { ObjectHelper.notNull(config.getUserName(), "userName"); ObjectHelper.notNull(config.getPassword(), "password"); } else { ObjectHelper.notNull(config.getRefreshToken(), "refreshToken"); } this.httpClient = httpClient; this.timeout = timeout; this.config = config; String loginUrl = config.getLoginUrl(); config.setLoginUrl(loginUrl.endsWith("/") ? loginUrl.substring(0, loginUrl.length() - 1) : loginUrl); this.objectMapper = JsonUtils.createObjectMapper(); this.listeners = new CopyOnWriteArraySet<SalesforceSessionListener>(); }
Source:
protected void handleReceive(final Context context, final Intent data) { try { if (data != null && data.getAction() != null) { switch (data.getAction()) { case DownloadManager.ACTION_DOWNLOAD_COMPLETE: handleDownloadCompleteIntent(context, data); break; case DownloadManager.ACTION_NOTIFICATION_CLICKED: handleDownloadNotificationClickIntent(context, data); break; } } } catch(Exception ex) { logger.error(ex); } }

Target:
protected void handleReceive(final Context context, final Intent data) { if (data != null && data.getAction() != null) { switch (data.getAction()) { case DownloadManager.ACTION_DOWNLOAD_COMPLETE: handleDownloadCompleteIntent(data); break; case DownloadManager.ACTION_NOTIFICATION_CLICKED: environment.getRouter().showDownloads(context); break; } } }
Source:
private void initStreamLogDirectory() { try { FileStore fs = Files.getFileStore(Paths.get(logDir.getParent().toString())); if (fs.isReadOnly()) { throw new UnrecoverableCorfuError("Cannot start Corfu on a read-only filesystem"); } } catch (IOException e) { throw new UnrecoverableCorfuError("Unable to retrieve Corfu Filesystem permissions"); } File corfuDir = new File(logDir.getParent().toString()); if (!corfuDir.canWrite()) { throw new UnrecoverableCorfuError("Corfu directory is not writable"); } if (logDir.toFile().exists()) { File logDirectory = new File(logDir.toString()); if (!logDirectory.canWrite()) { throw new UnrecoverableCorfuError("Stream log directory is not writable"); } log.info("Log directory already exists: {}", logDir); return; } try { Files.createDirectories(logDir); } catch (IOException e) { throw new UnrecoverableCorfuError("Can't create stream log directory", e); } }

Target:
private void initStreamLogDirectory() { if (logDir.toFile().exists()) { String corfuDir = logDir.getParent().toString(); try { FileStore fs = Files.getFileStore(Paths.get(corfuDir)); if (fs.isReadOnly()) { throw new UnrecoverableCorfuError("Cannot start Corfu on a read-only filesystem:" +corfuDir); } } catch (IOException e) { throw new UnrecoverableCorfuError("Unable to retrieve Corfu Filesystem permissions"+ corfuDir); } File corfuDirFile = new File(corfuDir); if (!corfuDirFile.canWrite()) { throw new UnrecoverableCorfuError("Corfu directory is not writable "+corfuDir); } File logDirectory = new File(logDir.toString()); if (!logDirectory.canWrite()) { throw new UnrecoverableCorfuError("Stream log directory not writable in "+corfuDir); } log.info("Log directory already exists: {}", logDir); return; } try { Files.createDirectories(logDir); } catch (IOException e) { throw new UnrecoverableCorfuError("Can't create stream log directory", e); } }
Source:
public void convertProfileGenericDataRequest() { final ProfileGenericDataRequest req1 = this.makeRequest(); final Object obj1 = this.mapper.map(req1, com.alliander.osgp.domain.core.valueobjects.smartmetering.ProfileGenericDataRequest.class); assertTrue((obj1 != null) && (obj1 instanceof com.alliander.osgp.domain.core.valueobjects.smartmetering.ProfileGenericDataRequest)); final Object obj2 = this.mapper.map(obj1, ProfileGenericDataRequest.class); assertTrue((obj2 != null) && (obj2 instanceof ProfileGenericDataRequest)); final ProfileGenericDataRequest req2 = (ProfileGenericDataRequest) obj2; assertTrue(req1.getDeviceIdentification().equals(req2.getDeviceIdentification())); }

Target:
public void convertProfileGenericDataRequest() { final ProfileGenericDataRequest source = this.makeRequest(); final Object result = this.mapper.map(source, com.alliander.osgp.domain.core.valueobjects.smartmetering.ProfileGenericDataRequest.class); assertNotNull("mapping ProfileGenericDataRequest should not return null", result); assertThat("mapping ProfileGenericDataRequest should return correct type", result, instanceOf(com.alliander.osgp.domain.core.valueobjects.smartmetering.ProfileGenericDataRequest.class)); final com.alliander.osgp.domain.core.valueobjects.smartmetering.ProfileGenericDataRequest target = (com.alliander.osgp.domain.core.valueobjects.smartmetering.ProfileGenericDataRequest) result; assertEquals(source.getDeviceIdentification(), target.getDeviceIdentification()); assertEquals(source.getObisCode().getA(), target.getObisCode().getA()); assertEquals(source.getObisCode().getF(), target.getObisCode().getF()); final DateTime targetEndDate = new DateTime(target.getEndDate().getTime()); assertEquals(source.getBeginDate().getYear(), targetEndDate.getYear()); }
Source:
private void searchGoogleMaps(final String query){ final AQuery aq = new AQuery(this); UserLocation loc = MainApplication.user.getLocation(); Double lon = loc.getLon(); Double lat = loc.getLat(); String url = GOOGLE_MAPS_API_URL+ query +"&location="+lat+","+lon+"&radius="+radius+"&key="+ API_Key; Log.e(TAG, "Query sent to Google Maps: " + url); AjaxCallback<JSONObject> cb = new AjaxCallback<JSONObject>(){ @Override public void callback(String url, JSONObject json, AjaxStatus status) { if (status.getError() != null){ Log.e(TAG, "Error accessing Google Maps API: " + status.getError()); return; } try { JSONArray results = json.getJSONArray("results"); if (results.length() > 0) for (int i = 0; i < results.length(); i++){ resultList.add(parseGoogleMapsResult(results.getJSONObject(i))); } } catch (JSONException e){ Log.e(TAG, "Error parsing Google Maps JSON: " + e); } Log.d(TAG, "Geocoding result: " + json.toString()); adapter.notifyDataSetChanged(); setHeader(query); } }; aq.ajax(url, JSONObject.class, cb); }

Target:
private void searchGoogleMaps(final String query){ final AQuery aq = new AQuery(this); UserLocation loc = MainApplication.user.getLocation(); Double lon = loc.getLon(); Double lat = loc.getLat(); String url = GOOGLE_MAPS_API_URL + query + "&location=" + lat + "," + lon + "&radius=" + radius + "&key=" + getString(R.string.Server_API_Key); Log.e(TAG, "Query sent to Google Maps: " + url); AjaxCallback<JSONObject> cb = new AjaxCallback<JSONObject>(){ @Override public void callback(String url, JSONObject json, AjaxStatus status) { if (status.getError() != null){ Log.e(TAG, "Error accessing Google Maps API: " + status.getError()); return; } try { JSONArray results = json.getJSONArray("results"); if (results.length() > 0) for (int i = 0; i < results.length(); i++){ resultList.add(parseGoogleMapsResult(results.getJSONObject(i))); } } catch (JSONException e){ Log.e(TAG, "Error parsing Google Maps JSON: " + e); } Log.d(TAG, "Geocoding result: " + json.toString()); adapter.notifyDataSetChanged(); setHeader(query); } }; aq.ajax(url, JSONObject.class, cb); }
Source:
public static Map<String, Long> getTermCounts(IndexReader reader, String termStr) throws IOException, ParseException { EnglishAnalyzer ea = new EnglishAnalyzer(CharArraySet.EMPTY_SET); return getTermCounts(reader, termStr, ea); }

Target:
public static Map<String, Long> getTermCounts(IndexReader reader, String termStr) throws IOException, ParseException { DefaultEnglishAnalyzer ea = DefaultEnglishAnalyzer.newDefaultInstance(); return getTermCountsWithAnalyzer(reader, termStr, ea); }
Source:
public EnrichedEvent poll(long timeout, TimeUnit unit) throws StageException { try { EnrichedEvent event = queue.poll(timeout, unit); return event; } catch (InterruptedException e) { LOG.error(Errors.MYSQL_001.getMessage(), e.toString(), e); Thread.currentThread().interrupt(); throw new StageException(Errors.MYSQL_001, e.toString(), e); } }

Target:
public EnrichedEvent poll(long timeout, TimeUnit unit) throws StageException { try { return queue.poll(timeout, unit); } catch (InterruptedException e) { LOG.error(Errors.MYSQL_001.getMessage(), e.toString(), e); Thread.currentThread().interrupt(); throw new StageException(Errors.MYSQL_001, e.toString(), e); } }
Source:
protected Set<Value.Immutable<?>> api$getVanillaValues() { final Set<Value.Immutable<?>> vanillaValues = super.api$getVanillaValues(); if (this.getTargetedEntity() != null) { this.beamTarget().map(Value::asImmutable).ifPresent(vanillaValues::add); } return vanillaValues; }

Target:
protected Set<Value.Immutable<?>> api$getVanillaValues() { final Set<Value.Immutable<?>> values = super.api$getVanillaValues(); this.beamTarget().map(Value::asImmutable).ifPresent(values::add); return values; }
Source:
String toJavaScript() { StringBuffer buffer = new StringBuffer(); if (convertUrls != null) buffer.append(",\n\t").append("convert_urls : ") .append(convertUrls); if (relativeUrls != null) buffer.append(",\n\t").append("relative_urls : ").append( relativeUrls); if (removeScriptHost != null) buffer.append(",\n\t").append("remove_script_host : ").append( removeScriptHost); if (autoResize) buffer.append(",\n\tauto_resize : true"); if (readOnly) buffer.append(",\n\treadonly : true"); if (contentCss != null) buffer.append(",\n\t").append("content_css : \"").append( RequestCycle.get().urlFor(contentCss)).append("\""); if (documentBaseUrl != null) buffer.append(",\n\t").append("document_base_url : \"").append( documentBaseUrl).append("\""); if (entityEncoding != null) buffer.append(",\n\t").append("entity_encoding : \"").append( entityEncoding).append("\""); if (Theme.advanced.equals(theme)) appendAdvancedSettings(buffer); appendPluginSettings(buffer); appendCustomSettings(buffer); return buffer.toString(); }

Target:
String toJavaScript() { StringBuffer buffer = new StringBuffer(); if (convertUrls != null) buffer.append(",\n\t").append("convert_urls : ") .append(convertUrls); if (relativeUrls != null) buffer.append(",\n\t").append("relative_urls : ").append( relativeUrls); if (removeScriptHost != null) buffer.append(",\n\t").append("remove_script_host : ").append( removeScriptHost); if (readOnly) buffer.append(",\n\treadonly : true"); if (contentCss != null) buffer.append(",\n\t").append("content_css : \"").append( RequestCycle.get().urlFor(contentCss)).append("\""); if (documentBaseUrl != null) buffer.append(",\n\t").append("document_base_url : \"").append( documentBaseUrl).append("\""); if (entityEncoding != null) buffer.append(",\n\t").append("entity_encoding : \"").append( entityEncoding).append("\""); if (Theme.advanced.equals(theme)) appendAdvancedSettings(buffer); appendPluginSettings(buffer); appendCustomSettings(buffer); return buffer.toString(); }
Source:
public List<QuestionableActivityListingDTO> checkMeasuresRemoved( CertifiedProductSearchDetails origListing, CertifiedProductSearchDetails newListing) { List<QuestionableActivityListingDTO> measuresRemovedActivities = new ArrayList<QuestionableActivityListingDTO>(); if (origListing.getMeasures() != null && origListing.getMeasures().size() > 0 && newListing.getMeasures() != null && newListing.getMeasures().size() > 0) { for (ListingMeasure origMeasure : origListing.getMeasures()) { Optional<ListingMeasure> matchingNewMeasure = newListing.getMeasures().stream() .filter(newMeasure -> origMeasure.getId().equals(newMeasure.getId())) .findFirst(); if (!matchingNewMeasure.isPresent()) { QuestionableActivityListingDTO activity = new QuestionableActivityListingDTO(); activity.setBefore(origMeasure.getMeasurementType().getName() + " measure " + origMeasure.getMeasure().getName() + " for " + origMeasure.getMeasure().getAbbreviation()); activity.setAfter(null); measuresRemovedActivities.add(activity); } } } else if (origListing.getMeasures() != null && (newListing.getMeasures() == null || newListing.getMeasures().size() == 0)) { for (ListingMeasure origMeasure : origListing.getMeasures()) { QuestionableActivityListingDTO activity = new QuestionableActivityListingDTO(); activity.setBefore(origMeasure.getMeasurementType().getName() + " measure " + origMeasure.getMeasure().getName() + " for " + origMeasure.getMeasure().getAbbreviation()); activity.setAfter(null); measuresRemovedActivities.add(activity); } } return measuresRemovedActivities; }

Target:
public List<QuestionableActivityListingDTO> checkMeasuresRemoved( CertifiedProductSearchDetails origListing, CertifiedProductSearchDetails newListing) { List<QuestionableActivityListingDTO> measuresRemovedActivities = new ArrayList<QuestionableActivityListingDTO>(); if (origListing.getMeasures() != null && origListing.getMeasures().size() > 0 && newListing.getMeasures() != null && newListing.getMeasures().size() > 0) { for (ListingMeasure origMeasure : origListing.getMeasures()) { Optional<ListingMeasure> matchingNewMeasure = newListing.getMeasures().stream() .filter(newMeasure -> origMeasure.getId().equals(newMeasure.getId())) .findAny(); if (!matchingNewMeasure.isPresent()) { QuestionableActivityListingDTO activity = new QuestionableActivityListingDTO(); activity.setBefore(origMeasure.getMeasureType().getName() + " measure " + origMeasure.getMeasure().getName() + " for " + origMeasure.getMeasure().getAbbreviation()); activity.setAfter(null); measuresRemovedActivities.add(activity); } } } else if (origListing.getMeasures() != null && (newListing.getMeasures() == null || newListing.getMeasures().size() == 0)) { for (ListingMeasure origMeasure : origListing.getMeasures()) { QuestionableActivityListingDTO activity = new QuestionableActivityListingDTO(); activity.setBefore(origMeasure.getMeasureType().getName() + " measure " + origMeasure.getMeasure().getName() + " for " + origMeasure.getMeasure().getAbbreviation()); activity.setAfter(null); measuresRemovedActivities.add(activity); } } return measuresRemovedActivities; }
Source:
public List<RolloutTask> plan(final Map<String, HostStatus> hostsAndStatuses) { final List<String> hosts = Lists.newArrayList(); for (final Map.Entry<String, HostStatus> entry : hostsAndStatuses.entrySet()) { if (entry.getValue().getStatus().equals(HostStatus.Status.UP)) { hosts.add(entry.getKey()); } } final List<RolloutTask> rolloutTasks = Lists.newArrayList(); final int parallelism = deploymentGroup.getRolloutOptions() != null ? deploymentGroup.getRolloutOptions().getParallelism() : 1; Lists.partition(hosts, parallelism) .forEach(partition -> rolloutTasks.addAll(rolloutTasks(partition))); return ImmutableList.copyOf(rolloutTasks); }

Target:
public List<RolloutTask> plan(final Map<String, HostStatus> hostsAndStatuses) { final List<String> hosts = hostsAndStatuses.entrySet() .stream() .filter(entry -> entry.getValue().getStatus().equals(HostStatus.Status.UP)) .map(entry -> entry.getKey()) .collect(Collectors.toList()); final List<RolloutTask> rolloutTasks = Lists.newArrayList(); final int parallelism = deploymentGroup.getRolloutOptions() != null ? deploymentGroup.getRolloutOptions().getParallelism() : 1; Lists.partition(hosts, parallelism) .forEach(partition -> rolloutTasks.addAll(rolloutTasks(partition))); return ImmutableList.copyOf(rolloutTasks); }
Source:
public void onUnityAdsReady(String placementId) { Iterator<WeakReference<UnityAdapterDelegate>> iterator = mUnityAdapterDelegatesSet.iterator(); while (iterator.hasNext()) { UnityAdapterDelegate delegate = iterator.next().get(); if (delegate != null && delegate.getPlacementId().equals(placementId)) { delegate.onUnityAdsReady(placementId); iterator.remove(); } } }

Target:
public void onUnityAdsReady(String placementId) { Iterator<WeakReference<UnityAdapterDelegate>> iterator = mUnityAdapterDelegatesSet.iterator(); while (iterator.hasNext()) { UnityAdapterDelegate delegate = iterator.next().get(); if(delegate.getPlacementId()!= null){ if (delegate.getPlacementId().equals(placementId)) { delegate.onUnityAdsReady(placementId); iterator.remove(); } } } }
Source:
public <T extends Projectile> Optional<T> launchProjectile(final EntityType<T> projectileType) { return ProjectileLauncher.launch(checkNotNull(projectileType, "projectileType"), this, null); }

Target:
public <T extends Projectile> Optional<T> launchProjectile(final EntityType<T> projectileType) { return ProjectileLauncher.launch(requireNonNull(projectileType, "projectileType"), this, null); }
Source:
public AnalysisResults analyzeModule(Module module, Collection<VirtualFile> filesToAnalyze, IssueListener listener) { Project p = module.getProject(); SonarLintConsole console = SonarLintConsole.get(p); SonarLintServerManager core = SonarLintUtils.get(SonarLintServerManager.class); Map<String, String> pluginProps; AnalysisConfigurator analysisConfigurator = module.getComponent(AnalysisConfigurator.class); if (analysisConfigurator != null) { console.debug("Configuring analysis with " + analysisConfigurator.getClass().getName()); pluginProps = analysisConfigurator.configure(module); } else { console.debug("No analysis configurator found"); pluginProps = new HashMap<>(); } ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(module); List<ClientInputFile> inputFiles = getInputFiles(p, moduleRootManager, filesToAnalyze); long start = System.currentTimeMillis(); SonarLintFacade facade = core.getFacadeForAnalysis(module.getProject()); if (facade == null) { console.info("Failed to create SonarLint engine for module '" + module.getName() + "'"); return null; } String what; if (filesToAnalyze.size() == 1) { what = "'" + filesToAnalyze.iterator().next().getName() + "'"; } else { what = Integer.toString(filesToAnalyze.size()) + " files"; } console.info("Analysing " + what + "..."); AnalysisResults result = facade.startAnalysis(inputFiles, listener, pluginProps); console.debug("Done in " + (System.currentTimeMillis() - start) + "ms\n"); return result; }

Target:
public AnalysisResults analyzeModule(Module module, Collection<VirtualFile> filesToAnalyze, IssueListener listener) { Project p = module.getProject(); SonarLintConsole console = SonarLintConsole.get(p); SonarLintServerManager core = SonarLintUtils.get(SonarLintServerManager.class); Map<String, String> pluginProps = new HashMap<>(); AnalysisConfigurator[] analysisConfigurators = module.getComponents(AnalysisConfigurator.class); if (analysisConfigurators != null && analysisConfigurators.length > 0) { for (AnalysisConfigurator config : analysisConfigurators) { console.debug("Configuring analysis with " + config.getClass().getName()); pluginProps.putAll(config.configure(module)); } } else { console.debug("No analysis configurator found"); } ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(module); List<ClientInputFile> inputFiles = getInputFiles(p, moduleRootManager, filesToAnalyze); long start = System.currentTimeMillis(); SonarLintFacade facade = core.getFacadeForAnalysis(module.getProject()); if (facade == null) { console.info("Failed to create SonarLint engine for module '" + module.getName() + "'"); return null; } String what; if (filesToAnalyze.size() == 1) { what = "'" + filesToAnalyze.iterator().next().getName() + "'"; } else { what = Integer.toString(filesToAnalyze.size()) + " files"; } console.info("Analysing " + what + "..."); AnalysisResults result = facade.startAnalysis(inputFiles, listener, pluginProps); console.debug("Done in " + (System.currentTimeMillis() - start) + "ms\n"); return result; }
Source:
public boolean valueEquals(String desiredValue, Object value) { if (value instanceof String) { if (desiredValue.equals(value)) return true; } else if (value instanceof Double) { try { if (Double.valueOf(desiredValue).equals(value)) return true; } catch (Exception e) { } } else if (value instanceof Integer) { try { if (Integer.valueOf(desiredValue).equals(value)) return true; } catch (Exception e) { } } else if (value instanceof Boolean) { try { if (Boolean.valueOf(desiredValue).equals(value)) return true; } catch (Exception e) { } } else if (value instanceof List) { List list = (List)value; for (Object val : list) { if (valueEquals(desiredValue, val)) return true; } } else if (value instanceof JsonNode) { try { JsonSerialization.readValue(desiredValue, JsonNode.class).equals(value); } catch (Exception e) { } } return false; }

Target:
public boolean valueEquals(String desiredValue, Object value) { if (value instanceof String) { if (desiredValue.equals(value)) return true; } else if (value instanceof Double) { try { if (Double.valueOf(desiredValue).equals(value)) return true; } catch (Exception e) { } } else if (value instanceof Integer) { try { if (Integer.valueOf(desiredValue).equals(value)) return true; } catch (Exception e) { } } else if (value instanceof Boolean) { try { if (Boolean.valueOf(desiredValue).equals(value)) return true; } catch (Exception e) { } } else if (value instanceof List) { List list = (List)value; for (Object val : list) { if (valueEquals(desiredValue, val)) return true; } } else if (value instanceof JsonNode) { try { if (JsonSerialization.readValue(desiredValue, JsonNode.class).equals(value)) return true; } catch (Exception ignore) { } } return false; }
Source:
public Device searchActiveDevice(@Identification final String deviceIdentification) throws UnregisteredDeviceException, InactiveDeviceException, UnknownEntityException { final Device device = this.searchDevice(deviceIdentification); final Ssld ssld = this.ssldRepository.findOne(device.getId()); if (ssld != null) { if (!device.isActivated() || !ssld.isPublicKeyPresent()) { throw new UnregisteredDeviceException(deviceIdentification); } } if (!device.isActivated()) { throw new InactiveDeviceException(deviceIdentification); } return device; }

Target:
public Device searchActiveDevice(@Identification final String deviceIdentification) throws UnregisteredDeviceException, InactiveDeviceException, UnknownEntityException { final Device device = this.searchDevice(deviceIdentification); final Ssld ssld = this.ssldRepository.findOne(device.getId()); if (!device.isActivated()) { throw new InactiveDeviceException(deviceIdentification); } if (ssld != null && !ssld.isPublicKeyPresent()) { throw new UnregisteredDeviceException(deviceIdentification); } return device; }
Source:
public static String generateJsonDiskDescription(Disk disk) throws IOException { String diskAlias = disk.getDiskAlias(); String diskDescription = StringUtils.defaultString(disk.getDiskDescription()); boolean encodeDiskAlias, encodeDiskDescription; if (encodeDiskAlias = !IS_ASCII_PATTERN.matcher(diskAlias).matches()) { diskAlias = encodeDiskProperty(diskAlias); } if (encodeDiskDescription = !IS_ASCII_PATTERN.matcher(diskDescription).matches()) { diskDescription = encodeDiskProperty(diskDescription); } int diskDescriptionMetadataPotentialLength = METADATA_DESCRIPTION_VALUE_MAX_LENGTH - DESCRIPTION_METADATA_OVERHEAD_LENGTH; if (diskAlias.length() <= diskDescriptionMetadataPotentialLength) { diskDescriptionMetadataPotentialLength -= diskAlias.length(); if (diskDescription.length() > diskDescriptionMetadataPotentialLength) { diskDescription = truncateDiskProperty(disk.getDiskDescription(), diskDescriptionMetadataPotentialLength, encodeDiskDescription); log.warn("Can't store full disk description since it's too long. " + "Truncating and storing {}={}.", disk.getId(), DISK_DESCRIPTION, diskDescription); } } else { diskAlias = truncateDiskProperty(disk.getDiskAlias(), diskDescriptionMetadataPotentialLength, encodeDiskAlias); diskDescription = StringUtils.EMPTY; log.warn("Can't store full disk alias since it's too long. " + "Truncating and storing {}={}.", disk.getId(), DISK_ALIAS, diskAlias); log.warn("Can't store disk description since the alias is too long. " + "The description will be stored as an empty string.", disk.getId()); } Map<String, Object> description = new TreeMap<>(); description.put(DISK_ALIAS, diskAlias); description.put(DISK_DESCRIPTION, diskDescription); if (encodeDiskAlias || encodeDiskDescription) { int encoding = 0; if (encodeDiskAlias) { encoding = DISK_ALIAS_ENCODED; if (encodeDiskDescription) { encoding = DISK_ALIAS_AND_DESCRIPTION_ENCODED; } } else if (encodeDiskDescription) { encoding = DISK_DESCRIPTION_ENCODED; } description.put(DISK_ENCODING, encoding); } return JsonHelper.mapToJson(description, false); }

Target:
public String generateJsonDiskDescription(Disk disk) throws IOException { Map<String, Object> description = new TreeMap<>(); description.put(DISK_ALIAS, disk.getDiskAlias()); description.put(DISK_DESCRIPTION, StringUtils.defaultString(disk.getDiskDescription())); return JsonHelper.mapToJson(generateJsonDiskDescription(description, DESCRIPTION_FIELDS_PRIORITY), false); }
Source:
private void resetOptionSettings(IHoldsOptions holder) { IOption[] opts = holder.getOptions(); for (IOption opt : opts) { Object val = opt.getDefaultValue(); if (val == null) val = opt.getValue(); try { switch(opt.getValueType()){ case IOption.BOOLEAN: if (val == null) val = new Boolean(false); ManagedBuildManager.setOption(toolChain.getParent(), holder, opt, (Boolean)opt.getDefaultValue()); break; case IOption.ENUMERATED: case IOption.TREE: case IOption.STRING: if (val == null) val = ""; ManagedBuildManager.setOption(toolChain.getParent(), holder, opt, (String)opt.getDefaultValue()); break; case IOption.STRING_LIST: case IOption.INCLUDE_PATH: case IOption.PREPROCESSOR_SYMBOLS: case IOption.LIBRARIES: case IOption.OBJECTS: case IOption.INCLUDE_FILES: case IOption.LIBRARY_PATHS: case IOption.LIBRARY_FILES: case IOption.MACRO_FILES: case IOption.UNDEF_INCLUDE_PATH: case IOption.UNDEF_PREPROCESSOR_SYMBOLS: case IOption.UNDEF_INCLUDE_FILES: case IOption.UNDEF_LIBRARY_PATHS: case IOption.UNDEF_LIBRARY_FILES: case IOption.UNDEF_MACRO_FILES: if (val == null) val = new String[0]; ManagedBuildManager.setOption(toolChain.getParent(), holder, opt, (String[])opt.getDefaultValue()); break; } } catch (BuildException e) { continue; } } }

Target:
private void resetOptionSettings(IHoldsOptions holder) { IOption[] opts = holder.getOptions(); for (IOption opt : opts) { Object val = opt.getDefaultValue(); if (val != null) { if (val instanceof Boolean) { ManagedBuildManager.setOption(toolChain.getParent(), holder, opt, (Boolean)val); } else if (val instanceof String[]) { ManagedBuildManager.setOption(toolChain.getParent(), holder, opt, (String[])val); } else { ManagedBuildManager.setOption(toolChain.getParent(), holder, opt, (String)val); } } } }
Source:
public List<AnnotationDefinition> getAllAnnotations() { if(!dependsOnOtherProjects() || getCDIProjects(true).contains(this)) { return getDefinitions().getAllAnnotations(); } List<CDICoreNature> ls = CDICoreNature.toList(getCDIProjects(true)); List<AnnotationDefinition> result = new ArrayList<AnnotationDefinition>(); Set<IType> types = new HashSet<IType>(); for (CDICoreNature p: ls) { List<AnnotationDefinition> ds2 = p.getDefinitions().getAllAnnotations(); for (AnnotationDefinition d: ds2) { IType t = d.getType(); if(t != null && !types.contains(t)) { types.add(t); result.add(d); } } } List<AnnotationDefinition> ds = getDefinitions().getAllAnnotations(); for (AnnotationDefinition d: ds) { IType t = d.getType(); if(t != null && !types.contains(t)) { types.add(t); result.add(d); } } return result; }

Target:
public List<AnnotationDefinition> getAllAnnotations() { return getDefinitions().getAllAnnotationsWithDependencies(); }
Source:
@Test public void shrinkingMoreThanOnePropertyParameter() { assertThat( testResult(ShrinkingMoreThanOnePropertyParameter.class), hasSingleFailureContaining( String.format("Shrunken args: [%s, %s]", new Foo(0), new Foo(1)))); }

Target:
@Test public void shrinkingMoreThanOnePropertyParameter() { assertThat( testResult(ShrinkingMoreThanOnePropertyParameter.class), hasSingleFailureContaining( String.format("Shrunken args: [%s, %s]", new Foo(1), new Foo(1)))); }
Source:
public VeluxProductReference(BCproductState productState) { this.name = new ProductName(productState.getName()); this.typeId = ProductTypeId.get(productState.getTypeId()); if (this.typeId == null) { logger.error( "PLEASE REPORT THIS TO MAINTAINER: VeluxProductReference({}) has found an unregistered ProductTypeId.", productState.getTypeId()); } }

Target:
public VeluxProductReference(BCproductState productState) { this.name = new ProductName(productState.getName()); this.typeId = ProductTypeId.get(productState.getTypeId()); if (this.typeId == null) { logger.warn( "Please report this to maintainer: VeluxProductReference({}) has found an unregistered ProductTypeId.", productState.getTypeId()); } }
Source:
public void getAccountProperties() { formTrainingAsyncClient.getAccountProperties().subscribe(accountProperties -> { System.out.printf("Account properties limit: %s%n", accountProperties.getLimit()); System.out.printf("Account properties count: %d%n", accountProperties.getCount()); }); END: com.azure.ai.formrecognizer.FormTrainingAsyncClient.getAccountProperties }

Target:
public void getAccountProperties() { formTrainingAsyncClient.getAccountProperties().subscribe(accountProperties -> { System.out.printf("Max number of models that can be trained for this account: %s%n", accountProperties.getLimit()); System.out.printf("Current count of trained custom models: %d%n", accountProperties.getCount()); }); END: com.azure.ai.formrecognizer.FormTrainingAsyncClient.getAccountProperties }
Source:
public void setPosition(double position) { double newPosition = positionRange != null ? positionRange.limitValue(position) : position; motionController.setSetpoint(newPosition); }

Target:
public void setPosition(double position) { motionController.setSetpoint(positionRange != null ? positionRange.limitValue(position) : position); }
Source:
static HasNameCell wrap(final String name) { return new HasNameCell() { @Override public Name getName() { return new Name(name); } @Override public void setName(final Name name) { throw new UnsupportedOperationException(); } @Override public Group render(final GridBodyCellRenderContext context) { final BaseGridCellValue<String> hasNameCellValue = new BaseGridCellValue<>(this.getName().getValue()); return RendererUtils.getCenteredCellText(context, new BaseGridCell<>(hasNameCellValue)); } }; }

Target:
static HasNameCell wrap(final String name) { return new HasNameCell() { @Override public Name getName() { return new Name(name); } @Override public void setName(final Name name) { throw new UnsupportedOperationException(SET_NAME_UNSUPPORTED_MESSAGE); } @Override public Group render(final GridBodyCellRenderContext context) { final BaseGridCellValue<String> hasNameCellValue = new BaseGridCellValue<>(this.getName().getValue()); return RendererUtils.getCenteredCellText(context, new BaseGridCell<>(hasNameCellValue)); } }; }