auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private String getSparkMaster(Properties properties) { String master = properties.getProperty("master"); if (master == null) { master = properties.getProperty("spark.master"); if (master == null) { <START> master = System.getenv("SPARK_HOME"); <END> } if (master == null) { master = "local[*]"; } } return master; }</code><technical_language>wait? master != SPARK_HOME?!</technical_language>

Target:
private String getSparkMaster(Properties properties) { String master = properties.getProperty("master"); if (master == null) { master = properties.getProperty("spark.master"); if (master == null) { master = "local[*]"; } } return master; }
Source:
<code>private void initialDatagramSocket() { if (datagramSocket == null) synchronized (InfluxDBImpl.class) { <START> if (datagramSocket == null) <END> try { datagramSocket = new DatagramSocket(); } catch (SocketException e) { throw new RuntimeException(e); } } }</code><technical_language>missing brackets</technical_language>

Target:
private void initialDatagramSocket() { if (datagramSocket == null) { synchronized (InfluxDBImpl.class) { if (datagramSocket == null) { try { datagramSocket = new DatagramSocket(); } catch (SocketException e) { throw new RuntimeException(e); } } } } }
Source:
<code>private static Map<String, String> getLastSegment(String text) { Pattern pattern = Pattern.compile(REGEX_LAST_SEGMENT); Matcher matcher = pattern.matcher(text); Map<String, String> result = new HashMap<String, String>(); if (matcher.find()) { <START> result.put("operator", matcher.group(1)); <END> result.put("segment", matcher.group(2) == null ? "" : matcher.group(2)); } else { result.put("operator", null); result.put("segment", null); } return result; }</code><technical_language>a simple two-field class instead. immutable</technical_language>

Target:
private static LastSegment getLastSegment(String text) { Pattern pattern = Pattern.compile(REGEX_LAST_SEGMENT); Matcher matcher = pattern.matcher(text); if (matcher.find()) { return new LastSegment(matcher.group(1), matcher.group(2) == null ? "" : matcher.group(2)); } else { return new LastSegment(null, null); } }
Source:
<code>public <T> T getConfigurationObject(Class<T> configClass) throws CarbonConfigurationException { String namespace = null; if (configClass.isAnnotationPresent(Configuration.class)) { Configuration configuration = configClass.getAnnotation(Configuration.class); if (!Configuration.NULL.equals(configuration.namespace())) { namespace = configuration.namespace(); } } loadDeploymentConfiguration(configFileReader); if (namespace != null && deploymentConfigs.containsKey(namespace)) { String jsonConfigString = deploymentConfigs.get(namespace); String yamlConfigString = ConfigurationUtils.convertJSONToYAML(jsonConfigString); if (logger.isDebugEnabled()) { <START> logger.debug("class name: " + configClass.getSimpleName() + " | new configurations : \n" + <END> yamlConfigString); } String yamlProcessedString = processPlaceholder(yamlConfigString); yamlProcessedString = org.wso2.carbon.kernel.utils.Utils.substituteVariables(yamlProcessedString); Yaml yaml = new Yaml(new CustomClassLoaderConstructor(configClass, configClass.getClassLoader())); yaml.setBeanAccess(BeanAccess.FIELD); return yaml.loadAs(yamlProcessedString, configClass); } else { if (logger.isDebugEnabled()) { logger.debug("Deployment configuration mapping doesn't exist: " + "creating configuration instance with default values"); } try { return configClass.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new CarbonConfigurationException("Error while creating configuration Instance : " + configClass.getSimpleName(), e); } } }</code><technical_language>need remove space colon: "configurations : \n"</technical_language>

Target:
public <T> T getConfigurationObject(Class<T> configClass) throws CarbonConfigurationException { String namespace = null; if (configClass.isAnnotationPresent(Configuration.class)) { Configuration configuration = configClass.getAnnotation(Configuration.class); if (!Configuration.NULL.equals(configuration.namespace())) { namespace = configuration.namespace(); } } loadDeploymentConfiguration(configFileReader); if (namespace != null && deploymentConfigs.containsKey(namespace)) { String yamlConfigString = deploymentConfigs.get(namespace); if (logger.isDebugEnabled()) { logger.debug("class name: " + configClass.getSimpleName() + " | new configurations: \n" + yamlConfigString); } String yamlProcessedString = processPlaceholder(yamlConfigString); yamlProcessedString = org.wso2.carbon.kernel.utils.Utils.substituteVariables(yamlProcessedString); Yaml yaml = new Yaml(new CustomClassLoaderConstructor(configClass, configClass.getClassLoader())); yaml.setBeanAccess(BeanAccess.FIELD); return yaml.loadAs(yamlProcessedString, configClass); } else { if (logger.isDebugEnabled()) { logger.debug("Deployment configuration mapping doesn't exist: " + "creating configuration instance with default values"); } try { return configClass.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new CarbonConfigurationException("Error while creating configuration instance: " + configClass.getSimpleName(), e); } } }
Source:
<code><START> public Map.Entry<Value, V> next() { <END> left--; do { keysIndex++; if (keys[keysIndex] != null && keys[keysIndex] != ValueNull.DELETED) return new DataUtils.MapEntry<Value, V>(keys[keysIndex], values[keysIndex]); } while (true); }</code><technical_language>Java if (left <= 0) { throw new NoSuchElementException(); }</technical_language>

Target:
public Map.Entry<Value, V> next() { if (left <= 0) throw new NoSuchElementException(); left--; for (;;) { keysIndex++; Value key = keys[keysIndex]; if (key != null && key != ValueNull.DELETED) return new AbstractMap.SimpleImmutableEntry<Value, V>(key, values[keysIndex]); } }
Source:
<code>private boolean isTabAvailable(String tab, Map<String, List<String>> tabAccessMap, Authentication auth) { <START> if (tabAccessMap.get(tab).size() == 0) { <END> return true; } for (String permission : tabAccessMap.get(tab)) { if(auth.getAuthorities().contains(new SimpleGrantedAuthority(permission))) { return true; } } return false; }</code><technical_language>before, I guard null</technical_language>

Target:
private boolean isTabAvailable(String tab, Map<String, List<String>> tabAccessMap, Authentication auth) { if (tabAccessMap.get(tab) == null || tabAccessMap.get(tab).size() == 0) { return true; } else { for (String permission : tabAccessMap.get(tab)) { if(auth.getAuthorities().contains(new SimpleGrantedAuthority(permission))) { return true; } } } return false; }
Source:
<code>public void setDrmLicenseUrl(String licenseUrl){ <START> Log.d("setDrmLicenseUrl", licenseUrl); <END> this.drmLicenseUrl = licenseUrl; }</code><technical_language>I remove Log statements code is ready merged</technical_language>

Target:
public void setDrmLicenseUrl(String licenseUrl){ this.drmLicenseUrl = licenseUrl; }
Source:
<code>public CommandCallback getCallback() { <START> return getParameters().isUseCinderCommandCallback() ? Injector.injectMembers(new ConcurrentChildCommandsExecutionCallback()) : null; <END> }</code><technical_language>replace this a provider: import javax.enterprise.inject.Instance @Inject private Instance<ConcurrentChildCommandsExecutionCallback> callbackProvider; ... callBackProvider.get()</technical_language>

Target:
public CommandCallback getCallback() { return getParameters().isUseCinderCommandCallback() ? callbackProvider.get() : null; }
Source:
<code>public void saveFilterIntoPreferences(final FilterSettings filterSettings, final Consumer<Boolean> callback) { <START> saveFilterIntoPreferences(filterSettings, callback, () -> { <END> filterSavedEvent.fire(new SavedFilterAddedEvent(new SavedFilter(filterSettings.getKey(), filterSettings.getTableName(), false))); callback.accept(true); }); }</code><technical_language>impression is saveFilterIntoPreferences doesnt need changed, this extra logic part of callback, work</technical_language>

Target:
public void saveFilterIntoPreferences(final FilterSettings filterSettings, final Consumer<Boolean> callback) { filterSettings.setKey(getNewFilterSettingsKey()); loadMultiGridPreferencesStore(store -> { loadSavedFiltersFromPreferences(store, savedFilters -> { final Optional<SavedFilter> savedFilter = savedFilters.stream().filter(f -> f.getName().equalsIgnoreCase(filterSettings.getTableName())).findFirst(); if (savedFilter.isPresent()) { callback.accept(false); return; } addFilterToPreferencesStore(filterSettings, store); saveMultiGridPreferencesStore(store, () -> { filterSavedEvent.fire(new SavedFilterAddedEvent(new SavedFilter(filterSettings.getKey(), filterSettings.getTableName(), false))); callback.accept(true); }); }); }); }
Source:
<code>byte[] toBytes() { byte[] buf = new byte[Version_Length + Offset_Length + Size_Length + TTL_Length + storeKey.sizeInBytes()]; ByteBuffer bufWrap = ByteBuffer.wrap(buf); bufWrap.putShort(version); <START> bufWrap.putLong(offset.getOffset()); <END> bufWrap.putLong(size); bufWrap.putLong(TTL_Length); bufWrap.put(storeKey.toBytes()); return buf; }</code><technical_language>this needs fixing for version 1 if understanding is right</technical_language>

Target:
byte[] toBytes() { byte[] buf = new byte[VERSION_LENGTH + OFFSET_LENGTH + SIZE_LENGTH + EXPIRES_AT_MS_LENGTH + storeKey.sizeInBytes()]; ByteBuffer bufWrap = ByteBuffer.wrap(buf); bufWrap.putShort(VERSION); bufWrap.putLong(offset.getOffset()); bufWrap.putLong(size); bufWrap.putLong(expiresAtMs); bufWrap.put(storeKey.toBytes()); return buf; }
Source:
<code>static String getConsumerClientId(String id, Config config) { if (config.get(JobConfig.JOB_NAME()) == null) { throw new ConfigException("Missing job name"); } String jobName = config.get(JobConfig.JOB_NAME()); <START> String jobId = (config.get(JobConfig.JOB_ID()) != null) ? config.get(JobConfig.JOB_ID()) : "1"; <END> return String.format("%s-%s-%s", id.replaceAll("\\W", "_"), jobName.replaceAll("\\W", "_"), jobId.replaceAll("\\W", "_")); }</code><technical_language>Prefer JobConfig.getJobId, default 1</technical_language>

Target:
static String getConsumerClientId(String id, Config config) { JobConfig jobConfig = new JobConfig(config); Option jobNameOption = jobConfig.getName(); if (jobNameOption.isEmpty()) { throw new ConfigException("Missing job name"); } String jobName = (String) jobNameOption.get(); Option jobIdOption = jobConfig.getJobId(); String jobId = "1"; if (! jobIdOption.isEmpty()) { jobId = (String) jobIdOption.get(); } return String.format("%s-%s-%s", id.replaceAll("\\W", "_"), jobName.replaceAll("\\W", "_"), jobId.replaceAll("\\W", "_")); }
Source:
<code>public static void addData(final Crosstab<Number> mainCrosstab, final Crosstab<Number> partialCrosstab) { if (partialCrosstab != null) { final CrosstabNavigator<Number> mainNavigator = new CrosstabNavigator<Number>(mainCrosstab); final CrosstabNavigator<Number> nav = new CrosstabNavigator<Number>(partialCrosstab); final List<CrosstabDimension> dimensions = partialCrosstab.getDimensions(); for (CrosstabDimension dimension : dimensions) { final List<String> categories = dimension.getCategories(); for (String category : categories) { final Number categoryValue = nav.where(dimension, category).safeGet(null); final CrosstabNavigator<Number> whereToPut = mainNavigator.where(dimension, category); if (categoryValue != null) { final Number oldValue = whereToPut.safeGet(null); if (oldValue != null) { <START> final Number newValue = new BigDecimal(categoryValue.longValue()).add(new BigDecimal( <END> oldValue.longValue())); whereToPut.put(newValue); } else { whereToPut.put(categoryValue); } } } } } }</code><technical_language>get BigDecimal, double? request more try retain original type - in usual scenarios is Integer Long. Switching a decimal type a semantic impact</technical_language>

Target:
public static void addData(final Crosstab<Number> mainCrosstab, final Crosstab<Number> partialCrosstab) { if (partialCrosstab != null) { final CrosstabNavigator<Number> mainNavigator = new CrosstabNavigator<Number>(mainCrosstab); final CrosstabNavigator<Number> nav = new CrosstabNavigator<Number>(partialCrosstab); final List<CrosstabDimension> dimensions = partialCrosstab.getDimensions(); for (CrosstabDimension dimension : dimensions) { final List<String> categories = dimension.getCategories(); for (String category : categories) { final Number categoryValue = nav.where(dimension, category).safeGet(null); final CrosstabNavigator<Number> whereToPut = mainNavigator.where(dimension, category); if (categoryValue != null) { final Number oldValue = whereToPut.safeGet(null); if (oldValue != null) { final Number newValue = sum(oldValue, categoryValue); whereToPut.put(newValue); } else { whereToPut.put(categoryValue); } } } } } }
Source:
<code>protected Observable<RegistrationChannel> reestablish() { return Observable.create(new Observable.OnSubscribe<RegistrationChannel>() { @Override public void call(Subscriber<? super RegistrationChannel> subscriber) { try { RegistrationChannel newDelegateChannel = channelFactory.call(); InstanceInfo instanceInfo = instanceInfoRef.get(); if (instanceInfo != null) { <START> newDelegateChannel.register(instanceInfo); <END> } subscriber.onNext(newDelegateChannel); subscriber.onCompleted(); } catch (Exception e) { subscriber.onError(e); } } }); }</code><technical_language>need subscribe here, good chain this return observable</technical_language>

Target:
protected Observable<RegistrationChannel> reestablish() { return Observable.create(new Observable.OnSubscribe<RegistrationChannel>() { @Override public void call(final Subscriber<? super RegistrationChannel> subscriber) { try { final RegistrationChannel newDelegateChannel = channelFactory.call(); InstanceInfo instanceInfo = instanceInfoRef.get(); if (instanceInfo != null) { newDelegateChannel.register(instanceInfo).subscribe(new Subscriber<Void>() { @Override public void onCompleted() { logger.info("Retry re-registration completed"); subscriber.onNext(newDelegateChannel); subscriber.onCompleted(); } @Override public void onError(Throwable e) { logger.info("Retry re-registration failed"); subscriber.onError(e); } @Override public void onNext(Void aVoid) { } }); } else { logger.info("InstanceInfo is null, no need to re-register"); subscriber.onNext(newDelegateChannel); subscriber.onCompleted(); } } catch (Exception e) { subscriber.onError(e); } } }); }
Source:
<code>private Boolean isEmptyEvidence(Evidence queryEvidence) { EvidenceType evidenceType = queryEvidence.getEvidenceType(); String knownEffect = queryEvidence.getKnownEffect(); LevelOfEvidence level = queryEvidence.getLevelOfEvidence(); String description = queryEvidence.getDescription().trim(); Set<Treatment> treatments = queryEvidence.getTreatments(); Set<NccnGuideline> nccnGuidelines = queryEvidence.getNccnGuidelines(); Set<ClinicalTrial> clinicalTrials = queryEvidence.getClinicalTrials(); <START> List<EvidenceType> therapyEvidenceTypes = Arrays.asList(EvidenceType.STANDARD_THERAPEUTIC_IMPLICATIONS_FOR_DRUG_SENSITIVITY, EvidenceType.STANDARD_THERAPEUTIC_IMPLICATIONS_FOR_DRUG_RESISTANCE, <END> EvidenceType.INVESTIGATIONAL_THERAPEUTIC_IMPLICATIONS_DRUG_RESISTANCE, EvidenceType.INVESTIGATIONAL_THERAPEUTIC_IMPLICATIONS_DRUG_SENSITIVITY); Boolean isEmpty = false; if(evidenceType.equals(EvidenceType.ONCOGENIC) || evidenceType.equals(EvidenceType.MUTATION_EFFECT)) { if(knownEffect.isEmpty() && description.isEmpty()) isEmpty = true; } else if(evidenceType.equals(EvidenceType.NCCN_GUIDELINES)) { Boolean validNccn = false; for(NccnGuideline nccn : nccnGuidelines) { if(!nccn.isEmpty()) { validNccn = true; } } isEmpty = !validNccn; } else if(evidenceType.equals(EvidenceType.CLINICAL_TRIAL)) { if(clinicalTrials.isEmpty()) isEmpty = true; } else if(therapyEvidenceTypes.contains(evidenceType)) { if(treatments == null && description.isEmpty()) isEmpty = true; } else if(description.isEmpty()) { isEmpty = true; } return isEmpty; }</code><technical_language>MainUtils.getTreatmentEvidenceTypes()</technical_language>

Target:
private Boolean isEmptyEvidence(Evidence queryEvidence) { EvidenceType evidenceType = queryEvidence.getEvidenceType(); String knownEffect = queryEvidence.getKnownEffect(); String description = queryEvidence.getDescription().trim(); Set<Treatment> treatments = queryEvidence.getTreatments(); Set<NccnGuideline> nccnGuidelines = queryEvidence.getNccnGuidelines(); Set<ClinicalTrial> clinicalTrials = queryEvidence.getClinicalTrials(); Boolean isEmpty = false; if(evidenceType.equals(EvidenceType.ONCOGENIC) || evidenceType.equals(EvidenceType.MUTATION_EFFECT)) { if(StringUtils.isNullOrEmpty(knownEffect) && StringUtils.isNullOrEmpty(description)) isEmpty = true; } else if(evidenceType.equals(EvidenceType.NCCN_GUIDELINES)) { Boolean validNccn = false; for(NccnGuideline nccn : nccnGuidelines) { if(!nccn.isEmpty()) { validNccn = true; } } isEmpty = !validNccn; } else if(evidenceType.equals(EvidenceType.CLINICAL_TRIAL)) { if(clinicalTrials == null || clinicalTrials.isEmpty()) isEmpty = true; } else if(MainUtils.getTreatmentEvidenceTypes().contains(evidenceType)) { if(treatments == null && StringUtils.isNullOrEmpty(description)) isEmpty = true; } else if(StringUtils.isNullOrEmpty(description)) { isEmpty = true; } return isEmpty; }
Source:
<code>public void shouldSetStrictOnPlugin() { RuntimeOptions runtimeOptions = new RuntimeOptions("--strict"); Plugins plugins = new Plugins(getSystemClassLoader(), pluginFactory, runtimeOptions); StrictAware plugin = Mockito.mock(StrictAware.class); plugins.addPlugin(plugin); <START> plugins.setSerialEventBusOnEventListenerPlugins(rootEventPublisher); <END> verify(plugin).setStrict(true); }</code><technical_language>suggestion</technical_language>

Target:
public void shouldSetStrictOnPlugin() { RuntimeOptions runtimeOptions = new RuntimeOptions("--strict"); Plugins plugins = new Plugins(getSystemClassLoader(), pluginFactory, runtimeOptions); StrictAware plugin = Mockito.mock(StrictAware.class); plugins.addPlugin(plugin); verify(plugin).setStrict(true); }
Source:
<code><START> private final T newInstance(K alias, ClassInstanceConfiguration<T> config) { <END> if (config == null) { config = getPreconfigured(alias); if (config == null) { return null; } } T instance; if(config.getInstance() != null) { instance = config.getInstance(); } else { try { instance = invokeConstructor(config.getClazz(), config.getArguments()); instantiated.add(instance); } catch (InstantiationException | InvocationTargetException | NoSuchMethodException | IllegalAccessException e) { throw new RuntimeException(e); } } AtomicInteger currentCount = providedVsCount.putIfAbsent(instance, new AtomicInteger(1)); if(currentCount != null) { currentCount.incrementAndGet(); } return instance; }</code><technical_language>need for final, private</technical_language>

Target:
private T newInstance(K alias, ClassInstanceConfiguration<T> config) { if (config == null) { config = getPreconfigured(alias); if (config == null) { return null; } } T instance; if(config.getInstance() != null) { instance = config.getInstance(); } else { try { instance = invokeConstructor(config.getClazz(), config.getArguments()); instantiated.add(instance); } catch (InstantiationException | InvocationTargetException | NoSuchMethodException | IllegalAccessException e) { throw new RuntimeException(e); } } AtomicInteger currentCount = providedVsCount.putIfAbsent(instance, new AtomicInteger(1)); if(currentCount != null) { currentCount.incrementAndGet(); } return instance; }
Source:
<code>public void testRetrieveSnippet() throws GitLabApiException { Snippet snippet = createSnippet (new Snippet( "Xml Snippet", "file.xml", "<parent><data>1</data></parent>", Visibility.INTERNAL, "Description")); <START> <END> SnippetsApi api = gitLabApi.getSnippetApi(); Snippet savedSnippet = api.getSnippet(snippet.getId()); assertEquals("Xml Snippet", savedSnippet.getTitle()); assertEquals("file.xml", savedSnippet.getFileName()); assertEquals("<parent><data>1</data></parent>", savedSnippet.getContent()); assertEquals("Description", savedSnippet.getDescription()); deleteSnippet(savedSnippet); }</code><technical_language>recommendation for a constant for content</technical_language>

Target:
public void testRetrieveSnippet() throws GitLabApiException { Snippet snippet = createSnippet (new Snippet(TEST_SNIPPET_TITLE_1, TEST_SNIPPET_FILE_NAME_1, TEST_SNIPPET_CONTENT_1, Visibility.INTERNAL, TEST_SNIPPET_DESCRIPTION_1)); SnippetsApi api = gitLabApi.getSnippetApi(); Snippet savedSnippet = api.getSnippet(snippet.getId(), true); assertEquals(TEST_SNIPPET_TITLE_1, savedSnippet.getTitle()); assertEquals(TEST_SNIPPET_FILE_NAME_1, savedSnippet.getFileName()); assertEquals(TEST_SNIPPET_CONTENT_1, savedSnippet.getContent()); assertEquals(TEST_SNIPPET_DESCRIPTION_1, savedSnippet.getDescription()); deleteSnippet(savedSnippet); }
Source:
<code>protected void <START> executeQueryCommand() <END> { List<Disk> allDisks = diskDao.getAllFromDisksIncludingSnapshotsByDiskId(getParameters().getId(), getUserID(), getParameters().isFiltered()); if (allDisks.size() == 1 ){ getQueryReturnValue().setReturnValue(allDisks.get(0)); return; } List<Disk> diskWithSnapshots = imagesHandler.fillSnapshotsToDiskImages(allDisks.stream() .map(DiskImage.class::cast) .collect(Collectors.toList())); getQueryReturnValue().setReturnValue(diskWithSnapshots.get(0)); }</code><technical_language>a lot better</technical_language>

Target:
protected void executeQueryCommand() { List<Disk> allDisks = diskDao.getAllFromDisksIncludingSnapshotsByDiskId(getParameters().getId(), getUserID(), getParameters().isFiltered()); if (allDisks.size() == 1){ getQueryReturnValue().setReturnValue(allDisks.get(0)); return; } List<Disk> diskWithSnapshots = (List<Disk>)imagesHandler.aggregateDiskImagesSnapshots(allDisks.stream() .map(DiskImage.class::cast) .collect(Collectors.toList())); getQueryReturnValue().setReturnValue(diskWithSnapshots.get(0)); }
Source:
<code>public void onCreate() { if (existsLoggedUser()) { <START> LoadCredentialsUseCase loadUserAndCredentialsUseCase =new AuthenticationFactory().getloadCredentialsUseCase(loginActivity); <END> loadUserAndCredentialsUseCase.execute(new LoadCredentialsUseCase.Callback() { @Override public void onSuccess(Credentials credentials) { finishAndGo(DashboardActivity.class); } }); } else { loginActivity.runOnUiThread(new Runnable() { public void run() { addDemoButton(); } }); } }</code><technical_language>necessary invoke load credentials case here? credentials this code</technical_language>

Target:
public void onCreate() { if (existsLoggedUser()) { finishAndGo(DashboardActivity.class); } else { loginActivity.runOnUiThread(new Runnable() { public void run() { addDemoButton(); } }); } }
Source:
<code>public void identifyUser(HttpServletRequest request, HttpServletResponse response) throws IOException, UserIdentityException { String sessionID = RequestUtils.getSessionId(request); if (StringUtils.isEmpty(sessionID)) { Error responseBody = new Error("user not authenticated"); logWarn(responseBody.getMessage()).log(); writeResponse(response, responseBody, SC_UNAUTHORIZED); return; } try { UserIdentity identity = getAuthorisationService().identifyUser(sessionID); logInfo("authenticated user identity confirmed") .sessionID(sessionID) .user(identity.getEmail()) .log(); writeResponse(response, identity, SC_OK); } catch (UserIdentityException e) { <START> writeResponse(response, new Error(e.getMessage()), e.getResponseCode()); <END> } }</code><technical_language>Is worth logging out response</technical_language>

Target:
public void identifyUser(HttpServletRequest request, HttpServletResponse response) throws IOException, UserIdentityException { if (StringUtils.isNotBlank(request.getHeader(AUTHORIZATION_HEADER))) { ServiceAccount serviceAccount = findService(request); if (serviceAccount != null) { if (request.getHeader(RequestUtils.TOKEN_HEADER) != null) { findUser(request, response); return; } else { writeResponse(response, new UserIdentity(serviceAccount.getId()), SC_OK); return; } } } writeResponse(response, new Error("service not authenticated"), SC_UNAUTHORIZED); }
Source:
<code>private Set<RulerColumnPlacementConstraint> readIds(IConfigurationElement[] children) throws CoreException { Set<RulerColumnPlacementConstraint> constraints= new LinkedHashSet<>((int) (children.length / 0.75) + 1, 0.75f); for (IConfigurationElement child : children) { String name= child.getName(); ExtensionPointHelper childHelper= new ExtensionPointHelper(child); boolean before; <START> switch (name) { <END> case AFTER: before= false; break; case BEFORE: before= true; break; default: childHelper.fail(RulerColumnMessages.RulerColumnPlacement_illegal_child_msg); continue; } constraints.add(new RulerColumnPlacementConstraint(childHelper.getNonNullAttribute(ID), before)); } return Collections.unmodifiableSet(constraints); }</code><technical_language>Is a null guard needed</technical_language>

Target:
private Set<RulerColumnPlacementConstraint> readIds(IConfigurationElement[] children) throws CoreException { Set<RulerColumnPlacementConstraint> constraints= new LinkedHashSet<>((int) (children.length / 0.75) + 1, 0.75f); for (IConfigurationElement child : children) { String name= child.getName(); ExtensionPointHelper childHelper= new ExtensionPointHelper(child); if (name == null) { childHelper.fail(RulerColumnMessages.RulerColumnPlacement_illegal_child_msg); continue; } boolean before; switch (name) { case AFTER: before= false; break; case BEFORE: before= true; break; default: childHelper.fail(RulerColumnMessages.RulerColumnPlacement_illegal_child_msg); continue; } constraints.add(new RulerColumnPlacementConstraint(childHelper.getNonNullAttribute(ID), before)); } return Collections.unmodifiableSet(constraints); }
Source:
<code>public Builder setChannelCount(int channelCount) { <START> this.channelCount = channelCount; <END> return this; }</code><technical_language>validation? channel count > 0</technical_language>

Target:
public Builder setChannelCount(int channelCount) { Preconditions.checkArgument(channelCount > 0, "Channel count has to be at least 1."); this.channelCount = channelCount; return this; }
Source:
<code>void viaQueueNameWithTopicNotAllowed() { assertThrows(IllegalArgumentException.class, () -> { final ServiceBusClientBuilder builder = new ServiceBusClientBuilder(); <START> builder.connectionString(NAMESPACE_CONNECTION_STRING) <END> .sender() .topicName(TOPIC_NAME) .viaQueueName(VIA_QUEUE_NAME) .buildAsyncClient(); }); }</code><technical_language>This scoped build method is invoked</technical_language>

Target:
void viaQueueNameWithTopicNotAllowed() { ServiceBusSenderClientBuilder builder = new ServiceBusClientBuilder() .connectionString(NAMESPACE_CONNECTION_STRING) .sender() .topicName(TOPIC_NAME) .viaQueueName(VIA_QUEUE_NAME); assertThrows(IllegalStateException.class, () -> builder.buildAsyncClient()); }
Source:
<code>public void run() { long now = timeProvider.getTime(); if (logger.isTraceEnabled()) { logger.trace(hashCode() + " running at " + now); } List<Requester> dueRequesters = getDueRequesters(now); if (logger.isTraceEnabled()) { logger.trace(hashCode() + " has " + dueRequesters.size() + " due requesters"); } <START> List<NACKPacket> nackPackets = createNackPackets(now, dueRequesters); <END> if (logger.isTraceEnabled()) { logger.trace(hashCode() + " injecting " + nackPackets.size() + " nack packets"); } injectNackPackets(nackPackets); }</code><technical_language>Do want hold lock getDueRequesters createNackPackets</technical_language>

Target:
public void run() { long now = timeProvider.currentTimeMillis(); if (logger.isTraceEnabled()) { logger.trace(hashCode() + " running at " + now); } List<Requester> dueRequesters = getDueRequesters(now); if (logger.isTraceEnabled()) { logger.trace(hashCode() + " has " + dueRequesters.size() + " due requesters"); } if (!dueRequesters.isEmpty()) { List<NACKPacket> nackPackets = createNackPackets(now, dueRequesters); if (logger.isTraceEnabled()) { logger.trace(hashCode() + " injecting " + nackPackets.size() + " nack packets"); } if (!nackPackets.isEmpty()) { injectNackPackets(nackPackets); } } }
Source:
<code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.player_skin_multiaudio_layout); completePlayerSetup(asked); Button setTrackButton = findViewById(R.id.setTrackButton); setTrackButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { <START> if (player != null && currentAudioTrack != null) { <END> setAudioTrack(); } } }); }</code><technical_language>extract this actions in separate method</technical_language>

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.player_skin_multiaudio_layout); completePlayerSetup(asked); initButtonListener(); }
Source:
<code>protected boolean canDoAction() { if (getVdsGroup() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_CLUSTER_CAN_NOT_BE_EMPTY); } <START> if (!FeatureSupported.vmSlaPolicy(getVdsGroup().getcompatibility_version())) { <END> return failCanDoAction(VdcBllMessages.VM_SLA_POLICY_NOT_SUPPORTED); } if (getVm() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_EXIST); } if (getVm().getStatus() != VMStatus.Up || getVm().getRunOnVds() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_STATUS_ILLEGAL, LocalizedVmStatus.from(getVm().getStatus())); } return true; }</code><technical_language>fetch compatibility version VM fetch cluster</technical_language>

Target:
protected boolean canDoAction() { if (getVm() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_EXIST); } if (getVm().getStatus() != VMStatus.Up) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_STATUS_ILLEGAL, LocalizedVmStatus.from(getVm().getStatus())); } if (!FeatureSupported.vmSlaPolicy(getVm().getVdsGroupCompatibilityVersion())) { return failCanDoAction(VdcBllMessages.VM_SLA_POLICY_NOT_SUPPORTED); } return true; }
Source:
<code>public void testSort() { ArrayList<SessionAttributes> testList = new ArrayList<SessionAttributes>(); ArrayList<SessionAttributes> expected = new ArrayList<SessionAttributes>(); Calendar cal = Calendar.getInstance(); cal.set(2014, 0, 1); Date time1 = cal.getTime(); cal.set(2014, 1, 1); Date time2 = cal.getTime(); cal.set(2014, 2, 1); Date time3 = cal.getTime(); SessionAttributes s1; SessionAttributes s2; SessionAttributes s3; SessionAttributes s4; <START> SessionAttributes s5; <END> s1 = new miniFeedback(time1, time2, "Session 1"); s2 = new miniEval(time2, time3, "Session 2"); s3 = new miniFeedback(time1, time2, "Session 3"); s4 = new miniEval(time1, time3, "Session 4"); s5 = new miniFeedback(time2, time3, "Session 5"); testList.add(s1); testList.add(s2); testList.add(s3); testList.add(s4); testList.add(s5); expected.add(s1); expected.add(s3); expected.add(s4); expected.add(s2); expected.add(s5); Collections.sort(testList, SessionAttributes.ASCENDING_ORDER); for (int i = 0; i < testList.size(); i++) { assertEquals(expected.get(i), testList.get(i)); } testList.clear(); testList.add(s1); testList.add(s2); testList.add(s3); testList.add(s4); testList.add(s5); expected.clear(); expected.add(s2); expected.add(s5); expected.add(s4); expected.add(s1); expected.add(s3); Collections.sort(testList, SessionAttributes.DESCENDING_ORDER); for (int i = 0; i < testList.size(); i++) { assertEquals(expected.get(i), testList.get(i)); } }</code><technical_language>moved there, e.g SessionAttributes s1 = ... etc</technical_language>

Target:
public void testSort() { ArrayList<SessionAttributes> testList = new ArrayList<SessionAttributes>(); ArrayList<SessionAttributes> expected = new ArrayList<SessionAttributes>(); Calendar cal = Calendar.getInstance(); cal.set(2014, 0, 1); Date time1 = cal.getTime(); cal.set(2014, 1, 1); Date time2 = cal.getTime(); cal.set(2014, 2, 1); Date time3 = cal.getTime(); SessionAttributes s1 = new miniFeedback(time1, time2, "Session 1"); SessionAttributes s2 = new miniEval(time2, time3, "Session 2"); SessionAttributes s3 = new miniFeedback(time1, time2, "Session 3"); SessionAttributes s4 = new miniEval(time1, time3, "Session 4"); SessionAttributes s5 = new miniFeedback(time2, time3, "Session 5"); testList.add(s1); testList.add(s2); testList.add(s3); testList.add(s4); testList.add(s5); expected.add(s1); expected.add(s3); expected.add(s4); expected.add(s2); expected.add(s5); Collections.sort(testList, SessionAttributes.ASCENDING_ORDER); for (int i = 0; i < testList.size(); i++) { assertEquals(expected.get(i), testList.get(i)); } testList.clear(); testList.add(s1); testList.add(s2); testList.add(s3); testList.add(s4); testList.add(s5); expected.clear(); expected.add(s2); expected.add(s5); expected.add(s4); expected.add(s1); expected.add(s3); Collections.sort(testList, SessionAttributes.DESCENDING_ORDER); for (int i = 0; i < testList.size(); i++) { assertEquals(expected.get(i), testList.get(i)); } }
Source:
<code>public static <T> Pair<String, String> getDataSourceAndIntervalStrings(final Query<T> query) { final List<String> datasourceNames = new ArrayList<>(); final List<String> intervals = new ArrayList<>(); query.getDataSources().forEach(spec -> { datasourceNames.addAll(spec.getDataSource().getNames()); intervals.addAll( <START> spec.getQuerySegmentSpec().getIntervals().stream().map(Interval::toString).collect(Collectors.toList()) <END> ); }); return new Pair<>( datasourceNames.stream().collect(Collectors.joining(",", "[", "]")), intervals.stream().collect(Collectors.joining(",", "[", "]")) ); }</code><technical_language>forEach(intervals::add) avoids materializing extra list</technical_language>

Target:
public static <T> Pair<String, String> getDataSourceAndIntervalStrings(final Query<T> query) { final List<String> datasourceNames = new ArrayList<>(); final List<String> intervals = new ArrayList<>(); query.getDataSources().forEach(spec -> { datasourceNames.addAll(spec.getDataSource().getNames()); spec.getQuerySegmentSpec().getIntervals().stream().map(Interval::toString).forEach(intervals::add); }); return new Pair<>(datasourceNames.toString(), intervals.toString()); }
Source:
<code>public HandlerResult handle(ProcessState state, ProcessInstance process) { Instance instance = (Instance) state.getResource(); List<InstanceHostMap> instanceHostMappings = objectManager.find(InstanceHostMap.class, INSTANCE_HOST_MAP.INSTANCE_ID, instance.getId()); if (instanceHostMappings.size() == 0) { return null; } InstanceHostMap mapping = instanceHostMappings.get(0); CacheManager cm = CacheManager.getCacheManagerInstance(this.objectManager); <START> HostInfo hostInfo = cm.getHostInfo(mapping.getHostId()); <END> hostInfo.removeInstance(mapping.getInstanceId()); log.debug("removed instance info from host info in cache manager", instance.getId(), mapping.getHostId()); return null; }</code><technical_language>safe side, check if hostInfo is null here</technical_language>

Target:
public HandlerResult handle(ProcessState state, ProcessInstance process) { Instance instance = (Instance) state.getResource(); if (instance == null) { return null; } List<InstanceHostMap> instanceHostMappings = objectManager.find(InstanceHostMap.class, INSTANCE_HOST_MAP.INSTANCE_ID, instance.getId()); for (InstanceHostMap mapping : instanceHostMappings) { CacheManager cm = CacheManager.getCacheManagerInstance(this.objectManager); HostInfo hostInfo = cm.getHostInfo(mapping.getHostId(), false); if (hostInfo == null) { return null; } InstanceInfo instanceInfo = hostInfo.removeInstance(mapping.getInstanceId()); if (instanceInfo != null) { log.debug("removed instance info from host info in cache manager", instance.getId(), mapping.getHostId()); } } return null; }
Source:
<code>public void checkAttributeSyntax(PerunSessionImpl perunSession, String key, Attribute attribute) throws InternalErrorException, WrongAttributeValueException { Integer maxUID = attribute.valueAsInteger(); <START> if(maxUID != null && maxUID < 1) throw new WrongAttributeValueException(attribute, "Attribute value must be min 1."); <END> }</code><technical_language>I change message "Attribute bigger 0."</technical_language>

Target:
public void checkAttributeSyntax(PerunSessionImpl perunSession, String key, Attribute attribute) throws InternalErrorException, WrongAttributeValueException { Integer maxUID = attribute.valueAsInteger(); if(maxUID != null && maxUID < 1) throw new WrongAttributeValueException(attribute, "Attribute value must be bigger than 0."); }
Source:
<code><START> public static Mono<byte[]> downloadFileAsync(String url, HttpPipeline httpPipeline) { <END> FileService service = RestProxy.create(FileService.class, httpPipeline); try { return stringResponse(service.download(getHost(url), getPathAndQuery(url))) .map(simpleResponse -> simpleResponse.getValue().getBytes(Charset.defaultCharset())); } catch (MalformedURLException ex) { return Mono.empty(); } }</code><technical_language>is in main? I assume this is needed in test</technical_language>

Target:
public static Mono<byte[]> downloadFileAsync(String url, HttpPipeline httpPipeline) { FileService service = RestProxy.create(FileService.class, httpPipeline); try { return service.download(getHost(url), getPathAndQuery(url)) .flatMap(response -> FluxUtil.collectBytesInByteBufferStream(response.getValue())); } catch (MalformedURLException ex) { return Mono.error(() -> ex); } }
Source:
<code>private List<String> takeOpenFiles(Collection<String> files, Map<FileSKVIterator,String> readersReserved) { List<String> filesToOpen = Collections.emptyList(); for (String file : files) { List<OpenReader> ofl = openFiles.get(file); if (ofl != null && ofl.size() > 0) { OpenReader openReader = ofl.remove(ofl.size() - 1); readersReserved.put(openReader.reader, file); if (ofl.size() == 0) { openFiles.remove(file); } } else { <START> if(filesToOpen.size() == 0) { <END> filesToOpen = new ArrayList<>(files.size()); } filesToOpen.add(file); } } return filesToOpen; }</code><technical_language>isEmpty()</technical_language>

Target:
private List<String> takeOpenFiles(Collection<String> files, Map<FileSKVIterator,String> readersReserved) { List<String> filesToOpen = Collections.emptyList(); for (String file : files) { List<OpenReader> ofl = openFiles.get(file); if (ofl != null && ofl.size() > 0) { OpenReader openReader = ofl.remove(ofl.size() - 1); readersReserved.put(openReader.reader, file); if (ofl.size() == 0) { openFiles.remove(file); } } else { if (filesToOpen.isEmpty()) { filesToOpen = new ArrayList<>(files.size()); } filesToOpen.add(file); } } return filesToOpen; }
Source:
<code>public void beginReleasePhoneNumbers(HttpClient httpClient) { PhoneNumber phoneNumber = new PhoneNumber(PHONENUMBER_TO_RELEASE); List<PhoneNumber> phoneNumbers = new ArrayList<>(); phoneNumbers.add(phoneNumber); Duration pollInterval = Duration.ofSeconds(5); PollerFlux<PhoneNumberRelease, PhoneNumberRelease> poller = this.getClient(httpClient).beginReleasePhoneNumbers(phoneNumbers, pollInterval); <START> AsyncPollResponse<PhoneNumberRelease, PhoneNumberRelease> asyncRes = <END> poller.takeUntil(apr -> apr.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COMPLETED). blockLast(); PhoneNumberRelease testResult = asyncRes.getValue(); assertEquals(ReleaseStatus.COMPLETE, testResult.getStatus()); }</code><technical_language>Didnt block instead stepVerifier in tests</technical_language>

Target:
public void beginReleasePhoneNumbers(HttpClient httpClient) { PhoneNumber phoneNumber = new PhoneNumber(PHONENUMBER_TO_RELEASE); List<PhoneNumber> phoneNumbers = new ArrayList<>(); phoneNumbers.add(phoneNumber); Duration pollInterval = Duration.ofSeconds(1); PollerFlux<PhoneNumberRelease, PhoneNumberRelease> poller = this.getClient(httpClient).beginReleasePhoneNumbers(phoneNumbers, pollInterval); Mono<AsyncPollResponse<PhoneNumberRelease, PhoneNumberRelease>> asyncRes = poller.last(); StepVerifier.create(asyncRes) .assertNext(item -> { assertEquals(ReleaseStatus.COMPLETE, item.getValue().getStatus()); }) .verifyComplete(); }
Source:
<code>public void onMessageReceived(RemoteMessage remoteMessage) { CloudMessaging cloudMessaging = new CloudMessaging(); cloudMessaging.initialize(remoteMessage); String title = cloudMessaging.getTitle(); String message = cloudMessaging.getMessage(); String webPageUrl = cloudMessaging.getWebPageUrl(); <START> if (!cloudMessaging.isValidData()) { <END> return; } showNotification(title, message, webPageUrl); }</code><technical_language>this check performed getters called</technical_language>

Target:
public void onMessageReceived(RemoteMessage remoteMessage) { CloudMessaging cloudMessaging = new CloudMessaging(this, new NotificationBuilderProvider(this), (NotificationManager) getSystemService(NOTIFICATION_SERVICE)); cloudMessaging.showNotification(new CloudMessage(remoteMessage)); }
Source:
<code>private List<Instant> deserializeListOfInstant(Message amqpMessage) { List<Instant> listInstant = new ArrayList<>(); if (amqpMessage.getBody() instanceof AmqpValue) { AmqpValue amqpValue = ((AmqpValue) amqpMessage.getBody()); if (amqpValue.getValue() instanceof Map) { @SuppressWarnings("unchecked") Map<String, Object> responseBody = (Map<String, Object>) amqpValue.getValue(); Object expirationListObj = responseBody.get(REQUEST_RESPONSE_EXPIRATIONS); <START> if (expirationListObj instanceof Date[]) { <END> listInstant = Arrays.stream((Date[]) expirationListObj) .map(Date::toInstant) .collect(Collectors.toList()); } } } return listInstant; }</code><technical_language>suggestion if (expirationListObj instanceof Date[]) {</technical_language>

Target:
private List<Instant> deserializeListOfInstant(Message amqpMessage) { if (amqpMessage.getBody() instanceof AmqpValue) { AmqpValue amqpValue = ((AmqpValue) amqpMessage.getBody()); if (amqpValue.getValue() instanceof Map) { @SuppressWarnings("unchecked") Map<String, Object> responseBody = (Map<String, Object>) amqpValue.getValue(); Object expirationListObj = responseBody.get(REQUEST_RESPONSE_EXPIRATIONS); if (expirationListObj instanceof Date[]) { return Arrays.stream((Date[]) expirationListObj) .map(Date::toInstant) .collect(Collectors.toList()); } } } return Collections.emptyList(); }
Source:
<code>protected void logSlowLockAcquisition(String lockId, LockClient currentHolder, long durationMillis) { <START> final String slowLockLogMessage = "Blocked for ms to acquire lock {}."; <END> Object[] messageParams = ImmutableList.of( SafeArg.of("durationMillis", durationMillis), UnsafeArg.of("lockId", lockId), SafeArg.of("outcome", currentHolder == null ? "successfully" : "unsuccessfully")).toArray(); if (isSlowLogEnabled() && durationMillis >= slowLogTriggerMillis) { SlowLockLogger.logger.info(slowLockLogMessage, messageParams); } else if (log.isDebugEnabled() && durationMillis > DEBUG_SLOW_LOG_TRIGGER_MILLIS) { log.debug(slowLockLogMessage, messageParams); } }</code><technical_language>I log message construction in of branches save construct collection convert array of time need do things</technical_language>

Target:
protected void logSlowLockAcquisition(String lockId, LockClient currentHolder, long durationMillis) { final String slowLockLogMessage = "Blocked for ms to acquire lock {}."; if (isSlowLogEnabled() && durationMillis >= slowLogTriggerMillis) { SlowLockLogger.logger.info(slowLockLogMessage, constructSlowLockLogParams(lockId, currentHolder, durationMillis)); } else if (log.isDebugEnabled() && durationMillis > DEBUG_SLOW_LOG_TRIGGER_MILLIS) { log.debug(slowLockLogMessage, constructSlowLockLogParams(lockId, currentHolder, durationMillis)); } }
Source:
<code>public void handleRetry(MotechEvent event) { <START> LOGGER.info("Handling the motech event with subject: {}", event.getSubject()); <END> Map<String, Object> eventParams = event.getParameters(); Task task = taskService.getTask((Long) eventParams.get(TASK_ID)); if (task == null) { unscheduleTaskRetries((String) eventParams.get(JOB_SUBJECT)); } else if (task.isEnabled()) { handleTask(task, eventParams); } }</code><technical_language>wise, distinguish this log regular handle method</technical_language>

Target:
public void handleRetry(MotechEvent event) { LOGGER.info("Handling the motech event with subject: for task retry", event.getSubject()); Map<String, Object> eventParams = event.getParameters(); Task task = taskService.getTask((Long) eventParams.get(TASK_ID)); if (task == null) { unscheduleTaskRetry((String) eventParams.get(JOB_SUBJECT)); } else if (task.isEnabled()) { handleTask(task, eventParams); } }
Source:
<code>public void processLeftData(final MistDataEvent input) { <START> if (input.getValue() instanceof WindowData) { <END> final WindowData<Tuple2<T, U>> window = (WindowData)input.getValue(); final Collection<T> firstInputList = new LinkedList<>(); final Collection<U> secondInputList = new LinkedList<>(); final Collection<Tuple2<T, U>> outputList = new LinkedList<>(); final Iterator<Tuple2<T, U>> inputIterator = window.getDataCollection().iterator(); while (inputIterator.hasNext()) { final Tuple2<T, U> tuple = inputIterator.next(); if (tuple.get(0) != null) { firstInputList.add((T)tuple.get(0)); } else { secondInputList.add((U)tuple.get(1)); } } final Iterator<T> firstInputIterator = firstInputList.iterator(); while (firstInputIterator.hasNext()) { final T firstInput = firstInputIterator.next(); final Iterator<U> secondInputIterator = secondInputList.iterator(); while (secondInputIterator.hasNext()) { final U secondInput = secondInputIterator.next(); if (joinBiPredicate.test(firstInput, secondInput)) { outputList.add(new Tuple2<>(firstInput, secondInput)); } } } window.setDataCollection(outputList); input.setValue(window); outputEmitter.emitData(input); } else { throw new TypeMismatchException( "The input value for join operator is not an instance implementing Window."); } }</code><technical_language>try catch instead of if else</technical_language>

Target:
public void processLeftData(final MistDataEvent input) { try { final WindowData<Tuple2<T, U>> windowData = (WindowData)input.getValue(); final Collection<T> firstInputList = new LinkedList<>(); final Collection<U> secondInputList = new LinkedList<>(); final Collection<Tuple2<T, U>> outputList = new LinkedList<>(); final Iterator<Tuple2<T, U>> inputIterator = windowData.getDataCollection().iterator(); while (inputIterator.hasNext()) { final Tuple2<T, U> tuple = inputIterator.next(); if (tuple.get(0) != null) { firstInputList.add((T)tuple.get(0)); } else { secondInputList.add((U)tuple.get(1)); } } final Iterator<T> firstInputIterator = firstInputList.iterator(); while (firstInputIterator.hasNext()) { final T firstInput = firstInputIterator.next(); final Iterator<U> secondInputIterator = secondInputList.iterator(); while (secondInputIterator.hasNext()) { final U secondInput = secondInputIterator.next(); if (joinBiPredicate.test(firstInput, secondInput)) { outputList.add(new Tuple2<>(firstInput, secondInput)); } } } final long windowStart = windowData.getStart(); final long windowSize = windowData.getEnd() - windowStart + 1; final WindowImpl<Tuple2<T, U>> window = new WindowImpl<>(windowStart, windowSize, outputList); input.setValue(window); outputEmitter.emitData(input); } catch (final ClassCastException e) { throw e; } }
Source:
<code>Object[][] data_lengthOfMonth() { return new Object[][] { { 1900, 1, 28 }, { 1900, 2, 28 }, { 1900, 3, 28 }, { 1900, 4, 28 }, { 1900, 5, 28 }, { 1900, 6, 28 }, { 1900, 7, 28 }, { 1900, 8, 28 }, { 1900, 9, 28 }, { 1900, 10, 28 }, { 1900, 11, 28 }, { 1900, 12, 28 }, { 1900, 13, 28 }, <START> { 1901, 13, 28 }, <END> { 1902, 13, 28 }, { 1903, 13, 28 }, { 1904, 13, 28 }, { 1905, 13, 28 }, { 1906, 13, 28 }, { 2000, 13, 28 }, { 2100, 13, 28 }, }; }</code><technical_language>This is set I referring to. Month 13 in this calendar _always_ 28 days, testing this is pointless. need testing "length" of leap-day year-day months. need choose a year, though, 1900 a leap-year here</technical_language>

Target:
Object[][] data_lengthOfMonth() { return new Object[][] { {1900, 1, 28}, {1900, 2, 28}, {1900, 3, 28}, {1900, 4, 28}, {1900, 5, 28}, {1900, 6, 28}, {1900, 7, 28}, {1900, 8, 28}, {1900, 9, 28}, {1900, 10, 28}, {1900, 11, 28}, {1900, 12, 28}, {1900, 13, 28}, }; }