auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public CepOperator( final List<CepEventPattern<T>> cepEventPatterns, final long windowTime) { this.eventPatternList = new ArrayList<>(); this.eventPatternList.addAll(cepEventPatterns); this.eventPatternList.add(0, null); this.windowTime = windowTime; this.matchedEventStackList = new ArrayList<>(); for (int eventIndex = eventPatternList.size() - 1; true; eventIndex--) { if (!eventPatternList.get(eventIndex).isOptional()) { this.minFinalStateIndex = eventIndex; break; } else if (eventIndex == 1) { this.minFinalStateIndex = 1; break; } } this.proceedIndexList = new ArrayList<>(); for (int eventIndex = 0; eventIndex < eventPatternList.size(); eventIndex++) { int minIndex; int maxIndex; if (eventIndex != 0 && eventPatternList.get(eventIndex).isTimes()) { minIndex = eventIndex; maxIndex = eventIndex + 1; } else { minIndex = eventIndex + 1; maxIndex = minIndex; } for (int i = eventIndex + 1; i < eventPatternList.size() - 1; i++) { if (eventPatternList.get(i).isOptional()) { maxIndex++; } else { break; } } if (minIndex >= eventPatternList.size()) { minIndex = -1; maxIndex = -1; } else if (maxIndex >= eventPatternList.size()) { maxIndex = minIndex; } final Tuple2<Integer, Integer> proceedIndexTup = new Tuple2<>(minIndex, maxIndex); this.proceedIndexList.add(proceedIndexTup); } }

Target:
public CepOperator( final List<CepEventPattern<T>> cepEventPatterns, final long windowTime) { this.eventPatternList = new ArrayList<>(); this.eventPatternList.addAll(cepEventPatterns); this.eventPatternList.add(0, null); this.windowTime = windowTime; this.matchedEventStackList = new ArrayList<>(); for (int eventIndex = eventPatternList.size() - 1; true; eventIndex--) { if (!eventPatternList.get(eventIndex).isOptional()) { this.minFinalStateIndex = eventIndex; break; } else if (eventIndex == 1) { this.minFinalStateIndex = 1; break; } } this.proceedIndexList = new ArrayList<>(); for (int eventIndex = 0; eventIndex < eventPatternList.size(); eventIndex++) { int minIndex; int maxIndex; if (eventIndex != 0 && eventPatternList.get(eventIndex).isRepeated()) { minIndex = eventIndex; maxIndex = eventIndex + 1; } else { minIndex = eventIndex + 1; maxIndex = minIndex; } for (int i = eventIndex + 1; i < eventPatternList.size() - 1; i++) { if (eventPatternList.get(i).isOptional()) { maxIndex++; } else { break; } } if (minIndex >= eventPatternList.size()) { minIndex = -1; maxIndex = -1; } else if (maxIndex >= eventPatternList.size()) { maxIndex = minIndex; } final Tuple2<Integer, Integer> proceedIndexTup = new Tuple2<>(minIndex, maxIndex); this.proceedIndexList.add(proceedIndexTup); } }
Source:
public static void main(String[] args) throws IOException, NoSuchAlgorithmException, InvalidKeyException, XmlPullParserException { try { MinioClient s3Client = new MinioClient("<LINK_0>", "YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY"); boolean found = s3Client.bucketExists("my-bucketname"); if (found) { System.out.println("my-bucketname already exists"); } else { s3Client.makeBucket("my-bucketname", null, true); System.out.println( "my-bucketname is created successfully with object lock functionality enabled."); } ObjectLockConfiguration config = new ObjectLockConfiguration(RetentionMode.COMPLIANCE, new RetentionDurationDays(100)); s3Client.setDefaultRetention("my-bucketname", config); ObjectLockConfiguration bucketConfig = s3Client.getDefaultRetention("my-bucketname"); System.out.println("Default retention configuration of bucket"); System.out.println("Mode: " + bucketConfig.mode()); System.out.println( "Duration: " + bucketConfig.duration().duration() + " " + bucketConfig.duration().unit()); } catch (MinioException e) { System.out.println("Error occurred: " + e); } }

Target:
public static void main(String[] args) throws IOException, NoSuchAlgorithmException, InvalidKeyException, XmlPullParserException { try { MinioClient s3Client = new MinioClient("<LINK_0>", "YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY"); boolean found = s3Client.bucketExists("my-bucketname"); if (found) { System.out.println("my-bucketname already exists"); } else { s3Client.makeBucket("my-bucketname", null, true); System.out.println( "my-bucketname is created successfully with object lock functionality enabled."); } ObjectLockConfiguration config = new ObjectLockConfiguration(RetentionMode.COMPLIANCE, new RetentionDurationDays(100)); s3Client.setDefaultRetention("my-bucketname", config); ObjectLockConfiguration bucketConfig = s3Client.getDefaultRetention("my-bucketname"); System.out.println("Default retention configuration of bucket"); System.out.println("Mode: " + bucketConfig.mode()); System.out.println("Duration: " + bucketConfig.duration()); } catch (MinioException e) { System.out.println("Error occurred: " + e); } }
Source:
public String getPrimaryIpv4HostAddress() { String primaryIP; String[] addrString = primaryAddress.split("/"); if (addrString.length > 1) { String ip = getIPv4inSubnet(primaryAddress); if (ip == null) { LOGGER.warn("Error in IP configuration, will continue to use first interface"); primaryIP = NetUtil.getLocalIpv4HostAddress(); } else { primaryIP = ip; } } else { primaryIP = addrString[0]; } return primaryIP; }

Target:
public String getPrimaryIpv4HostAddress() { String primaryIP; String[] addrString = primaryAddress.split("/"); if (addrString.length > 1) { String ip = getIPv4inSubnet(primaryAddress); if (ip == null) { LOGGER.warn("Invalid address '{}', will use first interface instead.", primaryAddress); primaryIP = getFirstLocalIPv4Address(); } else { primaryIP = ip; } } else { primaryIP = addrString[0]; } return primaryIP; }
Source:
public static boolean getShowGutenbergInfoPopupForTheNewPosts(PrefKey key, String siteURL) { if (TextUtils.isEmpty(siteURL)) { return false; } Set<String> urls; try { urls = prefs().getStringSet(key.name(), null); } catch (ClassCastException exp) { return false; } boolean flag = false; if (urls != null) { if (urls.contains(siteURL)) { flag = true; setShowGutenbergInfoPopupForTheNewPosts(siteURL, false); } } return flag; }

Target:
private static boolean getShowGutenbergInfoPopupForTheNewPosts(PrefKey key, String siteURL) { if (TextUtils.isEmpty(siteURL)) { return false; } Set<String> urls; try { urls = prefs().getStringSet(key.name(), null); } catch (ClassCastException exp) { return false; } boolean flag = false; if (urls != null) { if (urls.contains(siteURL)) { flag = true; setShowGutenbergInfoPopupForTheNewPosts(key, siteURL, false); } } return flag; }
Source:
public void receive_request(ServerRequestInfo serverRequestInfo) throws ForwardRequest { if (openTracingService == null) { return; } Tracer tracer = openTracingService.getTracer(PAYARA_CORBA_RMI_TRACER_NAME); if (tracer == null) { return; } ServiceContext serviceContext = serverRequestInfo.get_request_service_context(OPENTRACING_IIOP_ID); if (serviceContext == null) { return; } ByteArrayInputStream bis = new ByteArrayInputStream(serviceContext.context_data); OpenTracingIiopTextMap openTracingIiopTextMap = null; try (ObjectInput in = new OpenTracingIiopObjectInputStream(bis)) { openTracingIiopTextMap = (OpenTracingIiopTextMap) in.readObject(); } catch (IOException | ClassNotFoundException exception) { throw new ForwardRequest(exception.getMessage(), serverRequestInfo); } Tracer.SpanBuilder spanBuilder = tracer.buildSpan("rmi") .withTag(Tags.COMPONENT.getKey(), "ejb"); if (openTracingIiopTextMap != null) { SpanContext spanContext = tracer.extract(Format.Builtin.TEXT_MAP, openTracingIiopTextMap); spanBuilder.asChildOf(spanContext); } spanBuilder.startActive(true).span(); }

Target:
public void receive_request(ServerRequestInfo serverRequestInfo) throws ForwardRequest { if (!tracerAvailable()) { return; } ServiceContext serviceContext = serverRequestInfo.get_request_service_context(OPENTRACING_IIOP_ID); if (serviceContext == null) { return; } OpenTracingIiopTextMap openTracingIiopTextMap = null; try (ByteArrayInputStream bis = new ByteArrayInputStream(serviceContext.context_data); ObjectInput in = new OpenTracingIiopObjectInputStream(bis)) { openTracingIiopTextMap = (OpenTracingIiopTextMap) in.readObject(); } catch (IOException | ClassNotFoundException exception) { throw new ForwardRequest(exception.getMessage(), serverRequestInfo); } Tracer.SpanBuilder spanBuilder = tracer.buildSpan("rmi") .withTag(Tags.COMPONENT.getKey(), "ejb"); if (openTracingIiopTextMap != null) { SpanContext spanContext = tracer.extract(Format.Builtin.TEXT_MAP, openTracingIiopTextMap); spanBuilder.asChildOf(spanContext); } spanBuilder.startActive(true).span(); }
Source:
private PlanNodeStatsEstimate mapToOutputSymbols(PlanNodeStatsEstimate estimate, List<Symbol> inputs, List<Symbol> outputs) { checkArgument(inputs.size() == outputs.size(), "Inputs does not match outputs"); PlanNodeStatsEstimate.Builder mapped = PlanNodeStatsEstimate.builder() .setOutputRowCount(estimate.getOutputRowCount()); for (int i = 0; i < inputs.size(); i++) { mapped.addSymbolStatistics(outputs.get(i), estimate.getSymbolStatistics(inputs.get(i))); } return mapped.build(); }

Target:
private PlanNodeStatsEstimate mapToOutputSymbols(PlanNodeStatsEstimate estimate, List<Symbol> inputs, List<Symbol> outputs) { checkArgument(inputs.size() == outputs.size(), "Input symbols count does not match output symbols count"); PlanNodeStatsEstimate.Builder mapped = PlanNodeStatsEstimate.builder() .setOutputRowCount(estimate.getOutputRowCount()); for (int i = 0; i < inputs.size(); i++) { mapped.addSymbolStatistics(outputs.get(i), estimate.getSymbolStatistics(inputs.get(i))); } return mapped.build(); }
Source:
private void invalidate() { for(K key : map.keySet()) { try { invalidate(key); } catch (StoreAccessException cae) { LOG.warn("Failed to invalidate mapping for key {}", key, cae); } } this.clear(); }

Target:
private void invalidate() { for(K key : map.keySet()) { try { invalidate(key); } catch (StoreAccessException cae) { LOG.warn("Failed to invalidate mapping for key {}", key, cae); } } clear(); }
Source:
private void addRecents(final HttpServletRequest request, final User user, Structure.Type type, List<BaseContentTypesView> baseContentTypesView) throws DotDataException, LanguageException { Locale locale = LocaleUtil.getLocale(request); Map<String, String> baseContentTypeNames = this.getBaseContentTypeNames(locale); List<ContentTypeView> recentsContent = structureAPI.getRecentContentType(type, user, -1) .stream() .map(map -> new ContentTypeView(map.get("type").toString(), map.get("name").toString(), map.get("inode").toString(), contentTypeUtil.getActionUrl(request, map.get("inode").toString(), user))) .collect(Collectors.toList()); if (!recentsContent.isEmpty()){ String name = String.format("RECENT_%s" ,type.toString()); String label = LanguageUtil.get(locale, name); baseContentTypesView.add(new BaseContentTypesView(name, label, recentsContent)); } }

Target:
private void addRecents(final HttpServletRequest request, final User user, Structure.Type type, List<BaseContentTypesView> baseContentTypesView) throws DotDataException, LanguageException { Locale locale = LocaleUtil.getLocale(request); List<ContentTypeView> recentsContent = structureAPI.getRecentContentType(type, user, -1) .stream() .map(map -> new ContentTypeView(map.get("type").toString(), map.get("name").toString(), map.get("inode").toString(), contentTypeUtil.getActionUrl(request, map.get("inode").toString(), user))) .collect(Collectors.toList()); if (!recentsContent.isEmpty()){ String name = String.format("RECENT_%s" ,type.toString()); String label = LanguageUtil.get(locale, name.toLowerCase()); baseContentTypesView.add(new BaseContentTypesView(name, label, recentsContent)); } }
Source:
public MeasurementDetailsLoader( @NonNull final Context context, @Nullable String measurementId, @Nullable String ministryId, @Nullable String mcc, @Nullable String period, @NonNull final IntentFilter... filters) { super(context, filters); measurementDao = MeasurementDao.getInstance(context); if(measurementId != null && ministryId != null && mcc != null) { if(period == null) { this.period = getCurrentPeriod(); } else { this.period = period; } this.measurementId = measurementId; this.ministryId = ministryId; this.mcc = mcc; } }

Target:
public MeasurementDetailsLoader( @NonNull final Context context, @Nullable String measurementId, @Nullable String ministryId, @Nullable String mcc, @Nullable String period, @NonNull final IntentFilter... filters) { super(context, filters); measurementDao = MeasurementDao.getInstance(context); if(measurementId != null && ministryId != null && mcc != null) { if(period == null) { this.period = getCurrentPeriod(); } else { this.period = period; } this.measurementId = measurementId; this.ministryId = ministryId; this.mcc = mcc; addIntentFilter(BroadcastUtils.updateMeasurementDetailsFilter()); } }
Source:
public Response addServiceGroup( GroupBean serviceGroupDefinition) throws RestAPIException { try { StratosApiV41Utils.addServiceGroup(serviceGroupDefinition); URI url = uriInfo.getAbsolutePathBuilder().path(serviceGroupDefinition.getName()).build(); return Response.created(url).entity(new StatusResponseBean(Response.Status.CREATED.getStatusCode(), String.format("Cartridge Group added successfully: [cartridge-group] %s", serviceGroupDefinition.getName()))).build(); } catch (RestAPIException e) { if (e.getCause().getMessage().contains("already exists")) { return Response.status(Response.Status.CONFLICT).entity(new StatusResponseBean( Response.Status.CONFLICT.getStatusCode(), "Cartridge group not found")).build(); } else if(e.getCause().getMessage().contains("duplicate cartridges")) { return Response.status(Response.Status.BAD_REQUEST).entity(new StatusResponseBean( Response.Status.BAD_REQUEST.getStatusCode(), "Cartridges duplicated in the group definition")).build(); } else if(e.getCause().getMessage().contains("duplicate groups")) { return Response.status(Response.Status.BAD_REQUEST).entity(new StatusResponseBean( Response.Status.BAD_REQUEST.getStatusCode(), "Groups duplicated in the group definition")).build(); } else if(e.getCause().getMessage().contains("cyclic group")) { return Response.status(Response.Status.BAD_REQUEST).entity(new StatusResponseBean( Response.Status.BAD_REQUEST.getStatusCode(), "Cyclic group behaviour identified in the group definition")).build(); } else { throw e; } } }

Target:
public Response addServiceGroup( GroupBean serviceGroupDefinition) throws RestAPIException { try { StratosApiV41Utils.addServiceGroup(serviceGroupDefinition); URI url = uriInfo.getAbsolutePathBuilder().path(serviceGroupDefinition.getName()).build(); return Response.created(url).entity(new StatusResponseBean(Response.Status.CREATED.getStatusCode(), String.format("Cartridge Group added successfully: [cartridge-group] %s", serviceGroupDefinition.getName()))).build(); } catch (InvalidCartridgeGroupDefinitionException e) { return Response.status(Response.Status.BAD_REQUEST).entity(new StatusResponseBean( Response.Status.BAD_REQUEST.getStatusCode(), e.getMessage())).build(); } catch (RestAPIException e) { if (e.getCause().getMessage().contains("already exists")) { return Response.status(Response.Status.CONFLICT).entity(new StatusResponseBean( Response.Status.CONFLICT.getStatusCode(), "Cartridge group not found")).build(); } else { throw e; } } }
Source:
private void setupCPU(MetricRegistry metricRegistry) { MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); try { ObjectName objectName = ObjectName.getInstance("java.lang:type=OperatingSystem"); attrList = mbs.getAttributes(objectName, new String[]{"ProcessCpuLoad"}); } catch (MalformedObjectNameException | ReflectionException | InstanceNotFoundException e) { LOG.error("can't get attribute list for jvm-cpu", e); } metricRegistry.register(MetricRegistry.name("jvm-cpu"), (Gauge<Double>) () -> { try { return getProcessCpuLoad(); } catch (MalformedObjectNameException | ReflectionException | InstanceNotFoundException e) { LOG.error("Can't get cpu", e); return Double.NaN; } }); }

Target:
private void setupCPU(MetricRegistry metricRegistry) { MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); try { ObjectName objectName = ObjectName.getInstance("java.lang:type=OperatingSystem"); AttributeList attrList = mbs.getAttributes(objectName, new String[]{"ProcessCpuLoad"}); attr = (Attribute)attrList.get(0); } catch (MalformedObjectNameException | ReflectionException | InstanceNotFoundException e) { LOG.error("can't get attribute list for jvm-cpu", e); } metricRegistry.register(MetricRegistry.name("jvm-cpu"), this.getProcessCpuLoad); }
Source:
public static Bytes addShard(String nodeId, VariableOrder varOrder, VisibilityBindingSet bs) { String[] rowPrefixAndId = nodeId.split("_"); Preconditions.checkArgument(rowPrefixAndId.length == 2); String prefix = rowPrefixAndId[0]; String id = rowPrefixAndId[1]; String firstBindingString = ""; Bytes rowSuffix = Bytes.of(id); if (varOrder.getVariableOrders().size() > 0) { VariableOrder first = new VariableOrder(varOrder.getVariableOrders().get(0)); firstBindingString = BS_CONVERTER.convert(bs, first); rowSuffix = RowKeyUtil.makeRowKey(id, varOrder, bs); } BytesBuilder builder = Bytes.builder(); builder.append(Bytes.of(prefix + ":")); builder.append(genHash(Bytes.of(id + NODEID_BS_DELIM + firstBindingString))); builder.append(":"); builder.append(rowSuffix); return builder.toBytes(); }

Target:
public static Bytes addShard(String nodeId, VariableOrder varOrder, VisibilityBindingSet bs) { checkNotNull(nodeId); checkNotNull(varOrder); checkNotNull(bs); String[] rowPrefixAndId = nodeId.split("_"); Preconditions.checkArgument(rowPrefixAndId.length == 2); String prefix = rowPrefixAndId[0]; String id = rowPrefixAndId[1]; String firstBindingString = ""; Bytes rowSuffix = Bytes.of(id); if (varOrder.getVariableOrders().size() > 0) { VariableOrder first = new VariableOrder(varOrder.getVariableOrders().get(0)); firstBindingString = BS_CONVERTER.convert(bs, first); rowSuffix = RowKeyUtil.makeRowKey(id, varOrder, bs); } BytesBuilder builder = Bytes.builder(); builder.append(Bytes.of(prefix + ":")); builder.append(genHash(Bytes.of(id + NODEID_BS_DELIM + firstBindingString))); builder.append(":"); builder.append(rowSuffix); return builder.toBytes(); }
Source:
public JsonObject toJson() { JsonObject root = new JsonObject(); String name = mapConfig.getName(); if (!StringUtil.isNullOrEmpty(name)) { root.add("name", name); } String quorumName = mapConfig.getQuorumName(); if (!StringUtil.isNullOrEmpty(quorumName)) { root.add("quorumName", quorumName); } root.add("maxSize", mapConfig.getMaxSizeConfig().getSize()); root.add("maxSizePolicy", mapConfig.getMaxSizeConfig().getMaxSizePolicy().toString()); root.add("evictionPolicy", mapConfig.getEvictionPolicy().name()); root.add("memoryFormat", mapConfig.getInMemoryFormat().toString()); root.add("cacheDeserializedValues", mapConfig.getCacheDeserializedValues().toString()); root.add("metadataPolicy", mapConfig.getMetadataPolicy().toString()); root.add("backupCount", mapConfig.getBackupCount()); root.add("asyncBackupCount", mapConfig.getAsyncBackupCount()); root.add("ttl", mapConfig.getTimeToLiveSeconds()); root.add("maxIdle", mapConfig.getMaxIdleSeconds()); root.add("readBackupData", mapConfig.isReadBackupData()); root.add("statisticsEnabled", mapConfig.isStatisticsEnabled()); root.add("mergePolicy", new MergePolicyConfigDTO(mapConfig.getMergePolicyConfig()).toJson()); root.add("mapStoreConfig", new MapStoreConfigDTO(mapConfig.getMapStoreConfig()).toJson()); NearCacheConfig nearCacheConfig = mapConfig.getNearCacheConfig(); if (nearCacheConfig != null) { root.add("nearCacheConfig", new NearCacheConfigDTO(nearCacheConfig).toJson()); } return root; }

Target:
public JsonObject toJson() { JsonObject root = new JsonObject(); String name = mapConfig.getName(); if (!isNullOrEmpty(name)) { root.add("name", name); } String splitBrainProtectionName = mapConfig.getSplitBrainProtectionName(); if (!isNullOrEmpty(splitBrainProtectionName)) { root.add("splitBrainProtectionName", splitBrainProtectionName); } root.add("maxSize", mapConfig.getMaxSizeConfig().getSize()); root.add("maxSizePolicy", mapConfig.getMaxSizeConfig().getMaxSizePolicy().toString()); root.add("evictionPolicy", mapConfig.getEvictionPolicy().name()); root.add("memoryFormat", mapConfig.getInMemoryFormat().toString()); root.add("cacheDeserializedValues", mapConfig.getCacheDeserializedValues().toString()); root.add("metadataPolicy", mapConfig.getMetadataPolicy().toString()); root.add("backupCount", mapConfig.getBackupCount()); root.add("asyncBackupCount", mapConfig.getAsyncBackupCount()); root.add("ttl", mapConfig.getTimeToLiveSeconds()); root.add("maxIdle", mapConfig.getMaxIdleSeconds()); root.add("readBackupData", mapConfig.isReadBackupData()); root.add("statisticsEnabled", mapConfig.isStatisticsEnabled()); root.add("mergePolicy", new MergePolicyConfigDTO(mapConfig.getMergePolicyConfig()).toJson()); root.add("mapStoreConfig", new MapStoreConfigDTO(mapConfig.getMapStoreConfig()).toJson()); NearCacheConfig nearCacheConfig = mapConfig.getNearCacheConfig(); if (nearCacheConfig != null) { root.add("nearCacheConfig", new NearCacheConfigDTO(nearCacheConfig).toJson()); } return root; }
Source:
public AssetIngestor.Source getSource() { throw new UnsupportedOperationException("Not supported yet."); }

Target:
public AssetIngestor.Source getSource() { throw new UnsupportedOperationException("This implementation of folder does not provide a source."); }
Source:
public void setCardDetail(CardDetails cardDetail) { CardDetail = cardDetail; }

Target:
public void setCardDetail(CardDetails cardDetail) { this.cardDetail = cardDetail; }
Source:
File findManifestInKnownPathsStartingFromGenFolder(String sourcesGenerationFolder) throws FileNotFoundException { Matcher gradleMatcher = GRADLE_GEN_FOLDER.matcher(sourcesGenerationFolder); Matcher mavenMatcher = MAVEN_GEN_FOLDER.matcher(sourcesGenerationFolder); Matcher eclipseMatcher = ECLIPSE_GEN_FOLDER.matcher(sourcesGenerationFolder); AndroidManifestFinderStrategy strategy = null; File androidManifestFile = null; if (gradleMatcher.matches()) { strategy = new GradleAndroidManifestFinderStrategy(gradleMatcher); } else if (mavenMatcher.matches()) { strategy = new MavenAndroidManifestFinderStrategy(mavenMatcher); } else if (eclipseMatcher.matches()) { strategy = new EclipseAndroidManifestFinderStrategy(eclipseMatcher); } if (strategy != null) { androidManifestFile = strategy.findAndroidManifestFile(); } if (androidManifestFile != null) { LOGGER.debug("{} AndroidManifest.xml file found using generation folder {}: {}", strategy.name, sourcesGenerationFolder, androidManifestFile.toString()); } else { LOGGER.error("Could not find the AndroidManifest.xml file, using generation folder [{}])", sourcesGenerationFolder); } return androidManifestFile; }

Target:
File findManifestInKnownPathsStartingFromGenFolder(String sourcesGenerationFolder) throws FileNotFoundException { Iterable<AndroidManifestFinderStrategy> strategies = Arrays.asList(new GradleAndroidManifestFinderStrategy(sourcesGenerationFolder), new MavenAndroidManifestFinderStrategy(sourcesGenerationFolder), new EclipseAndroidManifestFinderStrategy(sourcesGenerationFolder)); AndroidManifestFinderStrategy applyingStrategy = null; for (AndroidManifestFinderStrategy strategy : strategies) { if (strategy.applies()) { applyingStrategy = strategy; break; } } File androidManifestFile = null; if (applyingStrategy != null) { androidManifestFile = applyingStrategy.findAndroidManifestFile(); } if (androidManifestFile != null) { LOGGER.debug("{} AndroidManifest.xml file found using generation folder {}: {}", applyingStrategy.name, sourcesGenerationFolder, androidManifestFile.toString()); } else { LOGGER.error("Could not find the AndroidManifest.xml file, using generation folder [{}])", sourcesGenerationFolder); } return androidManifestFile; }
Source:
public RepositoryDTO fetchInstallableApplications() { final File[] categoryDirectories = repositoryDirectory.listFiles(); if (categoryDirectories == null) { return null; } LOGGER.info("Reading directory : " + repositoryDirectory); final RepositoryDTO.Builder repositoryDTOBuilder = new RepositoryDTO.Builder() .withName(repositoryDirectory.getName()).withCategories(fetchCategories(categoryDirectories)); final File i18nDirectory = new File(repositoryDirectory, "i18n"); if (i18nDirectory.exists()) { final File[] translationFiles = i18nDirectory.listFiles((dir, name) -> name.endsWith(".json")); HashMap<String, String> translations = new HashMap<>(); for (File translation : translationFiles) { try { final String content = new String(Files.readAllBytes(translation.toPath())); translations.put(translation.getName(), content); } catch (IOException e) { LOGGER.error("Could not read translation json", e); } } repositoryDTOBuilder.withTranslations(translations); } return repositoryDTOBuilder.build(); }

Target:
public RepositoryDTO fetchInstallableApplications() { final File[] categoryDirectories = repositoryDirectory.listFiles(); if (categoryDirectories == null) { return new RepositoryDTO.Builder().build(); } LOGGER.info("Reading directory : " + repositoryDirectory); final RepositoryDTO.Builder repositoryDTOBuilder = new RepositoryDTO.Builder() .withName(repositoryDirectory.getName()).withCategories(fetchCategories(categoryDirectories)); final File i18nDirectory = new File(repositoryDirectory, "i18n"); if (i18nDirectory.exists()) { final File[] translationFiles = i18nDirectory.listFiles((dir, name) -> name.endsWith(".json")); Set<TranslationDTO> translations = new HashSet<>(); for (File translation : translationFiles) { try { final String language = translation.getName(); final String content = new String(Files.readAllBytes(translation.toPath())); final TranslationDTO.Builder translationDTOBuilder = new TranslationDTO.Builder() .withLanguage(language).withJson(content); translations.add(translationDTOBuilder.build()); } catch (IOException e) { LOGGER.error("Could not read translation json", e); } } repositoryDTOBuilder.withTranslations(translations); } return repositoryDTOBuilder.build(); }
Source:
protected void initStructureMergeViewerFilter(Comparison comparison, IComparisonScope comparisonScope) { EMFCompareRCPUIPlugin plugin = EMFCompareRCPUIPlugin.getDefault(); IDifferenceFilter.Registry filterRegistry = plugin.getDifferenceFilterRegistry(); Collection<IDifferenceFilter> filters = filterRegistry.getFilters(comparisonScope, comparison); Collection<IDifferenceFilter> selectedFilters = Lists.newArrayList(); Collection<IDifferenceFilter> unselectedFilters = Lists.newArrayList(); Collection<IDifferenceFilter> activeFilters = Lists.newArrayList(); for (IDifferenceFilter filter : filters) { if (filter instanceof IDeactivableDiffFilter) { if (((IDeactivableDiffFilter)filter).isActive()) { if (filter.defaultSelected()) { selectedFilters.add(filter); } else { unselectedFilters.add(filter); } activeFilters.add(filter); } } else { if (filter.defaultSelected()) { selectedFilters.add(filter); } else { unselectedFilters.add(filter); } activeFilters.add(filter); } } getStructureMergeViewerFilter().init(selectedFilters, unselectedFilters, activeFilters); }

Target:
protected void initStructureMergeViewerFilter(Comparison comparison, IComparisonScope comparisonScope) { EMFCompareRCPUIPlugin plugin = EMFCompareRCPUIPlugin.getDefault(); IDifferenceFilter.Registry filterRegistry = plugin.getDifferenceFilterRegistry(); Collection<IDifferenceFilter> filters = filterRegistry.getFilters(comparisonScope, comparison); Collection<IDifferenceFilter> selectedFilters = Lists.newArrayList(); Collection<IDifferenceFilter> unselectedFilters = Lists.newArrayList(); Collection<IDifferenceFilter> activeFilters = Lists.newArrayList(); for (IDifferenceFilter filter : filters) { if (!(filter instanceof IDeactivableDiffFilter) || ((IDeactivableDiffFilter)filter).isActive()) { if (filter.defaultSelected()) { selectedFilters.add(filter); } else { unselectedFilters.add(filter); } activeFilters.add(filter); } } getStructureMergeViewerFilter().init(selectedFilters, unselectedFilters, activeFilters); }
Source:
private static void bindNamed(ParsedParameters params, Binding binding, PreparedStatement statement, StatementContext context) { List<String> paramNames = params.getParameterNames(); boolean argumentsProvidedButNoneDeclared = paramNames.isEmpty() && !binding.isEmpty(); if (argumentsProvidedButNoneDeclared && !context.getConfig(SqlStatements.class).isUnusedBindingAllowed()) { throw new UnableToCreateStatementException(String.format("Superfluous named parameters provided while the query declares none: '%s'.", binding), context); } for (int i = 0; i < paramNames.size(); i++) { String name = paramNames.get(i); Optional<Argument> argument = binding.findForName(name, context); if (argument.isPresent()) { try { argument.get().apply(i + 1, statement, context); } catch (SQLException e) { throw new UnableToCreateStatementException(String.format("Exception while binding named parameter '%s'", name), e, context); } } else { throw new UnableToCreateStatementException(String.format("Missing named parameter '%s'.", name), context); } } }

Target:
private static void bindNamed(ParsedParameters params, Binding binding, PreparedStatement statement, StatementContext context) { List<String> paramNames = params.getParameterNames(); boolean argumentsProvidedButNoneDeclared = paramNames.isEmpty() && !binding.isEmpty(); if (argumentsProvidedButNoneDeclared && !context.getConfig(SqlStatements.class).isUnusedBindingAllowed()) { throw new UnableToCreateStatementException(String.format("Superfluous named parameters provided while the query declares none: '%s'.", binding), context); } for (int i = 0; i < paramNames.size(); i++) { String name = paramNames.get(i); Optional<Argument> argument = binding.findForName(name, context); try { argument.orElseThrow(() -> new UnableToCreateStatementException(String.format("Missing named parameter '%s'.", name), context)).apply(i + 1, statement, context); } catch (SQLException e) { throw new UnableToCreateStatementException(String.format("Exception while binding named parameter '%s'", name), e, context); } } }
Source:
protected void processHeader(CommandLine cl) { printInfo("File Size", "In Alluxio", cl.hasOption(MEMORY_OPTION_NAME) ? Optional.of("In Memory") : Optional.empty(), "Path", cl.hasOption(GROUP_BY_WORKER_OPTION_NAME) ? Optional.of("Worker Host Name") : Optional.empty()); }

Target:
protected void processHeader(CommandLine cl) { printInfo("File Size", "In Alluxio", "Path", cl.hasOption(MEMORY_OPTION_NAME) ? Optional.of("In Memory") : Optional.empty(), cl.hasOption(GROUP_BY_WORKER_OPTION_NAME) ? Optional.of("Worker Host Name") : Optional.empty()); }
Source:
private String getWsAgentUrl(String workspaceId) throws Exception { Workspace workspace = workspaceServiceClient.getById(workspaceId); workspaceServiceClient.ensureRunningStatus(workspace); Map<String, ? extends Machine> machines = workspaceServiceClient.getById(workspaceId).getRuntime().getMachines(); for (Machine machine : machines.values()) { if (machine.getServers().get("wsagent/http") != null) { return machine.getServers().get("wsagent/http").getUrl() + "/project"; } } throw new RuntimeException("Cannot find dev machine on workspace"); }

Target:
private String getWsAgentUrl(String workspaceId) throws Exception { Workspace workspace = workspaceServiceClient.getById(workspaceId); workspaceServiceClient.ensureRunningStatus(workspace); Map<String, ? extends Machine> machines = workspaceServiceClient.getById(workspaceId).getRuntime().getMachines(); for (Machine machine : machines.values()) { if (containsWsAgentServer(machine)) { Server wsAgentServer = machine.getServers().get(SERVER_WS_AGENT_HTTP_REFERENCE); if (wsAgentServer != null) { return wsAgentServer.getUrl() + "/project"; } else { throw new RuntimeException("Workspace agent server is null"); } } } throw new RuntimeException("Cannot find dev machine on workspace"); }
Source:
private static String toBase64_(byte[] bytes) { String base64 = Base64.getEncoder().encodeToString(bytes); StringBuilder str = new StringBuilder(base64.length() + base64.length() / 76); if (base64.length() > 76) { Splitter.fixedLength(76).split(base64).iterator().forEachRemaining(s -> { str.append(s); str.append("\n"); }); return str.substring(0, str.length() - 1); } return base64; }

Target:
private static String toBase64_(byte[] bytes) { String base64 = Base64.getEncoder().encodeToString(bytes); StringBuilder str = new StringBuilder(base64.length() + base64.length() / 76); Splitter.fixedLength(76).split(base64).iterator().forEachRemaining(s -> { str.append(s); str.append("\n"); }); return str.substring(0, str.length() - 1); }
Source:
public static void d(final String message, int padStack) { if (!BuildConfig.DEBUG) return; StackTraceElement calledFrom = Thread.currentThread().getStackTrace()[3 + padStack]; Log.d(tag(), String.format("%1$-"+75+ "s", message) + " ~ [" + calledFrom.getClassName() + "." + calledFrom.getMethodName() + "@" + calledFrom.getLineNumber() + "]"); }

Target:
public static void d(final String message, int padStack) { if (!BuildConfig.DEBUG) return; StackTraceElement calledFrom = Thread.currentThread().getStackTrace()[3 + padStack]; String stack = " ~ [" + calledFrom.getClassName() + "." + calledFrom.getMethodName() + "@" + calledFrom.getLineNumber() + "]"; Log.d(tag(), String.format("%1$-"+75+ "s", message) + stack); }
Source:
void validateListUserName(final String listUserName) throws FileParsingException { try { if (StringUtils.isNotEmpty(listUserName)) { final User user = this.userDataManager.getUserByFullname(listUserName); if (user != null) { this.importedList.setUserId(user.getUserid()); } else { throw new FileParsingException(CrossesListDescriptionSheetParser.INVALID_LIST_USER); } } } catch (MiddlewareQueryException e) { throw new FileParsingException(CrossesListDescriptionSheetParser.MORE_THAN_ONE_USER1 + listUserName + CrossesListDescriptionSheetParser.MORE_THAN_ONE_USER2); } }

Target:
void validateListUserName(final String listUserName) throws FileParsingException { try { if (StringUtils.isNotEmpty(listUserName)) { final User user = this.userDataManager.getUserByFullname(listUserName); if (user != null) { this.importedList.setUserId(user.getUserid()); } else { throw new FileParsingException(CrossesListDescriptionSheetParser.INVALID_LIST_USER); } } } catch (MiddlewareQueryException e) { throw new FileParsingException(String.format(MORE_THAN_ONE_USER, listUserName)); } }
Source:
protected boolean canDoAction() { if (getVm() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_FOUND); } if (getVm().getTemplateVersionNumber() != null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_SET_FOR_LATEST); } VmTemplate latest = getVmTemplateDAO().getTemplateWithLatestVersionInChain(getVm().getVmtGuid()); if (latest == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_DOES_NOT_EXIST); } if (getVm().getVmtGuid().equals(latest.getId())) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_ALREADY_IN_LATEST_VERSION); } setVmTemplateId(latest.getId()); setVmTemplate(latest); getVm().setVmtGuid(latest.getId()); return true; }

Target:
protected boolean canDoAction() { if (getVm() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_FOUND); } if (getVm().getTemplateVersionNumber() != null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_SET_FOR_LATEST); } if (getVmTemplate() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_DOES_NOT_EXIST); } if (getVm().getVmtGuid().equals(getVmTemplate().getId())) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_ALREADY_IN_LATEST_VERSION); } getVm().setVmtGuid(getVmTemplate().getId()); return true; }
Source:
public ValueGenerator(Field field) { ValueCounts valueCounts = field.getValueCounts(); type = field.getType(); if (valueCounts.size() == 0) { length = field.getMaxLength(); generatorType = RANDOM; } else { int length = valueCounts.size(); int runningTotal = 0; values = new String[length]; cumulativeFrequency = new int[length]; for (int i = 0; i < length; i++) { values[i] = valueCounts.get(i).getValue(); runningTotal += valueCounts.get(i).getFrequency(); cumulativeFrequency[i] = runningTotal; } totalFrequency = valueCounts.getSummedFrequency(); generatorType = REGULAR; } }

Target:
public ValueGenerator(Field field) { ValueCounts valueCounts = field.getValueCounts(); fieldName = field.getName(); type = field.getType(); boolean isUnique = field.getFractionUnique() != null && field.getFractionUnique() == 1; if (valueCounts.isEmpty()) { length = field.getMaxLength(); generatorType = RANDOM; } else { int length = valueCounts.size(); int runningTotal = 0; values = new String[length]; cumulativeFrequency = new int[length]; for (int i = 0; i < length; i++) { values[i] = valueCounts.get(i).getValue(); int frequency; if (doUniformSampling) { frequency = 1; } else { frequency = valueCounts.get(i).getFrequency(); } runningTotal += frequency; cumulativeFrequency[i] = runningTotal; } totalFrequency = runningTotal; generatorType = REGULAR; } if (isUnique) { generatorType = PRIMARY_KEY; pk_cursor = 0; } }
Source:
private void determineDrawerItemsToInclude() { boolean shouldShowSavedFormsItem = CommCarePreferences.isSavedFormsEnabled(); boolean shouldShowChangeLanguageItem = ChangeLocaleUtil.getLocaleNames().length > 1; int numItemsToInclude = allDrawerItems.size() - (shouldShowChangeLanguageItem ? 0 : 1) - (shouldShowSavedFormsItem ? 0 : 1); drawerItemsShowing = new NavDrawerItem[numItemsToInclude]; int index = 0; for (String id : getAllItemIdsInOrder()) { NavDrawerItem item = allDrawerItems.get(id); if ((id.equals(CHANGE_LANGUAGE_DRAWER_ITEM_ID) && !shouldShowChangeLanguageItem) || (id.equals(SAVED_FORMS_ITEM_ID) && !shouldShowSavedFormsItem)) { continue; } else { drawerItemsShowing[index] = item; index++; } } }

Target:
private void determineDrawerItemsToInclude() { boolean hideSavedFormsItem = !CommCarePreferences.isSavedFormsEnabled(); boolean hideChangeLanguageItem = ChangeLocaleUtil.getLocaleNames().length <= 1; int numItemsToInclude = allDrawerItems.size() - (hideChangeLanguageItem ? 1 : 0) - (hideSavedFormsItem ? 1 : 0); drawerItemsShowing = new NavDrawerItem[numItemsToInclude]; int index = 0; for (String id : getAllItemIdsInOrder()) { NavDrawerItem item = allDrawerItems.get(id); if (!excludeItem(id, hideChangeLanguageItem, hideSavedFormsItem)) { drawerItemsShowing[index] = item; index++; } } }
Source:
public Duration getNextRetryInterval(Exception lastException, Duration remainingTime) { int baseWaitTime = 0; if (lastException == null || !(lastException instanceof AmqpException)) { return this.onGetNextRetryInterval(lastException, remainingTime, baseWaitTime, this.getRetryCount()); } if (((AmqpException) lastException).getErrorCondition() == ErrorCondition.SERVER_BUSY_ERROR) { baseWaitTime += ClientConstants.SERVER_BUSY_BASE_SLEEP_TIME_IN_SECS; } return this.onGetNextRetryInterval(lastException, remainingTime, baseWaitTime, this.getRetryCount()); }

Target:
public Duration getNextRetryInterval(Exception lastException, Duration remainingTime) { int baseWaitTime = 0; if (!isRetriableException(lastException)) { return null; } if (retryCount.get() >= maxRetryCount) { return null; } if (((AmqpException) lastException).getErrorCondition() == ErrorCondition.SERVER_BUSY_ERROR) { baseWaitTime += ClientConstants.SERVER_BUSY_BASE_SLEEP_TIME_IN_SECS; } return this.calculateNextRetryInterval(lastException, remainingTime, baseWaitTime, this.getRetryCount()); }
Source:
public TaskSerdeTest() { TestUtils testUtils = new TestUtils(); jsonMapper = testUtils.getTestObjectMapper(); for (final Module jacksonModule : new FirehoseModule().getJacksonModules()) { jsonMapper.registerModule(jacksonModule); } final File baseDir = new File("lol"); baseDir.mkdir(); baseDir.deleteOnExit(); }

Target:
public TaskSerdeTest() { TestUtils testUtils = new TestUtils(); jsonMapper = testUtils.getTestObjectMapper(); for (final Module jacksonModule : new FirehoseModule().getJacksonModules()) { jsonMapper.registerModule(jacksonModule); } }
Source:
public DeclarationTree IMPORT_DECLARATION() { return b.<DeclarationTree>nonterminal(EcmaScriptLexer.IMPORT_DECLARATION) .is(b.firstOf( f.importDeclaration( b.token(JavaScriptKeyword.IMPORT), IMPORT_CLAUSE(), FROM_CLAUSE(), b.token(EcmaScriptLexer.EOS)), f.importModuleDeclaration( b.token(JavaScriptKeyword.IMPORT), STRING_LITERAL(), b.token(EcmaScriptLexer.EOS)))); }

Target:
public DeclarationTree IMPORT_DECLARATION() { return b.<DeclarationTree>nonterminal(EcmaScriptLexer.IMPORT_DECLARATION) .is(b.firstOf( f.importDeclaration( b.token(JavaScriptKeyword.IMPORT), IMPORT_CLAUSE(), FROM_CLAUSE(), b.token(EcmaScriptLexer.EOS)), f.importDeclaration( b.token(JavaScriptKeyword.IMPORT), FLOW_TYPE_KEYWORD(), IMPORT_CLAUSE(), FROM_CLAUSE(), b.token(EcmaScriptLexer.EOS)), f.importModuleDeclaration( b.token(JavaScriptKeyword.IMPORT), STRING_LITERAL(), b.token(EcmaScriptLexer.EOS)))); }
Source:
protected void reduce( LongWritable key, Iterable<BytesWritable> values, Context context ) throws IOException, InterruptedException { HyperLogLogCollector aggregate = HyperLogLogCollector.makeLatestCollector(); for (BytesWritable value : values) { aggregate.fold( HyperLogLogCollector.makeCollector(ByteBuffer.wrap(value.getBytes(), 0, value.getLength())) ); } Interval interval = config.getGranularitySpec().getSegmentGranularity().bucket(new DateTime(key.get())); intervals.add(interval); final Path outPath = config.makeSegmentPartitionInfoPath(interval); final OutputStream out = Utils.makePathAndOutputStream( context, outPath, config.isOverwriteFiles() ); try { HadoopDruidIndexerConfig.JSON_MAPPER.writerWithType( new TypeReference<Long>() { } ).writeValue( out, new Double(aggregate.estimateCardinality()).longValue() ); } finally { Closeables.close(out, false); } }

Target:
protected void reduce( LongWritable key, Iterable<BytesWritable> values, Context context ) throws IOException, InterruptedException { HyperLogLogCollector aggregate = HyperLogLogCollector.makeLatestCollector(); for (BytesWritable value : values) { aggregate.fold( HyperLogLogCollector.makeCollector(ByteBuffer.wrap(value.getBytes(), 0, value.getLength())) ); } Interval interval; if (determineIntervals) { interval = config.getGranularitySpec().getSegmentGranularity().bucket(DateTimes.utc(key.get())); } else { Optional<Interval> intervalOptional = config.getGranularitySpec().bucketInterval(DateTimes.utc(key.get())); if (!intervalOptional.isPresent()) { throw new ISE("WTF?! No bucket found for timestamp: %s", key.get()); } interval = intervalOptional.get(); } intervals.add(interval); final Path outPath = config.makeSegmentPartitionInfoPath(interval); final OutputStream out = Utils.makePathAndOutputStream( context, outPath, config.isOverwriteFiles() ); try { HadoopDruidIndexerConfig.JSON_MAPPER.writerWithType( new TypeReference<Long>() { } ).writeValue( out, aggregate.estimateCardinalityRound() ); } finally { Closeables.close(out, false); } }
Source:
public String get(String name) { List<String> requestIdList = values(name); String requestId = null; if (requestIdList != null && requestIdList.size() > 0) { requestId = requestIdList.get(0); } return requestId; }

Target:
public String get(String name) { List<String> valuesList = values(name); String value = null; if (valuesList != null && valuesList.size() > 0) { value = valuesList.get(0); } return value; }
Source:
protected void executeCommand() { DbUser userToAdd = getParameters().getUserToAdd(); for (DbUser user : SyncUsers.sync(Arrays.asList(userToAdd))) { DbFacade.getInstance().getDbUserDao().saveOrUpdate(user); } setActionReturnValue(DbFacade.getInstance().getDbUserDao().getByExternalId(userToAdd.getDomain(), userToAdd.getExternalId()).getId()); setSucceeded(true); }

Target:
protected void executeCommand() { DbUser userToAdd = getParameters().getUserToAdd(); DbUser syncedUser = SyncUsers.sync(Arrays.asList(userToAdd)).get(0); if (Guid.isNullOrEmpty(syncedUser.getId()) && syncedUser.isActive()) { DbFacade.getInstance().getDbUserDao().save(syncedUser); } else { if (!Guid.isNullOrEmpty(syncedUser.getId())) { DbFacade.getInstance().getDbUserDao().update(syncedUser); } } setActionReturnValue(DbFacade.getInstance().getDbUserDao().getByExternalId(userToAdd.getDomain(), userToAdd.getExternalId()).getId()); setSucceeded(true); }
Source:
private void testGetFeedbackSessionsClosedWithinThePastHour() throws Exception { ______TS("init : 0 standard sessions closed within the past hour"); List<FeedbackSessionAttributes> sessionList = fsLogic.getFeedbackSessionsClosedWithinThePastHour(); assertEquals(0, sessionList.size()); ______TS("case : 1 closed session in undeleted course within the past hour"); FeedbackSessionAttributes session = getNewFeedbackSession(); session.setTimeZone(ZoneId.of("UTC")); session.setSessionVisibleFromTime(TimeHelper.getInstantDaysOffsetFromNow(-1)); session.setStartTime(TimeHelper.getInstantDaysOffsetFromNow(-1)); session.setEndTime(TimeHelperExtension.getInstantHoursOffsetFromNow(-1)); ThreadHelper.waitBriefly(); fsLogic.createFeedbackSession(session); sessionList = fsLogic.getFeedbackSessionsClosedWithinThePastHour(); assertEquals(1, sessionList.size()); assertEquals(session.getFeedbackSessionName(), sessionList.get(0).getFeedbackSessionName()); ______TS("case : 1 closed session in deleted course within the past hour"); coursesLogic.moveCourseToRecycleBin(session.getCourseId()); sessionList = fsLogic.getFeedbackSessionsClosedWithinThePastHour(); assertEquals(0, sessionList.size()); coursesLogic.restoreCourseFromRecycleBin(session.getCourseId()); fsLogic.deleteFeedbackSessionCascade(session.getFeedbackSessionName(), session.getCourseId()); }

Target:
private void testGetFeedbackSessionsClosedWithinThePastHour() throws Exception { ______TS("init : 0 standard sessions closed within the past hour"); List<FeedbackSessionAttributes> sessionList = fsLogic.getFeedbackSessionsClosedWithinThePastHour(); assertEquals(0, sessionList.size()); ______TS("case : 1 closed session in undeleted course within the past hour"); FeedbackSessionAttributes session = getNewFeedbackSession(); session.setTimeZone(ZoneId.of("UTC")); session.setSessionVisibleFromTime(TimeHelper.getInstantDaysOffsetFromNow(-1)); session.setStartTime(TimeHelper.getInstantDaysOffsetFromNow(-1)); session.setEndTime(TimeHelperExtension.getInstantMinutesOffsetFromNow(-59)); fsLogic.createFeedbackSession(session); sessionList = fsLogic.getFeedbackSessionsClosedWithinThePastHour(); assertEquals(1, sessionList.size()); assertEquals(session.getFeedbackSessionName(), sessionList.get(0).getFeedbackSessionName()); ______TS("case : 1 closed session in deleted course within the past hour"); coursesLogic.moveCourseToRecycleBin(session.getCourseId()); sessionList = fsLogic.getFeedbackSessionsClosedWithinThePastHour(); assertEquals(0, sessionList.size()); coursesLogic.restoreCourseFromRecycleBin(session.getCourseId()); fsLogic.deleteFeedbackSessionCascade(session.getFeedbackSessionName(), session.getCourseId()); }
Source:
<T> boolean containsJsonSerializable(Class<T> c) { return CompositePath.class.isAssignableFrom(c) || ConflictResolutionPolicy.class.isAssignableFrom(c) || ConsistencyPolicy.class.isAssignableFrom(c) || DatabaseAccountLocation.class.isAssignableFrom(c) || ExcludedPath.class.isAssignableFrom(c) || IncludedPath.class.isAssignableFrom(c) || IndexingPolicy.class.isAssignableFrom(c) || PartitionKeyDefinition.class.isAssignableFrom(c) || SpatialSpec.class.isAssignableFrom(c) || SqlParameter.class.isAssignableFrom(c) || SqlQuerySpec.class.isAssignableFrom(c) || UniqueKey.class.isAssignableFrom(c) || UniqueKeyPolicy.class.isAssignableFrom(c) || Index.class.isAssignableFrom(c) || CosmosError.class.isAssignableFrom(c); }

Target:
<T> boolean containsJsonSerializable(Class<T> c) { return CompositePath.class.equals(c) || ConflictResolutionPolicy.class.equals(c) || ConsistencyPolicy.class.equals(c) || DatabaseAccountLocation.class.equals(c) || ExcludedPath.class.equals(c) || IncludedPath.class.equals(c) || IndexingPolicy.class.equals(c) || PartitionKeyDefinition.class.equals(c) || SpatialSpec.class.equals(c) || SqlParameter.class.equals(c) || SqlQuerySpec.class.equals(c) || UniqueKey.class.equals(c) || UniqueKeyPolicy.class.equals(c) || Index.class.isAssignableFrom(c) || CosmosError.class.equals(c); }