auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void isNotEmpty_acrossLinkingObjectListLink() { createIsEmptyDataSet(realm); assertEquals(2, realm.where(AllJavaTypes.class).findAll().size()); for (RealmFieldType type : SUPPORTED_IS_EMPTY_TYPES) { switch (type) { case STRING: assertEquals(1, realm.where(AllJavaTypes.class).isNotEmpty(AllJavaTypes.FIELD_LO_LIST + "." + AllJavaTypes.FIELD_STRING).count()); break; case BINARY: assertEquals(1, realm.where(AllJavaTypes.class).isNotEmpty(AllJavaTypes.FIELD_LO_LIST + "." + AllJavaTypes.FIELD_BINARY).count()); break; case LIST: assertEquals(1, realm.where(AllJavaTypes.class).isNotEmpty(AllJavaTypes.FIELD_LO_LIST + "." + AllJavaTypes.FIELD_LIST).count()); break; case LINKING_OBJECTS: assertEquals(1, realm.where(AllJavaTypes.class).isNotEmpty(AllJavaTypes.FIELD_LO_LIST + "." + AllJavaTypes.FIELD_LO_OBJECT).count()); assertEquals(1, realm.where(AllJavaTypes.class).isNotEmpty(AllJavaTypes.FIELD_LO_LIST + "." + AllJavaTypes.FIELD_LO_LIST).count()); break; default: fail("Unknown type: " + type); } } }

Target:
public void isNotEmpty_acrossLinkingObjectListLink() { createIsEmptyDataSet(realm); assertEquals(3, realm.where(AllJavaTypes.class).findAll().size()); for (RealmFieldType type : SUPPORTED_IS_EMPTY_TYPES) { switch (type) { case STRING: assertEquals(1, realm.where(AllJavaTypes.class).isNotEmpty(AllJavaTypes.FIELD_LO_LIST + "." + AllJavaTypes.FIELD_STRING).count()); break; case BINARY: assertEquals(1, realm.where(AllJavaTypes.class).isNotEmpty(AllJavaTypes.FIELD_LO_LIST + "." + AllJavaTypes.FIELD_BINARY).count()); break; case LIST: assertEquals(2, realm.where(AllJavaTypes.class).isNotEmpty(AllJavaTypes.FIELD_LO_LIST + "." + AllJavaTypes.FIELD_LIST).count()); break; case LINKING_OBJECTS: assertEquals(1, realm.where(AllJavaTypes.class).isNotEmpty(AllJavaTypes.FIELD_LO_LIST + "." + AllJavaTypes.FIELD_LO_OBJECT).count()); assertEquals(1, realm.where(AllJavaTypes.class).isNotEmpty(AllJavaTypes.FIELD_LO_LIST + "." + AllJavaTypes.FIELD_LO_LIST).count()); break; default: fail("Unknown type: " + type); } } }
Source:
private boolean matchesIncludeExcludeList(List<Pattern> includeList, List<Pattern> excludeList, String name) { if ( includeList.size() > 0 ) { boolean found = false; for ( Pattern p : includeList ) { found = found || p.matcher(name).find(); } if ( !found ) return false; } for ( Pattern p : excludeList ) { if ( p.matcher(name).find() ) return false; } return true; }

Target:
private boolean matchesIncludeExcludeList(List<Pattern> includeList, List<Pattern> excludeList, String name) { if ( includeList.size() > 0 ) { boolean found = false; for ( Pattern p : includeList ) { found = p.matcher(name).find(); if ( found ) break; } if ( !found ) return false; } for ( Pattern p : excludeList ) { if ( p.matcher(name).find() ) return false; } return true; }
Source:
public void processOptions() { options = new PolylineOptions(); if (hasProperty(MapModule.PROPERTY_POINTS)) { processPoints(getProperty(MapModule.PROPERTY_POINTS), false); } if (hasProperty(MapModule.PROPERTY_STROKE_COLOR)) { options.color(TiConvert.toColor((String) getProperty(MapModule.PROPERTY_STROKE_COLOR))); } if (hasProperty(PolylineProxy.PROPERTY_STROKE_COLOR2)) { options.color(TiConvert.toColor((String) getProperty(PolylineProxy.PROPERTY_STROKE_COLOR2))); } if (hasProperty(MapModule.PROPERTY_STROKE_WIDTH)) { options.width(TiConvert.toFloat(getProperty(MapModule.PROPERTY_STROKE_WIDTH))); } if (hasProperty(PolylineProxy.PROPERTY_STROKE_WIDTH2)) { options.width(TiConvert.toFloat(getProperty(PolylineProxy.PROPERTY_STROKE_WIDTH2))); } if (hasProperty(PolylineProxy.PROPERTY_ZINDEX)) { options.zIndex(TiConvert.toFloat(getProperty(PolylineProxy.PROPERTY_ZINDEX))); } if (hasProperty(TiC.PROPERTY_TOUCH_ENABLED)) { clickable = TiConvert.toBoolean(getProperty(TiC.PROPERTY_TOUCH_ENABLED)); } if (hasProperty(PolylineProxy.PROPERTY_STROKE_PATTERN2)) { if (getProperty(PolylineProxy.PROPERTY_STROKE_PATTERN2) instanceof HashMap) { options.pattern( processPatternDefinition((HashMap) getProperty(PolylineProxy.PROPERTY_STROKE_PATTERN2))); } else { options.pattern( processPatternDefinition(TiConvert.toInt(getProperty(PolylineProxy.PROPERTY_STROKE_PATTERN2)))); } } if (hasProperty(PolylineProxy.PROPERTY_JOINT_TYPE)) { options.jointType(TiConvert.toInt(getProperty(PolylineProxy.PROPERTY_JOINT_TYPE))); } }

Target:
public void processOptions() { options = new PolylineOptions(); if (hasProperty(MapModule.PROPERTY_POINTS)) { processPoints(getProperty(MapModule.PROPERTY_POINTS), false); } if (hasProperty(MapModule.PROPERTY_STROKE_COLOR)) { options.color(TiConvert.toColor((String) getProperty(MapModule.PROPERTY_STROKE_COLOR))); } if (hasProperty(PolylineProxy.PROPERTY_STROKE_COLOR2)) { options.color(TiConvert.toColor((String) getProperty(PolylineProxy.PROPERTY_STROKE_COLOR2))); } if (hasProperty(MapModule.PROPERTY_STROKE_WIDTH)) { options.width(TiConvert.toFloat(getProperty(MapModule.PROPERTY_STROKE_WIDTH))); } if (hasProperty(PolylineProxy.PROPERTY_STROKE_WIDTH2)) { options.width(TiConvert.toFloat(getProperty(PolylineProxy.PROPERTY_STROKE_WIDTH2))); } if (hasProperty(PolylineProxy.PROPERTY_ZINDEX)) { options.zIndex(TiConvert.toFloat(getProperty(PolylineProxy.PROPERTY_ZINDEX))); } if (hasProperty(TiC.PROPERTY_TOUCH_ENABLED)) { clickable = TiConvert.toBoolean(getProperty(TiC.PROPERTY_TOUCH_ENABLED)); } if (hasProperty(PolylineProxy.PROPERTY_STROKE_PATTERN2)) { if (getProperty(PolylineProxy.PROPERTY_STROKE_PATTERN2) instanceof HashMap) { options.pattern( processPatternDefinition((HashMap) getProperty(PolylineProxy.PROPERTY_STROKE_PATTERN2))); } else { options.pattern( processPatternDefinition(TiConvert.toInt(getProperty(PolylineProxy.PROPERTY_STROKE_PATTERN2)))); } } if (hasProperty(PolylineProxy.PROPERTY_JOINT_TYPE)) { options.jointType(TiConvert.toInt(getProperty(PolylineProxy.PROPERTY_JOINT_TYPE), 0)); } }
Source:
public String getBackgroundData(){ String[] backgroundData = new String[this.getNumFields()]; for(int i = 0; i < this.getNumFields() ; ++i){ backgroundData[i] = ""; } return backgroundData; }

Target:
public String getBackgroundData(){ synchronized(mAsyncLock) { loadVariableContext(); for(int i =0 ; i < this.getNumFields(); ++i ){ if(backgroundData[i] == null) { Text bg = fields[i].getBackground(); if(bg == null) { backgroundData[i] = "";} else { try { backgroundData[i] = bg.evaluate(context); } catch(XPathException xpe) { xpe.printStackTrace(); throw new RuntimeException("Invalid background output for field : " + fields[i].getHeader().toString()); } } } } return backgroundData; } }
Source:
protected static String createRouteMetricName(final Http.Context context) { final Http.Request r = context.request(); final StringBuilder metricNameBuilder = new StringBuilder("rest_service/"); metricNameBuilder.append(r.method()); final String route = context._requestHeader().tags().get("ROUTE_PATTERN").getOrElse( new AbstractFunction0<String>() { @Override public String apply() { return ""; } }) .replaceAll("\\$([^<]+)<([^>]+)>", ":$1"); if (!Strings.isNullOrEmpty(route)) { if (!route.startsWith("/")) { metricNameBuilder.append("/"); } metricNameBuilder.append(route); if (!route.endsWith("/")) { metricNameBuilder.append("/"); } } return metricNameBuilder.toString(); }

Target:
protected static String createRouteMetricName(final Http.Context context) { final Http.Request r = context.request(); final StringBuilder metricNameBuilder = new StringBuilder("rest_service/"); metricNameBuilder.append(r.method()); final String route = ROUTE_PATTERN_REGEX.matcher( Optional.ofNullable(context.request().tags().get(Router.Tags.ROUTE_PATTERN)).orElse("")) .replaceAll(":$1"); if (!Strings.isNullOrEmpty(route)) { if (!route.startsWith("/")) { metricNameBuilder.append("/"); } metricNameBuilder.append(route); if (!route.endsWith("/")) { metricNameBuilder.append("/"); } } return metricNameBuilder.toString(); }
Source:
static private Server createServerOrApplyConfiguration(String jettyConfiguration, Server server) throws Exception { Resource jettyConfigurationFile = Resource.newResource(jettyConfiguration); if (jettyConfigurationFile == null || !jettyConfigurationFile.exists()) { jettyConfigurationFile = Resource.newClassPathResource(jettyConfiguration); if (jettyConfigurationFile == null || !jettyConfigurationFile.exists()) { throw new FileNotFoundException("Unable to find jetty configuration file either locally or on classpath [" + jettyConfiguration + "]"); } } System.out.println("Using jetty configuration file to configure server: " + jettyConfigurationFile); XmlConfiguration configuration = new XmlConfiguration(jettyConfigurationFile.getInputStream()); if (server == null) { return (Server)configuration.configure(); } else { return (Server)configuration.configure(server); } }

Target:
static private Server createServerOrApplyConfiguration(String jettyConfiguration, Server server) throws Exception { Resource jettyConfigurationFile = Resource.newResource(jettyConfiguration); if (jettyConfigurationFile == null || !jettyConfigurationFile.exists()) { jettyConfigurationFile = Resource.newClassPathResource(jettyConfiguration); if (jettyConfigurationFile == null || !jettyConfigurationFile.exists()) { throw new FileNotFoundException("Unable to find jetty configuration file either locally or on classpath [" + jettyConfiguration + "]"); } } logger.info("Using jetty configuration file to configure server: " + jettyConfigurationFile); XmlConfiguration configuration = new XmlConfiguration(jettyConfigurationFile.getInputStream()); if (server == null) { return (Server)configuration.configure(); } else { return (Server)configuration.configure(server); } }
Source:
public Process runServer() throws IOException { final String serverConsoleLogPath = CORFU_LOG_PATH + File.separator + host + "_" + port + "_consolelog"; System.out.println(serverConsoleLogPath); File logPath = new File(getCorfuServerLogPath(host, port)); if (!logPath.exists()) { logPath.mkdir(); } ProcessBuilder builder = new ProcessBuilder(); if (!metricsConfigFile.isEmpty()) { addMetricsToProcessBuilder(builder, "corfu_server"); } else { builder.command("sh", "-c", "bin/corfu_server " + getOptionsString()); } builder.directory(new File(CORFU_PROJECT_DIR)); Process corfuServerProcess = builder.start(); StreamGobbler streamGobbler = new StreamGobbler(corfuServerProcess.getInputStream(), serverConsoleLogPath); Executors.newSingleThreadExecutor().submit(streamGobbler); return corfuServerProcess; }

Target:
public Process runServer() throws IOException { final String serverConsoleLogPath = CORFU_LOG_PATH + File.separator + host + "_" + port + "_consolelog"; File logPath = new File(getCorfuServerLogPath(host, port)); if (!logPath.exists()) { logPath.mkdir(); } ProcessBuilder builder = new ProcessBuilder(); if (!metricsConfigFile.isEmpty()) { addMetricsToProcessBuilder(builder, "corfu_server"); } else { builder.command("sh", "-c", "bin/corfu_server " + getOptionsString()); } builder.directory(new File(CORFU_PROJECT_DIR)); Process corfuServerProcess = builder.start(); StreamGobbler streamGobbler = new StreamGobbler(corfuServerProcess.getInputStream(), serverConsoleLogPath); Executors.newSingleThreadExecutor().submit(streamGobbler); return corfuServerProcess; }
Source:
public boolean checkUserExtSourceExistsById(PerunSession sess, int id) throws InternalErrorException { try { return 1 == jdbc.queryForInt("select 1 from user_ext_sources where id=?", id); } catch(RuntimeException ex) { throw new InternalErrorException(ex); } }

Target:
public void checkUserExtSourceExistsById(PerunSession sess, int id) throws InternalErrorException, UserExtSourceNotExistsException { try { boolean exists = 1 == jdbc.queryForInt("select 1 from user_ext_sources where id=?", id); if (!exists) throw new UserExtSourceNotExistsException("UserExtSource with ID=" + id + " doesn't exists."); } catch(RuntimeException ex) { throw new InternalErrorException(ex); } }
Source:
public void updateUser(HttpServletRequest request, HttpServletResponse response, @PathVariable String uid) throws IOException { ResponseWriter writer = null; try { writer = writerResolver.writerFor(request, response); Id userId = Id.valueOf(idCodec.decode(uid)); User editingUser = userFetcher.userFor(request).get(); if (!editingUser.is(Role.ADMIN) && !editingUser.getId().equals(userId)) { throw new ResourceForbiddenException(); } Optional<User> existing = userStore.userForId(userId); if (existing.isPresent()) { User posted = deserialize(new InputStreamReader(request.getInputStream()), User.class); if (!editingUser.is(Role.ADMIN) && isUserRoleChanged(posted, existing.get())) { throw InsufficientPrivilegeException.CANNOT_CHANGE_USER_ROLE; } User modified = updateProfileFields(posted, existing.get(), editingUser); userStore.store(modified); UserAwareQueryResult<User> queryResult = UserAwareQueryResult.singleResult(modified, UserAwareQueryContext.standard()); resultWriter.write(queryResult, writer); } else { throw new NotFoundException(userId); } } catch (Exception e) { log.error("Request exception " + request.getRequestURI(), e); ErrorSummary summary = ErrorSummary.forException(e); new ErrorResultWriter().write(summary, writer, request, response); } }

Target:
public void updateUser(HttpServletRequest request, HttpServletResponse response, @PathVariable String uid) throws IOException { ResponseWriter writer = null; try { writer = writerResolver.writerFor(request, response); Id userId = Id.valueOf(idCodec.decode(uid)); User editingUser = userFetcher.userFor(request).get(); if (!editingUser.is(Role.ADMIN) && !editingUser.getId().equals(userId)) { throw new ResourceForbiddenException(); } Optional<User> existing = userStore.userForId(userId); if (existing.isPresent()) { User posted = deserialize(new InputStreamReader(request.getInputStream()), User.class); if (!editingUser.is(Role.ADMIN) && isUserRoleChanged(posted, existing.get())) { throw new InsufficientPrivilegeException("You do not have permission to change the user role"); } User modified = updateProfileFields(posted, existing.get(), editingUser); userStore.store(modified); UserAwareQueryResult<User> queryResult = UserAwareQueryResult.singleResult(modified, UserAwareQueryContext.standard()); resultWriter.write(queryResult, writer); } else { throw new NotFoundException(userId); } } catch (Exception e) { log.error("Request exception " + request.getRequestURI(), e); ErrorSummary summary = ErrorSummary.forException(e); new ErrorResultWriter().write(summary, writer, request, response); } }
Source:
public void unsubscribe(String tenant, String metricId, Subscription.SubscriptionOwner subscriptionOwner) { unsubscribe(tenant, metricId, new HashSet<>(Arrays.asList(subscriptionOwner))); }

Target:
public void unsubscribe(String tenant, String metricId, Subscription.SubscriptionOwner subscriptionOwner) { unsubscribe(tenant, metricId, Collections.singleton(subscriptionOwner)); }
Source:
public void testReassignNotStartedWithEmptyTimeFormat() throws Exception { changeUser(USER_ADMINISTRATOR); Map<String, Object> parameters = new HashMap<>(); Long processInstanceId = null; try { processInstanceId = processClient.startProcess(CONTAINER_ID, PROCESS_ID_EVALUATION, parameters); List<TaskSummary> tasks = taskClient.findTasksAssignedAsBusinessAdministrator(USER_ADMINISTRATOR, 0, 10); TaskSummary task = tasks.get(0); OrgEntities reassign = OrgEntities.builder().users(Arrays.asList(USER_JOHN)).build(); assertExceptionContainsCorrectMessage(() -> userTaskAdminClient.reassignWhenNotStarted(CONTAINER_ID, task.getId(), "", reassign), "Error code: 400, message: \"Invalid time expression\"", "Invalid time expression"); } finally { if (processInstanceId != null) { processClient.abortProcessInstance(CONTAINER_ID, processInstanceId); } } }

Target:
public void testReassignNotStartedWithEmptyTimeFormat() throws Exception { changeUser(USER_ADMINISTRATOR); Map<String, Object> parameters = new HashMap<>(); Long processInstanceId = null; try { processInstanceId = processClient.startProcess(CONTAINER_ID, PROCESS_ID_EVALUATION, parameters); List<TaskSummary> tasks = taskClient.findTasksAssignedAsBusinessAdministrator(USER_ADMINISTRATOR, 0, 10); TaskSummary task = tasks.get(0); OrgEntities reassign = OrgEntities.builder().users(Arrays.asList(USER_JOHN)).build(); assertClientException( () -> userTaskAdminClient.reassignWhenNotStarted(CONTAINER_ID, task.getId(), "", reassign), 400, "Invalid time expression", "Invalid time expression"); } finally { if (processInstanceId != null) { processClient.abortProcessInstance(CONTAINER_ID, processInstanceId); } } }
Source:
private List<UrlInfo> getEndPoints(NhinTargetSystemType target) { List<UrlInfo> endpoints = new ArrayList<>(); UrlInfo entry = new UrlInfo(); entry.setHcid(target.getHomeCommunity().getHomeCommunityId()); entry.setUrl("https://localhost:8181/Gateway/PatientDiscovery/1_0/NhinService/NhinPatientDiscovery"); endpoints.add(entry); return endpoints; }

Target:
private List<UrlInfo> getEndPoints(NhinTargetSystemType target) { List<UrlInfo> endpoints = new ArrayList<>(); UrlInfo entry = new UrlInfo(); entry.setHcid(target.getHomeCommunity().getHomeCommunityId()); entry.setUrl(PD_URL); endpoints.add(entry); return endpoints; }
Source:
public static void main(String[] args) { String foo = System.getProperty("foo"); if (!"value 1".equals(foo)) { throw new IllegalStateException("foo system property mismatch (got [" + foo + "]"); } String bar = System.getProperty("bar"); if (!"value2".equals(bar)) { throw new IllegalStateException("bar system property mismatch (got [" + bar + "]"); } String property1 = System.getProperty("property1"); if (!"value1".equals(property1)) { throw new IllegalStateException("property1 system property mismatch (got [" + property1 + "]"); } String property2 = System.getProperty("property2"); if (property2 != null && !property2.isEmpty()) { throw new IllegalStateException("property2 system property mismatch (got [" + property2 + "]"); } String property3 = System.getProperty("property3"); if (!"run-jvmargs".equals(property3)) { throw new IllegalStateException("property3 system property mismatch (got [" + property3 + "]"); } System.out.println("I haz been run"); }

Target:
public static void main(String[] args) { String foo = System.getProperty("foo"); if (!"value 1".equals(foo)) { throw new IllegalStateException("foo system property mismatch (got [" + foo + "]"); } String bar = System.getProperty("bar"); if (!"value2".equals(bar)) { throw new IllegalStateException("bar system property mismatch (got [" + bar + "]"); } String property1 = System.getProperty("property1"); if (!"value1".equals(property1)) { throw new IllegalStateException("property1 system property mismatch (got [" + property1 + "]"); } String property2 = System.getProperty("property2"); if (!"".equals(property2)) { throw new IllegalStateException("property2 system property mismatch (got [" + property2 + "]"); } String property3 = System.getProperty("property3"); if (!"run-jvmargs".equals(property3)) { throw new IllegalStateException("property3 system property mismatch (got [" + property3 + "]"); } System.out.println("I haz been run"); }
Source:
private Binary fromAvroString(Object value) { if (value instanceof Utf8) { Utf8 utf8 = (Utf8) value; return Binary.fromConstantByteArray(utf8.getBytes(), 0, utf8.getByteLength()); } return Binary.fromString(value.toString()); }

Target:
private Binary fromAvroString(Object value) { if (value instanceof Utf8) { Utf8 utf8 = (Utf8) value; return Binary.fromReusedByteArray(utf8.getBytes(), 0, utf8.getByteLength()); } return Binary.fromString(value.toString()); }
Source:
private void copyLibIndexCache() throws IOException { String libIndexCacheName = "lib.index.cache"; File sourceLibDir = new File(project.getBuild().getDirectory(), libIndexCacheName); File destLibDir = new File(sharedResourcesDirectory, libIndexCacheName); FileUtils.copyDirectory(sourceLibDir, destLibDir); }

Target:
private void copyLibIndexCache() throws Exception { String libIndexCacheName = "lib.index.cache"; File sourceLibDir = new File(project.getBuild().getDirectory(), libIndexCacheName); if (!sourceLibDir.exists()) { throw new MojoExecutionException(sourceLibDir.getCanonicalPath() +" does not exist and cannot be installed"); } File destLibDir = new File(sharedResourcesDirectory, libIndexCacheName); FileUtils.copyDirectory(sourceLibDir, destLibDir); }
Source:
public void saveParameterValues() { try { scriptGeneratorModel.saveParameterValues(); } catch (UnsupportedTypeException e) { MessageDialog.openWarning(DISPLAY.getActiveShell(), "Unsupported language", "Cannot generate script. Language to generate in is unsupported."); LOG.error(e); } catch (InvalidParamsException e) { MessageDialog.openWarning(DISPLAY.getActiveShell(), "Params Invalid", "Cannot generate script. Parameters are invalid."); LOG.error(e); } }

Target:
public void saveParameterValues() { Optional<String> fileName = openFileDialog(SWT.SAVE); if (fileName.isPresent()) { try { scriptGeneratorModel.saveParameters(fileName.get()); MessageDialog.openInformation(DISPLAY.getActiveShell(), "Saved", "File saved!"); } catch (NoScriptDefinitionSelectedException e) { LOG.error(e); MessageDialog.openWarning(DISPLAY.getActiveShell(), "No script definition selection", "Cannot generate script. No script definition has been selected"); } } }
Source:
public List<ApplicationKeyJson> listKeys( @QueryParam("query") final String query ) { Applications applications = this.applicationService.getInstalledApplications(); if ( StringUtils.isNotBlank( query ) ) { applications = Applications.from( applications.stream(). filter( ( application ) -> containsIgnoreCase( application.getDisplayName(), query ) || containsIgnoreCase( application.getMaxSystemVersion(), query ) || containsIgnoreCase( application.getMinSystemVersion(), query ) || containsIgnoreCase( application.getSystemVersion(), query ) || containsIgnoreCase( application.getUrl(), query ) || containsIgnoreCase( application.getVendorName(), query ) || containsIgnoreCase( application.getVendorUrl(), query ) ). collect( Collectors.toList() ) ); } return applications.getApplicationKeys().stream().filter( applicationKey -> !ApplicationKey.from( "com.enonic.xp.admin.ui" ).equals( applicationKey ) && !ApplicationKey.from( "com.enonic.xp.app.standardidprovider" ).equals( applicationKey ) ) .map( ApplicationKeyJson::new ).collect( Collectors.toList() ); }

Target:
public List<String> listKeys( @QueryParam("query") final String query ) { Applications applications = this.applicationService.getInstalledApplications(); applications = this.filterApplication( applications, query ); return applications.getApplicationKeys().stream().filter( applicationKey -> !ApplicationKey.from( "com.enonic.xp.admin.ui" ).equals( applicationKey ) && !ApplicationKey.from( "com.enonic.xp.app.standardidprovider" ).equals( applicationKey ) ) .map( applicationKey -> applicationKey.toString() ).collect( Collectors.toList() ); }
Source:
private static void buildTargetRegions(BusinessEntity entity, OrganizationType org) { List<String> regions; if (entity.getCategoryBag() != null && CollectionUtils.isNotEmpty(entity.getCategoryBag().getKeyedReference())) { regions = new ArrayList<>(); for (KeyedReference keyRef : entity.getCategoryBag().getKeyedReference()) { if (null != keyRef.getTModelKey() && keyRef.getTModelKey().equalsIgnoreCase(UDDI_STATE_KEY)) { regions.add(keyRef.getKeyValue()); } } org.getTargetRegion().addAll(regions); } }

Target:
private static void buildTargetRegions(BusinessEntity entity, OrganizationType org) { List<String> regions; if (entity.getCategoryBag() != null && CollectionUtils.isNotEmpty(entity.getCategoryBag().getKeyedReference())) { regions = new ArrayList<>(); for (KeyedReference keyRef : entity.getCategoryBag().getKeyedReference()) { if (UDDIConstants.UDDI_STATE_KEY.equalsIgnoreCase(keyRef.getTModelKey())) { regions.add(keyRef.getKeyValue()); } } org.getTargetRegion().addAll(regions); } }
Source:
private void loadMaps() throws CachePersistenceException { try { for (File file : dataDirectory.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.endsWith(MAP_FILE_SUFFIX); } })) { FileInputStream fis = new FileInputStream(file); try { ObjectInputStream oin = new ObjectInputStream(fis); try { ConcurrentMap<?, ?> map = (ConcurrentMap<?, ?>) oin.readObject(); knownMaps.put(file.getName().replace(MAP_FILE_SUFFIX, ""), map); } finally { oin.close(); } } finally { fis.close(); } } } catch (Exception e) { knownMaps.clear(); throw new CachePersistenceException("Failed to load existing StateRepository data", e); } }

Target:
private void loadMaps() throws CachePersistenceException { try { for (File file : dataDirectory.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.endsWith(MAP_FILE_SUFFIX); } })) { FileInputStream fis = new FileInputStream(file); try { ObjectInputStream oin = new ObjectInputStream(fis); try { String name = (String) oin.readObject(); Tuple tuple = (Tuple) oin.readObject(); knownMaps.put(name, tuple); } finally { oin.close(); } } finally { fis.close(); } } } catch (Exception e) { knownMaps.clear(); throw new CachePersistenceException("Failed to load existing StateRepository data", e); } }
Source:
public void setReplyChannel(MessageChannel replyChannel) { this.setOutputChannel(replyChannel); }

Target:
public void setReplyChannel(MessageChannel replyChannel) { setOutputChannel(replyChannel); }
Source:
private ObjectWriter getObjectWriter(List<String> fieldsToReturn) { if (fieldsToReturn.isEmpty()) { FilterProvider filter = new SimpleFilterProvider().addFilter("filter properties by name", SimpleBeanPropertyFilter.serializeAll()); return mapper.writer(filter); } HashSet<String> givenFields = new HashSet<>(); givenFields.add("schemas"); givenFields.addAll(fieldsToReturn); String[] finalFieldsToReturn = givenFields.toArray(new String[givenFields.size()]); FilterProvider filters = new SimpleFilterProvider() .addFilter("filter properties by name", SimpleBeanPropertyFilter.filterOutAllExcept( finalFieldsToReturn)); return mapper.writer(filters); }

Target:
private ObjectWriter getObjectWriter(List<String> fieldsToReturn) { if (fieldsToReturn.isEmpty()) { return mapper.writer(); } HashSet<String> givenFields = new HashSet<>(); givenFields.add("schemas"); givenFields.addAll(fieldsToReturn); String[] finalFieldsToReturn = givenFields.toArray(new String[givenFields.size()]); FilterProvider filters = new SimpleFilterProvider() .addFilter("propertiesFilter", SimpleBeanPropertyFilter.filterOutAllExcept( finalFieldsToReturn)); return mapper.writer(filters); }
Source:
protected void doOperation() { List<StudentProfileAttributes> allStudentProfiles = profilesLogic.getAllStudentProfiles(); int numberOfAffectedProfiles = 0; int numberOfUpdatedProfiles = 0; LoopHelper loopHelper = new LoopHelper(100, "student profiles processed."); println("Running data migration for sanitization on student profiles..."); println("Preview: " + isPreview); for (StudentProfileAttributes profile : allStudentProfiles) { loopHelper.recordLoop(); boolean isProfileSanitized = isProfileSanitized(profile); if (!isProfileSanitized) { continue; } numberOfAffectedProfiles++; try { desanitizeAndUpdateProfile(profile); numberOfUpdatedProfiles++; } catch (InvalidParametersException | EntityDoesNotExistException e) { println("Problem sanitizing profile with google id " + profile.googleId); println(e.getMessage()); } } println("Total number of profiles: " + loopHelper.getCount()); println("Number of affected profiles: " + numberOfAffectedProfiles); println("Number of updated profiles: " + numberOfUpdatedProfiles); }

Target:
protected void doOperation() { List<StudentProfileAttributes> allStudentProfiles = profilesLogic.getAllStudentProfiles(); int numberOfAffectedProfiles = 0; int numberOfUpdatedProfiles = 0; LoopHelper loopHelper = new LoopHelper(100, "student profiles processed."); println("Running data migration for sanitization on student profiles..."); println("Preview: " + isPreview); for (StudentProfileAttributes profile : allStudentProfiles) { loopHelper.recordLoop(); boolean hasAllUnsanitizedFields = !hasAnySanitizedField(profile); if (hasAllUnsanitizedFields) { continue; } numberOfAffectedProfiles++; try { desanitizeAndUpdateProfile(profile); numberOfUpdatedProfiles++; } catch (InvalidParametersException | EntityDoesNotExistException e) { println("Problem sanitizing profile with google id " + profile.googleId); println(e.getMessage()); } } println("Total number of profiles: " + loopHelper.getCount()); println("Number of affected profiles: " + numberOfAffectedProfiles); println("Number of updated profiles: " + numberOfUpdatedProfiles); }
Source:
protected void setup(Binder binder) { Set<String> eventClientTypes = buildConfigObject(BenchmarkRunnerConfig.class).getEventClients(); Sets.SetView<String> unsupportedEventClients = difference(eventClientTypes, supportedEventClientTypes); checkArgument(unsupportedEventClients.isEmpty(), "Unsupported EventClient: %s", unsupportedEventClients); Multibinder<EventClient> eventClientBinder = newSetBinder(binder, EventClient.class); for (Map.Entry<String, Class<? extends EventClient>> entry : DEFAULT_EVENT_CLIENTS.entrySet()) { if (eventClientTypes.contains(entry.getKey())) { eventClientBinder.addBinding().to(entry.getValue()).in(SINGLETON); } } }

Target:
protected void setup(Binder binder) { Set<String> eventClientTypes = buildConfigObject(BenchmarkRunnerConfig.class).getEventClients(); Sets.SetView<String> unsupportedEventClients = difference(eventClientTypes, supportedEventClientTypes); checkArgument(unsupportedEventClients.isEmpty(), "Unsupported EventClient: %s", unsupportedEventClients); Multibinder<EventClient> eventClientBinder = newSetBinder(binder, EventClient.class); for (Entry<String, Class<? extends EventClient>> entry : DEFAULT_EVENT_CLIENTS.entrySet()) { if (eventClientTypes.contains(entry.getKey())) { eventClientBinder.addBinding().to(entry.getValue()).in(SINGLETON); } } }
Source:
private Map<String, DbParameterAccessor> readIntoParams(String[] queryParameters, String query) throws SQLException { PreparedStatement dc = currentConnection.prepareStatement(query); try { for (int i = 0; i < queryParameters.length; i++) { dc.setString(i + 1, NameNormaliser.normaliseName(queryParameters[i])); } ResultSet rs = dc.executeQuery(); Map<String, DbParameterAccessor> allParams = new HashMap<String, DbParameterAccessor>(); while (rs.next()) { String paramName = rs.getString(1); if (paramName == null) paramName = ""; String dataType = rs.getString(2); String direction = rs.getString(3); int position = rs.getInt(4); Direction paramDirection = getParameterDirection(direction); DbParameterAccessor dbp = new DbParameterAccessor(paramName, paramDirection, getSqlType(dataType), getJavaClass(dataType), paramDirection == RETURN_VALUE ? -1 : position); allParams.put(NameNormaliser.normaliseName(paramName), dbp); } rs.close(); return allParams; } finally { dc.close(); } }

Target:
private Map<String, DbParameterAccessor> readIntoParams(String[] queryParameters, String query) throws SQLException { try (PreparedStatement dc = currentConnection.prepareStatement(query)) { for (int i = 0; i < queryParameters.length; i++) { dc.setString(i + 1, NameNormaliser.normaliseName(queryParameters[i])); } ResultSet rs = dc.executeQuery(); Map<String, DbParameterAccessor> allParams = new HashMap<String, DbParameterAccessor>(); while (rs.next()) { String paramName = defaultIfNull(rs.getString(1), ""); String dataType = rs.getString(2); String direction = rs.getString(3); int position = rs.getInt(4); Direction paramDirection = getParameterDirection(direction); if (paramDirection != RETURN_VALUE && paramName.isEmpty()) { throw new SQLException("Missing column or procedure parameter name"); } DbParameterAccessor dbp = createDbParameterAccessor( paramName, paramDirection, getSqlType(dataType), getJavaClass(dataType), paramDirection == RETURN_VALUE ? -1 : position); allParams.put(NameNormaliser.normaliseName(paramName), dbp); } rs.close(); return allParams; } }
Source:
public void destroy(final String identifier) throws EhcacheEntityNotFoundException, EntityBusyException { Hold existingMaintenance = maintenanceHolds.get(identifier); Hold localMaintenance = null; if (existingMaintenance == null) { localMaintenance = createAccessLockFor(identifier).tryWriteLock(); } if (existingMaintenance == null && localMaintenance == null) { throw new EntityBusyException("Destroy operation failed; " + identifier + " clustered tier's maintenance lease held"); } boolean finished = false; try { EntityRef<EhcacheClientEntity, UUID> ref = getEntityRef(identifier); try { if (!ref.destroy()) { throw new EntityBusyException("Destroy operation failed; " + identifier + " clustered tier in use by other clients"); } finished = true; } catch (EntityNotProvidedException e) { LOGGER.error("Unable to delete clustered tier manager for id {}", identifier, e); throw new AssertionError(e); } catch (EntityNotFoundException e) { throw new EhcacheEntityNotFoundException(e); } catch (PermanentEntityException e) { LOGGER.error("Unable to destroy entity - server says it is permanent"); throw new AssertionError(e); } } finally { if (localMaintenance != null) { if (finished) { localMaintenance.unlock(); } else { silentlyUnlock(localMaintenance, identifier); } } } }

Target:
public void destroy(final String identifier) throws EhcacheEntityNotFoundException, EntityBusyException { Hold existingMaintenance = maintenanceHolds.get(identifier); Hold localMaintenance = null; if (existingMaintenance == null) { localMaintenance = createAccessLockFor(identifier).tryWriteLock(); } if (existingMaintenance == null && localMaintenance == null) { throw new EntityBusyException("Destroy operation failed; " + identifier + " clustered tier's maintenance lease held"); } boolean finished = false; try { EntityRef<EhcacheClientEntity, UUID> ref = getEntityRef(identifier); try { if (!ref.destroy()) { throw new EntityBusyException("Destroy operation failed; " + identifier + " clustered tier in use by other clients"); } finished = true; } catch (EntityNotProvidedException e) { LOGGER.error("Unable to delete clustered tier manager for id {}", identifier, e); throw new AssertionError(e); } catch (EntityNotFoundException e) { throw new EhcacheEntityNotFoundException(e); } catch (PermanentEntityException e) { LOGGER.error("Unable to destroy entity - server says it is permanent", e); throw new AssertionError(e); } } finally { if (localMaintenance != null) { if (finished) { localMaintenance.unlock(); } else { silentlyUnlock(localMaintenance, identifier); } } } }
Source:
public void deleteSuccess() throws Exception { context.turnOffAuthorisationSystem(); MetadataField metadataField = MetadataFieldBuilder.createMetadataField(context, ELEMENT, QUALIFIER, SCOPE_NOTE) .build(); getClient().perform(get("/api/core/metadatafields/" + metadataField.getID())) .andExpect(status().isOk()); getClient(getAuthToken(admin.getEmail(), password)) .perform(delete("/api/core/metadatafields/" + metadataField.getID())) .andExpect(status().isNoContent()); getClient().perform(get("/api/core/metadatafields/" + metadataField.getID())) .andExpect(status().isNotFound()); }

Target:
public void deleteSuccess() throws Exception { context.turnOffAuthorisationSystem(); MetadataField metadataField = MetadataFieldBuilder.createMetadataField(context, ELEMENT, QUALIFIER, SCOPE_NOTE) .build(); context.restoreAuthSystemState(); getClient().perform(get("/api/core/metadatafields/" + metadataField.getID())) .andExpect(status().isOk()); getClient(getAuthToken(admin.getEmail(), password)) .perform(delete("/api/core/metadatafields/" + metadataField.getID())) .andExpect(status().isNoContent()); getClient().perform(get("/api/core/metadatafields/" + metadataField.getID())) .andExpect(status().isNotFound()); }
Source:
public void queueLogout(Player player) { if (player.getState() == EntityState.ACTIVE && !logouts.contains(player)) { logouts.offer(player); } }

Target:
public void queueLogout(Player player) { if (player.getState() == EntityState.ACTIVE && !logouts.contains(player)) { logouts.add(player); } }
Source:
private NewsIterator(String dataDirectory, WordVectors wordVectors, int batchSize, int truncateLength, boolean train, TokenizerFactory tokenizerFactory) { this.dataDirectory = dataDirectory; this.batchSize = batchSize; this.vectorSize = wordVectors.getWordVector(wordVectors.vocab().wordAtIndex(0)).length; this.wordVectors = wordVectors; this.truncateLength = truncateLength; this.tokenizerFactory = tokenizerFactory; this.populateData(train); this.labels = new ArrayList<String>(); for (int i = 0; i < this.categoryData.size(); i++) { this.labels.add(this.categoryData.get(i).getKey().split(",")[1]); } }

Target:
private NewsIterator(String dataDirectory, WordVectors wordVectors, int batchSize, int truncateLength, boolean train, TokenizerFactory tokenizerFactory) { this.dataDirectory = dataDirectory; this.batchSize = batchSize; this.vectorSize = wordVectors.getWordVector(wordVectors.vocab().wordAtIndex(0)).length; this.wordVectors = wordVectors; this.truncateLength = truncateLength; this.tokenizerFactory = tokenizerFactory; this.populateData(train); this.labels = new ArrayList<>(); for (int i = 0; i < this.categoryData.size(); i++) { this.labels.add(this.categoryData.get(i).getKey().split(",")[1]); } }
Source:
public void update() throws BankException, LoginException, BankChoiceException, IOException { super.update(); if (username == null || password == null || username.length() == 0 || password.length() == 0) { throw new LoginException(res.getText(R.string.invalid_username_password).toString()); } if (response == null) { urlopen = login(); } try { Matcher matcher; matcher = reBalance.matcher(response); matcher = reBalance.matcher(response); if(matcher.find()) { accounts.add(new Account("Kvar att utnyttja" , Helpers.parseBalance(matcher.group(1)), "1")); balance = balance.add(Helpers.parseBalance(matcher.group(1))); } if(matcher.find()) { accounts.add(new Account("Saldo" , Helpers.parseBalance(matcher.group(1)), "2")); accounts.add(new Account("Saldo" , Helpers.parseBalance(matcher.group(1)).negate(), "4")); } if(matcher.find()) { accounts.add(new Account("Köpgräns" , Helpers.parseBalance(matcher.group(1)), "3")); } if (accounts.isEmpty()) { throw new BankException(res.getText(R.string.no_accounts_found).toString()); } response = urlopen.open("<LINK_0>"); matcher = reTransactions.matcher(response); ArrayList<Transaction> transactions = new ArrayList<Transaction>(); while (matcher.find()) { transactions.add(new Transaction(matcher.group(1).trim(), Html.fromHtml(matcher.group(2)).toString().trim(), Helpers.parseBalance(matcher.group(3)).negate())); } accounts.get(0).setTransactions(transactions); } finally { super.updateComplete(); } }

Target:
public void update() throws BankException, LoginException, BankChoiceException, IOException { super.update(); if (username == null || password == null || username.length() == 0 || password.length() == 0) { throw new LoginException(res.getText(R.string.invalid_username_password).toString()); } if (response == null) { urlopen = login(); } Matcher matcher = reBalance.matcher(response); if(matcher.find()) { accounts.add(new Account("Kvar att utnyttja" , Helpers.parseBalance(matcher.group(1)), "1")); balance = balance.add(Helpers.parseBalance(matcher.group(1))); } if(matcher.find()) { accounts.add(new Account("Saldo" , Helpers.parseBalance(matcher.group(1)), "2")); accounts.add(new Account("Saldo" , Helpers.parseBalance(matcher.group(1)).negate(), "4")); } if(matcher.find()) { accounts.add(new Account("Köpgräns" , Helpers.parseBalance(matcher.group(1)), "3")); } if (accounts.isEmpty()) { throw new BankException(res.getText(R.string.no_accounts_found).toString()); } response = urlopen.open("<LINK_0>"); matcher = reTransactions.matcher(response); ArrayList<Transaction> transactions = new ArrayList<Transaction>(); while (matcher.find()) { transactions.add(new Transaction(matcher.group(1).trim(), Html.fromHtml(matcher.group(2)).toString().trim(), Helpers.parseBalance(matcher.group(3)).negate())); } accounts.get(0).setTransactions(transactions); super.updateComplete(); }
Source:
public CorfuServerNode(@Nonnull ServerContext serverContext) { LogUnitServerConfig config = LogUnitServerConfig.parse(serverContext.getServerConfig()); StreamLog streamLog; if (config.isMemoryMode()) { log.warn("Log unit opened in-memory mode (Maximum size={}). " + "This should be run for testing purposes only. " + "If you exceed the maximum size of the unit, old entries will be " + "AUTOMATICALLY trimmed. " + "The unit WILL LOSE ALL DATA if it exits.", Utils .convertToByteStringRepresentation(config.getMaxCacheSize())); streamLog = new InMemoryStreamLog(); } else{ streamLog = new StreamLogFiles(serverContext, config.isNoVerify()); } ImmutableMap<Class, AbstractServer> servers = ImmutableMap.<Class, AbstractServer>builder() .put(BaseServer.class, new BaseServer(serverContext)) .put(SequencerServer.class, new SequencerServer(serverContext)) .put(LayoutServer.class, new LayoutServer(serverContext)) .put(LogUnitServer.class, new LogUnitServer(serverContext, streamLog)) .put(ManagementServer.class, new ManagementServer(serverContext, streamLog)) .build(); this.serverContext = serverContext; this.serverMap = servers; router = new NettyServerRouter(new ArrayList<>(serverMap.values())); this.serverContext.setServerRouter(router); this.close = new AtomicBoolean(false); }

Target:
public CorfuServerNode(@Nonnull ServerContext serverContext) { this(serverContext, ImmutableMap.<Class, AbstractServer>builder() .put(BaseServer.class, new BaseServer(serverContext)) .put(SequencerServer.class, new SequencerServer(serverContext)) .put(LayoutServer.class, new LayoutServer(serverContext)) .put(LogUnitServer.class, new LogUnitServer(serverContext)) .put(ManagementServer.class, new ManagementServer(serverContext)) .build() ); }
Source:
static Class<? extends Widget> getMobileNativeWidgetClass(Class<? extends Widget> declaredClass, AnnotatedElement annotatedElement, String platform, String automation) { String transformedPlatform = String.valueOf(platform).toUpperCase().trim(); String transformedAutomation = String.valueOf(automation).toUpperCase().trim(); if (ANDROID.equalsIgnoreCase(transformedPlatform) && AutomationName.SELENDROID .equalsIgnoreCase(transformedAutomation)) { return getConvenientClass(declaredClass, annotatedElement, SELENDROID); } if (ANDROID.equalsIgnoreCase(transformedPlatform)) { return getConvenientClass(declaredClass, annotatedElement, ANDROID_UI_AUTOMATOR); } if (IOS.equalsIgnoreCase(transformedPlatform) && AutomationName.IOS_XCUI_TEST .equalsIgnoreCase(transformedAutomation)) { return getConvenientClass(declaredClass, annotatedElement, IOS_XCUIT_AUTOMATION); } if (IOS.equalsIgnoreCase(transformedPlatform)) { return getConvenientClass(declaredClass, annotatedElement, IOS_UI_AUTOMATION); } if (WINDOWS.equalsIgnoreCase(transformedPlatform)) { return getConvenientClass(declaredClass, annotatedElement, WINDOWS_AUTOMATION); } return getDefaultOrHTMLWidgetClass(declaredClass, annotatedElement); }

Target:
static Class<? extends Widget> getMobileNativeWidgetClass(Class<? extends Widget> declaredClass, AnnotatedElement annotatedElement, String platform, String automation) { String transformedPlatform = String.valueOf(platform).toUpperCase().trim(); String transformedAutomation = String.valueOf(automation).toUpperCase().trim(); if (ANDROID.equalsIgnoreCase(transformedPlatform)) { if (AutomationName.SELENDROID.equalsIgnoreCase(transformedAutomation)) { return getConvenientClass(declaredClass, annotatedElement, SELENDROID); } return getConvenientClass(declaredClass, annotatedElement, ANDROID_UI_AUTOMATOR); } if (IOS.equalsIgnoreCase(transformedPlatform)) { if (AutomationName.IOS_XCUI_TEST.equalsIgnoreCase(transformedAutomation)) { return getConvenientClass(declaredClass, annotatedElement, IOS_XCUIT_AUTOMATION); } return getConvenientClass(declaredClass, annotatedElement, IOS_UI_AUTOMATION); } if (WINDOWS.equalsIgnoreCase(transformedPlatform)) { return getConvenientClass(declaredClass, annotatedElement, WINDOWS_AUTOMATION); } return getDefaultOrHTMLWidgetClass(declaredClass, annotatedElement); }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof TreeNode)) { return false; } TreeNode node = (TreeNode) obj; if (docRef.equals(node.docRef)) { return (((position == null) && (node.position == null)) || ((position != null) && position.equals(node.position))); } return false; }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof TreeNode)) { return false; } TreeNode node = (TreeNode) obj; return Objects.equal(docRef, node.docRef) && Objects.equal(position, node.position); }
Source:
public WindowedQueryBolt(StreamSelector type, String streamId, String key) { if (type!=StreamSelector.STREAM && type!=StreamSelector.SOURCE) throw new IllegalArgumentException(type.name()); streamSelectorType = type; streamJoinOrder.add(streamId); joinCriteria.put(streamId, new JoinInfo(key) ); }

Target:
public WindowedQueryBolt(StreamSelector type, String streamId, String key) { streamSelectorType = type; joinCriteria.put(streamId, new JoinInfo(key) ); }
Source:
protected void log(Site site, Object... params) { if (!prefs.getBoolean(PrefKeys.getEventLoggingEnabled(), true)) { return; } JSONObject eventData = new JSONObject(); try { Log.d(ANALYTICS_TAG, this.getClass().getSimpleName() + ": Building event to transmit"); for (int i = 0; i < params.length; i += 2) { eventData.put(params[i].toString(), params[i + 1]); Log.d(ANALYTICS_TAG, this.getClass().getSimpleName() + ": event_" + params[i] + " = " + params[i + 1]); } } catch (JSONException e) { throw new RuntimeException(e); } new EventLoggingEvent( schemaName, revision, Utils.getDBNameForSite(site), app.getUserAgent(), preprocessData(eventData) ).log(); }

Target:
protected void log(Site site, Object... params) { if (!prefs.getBoolean(PrefKeys.getEventLoggingEnabled(), true)) { return; } JSONObject eventData = new JSONObject(); String logString = this.getClass().getSimpleName() + ": Sending event"; try { for (int i = 0; i < params.length; i += 2) { eventData.put(params[i].toString(), params[i + 1]); logString += ", event_" + params[i] + " = " + params[i + 1]; } Log.d(ANALYTICS_TAG, logString); } catch (JSONException e) { throw new RuntimeException(e); } new EventLoggingEvent( schemaName, revision, Utils.getDBNameForSite(site), app.getUserAgent(), preprocessData(eventData) ).log(); }
Source:
public Object getReplacementValue(Object initialValue) { Object replacementValue = ""; if (initialValue != null) { if (initialValue instanceof Cohort) { replacementValue = new Integer(((Cohort) initialValue).size()); } else if (initialValue instanceof IndicatorResult) { replacementValue = new Integer((Integer) ((IndicatorResult) initialValue).getValue()); } else { replacementValue = initialValue; } } return replacementValue; }

Target:
public Object getReplacementValue(Object initialValue) { Object replacementValue = ""; if (initialValue != null) { if (initialValue instanceof Cohort) { replacementValue = new Integer(((Cohort) initialValue).size()); } else if (initialValue instanceof IndicatorResult) { replacementValue = new Double(((IndicatorResult) initialValue).getValue().doubleValue()); } else { replacementValue = initialValue; } } return replacementValue; }
Source:
public void onClickTypeButton(final ClickEvent clickEvent) { dataTypePageNavTab.active(); }

Target:
public void onClickTypeButton(final ClickEvent clickEvent) { dataTypePageActiveEvent.fire(new DataTypePageTabActiveEvent()); }