auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void populateAuthnReqDTO(HttpServletRequest req, SAMLSSOAuthnReqDTO authnReqDTO, SAMLSSOSessionDTO sessionDTO, AuthenticationResult authResult) throws UserStoreException, IdentityException { authnReqDTO.setAssertionConsumerURL(sessionDTO.getAssertionConsumerURL()); authnReqDTO.setId(sessionDTO.getRequestID()); authnReqDTO.setIssuer(sessionDTO.getIssuer()); authnReqDTO.setSubject(sessionDTO.getSubject()); authnReqDTO.setRpSessionId(sessionDTO.getRelyingPartySessionId()); authnReqDTO.setRequestMessageString(sessionDTO.getRequestMessageString()); authnReqDTO.setQueryString(sessionDTO.getHttpQueryString()); authnReqDTO.setDestination(sessionDTO.getDestination()); authnReqDTO.setUser(authResult.getSubject()); authnReqDTO.setIdPInitSSOEnabled(sessionDTO.isIdPInitSSO()); authnReqDTO.setClaimMapping(authResult.getClaimMapping()); authnReqDTO.setTenantDomain(sessionDTO.getTenantDomain()); authnReqDTO.setIdPInitSLOEnabled(sessionDTO.isIdPInitSLO()); <START> if (StringUtils.isNotBlank(sessionDTO.getAttributeConsumingServiceIndex())) { <END> authnReqDTO.setAttributeConsumingServiceIndex(Integer.parseInt(sessionDTO.getAttributeConsumingServiceIndex())); } SAMLSSOUtil.setIsSaaSApplication(authResult.isSaaSApp()); SAMLSSOUtil.setUserTenantDomain(authResult.getSubject().getTenantDomain()); }</code><technical_language>if this is a string a number ? get a NumberFormatException line. correct do this checking StringUtils.isNumeric</technical_language>

Target:
private void populateAuthnReqDTO(HttpServletRequest req, SAMLSSOAuthnReqDTO authnReqDTO, SAMLSSOSessionDTO sessionDTO, AuthenticationResult authResult) throws UserStoreException, IdentityException { authnReqDTO.setAssertionConsumerURL(sessionDTO.getAssertionConsumerURL()); authnReqDTO.setId(sessionDTO.getRequestID()); authnReqDTO.setIssuer(sessionDTO.getIssuer()); authnReqDTO.setSubject(sessionDTO.getSubject()); authnReqDTO.setRpSessionId(sessionDTO.getRelyingPartySessionId()); authnReqDTO.setRequestMessageString(sessionDTO.getRequestMessageString()); authnReqDTO.setQueryString(sessionDTO.getHttpQueryString()); authnReqDTO.setDestination(sessionDTO.getDestination()); authnReqDTO.setUser(authResult.getSubject()); authnReqDTO.setIdPInitSSOEnabled(sessionDTO.isIdPInitSSO()); authnReqDTO.setClaimMapping(authResult.getClaimMapping()); authnReqDTO.setTenantDomain(sessionDTO.getTenantDomain()); authnReqDTO.setIdPInitSLOEnabled(sessionDTO.isIdPInitSLO()); if (!(sessionDTO.getAttributeConsumingServiceIndex() < 1)) { authnReqDTO.setAttributeConsumingServiceIndex(sessionDTO.getAttributeConsumingServiceIndex()); } SAMLSSOUtil.setIsSaaSApplication(authResult.isSaaSApp()); SAMLSSOUtil.setUserTenantDomain(authResult.getSubject().getTenantDomain()); }
Source:
<code>public GroupForm getGroupForm(String key) { log.debug("Initializing group form for group key " + key); IEntityGroup group = GroupService.findGroup(key); GroupForm form = new GroupForm(); form.setKey(key); form.setName(group.getName()); form.setDescription(group.getDescription()); form.setCreatorId(group.getCreatorID()); form.setType(groupListHelper.getEntityType(group).toString()); <START> Iterator<IGroupMember> groupIter = group.getChildren().iterator(); <END> while (groupIter.hasNext()) { IGroupMember child = groupIter.next(); JsonEntityBean childBean = groupListHelper.getEntity(child); form.addMember(childBean); } return form; }</code><technical_language>For refactor</technical_language>

Target:
public GroupForm getGroupForm(String key) { log.debug("Initializing group form for group key " + key); IEntityGroup group = GroupService.findGroup(key); GroupForm form = new GroupForm(); form.setKey(key); form.setName(group.getName()); form.setDescription(group.getDescription()); form.setCreatorId(group.getCreatorID()); form.setType(groupListHelper.getEntityType(group).toString()); for (IGroupMember child : group.getChildren()) { JsonEntityBean childBean = groupListHelper.getEntity(child); form.addMember(childBean); } return form; }
Source:
<code>public static String readFromURL(final URL url) throws IOException { final StringBuilder builder = new StringBuilder(); BufferedReader reader = null; <START> try { <END> reader = new BufferedReader(new InputStreamReader(url.openStream(), BackendFileSystemManager.UT8)); String line = null; while ((line = reader.readLine()) != null) { builder.append(line); builder.append("\n"); } return builder.toString(); } finally { if (null != reader) { reader.close(); } } }</code><technical_language>This simplified Java 7 try resources: java try (BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream(), BackendFileSystemManager.UT8))) { String line; while ((line = reader.readLine()) != null) { builder.append(line); builder.append("\n"); } return builder.toString(); }</technical_language>

Target:
public static String readFromURL(final URL url) throws IOException { final StringBuilder builder = new StringBuilder(); try (BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream(), BackendFileSystemManager.UT8))) { String line; while ((line = reader.readLine()) != null) { builder.append(line); builder.append("\n"); } return builder.toString(); } }
Source:
<code>public NeedsPaging<PatientIdentifier> doGetAll(Patient parent, RequestContext context) throws ResponseException { <START> List<PatientIdentifier> newPatientIdentifier; <END> if (context.getIncludeAll()) { newPatientIdentifier = new ArrayList<PatientIdentifier>(parent.getIdentifiers()); } else { newPatientIdentifier = parent.getActiveIdentifiers(); } return new NeedsPaging<PatientIdentifier>(newPatientIdentifier, context); }</code><technical_language>patientIdentifiers newPatientIdentifier</technical_language>

Target:
public NeedsPaging<PatientIdentifier> doGetAll(Patient parent, RequestContext context) throws ResponseException { List<PatientIdentifier> patientIdentifiers; if (context.getIncludeAll()) { patientIdentifiers = new ArrayList<PatientIdentifier>(parent.getIdentifiers()); } else { patientIdentifiers = parent.getActiveIdentifiers(); } return new NeedsPaging<PatientIdentifier>(patientIdentifiers, context); }
Source:
<code>private HTableDescriptor[] getTableDescriptorsIgnoreFailure(TableName[] tableNames) { List<HTableDescriptor> descriptors = new ArrayList<>(); for (TableName tableName : tableNames) { try { descriptors.add(getTableDescriptor(tableName)); } catch (IOException ex) { <START> LOG.warn( <END> "Table name %s failed with %s with error message as %s", tableName.getNameAsString(), ex.getClass().getSimpleName(), ex.getMessage()); } } return descriptors.toArray(new HTableDescriptor[0]); }</code><technical_language>This is expected scenario, need alarm user. Please remove logging</technical_language>

Target:
private HTableDescriptor[] getTableDescriptorsIgnoreFailure(TableName[] tableNames) throws IOException { List<HTableDescriptor> descriptors = new ArrayList<>(); for (TableName tableName : tableNames) { try { descriptors.add(getTableDescriptor(tableName)); } catch (IOException ex) { if (ex instanceof TableNotFoundException || ex.getCause() instanceof FailedPreconditionException || Status.Code.FAILED_PRECONDITION == Status.fromThrowable(ex.getCause()).getCode()) { continue; } throw ex; } } return descriptors.toArray(new HTableDescriptor[0]); }
Source:
<code>public void testGetWindowsPathHumanishName() throws IllegalArgumentException, URISyntaxException { <START> String humanishName = new URIish("file:/ END> + File.separator + "b" + File.separator + "c.git/") .getHumanishName(); assertEquals("c", humanishName); }</code><technical_language>No. This is a platform specific test. Mac OS X Linux test this works correctly for Windows paths. Please \\ literally in test string</technical_language>

Target:
public void testGetWindowsPathHumanishName() throws IllegalArgumentException, URISyntaxException { String humanishName = new URIish("file:/ .getHumanishName(); assertEquals("c", humanishName); }
Source:
<code>public ValidationResult validate(EnvironmentDto environmentDto, ParametersDto parametersDto, ValidationResultBuilder validationResultBuilder) { AzureParametersDto azureParametersDto = parametersDto.azureParametersDto(); if (!azureSingleResourceGroupFeatureSwitch.isActive() || Objects.isNull(azureParametersDto)) { return validationResultBuilder.build(); <START> } <END> AzureResourceGroupDto azureResourceGroupDto = azureParametersDto.getAzureResourceGroupDto(); if (Objects.isNull(azureResourceGroupDto) || USE_MULTIPLE.equals(azureResourceGroupDto.getResourceGroupUsagePattern()) || !USE_EXISTING.equals(azureResourceGroupDto.getResourceGroupCreation())) { return validationResultBuilder.build(); } CloudCredential cloudCredential = credentialToCloudCredentialConverter.convert(environmentDto.getCredential()); AzureClient azureClient = azureClientService.getClient(cloudCredential); if (!azureClient.resourceGroupExists(azureResourceGroupDto.getName())) { validationResultBuilder.error(String.format("Resource group '%s' does not exist.", azureResourceGroupDto.getName())); } return validationResultBuilder.build(); }</code><technical_language>add some log validation process</technical_language>

Target:
public ValidationResult validate(EnvironmentDto environmentDto, ParametersDto parametersDto, ValidationResultBuilder validationResultBuilder) { LOGGER.debug("ParametersDto: {}, featureSwitch: {}", parametersDto, azureSingleResourceGroupFeatureSwitch.isActive()); AzureParametersDto azureParametersDto = parametersDto.azureParametersDto(); if (!azureSingleResourceGroupFeatureSwitch.isActive() || Objects.isNull(azureParametersDto)) { return validationResultBuilder.build(); } AzureResourceGroupDto azureResourceGroupDto = azureParametersDto.getAzureResourceGroupDto(); if (Objects.isNull(azureResourceGroupDto) || USE_MULTIPLE.equals(azureResourceGroupDto.getResourceGroupUsagePattern()) || !USE_EXISTING.equals(azureResourceGroupDto.getResourceGroupCreation())) { return validationResultBuilder.build(); } LOGGER.debug("Using single, existing resource group {}", azureResourceGroupDto.getName()); CloudCredential cloudCredential = credentialToCloudCredentialConverter.convert(environmentDto.getCredential()); AzureClient azureClient = azureClientService.getClient(cloudCredential); if (!azureClient.resourceGroupExists(azureResourceGroupDto.getName())) { validationResultBuilder.error(String.format("Resource group '%s' does not exist.", azureResourceGroupDto.getName())); } return validationResultBuilder.build(); }
Source:
<code>public PackReverseIndex(final PackIndex packIndex) { index = packIndex; final long cnt = index.getObjectCount(); if (cnt > Integer.MAX_VALUE) throw new IllegalArgumentException( JGitText.get().hugeIndexesAreNotSupportedByJgitYet); if (cnt == 0) { bucketSize = Long.MAX_VALUE; offsetIndex = new int[1]; nth = new int[0]; return; } final long[] offsetsBySha1 = new long[(int) cnt]; long maxOffset = 0; int ith = 0; for (final MutableEntry me : index) { final long o = me.getOffset(); offsetsBySha1[ith++] = o; if (o > maxOffset) maxOffset = o; } bucketSize = maxOffset / cnt + 1; int[] bucketIndex = new int[(int) cnt]; int[] bucketValues = new int[(int) cnt + 1]; for (int oi = 0; oi < offsetsBySha1.length; oi++) { final long o = offsetsBySha1[oi]; final int bucket = (int) (o / bucketSize); final int bucketValuesPos = oi + 1; final int current = bucketIndex[bucket]; bucketIndex[bucket] = bucketValuesPos; bucketValues[bucketValuesPos] = current; } int nthByOffset = 0; nth = new int[offsetsBySha1.length]; <START> offsetIndex = bucketIndex; END> for (int bi = 0; bi < bucketIndex.length; bi++) { final int start = nthByOffset; for (int vi = bucketIndex[bi]; vi > 0; vi = bucketValues[vi]) { final int nthBySha1 = vi - 1; final long o = offsetsBySha1[nthBySha1]; int insertion = nthByOffset++; for (; start < insertion; insertion--) { if (o > offsetsBySha1[nth[insertion - 1]]) break; nth[insertion] = nth[insertion - 1]; } nth[insertion] = nthBySha1; } offsetIndex[bi] = nthByOffset; } }</code><technical_language>Nice. Thanks - yeah, this is more readable</technical_language>

Target:
public PackReverseIndex(final PackIndex packIndex) { index = packIndex; final long cnt = index.getObjectCount(); if (cnt + 1 > Integer.MAX_VALUE) throw new IllegalArgumentException( JGitText.get().hugeIndexesAreNotSupportedByJgitYet); if (cnt == 0) { bucketSize = Long.MAX_VALUE; offsetIndex = new int[1]; nth = new int[0]; return; } final long[] offsetsBySha1 = new long[(int) cnt]; long maxOffset = 0; int ith = 0; for (final MutableEntry me : index) { final long o = me.getOffset(); offsetsBySha1[ith++] = o; if (o > maxOffset) maxOffset = o; } bucketSize = maxOffset / cnt + 1; int[] bucketIndex = new int[(int) cnt]; int[] bucketValues = new int[(int) cnt + 1]; for (int oi = 0; oi < offsetsBySha1.length; oi++) { final long o = offsetsBySha1[oi]; final int bucket = (int) (o / bucketSize); final int bucketValuesPos = oi + 1; final int current = bucketIndex[bucket]; bucketIndex[bucket] = bucketValuesPos; bucketValues[bucketValuesPos] = current; } int nthByOffset = 0; nth = new int[offsetsBySha1.length]; offsetIndex = bucketIndex; for (int bi = 0; bi < bucketIndex.length; bi++) { final int start = nthByOffset; for (int vi = bucketIndex[bi]; vi > 0; vi = bucketValues[vi]) { final int nthBySha1 = vi - 1; final long o = offsetsBySha1[nthBySha1]; int insertion = nthByOffset++; for (; start < insertion; insertion--) { if (o > offsetsBySha1[nth[insertion - 1]]) break; nth[insertion] = nth[insertion - 1]; } nth[insertion] = nthBySha1; } offsetIndex[bi] = nthByOffset; } }
Source:
<code>public void testDefault() throws Exception { final String[] expected = { "27:31: " + getCheckMessage(MSG_WS_FOLLOWED, ";"), "43:32: " + getCheckMessage(MSG_WS_FOLLOWED, ";"), "55:11: " + getCheckMessage(MSG_WS_FOLLOWED, ";"), }; <START> verify(checkConfig, getPath("InputForIteratorPad.java"), expected); <END> }</code><technical_language>inputs named test. InputEmptyForIteratorPad..</technical_language>

Target:
public void testDefault() throws Exception { final String[] expected = { "27:31: " + getCheckMessage(MSG_WS_FOLLOWED, ";"), "43:32: " + getCheckMessage(MSG_WS_FOLLOWED, ";"), "55:11: " + getCheckMessage(MSG_WS_FOLLOWED, ";"), }; verify(checkConfig, getPath("InputEmptyForIteratorPad.java"), expected); }
Source:
<code>public void run() { _logger.info("Starting the Kafka-based connector task for {}", _datastreamTask); boolean startingUp = true; long pollInterval = 0; _eventsProcessedCountLoggedTime = Instant.now(); try { _consumer = createKafkaConsumer(_consumerProps); consumerSubscribe(); ConsumerRecords<?, ?> records; while (!_shouldDie) { preConsumerPollHook(); records = pollRecords(pollInterval); if (startingUp) { pollInterval = _pollTimeoutMs; startingUp = false; _startedLatch.countDown(); } if (records != null && !records.isEmpty()) { Instant readTime = Instant.now(); processRecords(records, readTime); trackEventsProcessedProgress(records.count()); } } _logger.info("Flushing and committing offsets before task exits.", _taskName); maybeCommitOffsets(_consumer, true); } catch (WakeupException e) { if (!_shouldDie) { _logger.error("Got WakeupException while not in shutdown mode.", e); throw e; <START> } else { <END> _logger.info("Got WakeupException, shutting down task {}.", _taskName); } } catch (Exception e) { _logger.error("{} failed with exception.", _taskName, e); _datastreamTask.setStatus(DatastreamTaskStatus.error(e.toString() + ExceptionUtils.getFullStackTrace(e))); throw new DatastreamRuntimeException(e); } finally { _stoppedLatch.countDown(); _consumer.close(); _logger.info("{} stopped", _taskName); } }</code><technical_language>nitpick: invert order of if if(_ShouldDie) { ... } else { ... }</technical_language>

Target:
public void run() { _logger.info("Starting the Kafka-based connector task for {}", _datastreamTask); boolean startingUp = true; long pollInterval = 0; _eventsProcessedCountLoggedTime = Instant.now(); try { _consumer = createKafkaConsumer(_consumerProps); consumerSubscribe(); ConsumerRecords<?, ?> records; while (!_shutdown) { preConsumerPollHook(); records = pollRecords(pollInterval); if (startingUp) { pollInterval = _pollTimeoutMs; startingUp = false; _startedLatch.countDown(); } if (records != null && !records.isEmpty()) { Instant readTime = Instant.now(); processRecords(records, readTime); trackEventsProcessedProgress(records.count()); } } _logger.info("Flushing and committing offsets before task exits.", _taskName); maybeCommitOffsets(_consumer, true); } catch (WakeupException e) { if (_shutdown) { _logger.info("Got WakeupException, shutting down task {}.", _taskName); maybeCommitOffsets(_consumer, true); } else { _logger.error("Got WakeupException while not in shutdown mode.", e); throw e; } } catch (Exception e) { _logger.error("{} failed with exception.", _taskName, e); _datastreamTask.setStatus(DatastreamTaskStatus.error(e.toString() + ExceptionUtils.getFullStackTrace(e))); throw new DatastreamRuntimeException(e); } finally { _stoppedLatch.countDown(); _consumer.close(); _logger.info("{} stopped", _taskName); } }
Source:
<code>public static Object instantiateInstanceWithClientConfig(String className, IClientConfig clientConfig) throws InstantiationException, IllegalAccessException, ClassNotFoundException { Class clazz = Class.forName(className); if (IClientConfigAware.class.isAssignableFrom(clazz)) { IClientConfigAware obj = (IClientConfigAware) clazz.newInstance(); obj.initWithNiwsConfig(clientConfig); return obj; } else { try { if (clazz.getConstructor(IClientConfig.class) != null) { return clazz.getConstructor(IClientConfig.class).newInstance(clientConfig); } <START> } catch (NoSuchMethodException | SecurityException | IllegalArgumentException | InvocationTargetException ignore) { END> } } logger.warn("Class " + className + " neither implements IClientConfigAware nor provides a constructor with IClientConfig as the parameter. Only default constructor will be used."); return clazz.newInstance(); }</code><technical_language>log</technical_language>

Target:
public static Object instantiateInstanceWithClientConfig(String className, IClientConfig clientConfig) throws InstantiationException, IllegalAccessException, ClassNotFoundException { Class clazz = Class.forName(className); if (IClientConfigAware.class.isAssignableFrom(clazz)) { IClientConfigAware obj = (IClientConfigAware) clazz.newInstance(); obj.initWithNiwsConfig(clientConfig); return obj; } else { try { if (clazz.getConstructor(IClientConfig.class) != null) { return clazz.getConstructor(IClientConfig.class).newInstance(clientConfig); } } catch (NoSuchMethodException ignored) { } catch (SecurityException | IllegalArgumentException | InvocationTargetException e) { logger.warn("Error getting/invoking IClientConfig constructor of {}", className, e); } } logger.warn("Class " + className + " neither implements IClientConfigAware nor provides a constructor with IClientConfig as the parameter. Only default constructor will be used."); return clazz.newInstance(); }
Source:
<code>public synchronized int getNextSequenceNumber() { IMemoryLocalStorage memoryLocalStorage = cachedLocalStorage; <START> if(memoryLocalStorage == null) { <END> try { memoryLocalStorage = createCachedLocalStorage(); return getNextSequenceNumber(memoryLocalStorage); } catch (Exception e) { SwrveLogger.e(LOG_TAG, "Error getting getNextSequenceNumber", e); } finally { if (memoryLocalStorage != null) memoryLocalStorage.close(); } } return getNextSequenceNumber(memoryLocalStorage); }</code><technical_language>Is this overwritten SDK is init'ed</technical_language>

Target:
public synchronized int getNextSequenceNumber() { MemoryCachedLocalStorage memoryCachedLocalStorage = cachedLocalStorage; if (memoryCachedLocalStorage == null) { try { memoryCachedLocalStorage = createCachedLocalStorage(); ILocalStorage sqliteLocalStorage = createLocalStorage(); memoryCachedLocalStorage.setSecondaryStorage(sqliteLocalStorage); return getNextSequenceNumber(memoryCachedLocalStorage); } catch (Exception e) { SwrveLogger.e(LOG_TAG, "Error getting getNextSequenceNumber", e); } finally { if (memoryCachedLocalStorage != null) memoryCachedLocalStorage.close(); } } return getNextSequenceNumber(memoryCachedLocalStorage); }
Source:
<code>public DefaultManagementRegistryService(ManagementRegistryServiceConfiguration configuration) { if (configuration == null) { <START> throw new NullPointerException(); <END> } this.configuration = configuration; }</code><technical_language>Worth reporting null</technical_language>

Target:
public DefaultManagementRegistryService(ManagementRegistryServiceConfiguration configuration) { this.configuration = configuration == null ? new DefaultManagementRegistryConfiguration() : configuration; }
Source:
<code>public static String createRootVariable(Path<?> path, int suffix) { <START> String variable = path.accept(ToStringVisitor.DEFAULT, TEMPLATES).replace('.', '_'); <END> return variable + "_" + suffix; }</code><technical_language>templates UnderscoreTemplates, is necessary replace '.' '_'</technical_language>

Target:
public static String createRootVariable(Path<?> path, int suffix) { String variable = path.accept(ToStringVisitor.DEFAULT, TEMPLATES); return variable + "_" + suffix; }
Source:
<code>public void inflatedueDate() { mfDatePicker = MFDatePicker.newInsance(this); etChargeDueDate.setText(MFDatePicker.getDatePickedAsString()); <START> etChargeDueDate.setOnClickListener(new View.OnClickListener() { <END> @Override public void onClick(View view) { mfDatePicker.show(getActivity().getSupportFragmentManager(), FragmentConstants .DFRAG_DATE_PICKER); } }); }</code><technical_language>Remove OnClickListener Implementation ButterKnife @OnClick annotation</technical_language>

Target:
public void inflatedueDate() { mfDatePicker = MFDatePicker.newInsance(this); etChargeDueDate.setText(MFDatePicker.getDatePickedAsString()); }
Source:
<code>Optional<Work> lookup(String workId) { <START> return allQueued.values().stream().map(queue -> queue.lookup(workId)).filter(work -> work != null).findAny(); <END> }</code><technical_language>work -> work != null is a replace candidate for Objects::nonNull</technical_language>

Target:
Optional<Work> lookup(String workId) { return allQueued.values().stream().map(queue -> queue.lookup(workId)).filter(Objects::nonNull).findAny(); }
Source:
<code>public void setUp() { <START> random = new Random(); <END> System.setProperty(MockLogger.LOG_KEY_PREFIX + LinkdTopologyProvider.class.getName(), "INFO"); }</code><technical_language>set a seed here? subsequent runs generate random networks</technical_language>

Target:
public void setUp() { random = new Random(42); System.setProperty(MockLogger.LOG_KEY_PREFIX + LinkdTopologyProvider.class.getName(), "INFO"); MetricRegistry registry = Mockito.mock(MetricRegistry.class); provider = new LinkdTopologyProvider(registry); }
Source:
<code><START> public AnalyzeTextOptions setTokenFilters(TokenFilterName... tokenFilters) { <END> this.tokenFilters = Arrays.asList(tokenFilters); return this; }</code><technical_language>options input</technical_language>

Target:
public AnalyzeTextOptions setTokenFilters(TokenFilterName... tokenFilters) { this.tokenFilters = (tokenFilters == null) ? null : Arrays.asList(tokenFilters); return this; }
Source:
<code>public void testMissingELDependencyThrowsExceptionDuringFactoryBootstrap() throws Exception { <START> System.out.println("yo"); <END> ClassLoader classLoader = new ELIgnoringClassLoader(); Class<?> clazz = classLoader.loadClass( Validation.class.getName() ); Object validation = clazz.newInstance(); Method m = clazz.getMethod( "buildDefaultValidatorFactory" ); try { m.invoke( validation ); fail( "An exception should have been thrown" ); } catch ( InvocationTargetException e ) { Exception exceptionInValidation = (Exception) e.getTargetException(); assertEquals( exceptionInValidation.getMessage(), "Unable to instantiate Configuration.", "Bootstrapping in Validation should throw an exception " ); Throwable rootCause = exceptionInValidation.getCause(); assertTrue( rootCause.getMessage().startsWith( "HV000183" ), "The root cause of the failure should be missing EL dependencies" ); } }</code><technical_language>I guess some left-over :)</technical_language>

Target:
public void testMissingELDependencyThrowsExceptionDuringFactoryBootstrap() throws Exception { ClassLoader classLoader = new ELIgnoringClassLoader(); Class<?> clazz = classLoader.loadClass( Validation.class.getName() ); Object validation = clazz.newInstance(); Method m = clazz.getMethod( "buildDefaultValidatorFactory" ); Object validatorFactory = m.invoke( validation ); Method getValidatorMethod = validatorFactory.getClass().getMethod( "getValidator" ); try { getValidatorMethod.invoke( validatorFactory ); fail( "An exception should have been thrown" ); } catch ( InvocationTargetException e ) { Exception exceptionInValidation = (Exception) e.getTargetException(); assertEquals( exceptionInValidation.getMessage(), "HV000183: Unable to load 'javax.el.ExpressionFactory'. Check that you have the EL dependencies on the classpath, or use ParameterMessageInterpolator instead", "Bootstrapping in Validation should throw an exception " ); } }
Source:
<code>@Nonnull @Override public Directive<DirectiveValue> construct(Set<DirectiveValue> newValues) { <START> return new BlockAllMixedContentDirective(); <END> }</code><technical_language>return this;</technical_language>

Target:
@Nonnull @Override public Directive<DirectiveValue> construct(Set<DirectiveValue> newValues) { return this; }
Source:
<code>public int paginate( final MasterReport report, final int yieldRate ) throws ReportProcessingException, IOException, ContentIOException { final ExtendedConfiguration config = ClassicEngineBoot.getInstance().getExtendedConfig(); final boolean firstPageMode = config.getBoolProperty( "org.pentaho.reporting.platform.plugin.output.FirstPageMode" ); <START> if ( firstPageMode ) { <END> return 1; } try { String key = report.getContentCacheKey(); if ( key == null ) { key = createKey( report ); } final IReportContent cachedContent = getCachedContent( key ); if ( cachedContent != null ) { return cachedContent.getPageCount(); } final IReportContent freshCache = regenerateCache( report, yieldRate, key ); return freshCache.getPageCount(); } catch ( final CacheKeyException e ) { return super.paginate( report, yieldRate ); } }</code><technical_language>No, dont do that. Change report-viewer ask for paginated results (renderMode=XML renderMode=PARAMETER). in async-mode, report-viewer send parameter-xml requests renderMode=XML mode. Instead, compute return total number of pages part of status request, update paginationControl in report-viewer values. This renders change unnecessary "paginate" called output-handler</technical_language>

Target:
public int paginate( final MasterReport report, final int yieldRate ) throws ReportProcessingException, IOException, ContentIOException { try { String key = report.getContentCacheKey(); if ( key == null ) { key = createKey( report ); } final IReportContent cachedContent = getCachedContent( key ); if ( cachedContent != null ) { return cachedContent.getPageCount(); } final IReportContent freshCache = regenerateCache( report, yieldRate, key, 0 ); return freshCache.getPageCount(); } catch ( final CacheKeyException e ) { return super.paginate( report, yieldRate ); } }
Source:
<code>private void sendKinesisRecord(ByteBuffer data, PutRecordRequest putRecordRequest) { putRecordRequest.setData(data); try { kinesisClient.putRecord(putRecordRequest); } catch (ProvisionedThroughputExceededException ex) { <START> LOG.debug("Throughput exceeded. Sleeping for 10 ms and retrying"); <END> } try { Thread.sleep(10); } catch (InterruptedException e) { LOG.info("Retry wait interrupted", e); } }</code><technical_language>is retry happening</technical_language>

Target:
private void sendKinesisRecord(ByteBuffer data, PutRecordRequest putRecordRequest) { for (int i = 0; i < MAX_RETRIES; i++) { putRecordRequest.setData(data); try { kinesisClient.putRecord(putRecordRequest); return; } catch (ProvisionedThroughputExceededException ex) { LOG.debug("Throughput exceeded. Sleeping for 10 ms and retrying."); try { Thread.sleep(10); } catch (InterruptedException e) { LOG.info("Retry wait interrupted", e); } } } LOG.error("Maximum retries exhausted"); }
Source:
<code><START> private void updateArbiterAvailability() { <END> getArbiterVolume().setIsAvailable(getTypeList().getSelectedItem().isReplicatedType() && getCluster().getSelectedItem() != null); }</code><technical_language>condition Arbiter volume is for version 4.1 lower? In case removing version check changes logic for other versions. Arbiter volume removed completely</technical_language>

Target:
private void updateArbiterAvailability() { getArbiterVolume().setIsAvailable(getTypeList().getSelectedItem().isReplicatedType()); }
Source:
<code>public static <T> TSpliterator<T> spliterator(Iterator<? extends T> iterator, long size, int characteristics) { <START> TArrayList<T> list = new TArrayList<T>(); <END> while (iterator.hasNext()) { list.add((T) iterator.next()); } return list.spliterator(); }</code><technical_language>provide fair implementation for this kind of spliterator</technical_language>

Target:
public static <T> TSpliterator<T> spliterator(Iterator<? extends T> iterator, long size, int characteristics) { return new TSpliterator<T>() { @Override public boolean tryAdvance(Consumer<? super T> action) { if (iterator.hasNext()) { action.accept(iterator.next()); return true; } else { return false; } } @Override public TSpliterator<T> trySplit() { return null; } @Override public long estimateSize() { return size; } @Override public int characteristics() { return characteristics; } }; }
Source:
<code>private CurveCurrencyParameterSensitivity mapSensitivity(DoubleUnaryOperator operator, Currency currency) { <START> double[] updated = new double[sensitivity.length]; <END> for (int i = 0; i < sensitivity.length; i++) { updated[i] = operator.applyAsDouble(sensitivity[i]); } return new CurveCurrencyParameterSensitivity(metadata, currency, updated); }</code><technical_language>this implementation than: double[] updated = DoubleStream.of(sensitivity).map(operator).toArray();</technical_language>

Target:
private CurveCurrencyParameterSensitivity mapSensitivity(DoubleUnaryOperator operator, Currency currency) { return new CurveCurrencyParameterSensitivity(metadata, currency, DoubleArrayMath.apply(sensitivity, operator)); }
Source:
<code>public static Duration getExpiry(ExpiryPolicy policy, Operation op) { switch (op) { case CREATION: try { return policy.getExpiryForCreation(); } catch (Throwable t) { <START> return Duration.ETERNAL; <END> } case ACCESS: try { return policy.getExpiryForAccess(); } catch (Throwable t) { return null; } case UPDATE: try { return policy.getExpiryForUpdate(); } catch (Exception e) { return null; } default: throw log.unknownExpiryOperation(op.toString()); } }</code><technical_language>Duration.Eternal null in other cases</technical_language>

Target:
public static Duration getExpiry(ExpiryPolicy policy, Operation op) { switch (op) { case CREATION: try { return policy.getExpiryForCreation(); } catch (Throwable t) { return getDefaultDuration(); } case ACCESS: try { return policy.getExpiryForAccess(); } catch (Throwable t) { return null; } case UPDATE: try { return policy.getExpiryForUpdate(); } catch (Exception e) { return null; } default: throw log.unknownExpiryOperation(op.toString()); } }
Source:
<code>public void testSetTime() throws Exception { try (AccumuloClient client = createAccumuloClient()) { tableName = "testSetTime_table1"; NewTableConfiguration newTableConf = new NewTableConfiguration(); newTableConf.setTimeType(TimeType.LOGICAL); client.tableOperations().create(tableName, newTableConf); <START> aconf = getCluster().getServerContext().getConfiguration(); <END> fs = getCluster().getFileSystem(); rootPath = cluster.getTemporaryPath().toString(); testSingleTabletSingleFile(client, false, true); } }</code><technical_language>is need set aconf, fs, rootPath set @Before method</technical_language>

Target:
public void testSetTime() throws Exception { try (AccumuloClient client = createAccumuloClient()) { tableName = "testSetTime_table1"; NewTableConfiguration newTableConf = new NewTableConfiguration(); newTableConf.setTimeType(TimeType.LOGICAL); client.tableOperations().create(tableName, newTableConf); testSingleTabletSingleFile(client, false, true); } }
Source:
<code><START> public RangeResourceEntry add(ResourceEntry<Long> resourceEntry) { <END> RangeResourceEntry rangeResourceEntry = (RangeResourceEntry) resourceEntry; if (this.begin < rangeResourceEntry.getBegin()) { this.begin = rangeResourceEntry.getBegin(); } if (this.end > rangeResourceEntry.getBegin()) { this.end = rangeResourceEntry.getBegin(); } return this; }</code><technical_language>For this method, if a range say, [u,v] want add [w,x], cases do this result is [u,x] (when v+1 = w) [w,v] (when x+1 = u). misunderstanding options separate ranges, range. If this is case, need logic instead of is there: if (end+1 != rangeResource.getBegin() && != rangeResource.end()+1) { //incompatible addition, throw exception? } if (end < rangeResourceEntry.getBegin()) { end = rangeResourceEntry.getEnd(); } else if (begin > rangeResourceEntry.getEnd()) { = rangeResourceEntry.getBegin(); } If case, explain this is supposed work? (Either way, I logic is flawed do beginning of rangeResourceEntry)</technical_language>

Target:
public RangeResourceEntry add(ResourceEntry<Long> resourceEntry) { RangeResourceEntry rangeResourceEntry = (RangeResourceEntry) resourceEntry; if (rangeResourceEntry.getEnd() < rangeResourceEntry.getEnd() || rangeResourceEntry.getBegin() > this.end + 1 || rangeResourceEntry.getEnd() < this.begin - 1) { return this; } if (rangeResourceEntry.getBegin() < this.begin) { this.begin = rangeResourceEntry.getBegin(); } if (rangeResourceEntry.getEnd() > this.end) { this.end = rangeResourceEntry.getEnd(); } return this; }
Source:
<code>protected Binding[] createBindings(Control control) throws DatabindingFailedException { final IObservableValue value = WidgetProperties.text().observe(hyperlink); final Binding binding = getDataBindingContext().bindValue(value, getModelValue(), createValueExtractingUpdateStrategy(), new UpdateValueStrategy() { @Override public Object convert(Object value) { updateChangeListener((EObject) value); return "<a>" + getText(value) + "</a>"; } }); final IObservableValue tooltipValue = WidgetProperties.tooltipText().observe(hyperlink); final Binding tooltipBinding = getDataBindingContext().bindValue(tooltipValue, getModelValue(), createValueExtractingUpdateStrategy(), new UpdateValueStrategy() { @Override public Object convert(Object value) { return getText(value); } }); final IObservableValue imageValue = WidgetProperties.image().observe(imageHyperlink); final Binding imageBinding = getDataBindingContext().bindValue(imageValue, getModelValue(), new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER), new UpdateValueStrategy() { @Override public Object convert(Object value) { return getImage(value); } }); final IObservableValue deleteButtonEnablement = WidgetProperties.enabled().observe(deleteReferenceButton); getDataBindingContext().bindValue(deleteButtonEnablement, getModelValue(), createValueExtractingUpdateStrategy(), new UpdateValueStrategy() { @Override public Object convert(Object value) { return value != null; } }); <START> return new Binding[] { binding, tooltipBinding, imageBinding }; <END> }</code><technical_language>is deleteButtonEnablement binding returned</technical_language>

Target:
protected Binding[] createBindings(Control control) throws DatabindingFailedException { final IObservableValue value = WidgetProperties.text().observe(hyperlink); final Binding binding = getDataBindingContext().bindValue(value, getModelValue(), createValueExtractingUpdateStrategy(), new UpdateValueStrategy() { @Override public Object convert(Object value) { updateChangeListener((EObject) value); return "<a>" + getText(value) + "</a>"; } }); final IObservableValue tooltipValue = WidgetProperties.tooltipText().observe(hyperlink); final Binding tooltipBinding = getDataBindingContext().bindValue(tooltipValue, getModelValue(), createValueExtractingUpdateStrategy(), new UpdateValueStrategy() { @Override public Object convert(Object value) { return getText(value); } }); final IObservableValue imageValue = WidgetProperties.image().observe(imageHyperlink); final Binding imageBinding = getDataBindingContext().bindValue(imageValue, getModelValue(), new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER), new UpdateValueStrategy() { @Override public Object convert(Object value) { return getImage(value); } }); final IObservableValue deleteButtonEnablement = WidgetProperties.enabled().observe(deleteReferenceButton); final Binding deleteBinding = getDataBindingContext().bindValue(deleteButtonEnablement, getModelValue(), createValueExtractingUpdateStrategy(), new UpdateValueStrategy() { @Override public Object convert(Object value) { return value != null; } }); return new Binding[] { binding, tooltipBinding, imageBinding, deleteBinding }; }
Source:
<code>public VariantWrapper read() <START> throws Exception, UnexpectedInputException, ParseException, NonTransientResourceException { <END> DBObject dbObject = delegateReader.read(); if (dbObject != null) { Variant variant = converter.convertToDataModelType(dbObject); return new VariantWrapper(variant); } else { return null; } }</code><technical_language>necessary</technical_language>

Target:
public VariantWrapper read() throws Exception { DBObject dbObject = delegateReader.read(); if (dbObject != null) { Variant variant = converter.convertToDataModelType(dbObject); return new VariantWrapper(variant); } else { return null; } }
Source:
<code>public static Mapping forIgnore( String targetName) { return new Mapping( null, null, null, null, targetName, null, true, null, null, null, null, null, null, <START> new HashSet<>(), <END> null, null, null ); }</code><technical_language>changing I is Collections.emptySet(). in fromMappingPrism</technical_language>

Target:
public static Mapping forIgnore( String targetName) { return new Mapping( null, null, null, null, targetName, null, true, null, null, null, null, null, null, Collections.emptySet(), null, null, null ); }
Source:
<code>public void teleport(CommandContext args, Actor sender) throws CommandException { LocalPlayer player = worldGuard.checkPlayer(sender); Location teleportLocation; World world = checkWorld(args, player, 'w'); RegionManager regionManager = checkRegionManager(world); ProtectedRegion existing = checkExistingRegion(regionManager, args.getString(0), true); if (!getPermissionModel(player).mayTeleportTo(existing)) { throw new CommandPermissionsException(); } if (args.hasFlag('s')) { teleportLocation = existing.getFlag(Flags.SPAWN_LOC); if (teleportLocation == null) { throw new CommandException( "The region has no spawn point associated."); } } else { teleportLocation = existing.getFlag(Flags.TELE_LOC); if (teleportLocation == null) { throw new CommandException("The region has no teleport point associated."); } } String message = existing.getFlag(Flags.TELE_MESSAGE); message = message == null ? Flags.TELE_MESSAGE.getDefault() : message; <START> message = message == null ? "" : message.replace("%id%", existing.getId()); <END> player.teleport(teleportLocation, message, "Unable to teleport to region '" + existing.getId() + "'."); }</code><technical_language>getDefault return compile-time default. is this nullcheck necessary</technical_language>

Target:
public void teleport(CommandContext args, Actor sender) throws CommandException { LocalPlayer player = worldGuard.checkPlayer(sender); Location teleportLocation; World world = checkWorld(args, player, 'w'); RegionManager regionManager = checkRegionManager(world); ProtectedRegion existing = checkExistingRegion(regionManager, args.getString(0), true); if (!getPermissionModel(player).mayTeleportTo(existing)) { throw new CommandPermissionsException(); } if (args.hasFlag('s')) { teleportLocation = existing.getFlag(Flags.SPAWN_LOC); if (teleportLocation == null) { throw new CommandException( "The region has no spawn point associated."); } } else { teleportLocation = existing.getFlag(Flags.TELE_LOC); if (teleportLocation == null) { throw new CommandException("The region has no teleport point associated."); } } String message = existing.getFlag(Flags.TELE_MESSAGE); if (message == null) { message = Flags.TELE_MESSAGE.getDefault(); } player.teleport(teleportLocation, message.replace("%id%", existing.getId()), "Unable to teleport to region '" + existing.getId() + "'."); }
Source:
<code>public boolean equals(Object o) { <START> return o instanceof GitHubPushCause || super.equals(o); <END> }</code><technical_language>This is a bug IIUC. This &&, GitHubPushCause instance equal</technical_language>

Target:
public boolean equals(Object o) { return o instanceof GitHubPushCause && Objects.equals(this.pushedBy, ((GitHubPushCause) o).pushedBy) && super.equals(o); }
Source:
<code>public void process(Exchange exchange) throws Exception { CamelCMISActions action = exchange.getIn().getHeader(CamelCMISConstants.CMIS_ACTION, CamelCMISActions.class); <START> this.getClass().getDeclaredMethod(action.getMethodName(), Exchange.class).invoke(this , exchange); <END> }</code><technical_language>Agree @oscerd tests reflection is actively using. ObjectHelper.invokeMethod ObjectHelper.invokeMethodSafe here</technical_language>

Target:
public void process(Exchange exchange) throws Exception { CamelCMISActions action = exchange.getIn().getHeader(CamelCMISConstants.CMIS_ACTION, CamelCMISActions.class); Class[] paramMethod = {Exchange.class}; Method method = ReflectionHelper.findMethod(this.getClass(), action.getMethodName(), paramMethod); Object object = ObjectHelper.invokeMethod(method, this, exchange); exchange.getOut().copyFrom(exchange.getIn()); exchange.getOut().setBody(object); }
Source:
<code>synchronized void sendButtonToListeners(LIRCButtonEvent buttonEvent) { try { <START> <END> for (LIRCEventListener listener : listeners) { listener.buttonPressed(buttonEvent); } } catch (Exception e) { logger.error("Error invoking event listener", e); } }</code><technical_language>blank line</technical_language>

Target:
public synchronized void sendButtonToListeners(LIRCButtonEvent buttonEvent) { try { for (LIRCEventListener listener : listeners) { listener.buttonPressed(buttonEvent); } } catch (Exception e) { logger.error("Error invoking event listener", e); } }
Source:
<code>protected void readFromResources(String postFix) { if (!new File(absolutePathOfStorageDir + File.separator + getFileName() + "_" + Version.VERSION).exists()) makeFileFromResourceFile(postFix); else { File dbDir = new File(absolutePathOfStorageDir); List<File> resourceFiles = Arrays.asList(dbDir.list((dir, name) -> name.startsWith(getFileName() + "_"))).stream().map(s -> new File(s)).collect(Collectors.toList()); history = new HashMap<>(); store = readStore(getFileName()); resourceFiles.forEach(file -> { SplitStore tmp = readStore(file.getName().replace(postFix, "")); history.put(file.getName().replace(postFix, "").replace(getFileName(), "").replace("_", ""), tmp); }); } <START> } <END></code><technical_language>This checks if latest file exists..</technical_language>

Target:
protected void readFromResources(String postFix) { history = new HashMap<>(); store = readStore(getFileName()); List<String> versions = new ArrayList<>(); versions.add(Version.VERSION); versions.addAll(Version.history); versions.forEach(version -> { String filename = getFileName() + "_" + version; if (new File(absolutePathOfStorageDir, filename).exists()) { history.put(version, readStore(getFileName() + "_" + version)); } else { history.put(version, copyAndSplit(version, postFix)); } }); storage.initAndGetPersistedWithFileName(getFileName(), 10); }
Source:
<code>public ReviewInput toReviewInput(@NotNull Review review, @Nullable String tag) { ReviewInput reviewInput = new ReviewInput(); reviewInput.message = Joiner.on(". ").join(review.getMessages()); reviewInput.labels = new HashMap<>(review.getScores()); if (StringUtils.isNotBlank(tag)) { reviewInput.tag = tag; } reviewInput.comments = new HashMap<>(); <START> for (ReviewFile file : review.getFiles()) { <END> List<ReviewInput.CommentInput> comments = new ArrayList<>(); for (Comment comment : file.getComments()) { ReviewInput.CommentInput commentInput = new ReviewInput.CommentInput(); commentInput.line = comment.getLine(); commentInput.message = comment.getMessage(); comments.add(commentInput); } reviewInput.comments.put(file.getReviewFilename(), comments); } return reviewInput; }</code><technical_language>convert streams</technical_language>

Target:
public ReviewInput toReviewInput(@NotNull Review review, @Nullable String tag) { ReviewInput reviewInput = new ReviewInput(); reviewInput.message = Joiner.on(MESSAGE_SEPARATOR).join(review.getMessages()); reviewInput.labels = new HashMap<>(review.getScores()); if (StringUtils.isNotBlank(tag)) { reviewInput.tag = tag; } reviewInput.comments = review.getFiles().stream() .collect(Collectors.toMap(ReviewFile::getReviewFilename, this::buildFileComments)); return reviewInput; }
Source:
<code>public IterableStream<ServiceBusReceivedMessage> receive(int maxMessages, Duration maxWaitTime) { if (maxMessages <= 0) { throw logger.logExceptionAsError(new IllegalArgumentException( "'maxMessages' cannot be less than or equal to 0. maxMessages: " + maxMessages)); <START> } else if (maxWaitTime.isNegative() || maxWaitTime.isZero()) { <END> throw logger.logExceptionAsError( new IllegalArgumentException("'maxWaitTime' cannot be zero or less. maxWaitTime: " + maxWaitTime)); } final Flux<ServiceBusReceivedMessage> messages = Flux.create(emitter -> queueWork(maxMessages, maxWaitTime, emitter)); return new IterableStream<>(messages); }</code><technical_language>NullPointerException if maxWaitTime is null</technical_language>

Target:
public IterableStream<ServiceBusReceivedMessage> receive(int maxMessages, Duration maxWaitTime) { if (maxMessages <= 0) { throw logger.logExceptionAsError(new IllegalArgumentException( "'maxMessages' cannot be less than or equal to 0. maxMessages: " + maxMessages)); } else if (Objects.isNull(maxWaitTime)) { throw logger.logExceptionAsError( new NullPointerException("'maxWaitTime' cannot be null.")); } else if (maxWaitTime.isNegative() || maxWaitTime.isZero()) { throw logger.logExceptionAsError( new IllegalArgumentException("'maxWaitTime' cannot be zero or less. maxWaitTime: " + maxWaitTime)); } final Flux<ServiceBusReceivedMessage> messages = Flux.create(emitter -> queueWork(maxMessages, maxWaitTime, emitter)); return new IterableStream<>(messages); }
Source:
<code>public static String supportedVerbs() { <START> StringBuilder verbNames = new StringBuilder(); <END> for (GetActionArgument verb: GetActionArgument.values()) { verbNames.append(verb.name().toLowerCase() + " "); } return verbNames.toString(); }</code><technical_language>Arrays.asList(values()).toString();</technical_language>

Target:
public static String supportedVerbs() { return Arrays.asList(values()).toString().replaceAll("^.|.$", ""); }