auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static AdminRequest readFrom(DataInputStream stream, ClusterMap clusterMap) throws IOException { Short versionId = stream.readShort(); <START> if (!versionId.equals(ADMIN_REQUEST_VERSION_V2)) { <END> throw new IllegalStateException("Unrecognized version for AdminRequest: " + ADMIN_REQUEST_VERSION_V2); } int correlationId = stream.readInt(); String clientId = Utils.readIntString(stream); AdminRequestOrResponseType type = AdminRequestOrResponseType.values()[stream.readShort()]; PartitionId id = null; if (stream.readByte() == 1){ id = clusterMap.getPartitionIdFromStream(stream); } return new AdminRequest(type, id, correlationId, clientId); }</code><technical_language>I guess this is controllable, v1 requests exist more? reason compatible</technical_language>

Target:
public static AdminRequest readFrom(DataInputStream stream, ClusterMap clusterMap) throws IOException { Short versionId = stream.readShort(); if (!versionId.equals(ADMIN_REQUEST_VERSION_V2)) { throw new IllegalStateException("Unrecognized version for AdminRequest: " + versionId); } int correlationId = stream.readInt(); String clientId = Utils.readIntString(stream); AdminRequestOrResponseType type = AdminRequestOrResponseType.values()[stream.readShort()]; PartitionId id = null; if (stream.readByte() == 1) { id = clusterMap.getPartitionIdFromStream(stream); } return new AdminRequest(type, id, correlationId, clientId); }
Source:
<code>protected void setupAccessors() { Pattern pattern = Pattern.compile(ConfigProperties.OAUTH_CONSUMER_REGEX); Matcher matcher; for (String key : this.config.getKeys()) { matcher = pattern.matcher(key); if (matcher.matches() && matcher.groupCount() >= 1) { String consumer = matcher.group(1); String secret = this.config.getProperty(key); OAuthAccessor accessor = new OAuthAccessor(new OAuthConsumer("", consumer, secret, null)); log.debug(String.format("Creating OAuth consumer \"%s\"", consumer)); this.accessors.put(consumer, accessor); } <START> } <END> }</code><technical_language>I if happy exception a user. I a warning more appropriate</technical_language>

Target:
protected void setupAccessors() { Pattern pattern = Pattern.compile(ConfigProperties.OAUTH_CONSUMER_REGEX); Matcher matcher; for (String key : this.config.getKeys()) { matcher = pattern.matcher(key); if (matcher.matches() && matcher.groupCount() >= 1) { String consumer = matcher.group(1); String secret = this.config.getProperty(key); OAuthAccessor accessor = new OAuthAccessor(new OAuthConsumer("", consumer, secret, null)); log.debug(String.format("Creating OAuth consumer \"%s\"", consumer)); this.accessors.put(consumer, accessor); } } if (this.accessors.size() < 1) { log.warn("OAuth is enabled, but no OAuth consumers are defined."); } }
Source:
<code>public static void broadcastEvictAll(AdvancedCache cache) { final RpcManager rpcManager = cache.getRpcManager(); if ( rpcManager != null ) { final EvictAllCommand cmd = new EvictAllCommand(ByteString.fromString(cache.getName())); final RpcOptions options = isSynchronousCache(cache) ? rpcManager.getSyncRpcOptions() : <START> new RpcOptions(DeliverOrder.PER_SENDER, cache.getCacheConfiguration().clustering().remoteTimeout(), TimeUnit.MILLISECONDS); <END> CompletionStages.join(rpcManager.invokeCommandOnAll(cmd, VoidResponseCollector.validOnly(), options)); } }</code><technical_language>suggestion: create RpcManager.getSyncOrderedRpcOptions(); if this method is invoked often</technical_language>

Target:
public static void broadcastEvictAll(AdvancedCache cache) { final RpcManager rpcManager = cache.getRpcManager(); if (rpcManager != null) { final EvictAllCommand cmd = new EvictAllCommand(ByteString.fromString(cache.getName())); if (isSynchronousCache(cache)) { rpcManager.blocking(rpcManager.invokeCommandOnAll(cmd, VoidResponseCollector.validOnly(), rpcManager.getSyncRpcOptions())); } else { rpcManager.sendToAll(cmd, DeliverOrder.PER_SENDER); } } }
Source:
<code>void unassignTask(DatastreamTask task) { boolean taskPresent = _tasks.remove(task); if (taskPresent) { <START> shutdownProducer(); <END> } }</code><technical_language>note is shutdownProducer() requires obtaining lock, this operation get stuck waiting this lock. Operations flush a while (up 15 minutes for BMM current flush timeout). concern unassignTask() is called onAssignmentChange() threads, right? a limited time of 30-60 seconds needs complete</technical_language>

Target:
void unassignTask(DatastreamTask task) { unassignTasks(Collections.singletonList(task)); }
Source:
<code>protected void verifyColumn(Type columnType, Map<String, ElementValue> elements) { <START> if (verifyColumnType(columnType) && !elements.containsKey("length")) { <END> BugInstance bug = new BugInstance(this, "IMPLICIT_LENGTH", HIGH_PRIORITY); if (visitingMethod()) { bug.addMethod(this); } getBugReporter().reportBug(bug); } }</code><technical_language>consider of "length", > 0, for Oracle [<= 4000](<LINK_0></technical_language>

Target:
protected void verifyColumn(Type columnType, Map<String, ElementValue> elements) { if (! isTarget(columnType)) { return; } if (! elements.containsKey("length")) { BugInstance bug = new BugInstance(this, "IMPLICIT_LENGTH", HIGH_PRIORITY); if (visitingMethod()) { bug.addMethod(this); } getBugReporter().reportBug(bug); } else { ElementValue value = elements.get("length"); int lengthValue = Integer.parseInt(value.stringifyValue()); if (lengthValue <= 0) { reportIllegalLength(lengthValue); } else if (MAX_LENGTH_OF_VARCHAR < lengthValue && !isVisitingLob()) { reportIllegalLength(lengthValue); } } }
Source:
<code><START> private static boolean processClass(String name, byte[] bytes) { <END> if (! args.coreLibrary) { checkClassName(name); } if (args.parallelParse) { Future<DirectClassFile> dcff = classParserPool.submit( new ClassParserTask(name, bytes)); Future<Boolean> cdiStatus = directClassFileConsumer.submit( new DirectClassFileConsumer(name, bytes, dcff)); } else { try { new DirectClassFileConsumer(name, bytes, null).call( new ClassParserTask(name, bytes).call()); } catch(Exception ex) { throw new RuntimeException("Exception parsing classes", ex); } } return true; }</code><technical_language>a cap number of "opened, bytes extracted, waiting parsed/consumed" tasks? Otherwise, memory usage start ballooning unnecessarily if consuming threads start "fall behind" for reason (holding big byte[] arrays for files ready for)</technical_language>

Target:
private static boolean processClass(String name, byte[] bytes) { if (! args.coreLibrary) { checkClassName(name); } try { new DirectClassFileConsumer(name, bytes, null).call( new ClassParserTask(name, bytes).call()); } catch(Exception ex) { throw new RuntimeException("Exception parsing classes", ex); } return true; }
Source:
<code>public static void verifyAggregations( List<AggregatorFactory> aggFactories, List<PostAggregator> postAggs ) { Preconditions.checkNotNull(aggFactories, "aggregations cannot be null"); Preconditions.checkArgument(aggFactories.size() > 0, "Must have at least one AggregatorFactory"); if (postAggs != null && !postAggs.isEmpty()) { Set<String> combinedAggNames = Sets.newHashSet( Lists.transform( aggFactories, new Function<AggregatorFactory, String>() { @Override public String apply(AggregatorFactory input) { return input.getName(); } } ) ); for (PostAggregator postAgg : postAggs) { Set<String> dependencies = postAgg.getDependentFields(); Set<String> missing = Sets.difference(dependencies, combinedAggNames); Preconditions.checkArgument( missing.isEmpty(), "Missing fields [%s] for postAggregator [%s]", missing, postAgg.getName() ); <START> combinedAggNames.add(postAgg.getName()); <END> } final Collection<String> aggAndPostAgg = Sets.intersection( Sets.<String>newHashSet( Collections2.transform( aggFactories, new Function<AggregatorFactory, String>() { @Override public String apply(AggregatorFactory input) { return input.getName(); } } ) ), Sets.<String>newHashSet( Collections2.transform( postAggs, new Function<PostAggregator, String>() { @Override public String apply(PostAggregator input) { return input.getName(); } } ) ) ); Preconditions.checkArgument( aggAndPostAgg.isEmpty(), "%s cannot be both aggregators and post aggregators", Arrays.toString(aggAndPostAgg.toArray()) ); } }</code><technical_language>Modified a bit. I do check a feature of Set.add (see code)</technical_language>

Target:
public static void verifyAggregations( List<AggregatorFactory> aggFactories, List<PostAggregator> postAggs ) { Preconditions.checkNotNull(aggFactories, "aggregations cannot be null"); Preconditions.checkArgument(aggFactories.size() > 0, "Must have at least one AggregatorFactory"); final Set<String> aggNames = Sets.newHashSet(); for (AggregatorFactory aggFactory : aggFactories) { Preconditions.checkArgument(aggNames.add(aggFactory.getName()), "[%s] already defined", aggFactory.getName()); } if (postAggs != null && !postAggs.isEmpty()) { final Set<String> combinedAggNames = Sets.newHashSet(aggNames); for (PostAggregator postAgg : postAggs) { final Set<String> dependencies = postAgg.getDependentFields(); final Set<String> missing = Sets.difference(dependencies, combinedAggNames); Preconditions.checkArgument( missing.isEmpty(), "Missing fields [%s] for postAggregator [%s]", missing, postAgg.getName() ); Preconditions.checkArgument(combinedAggNames.add(postAgg.getName()), "[%s] already defined"); } } }
Source:
<code>public final <T> Set<ConstraintViolation<T>> validate(T object, Class<?>... groups) { Contracts.assertNotNull( object, MESSAGES.validatedObjectMustNotBeNull() ); sanityCheckGroups( groups ); BaseBeanValidationContext<T> validationContext = getValidationContextBuilder().forValidate( object ); if ( !validationContext.getRootBeanMetaData().hasConstraints() ) { return Collections.emptySet(); } ValidationOrder validationOrder = determineGroupValidationOrder( groups ); BeanValueContext<?, Object> valueContext = ValueContexts.getLocalExecutionContextForBean( validatorScopedContext.getParameterNameProvider(), object, validationContext.getRootBeanMetaData(), <START> validationContext.getRootBeanMetaData(), <END> PathImpl.createRootPath() ); return validateInContext( validationContext, valueContext, validationOrder ); }</code><technical_language>add this parameter? exact other. drop it</technical_language>

Target:
public final <T> Set<ConstraintViolation<T>> validate(T object, Class<?>... groups) { Contracts.assertNotNull( object, MESSAGES.validatedObjectMustNotBeNull() ); sanityCheckGroups( groups ); BaseBeanValidationContext<T> validationContext = getValidationContextBuilder().forValidate( object ); if ( !validationContext.getRootBeanMetaData().hasConstraints() ) { return Collections.emptySet(); } ValidationOrder validationOrder = determineGroupValidationOrder( groups ); BeanValueContext<?, Object> valueContext = ValueContexts.getLocalExecutionContextForBean( validatorScopedContext.getParameterNameProvider(), object, validationContext.getRootBeanMetaData(), PathImpl.createRootPath() ); return validateInContext( validationContext, valueContext, validationOrder ); }
Source:
<code>public Observable<List<ShippingRate>> getShippingRates(final String checkoutToken) { if (checkoutToken == null) { throw new NullPointerException("checkoutToken cannot be null"); } int[] successCodes = {HTTP_OK}; return retrofitService .getShippingRates(checkoutToken) .retryWhen(networkRetryPolicyProvider.provide()) .doOnNext(new RetrofitSuccessHttpStatusCodeHandler<>(successCodes)) .retryWhen(pollingRetryPolicyProvider.provide()) .compose(new UnwrapRetrofitBodyTransformer<ShippingRatesWrapper, List<ShippingRate>>()) .observeOn(callbackScheduler) .doOnError(new Action1<Throwable>() { @Override public void call(Throwable throwable) { <START> System.out.println(throwable); <END> } }); }</code><technical_language>need introduce SDK logger, this is place required</technical_language>

Target:
public Observable<List<ShippingRate>> getShippingRates(final String checkoutToken) { if (checkoutToken == null) { throw new NullPointerException("checkoutToken cannot be null"); } int[] successCodes = {HTTP_OK}; return retrofitService .getShippingRates(checkoutToken) .retryWhen(networkRetryPolicyProvider.provide()) .doOnNext(new RetrofitSuccessHttpStatusCodeHandler<>(successCodes)) .retryWhen(pollingRetryPolicyProvider.provide()) .compose(new UnwrapRetrofitBodyTransformer<ShippingRatesWrapper, List<ShippingRate>>()) .observeOn(callbackScheduler); }
Source:
<code>PagedFluxBase<SuggestResult, SuggestPagedResponse> suggest(String searchText, String suggesterName, SuggestOptions suggestOptions, RequestOptions requestOptions, Context context) { SuggestRequest suggestRequest = this.createSuggestRequest(searchText, suggesterName, SuggestOptionsHandler.ensureSuggestOptions(suggestOptions)); <START> return new PagedFluxBase<>( () -> this.suggestFirst(requestOptions, suggestRequest, context), nextLink -> Mono.empty()); <END> }</code><technical_language>question above</technical_language>

Target:
PagedFluxBase<SuggestResult, SuggestPagedResponse> suggest(String searchText, String suggesterName, SuggestOptions suggestOptions, RequestOptions requestOptions, Context context) { SuggestRequest suggestRequest = this.createSuggestRequest(searchText, suggesterName, SuggestOptionsHandler.ensureSuggestOptions(suggestOptions)); return new PagedFluxBase<>( () -> this.suggestFirst(requestOptions, suggestRequest, context)); }
Source:
<code>public String getViewLabelPrefix() { if (!fType.equals(XmlAnalysisModuleType.PATTERN)) { return <START> TmfXmlStrings.EMPTY_STRING; <END> } String viewLabel = TmfXmlStrings.EMPTY_STRING; List<Element> head = TmfXmlUtils.getChildElements(fSourceElement, TmfXmlStrings.HEAD); if (head.size() == 1) { List<Element> labels = TmfXmlUtils.getChildElements(head.get(0), TmfXmlStrings.VIEW_LABEL_PREFIX); if (!labels.isEmpty()) { viewLabel = labels.get(0).getAttribute(TmfXmlStrings.VALUE); } } return viewLabel; }</code><technical_language>StringUtils EMPTY, load a package for empty string... other XmlAnalysis do get a prefix</technical_language>

Target:
public String getViewLabelPrefix() { if (!fType.equals(XmlAnalysisModuleType.PATTERN)) { return null; } String viewLabel = TmfXmlStrings.EMPTY_STRING; List<Element> head = TmfXmlUtils.getChildElements(fSourceElement, TmfXmlStrings.HEAD); if (head.size() == 1) { List<Element> labels = TmfXmlUtils.getChildElements(head.get(0), TmfXmlStrings.VIEW_LABEL_PREFIX); if (!labels.isEmpty()) { viewLabel = labels.get(0).getAttribute(TmfXmlStrings.VALUE); } } return viewLabel.equals(TmfXmlStrings.EMPTY_STRING) ? null : viewLabel; }
Source:
<code>public List<IntegrityMessage> check(BibDatabase database) { ObservableList<BibEntry> bibEntries = database.getEntries(); BiMap<DOI, List<BibEntry>> duplicateMap = HashBiMap.create(bibEntries.size()); for (BibEntry bibEntry : bibEntries) { bibEntry.getDOI().ifPresent(doi -> duplicateMap.computeIfAbsent(doi, absentDoi -> new ArrayList<>()).add(bibEntry)); } return duplicateMap.inverse().keySet().stream() .filter(list -> list.size() > 1) .flatMap(list -> list.stream()) <START> .map(item -> new IntegrityMessage(Localization.lang("Unique DOI used in multiple entries"), item, StandardField.DOI)) <END> .collect(Collectors.toList()); }</code><technical_language>I "The DOI is used..." is</technical_language>

Target:
public List<IntegrityMessage> check(BibDatabase database) { ObservableList<BibEntry> bibEntries = database.getEntries(); BiMap<DOI, List<BibEntry>> duplicateMap = HashBiMap.create(bibEntries.size()); for (BibEntry bibEntry : bibEntries) { bibEntry.getDOI().ifPresent(doi -> duplicateMap.computeIfAbsent(doi, absentDoi -> new ArrayList<>()).add(bibEntry)); } return duplicateMap.inverse().keySet().stream() .filter(list -> list.size() > 1) .flatMap(list -> list.stream()) .map(item -> new IntegrityMessage(Localization.lang("Same DOI used in multiple entries"), item, StandardField.DOI)) .collect(Collectors.toList()); }
Source:
<code>public void testBuildWithWorkflowProjects() throws Exception { Project<?, ?> masterProject = createFreeStyleProject("project"); WorkflowJob workflowProject = (WorkflowJob) Jenkins.getInstance().createProject(WorkflowJob.class, "workflowproject"); <START> workflowProject.setDefinition(new CpsFlowDefinition("node { echo myParam; }")); <END> String projectToTrigger = "subproject1, workflowproject"; List<AbstractBuildParameters> buildParameters = new ArrayList<AbstractBuildParameters>(); buildParameters.add(new CurrentBuildParameters()); PredefinedBuildParameters customParams = new PredefinedBuildParameters("myParam=GOOBER"); buildParameters.add(customParams); BlockingBehaviour neverFail = new BlockingBehaviour("never", "never", "never"); BlockableBuildTriggerConfig masterConfig = new BlockableBuildTriggerConfig(projectToTrigger, neverFail, buildParameters); addParameterizedTrigger(masterProject, masterConfig); Project subProject1 = createFreeStyleProject("subproject1"); subProject1.setQuietPeriod(0); masterProject.scheduleBuild2(0, new Cause.UserCause()).get(); assertEquals(1, workflowProject.getBuilds().size()); assertEquals(1, subProject1.getBuilds().size()); WorkflowRun workflowRun = workflowProject.getBuilds().get(0); assertEquals(Result.SUCCESS.ordinal, workflowRun.getResult().ordinal); assertTrue("Parameter was not passed correctly to workflow job!", workflowRun.getLog(100).contains("GOOBER")); }</code><technical_language>node block unnecessary BTW</technical_language>

Target:
public void testBuildWithWorkflowProjects() throws Exception { Project<?, ?> masterProject = createFreeStyleProject("project"); WorkflowJob workflowProject = Jenkins.getInstance().createProject(WorkflowJob.class, "workflowproject"); workflowProject.setDefinition(new CpsFlowDefinition("node { echo myParam; }")); String projectToTrigger = "subproject1, workflowproject"; List<AbstractBuildParameters> buildParameters = new ArrayList<AbstractBuildParameters>(); buildParameters.add(new CurrentBuildParameters()); PredefinedBuildParameters customParams = new PredefinedBuildParameters("myParam=GOOBER"); buildParameters.add(customParams); BlockingBehaviour neverFail = new BlockingBehaviour("never", "never", "never"); BlockableBuildTriggerConfig masterConfig = new BlockableBuildTriggerConfig(projectToTrigger, neverFail, buildParameters); addParameterizedTrigger(masterProject, masterConfig); Project subProject1 = createFreeStyleProject("subproject1"); subProject1.setQuietPeriod(0); masterProject.scheduleBuild2(0, new Cause.UserCause()).get(); assertEquals(1, workflowProject.getBuilds().size()); assertEquals(1, subProject1.getBuilds().size()); WorkflowRun workflowRun = workflowProject.getBuilds().get(0); assertBuildStatusSuccess(workflowRun); assertLogContains("GOOBER", workflowRun); }
Source:
<code>public Task<Status> signOut() { final TaskCompletionSource<Status> statusTask = new TaskCompletionSource<>(); <START> getConnectedApiTask().addOnSuccessListener(new OnSuccessListener<Bundle>() { <END> @Override public void onSuccess(Bundle bundle) { Auth.GoogleSignInApi.signOut(mClient) .setResultCallback(new TaskResultCaptor<>(statusTask)); } }); return statusTask.getTask(); }</code><technical_language>Missed this, add onFailureListener getConnectedApiTask() propagates failure statusTask setException</technical_language>

Target:
public Task<Status> signOut() { final TaskCompletionSource<Status> statusTask = new TaskCompletionSource<>(); getConnectedApiTask().addOnCompleteListener(new ExceptionForwarder<>( statusTask, new OnSuccessListener<Bundle>() { @Override public void onSuccess(Bundle status) { Auth.GoogleSignInApi.signOut(mClient) .setResultCallback(new TaskResultCaptor<>(statusTask)); } })); return statusTask.getTask(); }
Source:
<code>static InternationalFixedDate ofYearDay(final int prolepticYear, final int dayOfYear) { InternationalFixedChronology.YEAR_RANGE.checkValidValue(prolepticYear, ChronoField.YEAR_OF_ERA); InternationalFixedChronology.DAY_OF_YEAR_RANGE.checkValidValue(dayOfYear, ChronoField.DAY_OF_YEAR); if (dayOfYear == InternationalFixedChronology.DAYS_IN_YEAR + 1 && !InternationalFixedChronology.INSTANCE.isLeapYear(prolepticYear)) { <START> throw new DateTimeException("Invalid Year Day: " + prolepticYear + '/' + dayOfYear); <END> } return new InternationalFixedDate(prolepticYear, dayOfYear); }</code><technical_language>error message changed reference actual problem of "not a leap year". existing implementations</technical_language>

Target:
static InternationalFixedDate ofYearDay(final int prolepticYear, final int dayOfYear) { YEAR_RANGE.checkValidValue(prolepticYear, ChronoField.YEAR_OF_ERA); ChronoField.DAY_OF_YEAR.checkValidValue(dayOfYear); if (dayOfYear == DAYS_IN_YEAR + 1 && !INSTANCE.isLeapYear(prolepticYear)) { throw new DateTimeException("Invalid date 'DayOfYear 366' as '" + prolepticYear + "' is not a leap year"); } boolean isLeapYear = INSTANCE.isLeapYear(prolepticYear); boolean isYearDay = dayOfYear == DAYS_IN_YEAR + (isLeapYear ? 1 : 0); boolean isLeapDay = isLeapYear && dayOfYear == LEAP_DAY_AS_DAY_OF_YEAR; int doy = isLeapYear && dayOfYear > LEAP_DAY_AS_DAY_OF_YEAR ? dayOfYear - 1 : dayOfYear; int month = isYearDay ? 0 : isLeapDay ? -1 : 1 + ((doy - 1) / DAYS_IN_MONTH); int day = isYearDay ? 0 : isLeapDay ? -1 : 1 + ((doy - 1) % DAYS_IN_MONTH); return new InternationalFixedDate(prolepticYear, month, day); }
Source:
<code>@Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, String arg) throws IgniteException { <START> return Collections.singletonMap(new Job(arg), subgrid.stream().filter(ClusterNode::isLocal).findFirst().get()); <END> }</code><technical_language>F#find</technical_language>

Target:
@Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, String arg) throws IgniteException { return Collections.singletonMap(new Job(arg), F.find(subgrid, null, (IgnitePredicate<? super ClusterNode>)ClusterNode::isLocal)); }
Source:
<code>public void onClick(View v) { Log.d(TAG_FRAGMENT, "Clicked: " + v.getId()); switch (v.getId()) { case R.id.linear_layout_smb: dismiss(); SmbSearchDialog smbDialog=new SmbSearchDialog(); smbDialog.show(getActivity().getFragmentManager(), "tab"); return; case R.id.linear_layout_scp: dismiss(); SftpConnectDialog sftpConnectDialog = new SftpConnectDialog(); Bundle args = new Bundle(); args.putBoolean("edit", false); sftpConnectDialog.setArguments(args); sftpConnectDialog.show(getActivity().getFragmentManager(), "tab"); return; case R.id.linear_layout_box: ((MainActivity) getActivity()).addConnection(OpenMode.BOX); break; case R.id.linear_layout_dropbox: ((MainActivity) getActivity()).addConnection(OpenMode.DROPBOX); break; case R.id.linear_layout_google_drive: ((MainActivity) getActivity()).addConnection(OpenMode.GDRIVE); break; case R.id.linear_layout_onedrive: ((MainActivity) getActivity()).addConnection(OpenMode.ONEDRIVE); break; case R.id.linear_layout_get_cloud: Intent cloudPluginIntent = new Intent(Intent.ACTION_VIEW); cloudPluginIntent.setData(Uri.parse(getString(R.string.cloud_plugin_google_play_uri))); try { startActivity(cloudPluginIntent); } catch (ActivityNotFoundException ifGooglePlayIsNotInstalled) { <START> cloudPluginIntent = new Intent(Intent.ACTION_VIEW); <END> cloudPluginIntent.setData(Uri.parse(getString(R.string.cloud_plugin_google_play_web_uri))); startActivity(cloudPluginIntent); } break; } dismiss(); }</code><technical_language>This line redundant</technical_language>

Target:
public void onClick(View v) { Log.d(TAG_FRAGMENT, "Clicked: " + v.getId()); switch (v.getId()) { case R.id.linear_layout_smb: dismiss(); SmbSearchDialog smbDialog=new SmbSearchDialog(); smbDialog.show(getActivity().getFragmentManager(), "tab"); return; case R.id.linear_layout_scp: dismiss(); SftpConnectDialog sftpConnectDialog = new SftpConnectDialog(); Bundle args = new Bundle(); args.putBoolean("edit", false); sftpConnectDialog.setArguments(args); sftpConnectDialog.show(getActivity().getFragmentManager(), "tab"); return; case R.id.linear_layout_box: ((MainActivity) getActivity()).addConnection(OpenMode.BOX); break; case R.id.linear_layout_dropbox: ((MainActivity) getActivity()).addConnection(OpenMode.DROPBOX); break; case R.id.linear_layout_google_drive: ((MainActivity) getActivity()).addConnection(OpenMode.GDRIVE); break; case R.id.linear_layout_onedrive: ((MainActivity) getActivity()).addConnection(OpenMode.ONEDRIVE); break; case R.id.linear_layout_get_cloud: Intent cloudPluginIntent = new Intent(Intent.ACTION_VIEW); cloudPluginIntent.setData(Uri.parse(getString(R.string.cloud_plugin_google_play_uri))); try { startActivity(cloudPluginIntent); } catch (ActivityNotFoundException ifGooglePlayIsNotInstalled) { cloudPluginIntent.setData(Uri.parse(getString(R.string.cloud_plugin_google_play_web_uri))); startActivity(cloudPluginIntent); } break; } dismiss(); }
Source:
<code>public void testJDBCBuilderUsingConnectionString() throws Exception { final String connectionUrl = "testConnectionUrl"; ResultSetMetaData metadata = createMock(ResultSetMetaData.class); <START> try (Connection connection = EasyMock.createNiceMock(Connection.class);Statement statement = createMock(Statement.class);ResultSet resultSet = createMock(ResultSet.class)){ <END> PowerMock.mockStatic(DriverManager.class); expect(DriverManager.getConnection(connectionUrl)).andReturn(connection).once(); expect(connection.createStatement()).andReturn(statement); expect(statement.executeQuery("select * from book")).andReturn(resultSet); expect(resultSet.getMetaData()).andReturn(metadata); if (resultSet.next()) { } expectLastCall().andAnswer(new IAnswer<Boolean>() { int called; @Override public Boolean answer() { called++; if (called < 2) { return true; } return false; } }).times(2); expect(resultSet.getObject("BOOK_ID", Comparable.class)).andReturn("1").times(1); expect(resultSet.getObject("TITLE", Comparable.class)).andReturn("Apache Knox: The Definitive Guide").times(1); expect(metadata.getTableName(1)).andReturn("BOOK"); expect(metadata.getColumnCount()).andReturn(2); expect(metadata.getColumnName(1)).andReturn("BOOK_ID").anyTimes(); expect(metadata.getColumnName(2)).andReturn("TITLE").anyTimes(); resultSet.close(); expectLastCall().andAnswer(new IAnswer<Object>() { @Override public Object answer() { return null; } }).times(2); statement.close(); expectLastCall().andAnswer(new IAnswer<Object>() { @Override public Object answer() { return null; } }).times(2); connection.close(); expectLastCall().andAnswer(new IAnswer<Object>() { @Override public Object answer() { return null; } }); PowerMock.replay(DriverManager.class); replay(connection, statement, resultSet, metadata); KnoxShellTable table = KnoxShellTable.builder().jdbc().connectTo("testConnectionUrl").sql("select * from book"); assertEquals(1, table.getRows().size()); } }</code><technical_language>Multiple lines here. statement a new line</technical_language>

Target:
public void testJDBCBuilderUsingConnectionString() throws Exception { System.setProperty(SYSTEM_PROPERTY_DERBY_STREAM_ERROR_FILE, "/dev/null"); final Path derbyDatabaseFolder = Paths.get(testFolder.newFolder().toPath().toString(), SAMPLE_DERBY_DATABASE_NAME); Database derbyDatabase = null; try { derbyDatabase = prepareDerbyDatabase(derbyDatabaseFolder); assertTrue(derbyDatabase.hasTable("BOOKS")); final KnoxShellTable table = KnoxShellTable.builder().jdbc().driver(DerbyDatabase.DRIVER).connectTo(DerbyDatabase.PROTOCOL + derbyDatabaseFolder.toString()) .sql("select * from books"); assertEquals(2, table.getRows().size()); assertTrue(table.values("TITLE").containsAll(Arrays.asList("Apache Knox: The Definitive Guide", "Apache Knox: The Definitive Guide 2nd Edition"))); } finally { if (derbyDatabase != null) { derbyDatabase.shutdown(); } System.clearProperty(SYSTEM_PROPERTY_DERBY_STREAM_ERROR_FILE); } }
Source:
<code>public void put(Collection<SinkRecord> records) throws ConnectException { try { <START> if (hdfsWriter != null) { <END> hdfsWriter.write(records); } } catch (ConnectException e) { throw new ConnectException(e); } }</code><technical_language>hdfsWriter is null? start guarantee is null, result in error connector stop? Is this a bug in Kafka Connect runtime invoking this start fails? is this ConnectException in start throw exception? This dangerous effectively dropping data this code</technical_language>

Target:
public void put(Collection<SinkRecord> records) throws ConnectException { try { hdfsWriter.write(records); } catch (ConnectException e) { throw new ConnectException(e); } }
Source:
<code><START> public final void addEndpoint(final Endpoint endpoint) { <END> endpoint.setMessageDeliverer(deliverer); endpoint.setExecutor(executor); endpoints.add(endpoint); }</code><technical_language>do need this method final of others</technical_language>

Target:
public void addEndpoint(final Endpoint endpoint) { endpoint.setMessageDeliverer(deliverer); endpoint.setExecutor(executor); endpoints.add(endpoint); }
Source:
<code>private List<TokenCredential> getCredentialsChain() { <START> List<TokenCredential> output = new ArrayList<>(4); <END> if (!excludeEnvironmentCredential) { output.add(new EnvironmentCredential(identityClientOptions)); } if (!excludeManagedIdentityCredential) { output.add(new ManagedIdentityCredential(null, identityClientOptions)); } if (!excludeSharedTokenCacheCredential) { output.add(new SharedTokenCacheCredential(null, null, "04b07795-8ddb-461a-bbee-02f9e1bf7b46", identityClientOptions)); } if (!excludeAzureCliCredential) { output.add(new AzureCliCredential(identityClientOptions)); } if (output.size() == 0) { throw logger.logExceptionAsError(new IllegalArgumentException("At least one credential type must be" + " included in the authentication flow.")); } return output; }</code><technical_language>simply build a Deque here</technical_language>

Target:
private ArrayDeque<TokenCredential> getCredentialsChain() { ArrayDeque<TokenCredential> output = new ArrayDeque<>(4); if (!excludeEnvironmentCredential) { output.add(new EnvironmentCredential(identityClientOptions)); } if (!excludeManagedIdentityCredential) { output.add(new ManagedIdentityCredential(null, identityClientOptions)); } if (!excludeSharedTokenCacheCredential) { output.add(new SharedTokenCacheCredential(null, null, "04b07795-8ddb-461a-bbee-02f9e1bf7b46", identityClientOptions)); } if (!excludeAzureCliCredential) { output.add(new AzureCliCredential(identityClientOptions)); } if (output.size() == 0) { throw logger.logExceptionAsError(new IllegalArgumentException("At least one credential type must be" + " included in the authentication flow.")); } return output; }
Source:
<code>public void onDestroy() { super.onDestroy(); if (getService() != null) { <START> getService().unregisteronServiceStateChangeListener(this::onServiceStateChange); <END> } mIdView.removeTextChangedListener(mIdTextWatcher); mNameView.removeTextChangedListener(mNameTextWatcher); mAddressesView.removeTextChangedListener(mAddressesTextWatcher); }</code><technical_language>unregisterOn</technical_language>

Target:
public void onDestroy() { super.onDestroy(); SyncthingService syncthingService = getService(); if (syncthingService != null) { syncthingService.unregisterOnServiceStateChangeListener(this::onServiceStateChange); } mIdView.removeTextChangedListener(mIdTextWatcher); mNameView.removeTextChangedListener(mNameTextWatcher); mAddressesView.removeTextChangedListener(mAddressesTextWatcher); }
Source:
<code><START> List<SelfAddressProvider> selfAddressProviders(Environment environment) { <END> return Lists.newArrayList( new RatelSelfAddressProvider(environment), new JbossSelfAddressProvider(environment), new LocalhostSelfAddressProvider() ); }</code><technical_language>Consider creating class DefaultSelfAddressProviderChain initialising providers in constructor</technical_language>

Target:
List<SelfAddressProvider> selfAddressProviders(Environment environment) { return Lists.newArrayList( new RatelPropertySelfAddressProvider(environment), new JbossPropertySelfAddressProvider(environment), new LocalhostSelfAddressProvider() ); }
Source:
<code><START> public int compare(String o1, String o2) <END> { if (o1 == o2) { return 0; } BigDecimal bd1 = convertStringToBigDecimal(o1); BigDecimal bd2 = convertStringToBigDecimal(o2); if (bd1 != null && bd2 != null) { return bd1.compareTo(bd2); } if (bd1 == null && bd2 == null) { return StringComparators.LEXICOGRAPHIC.compare(o1, o2); } if (bd1 == null) { return -1; } else { return 1; } }</code><technical_language>@jon-wei Do benchmarks this performs relative alphaNumeric for dimensions integers (in order way)? If please add topN benchmarks? wondering if need optimizing this for numerics fit in primitives not. If performance is roughly similar I need worry it</technical_language>

Target:
public int compare(String o1, String o2) { if (o1 == o2) { return 0; } if (o1 == null) { return -1; } if (o2 == null) { return 1; } Long long1 = Longs.tryParse(o1); Long long2 = Longs.tryParse(o2); final BigDecimal bd1 = long1 == null ? convertStringToBigDecimal(o1) : new BigDecimal(long1); final BigDecimal bd2 = long2 == null ? convertStringToBigDecimal(o2) : new BigDecimal(long2); if (bd1 != null && bd2 != null) { return bd1.compareTo(bd2); } if (bd1 == null && bd2 == null) { return StringComparators.LEXICOGRAPHIC.compare(o1, o2); } if (bd1 == null) { return -1; } else { return 1; } }
Source:
<code>public void checkServerTrusted(X509Certificate[] chain, String authType, SSLEngine engine) throws CertificateException { x509ExtendedTrustManager.checkServerTrusted(chain, authType, engine); if (serverHostnameVerificationEnabled) { try { performHostVerification(InetAddress.getByName(engine.getPeerHost()), chain[0]); } catch (UnknownHostException e) { <START> throw new CertificateException("failed to verify host", e); <END> } } }</code><technical_language>nit: Failed</technical_language>

Target:
public void checkServerTrusted(X509Certificate[] chain, String authType, SSLEngine engine) throws CertificateException { x509ExtendedTrustManager.checkServerTrusted(chain, authType, engine); if (serverHostnameVerificationEnabled) { try { performHostVerification(InetAddress.getByName(engine.getPeerHost()), chain[0]); } catch (UnknownHostException e) { throw new CertificateException("Failed to verify host", e); } } }
Source:
<code>public void verifyFromModuleHasHeadline() { <START> List<WebElement> communityHeadlinesList = driver.findElements(fromCommunityHeadlinesBy); <END> for (int i = 0; i < communityHeadlinesList.size(); i++) { PageObjectLogging.log("verifyFromModuleHasHeadline", "Checking headline number "+(i+1), true); scrollToElement(communityHeadlinesList.get(i)); waitForElementByElement(communityHeadlinesList.get(i)); } PageObjectLogging.log("verifyFromModuleHasHeadline", "Verify that from the community module has headline", true); }</code><technical_language>move this UI mapping</technical_language>

Target:
public void verifyFromModuleHasHeadline() { for (WebElement element : fromCommunityHeadlines) { scrollToElement(element); waitForElementByElement(element); } PageObjectLogging.log( "verifyFromModuleHasHeadline", "Verify that from the community module has headline", true ); }
Source:
<code>GerritCallback<ApprovalSummarySet> approvalFormatter( final int dataBegin, final int rows) { <START> return new GerritCallback<ApprovalSummarySet>() { <END> @Override public void onSuccess(final ApprovalSummarySet as) { Map<Change.Id, ApprovalSummary>ids = as.getSummaryMap(); for (int row = dataBegin; row < dataBegin + rows; row++) { final ChangeInfo c = getRowItem(row); if (ids.containsKey(c.getId())) { displayApprovals(row, ids.get(c.getId())); } } } }; }</code><technical_language>a bug in gwtjsonrpc library fails compile Map<Change.Id, ApprovalSummary>. in theory work, I thought I Map<K,V> in other type I serializing RPC, broken in return type. I workaround is sane, point out, more flexible in long run</technical_language>

Target:
GerritCallback<ApprovalSummarySet> approvalFormatter( final int dataBegin, final int rows) { return new GerritCallback<ApprovalSummarySet>() { @Override public void onSuccess(final ApprovalSummarySet as) { Map<Change.Id, ApprovalSummary> ids = as.getSummaryMap(); AccountInfoCache aic = as.getAccountInfoCache(); for (int row = dataBegin; row < dataBegin + rows; row++) { final ChangeInfo c = getRowItem(row); if (ids.containsKey(c.getId())) { displayApprovals(row, ids.get(c.getId()), aic); } } } }; }
Source:
<code>private void addRequirePostCrumbHandler(WebApp webApp) { webApp.getResponseRenderers().add(0, new HttpResponseRenderer() { @Override public boolean generateResponse(StaplerRequest req, StaplerResponse rsp, Object node, Object response) throws IOException, ServletException { if (response instanceof HttpResponseException) { Class<?> c = response.getClass(); <START> if (RequirePOST.Processor.class.equals(c.getEnclosingClass())) { <END> CrumbIssuer crumbIssuer = getCrumbIssuer(); if (crumbIssuer != null) { String crumbFieldName = crumbIssuer.getDescriptor().getCrumbRequestField(); StringWriter output = new StringWriter(); final PrintWriter resWriter = new PrintWriter(output); StaplerResponse res = new StaplerResponseWrapper(rsp) { public PrintWriter getWriter() throws IOException { return resWriter; } }; ((HttpResponseException)response).generateResponse(req, res, node); String crumbHiddenInput = "<input type=\"hidden\" name=\""+crumbFieldName+"\" value=\""+crumbIssuer.getCrumb(req)+"\"/>"; rsp.getWriter().write(output.toString().replace("</form>",crumbHiddenInput+"</form>")); return true; } } } return false; } }); }</code><technical_language>check c.getName().equals(" ") I think</technical_language>

Target:
private void addRequirePostCrumbHandler(WebApp webApp) { webApp.getResponseRenderers().add(0, new HttpResponseRenderer() { @Override public boolean generateResponse(StaplerRequest req, StaplerResponse rsp, Object node, Object response) throws IOException, ServletException { if (response instanceof HttpResponseException) { Class<?> c = response.getClass(); if (POST_PROCESSOR_EXCEPTION_CLASS_NAME.equals(c.getName())) { CrumbIssuer crumbIssuer = getCrumbIssuer(); if (crumbIssuer != null) { String crumbFieldName = crumbIssuer.getDescriptor().getCrumbRequestField(); StringWriter output = new StringWriter(); final PrintWriter resWriter = new PrintWriter(output); StaplerResponse res = new StaplerResponseWrapper(rsp) { public PrintWriter getWriter() throws IOException { return resWriter; } @Override public void setContentLengthLong(long len) { getWrapped().setContentLengthLong(len); } @Override public void setCharacterEncoding(String charset) { getWrapped().setCharacterEncoding(charset); } @Override public String getContentType() { return getWrapped().getContentType(); } @Override public int getStatus() { return getWrapped().getStatus(); } @Override public Collection<String> getHeaders(String name) { return getWrapped().getHeaders(name); } @Override public Collection<String> getHeaderNames() { return getWrapped().getHeaderNames(); } @Override public String getHeader(String name) { return getWrapped().getHeader(name); } }; ((HttpResponseException)response).generateResponse(req, res, node); String crumbHiddenInput = "<input type=\"hidden\" name=\""+crumbFieldName+"\" value=\""+crumbIssuer.getCrumb(req)+"\"/>"; rsp.getWriter().write(output.toString().replace("</form>",crumbHiddenInput+"</form>")); return true; } } } return false; } }); }
Source:
<code>private String[] findInheritedStringArray(Class<?> cls, String methodName) { if (null == cls) { return new String[0]; } List<String> result = Lists.newArrayList(); while (cls != null && cls != Object.class) { <START> Annotation annotation = cls.getAnnotation((Class<? extends Annotation>) Test.class); <END> if (annotation != null) { String[] g = (String[]) invokeMethod(annotation, methodName); result.addAll(Arrays.asList(g)); } cls = cls.getSuperclass(); } return result.toArray(new String[0]); }</code><technical_language>remove cast here</technical_language>

Target:
private String[] findInheritedStringArray(Class<?> cls, String methodName) { if (null == cls) { return new String[0]; } List<String> result = Lists.newArrayList(); while (cls != null && cls != Object.class) { Annotation annotation = cls.getAnnotation(Test.class); if (annotation != null) { String[] g = (String[]) invokeMethod(annotation, methodName); result.addAll(Arrays.asList(g)); } cls = cls.getSuperclass(); } return result.toArray(new String[0]); }
Source:
<code>private boolean wasNotJustMarkedAsRead(TurboIssue issue) { if (!issue.isCurrentlyRead() || !issue.getMarkedReadAt().isPresent()) return false; LocalDateTime markedReadAt = issue.getMarkedReadAt().get(); LocalDateTime updatedAt = issue.getUpdatedAt(); if (updatedAt.isAfter(markedReadAt)) { return true; } else if (updatedAt.isBefore(markedReadAt) && <START> (markedReadAt.toEpochSecond(null) - updatedAt.toEpochSecond(null) < 3L)) { <END> return true; } else { return false; } }</code><technical_language>zone offset [must non-null](<LINK_0> is Utility.localDateTimeToLong, I guess use. alternative is [until method](<LINK_1> actually</technical_language>

Target:
private boolean wasNotJustMarkedAsRead(TurboIssue issue) { if (!issue.isCurrentlyRead() || !issue.getMarkedReadAt().isPresent()) return false; LocalDateTime markedReadAt = issue.getMarkedReadAt().get(); LocalDateTime updatedAt = issue.getUpdatedAt(); if (updatedAt.isBefore(markedReadAt) && (updatedAt.until(markedReadAt, ChronoUnit.SECONDS) < 3L)) { return false; } else if (updatedAt.isAfter(markedReadAt)) { return true; } else { return false; } }
Source:
<code>public void onEditTabSelected() { scenarioSimulationEditorBusinessClientWrapper.onEditTabSelected(); verify(scenarioSimulationEditorPresenterMock, times(1)).setFocusedContext(eq(scenarioSimulationContextLocal)); <START> verify(scenarioSimulationEditorPresenterMock, times(1)).setItemMenuForMainGridEnabled(true); <END> }</code><technical_language>Do test for disabling menu items</technical_language>

Target:
public void onEditTabSelected() { scenarioSimulationEditorBusinessClientWrapper.onEditTabSelected(); verify(scenarioSimulationEditorPresenterMock, times(1)).setFocusedContext(eq(scenarioSimulationContextLocal)); verify(scenarioSimulationEditorPresenterMock, times(1)).setItemMenuForMainGridEnabled(eq(true)); verify(scenarioGridWidgetMock, times(1)).clearSelections(); verify(scenarioGridWidgetMock, times(1)).select(); verify(backgroundGridWidgetMock, times(1)).deselect(); }
Source:
<code>private void updateFileEncoding(final String encoding) throws CoreException, OperationCanceledException { final org.eclipse.core.resources.IFile file = getDelegate(); if (!file.exists()) return; <START> String projectEncoding = file.getProject().getDefaultCharset(); <END> String fileEncoding = file.getCharset(); if (encoding.equals(fileEncoding)) { log.debug("encoding does not need to be changed for file: " + file); return; } if (encoding.equals(projectEncoding)) { log.debug( "changing encoding for file " + file + " to use default project encoding: " + projectEncoding); file.setCharset(null, new NullProgressMonitor()); return; } log.debug("changing encoding for file " + file + " to encoding: " + encoding); file.setCharset(encoding, new NullProgressMonitor()); }</code><technical_language>Welcome Eclipse world. work that. charset is inherited parent (container). try yourself. Select a Saros package folder in Eclipse change encoding (e.g UTF-16). open a Java class file package subpackage garbage in editor</technical_language>

Target:
private void updateFileEncoding(final String encoding) throws CoreException, OperationCanceledException { final org.eclipse.core.resources.IFile file = getDelegate(); if (!file.exists()) return; String fileEncoding = file.getCharset(); if (encoding.equals(fileEncoding)) { log.debug("encoding does not need to be changed for file: " + file); return; } String parentContainerEncoding = file.getParent().getDefaultCharset(); if (encoding.equals(parentContainerEncoding)) { log.debug( "changing encoding for file " + file + " to inherit parent container encoding: " + parentContainerEncoding); file.setCharset(null, new NullProgressMonitor()); return; } log.debug("changing encoding for file " + file + " to encoding: " + encoding); file.setCharset(encoding, new NullProgressMonitor()); }
Source:
<code>public static Response put(URI uri) throws URISyntaxException, HttpException { <START> return putBody(new HttpPut(uri), StringUtils.EMPTY, ContentType.APPLICATION_JSON, null, null); <END> }</code><technical_language>do set ContentType.APPLICATION_JSON (and in below) a body content</technical_language>

Target:
public static Response put(URI uri) throws URISyntaxException, HttpException { return putBody(new HttpPut(uri), null, null, null, null); }
Source:
<code>private void updateRecents() { this.recents.clearRecents(); String[] recentGames = null; String preference = this.controller.getPreferences().getString( Preferences.RECENT_GAMES); if (preference != null && preference.contains(";")) { recentGames = preference.split(";"); } if (recentGames == null || "".equals(recentGames)) { return; } else { for (String recentGame : recentGames) { if (recentGame.isEmpty()) { continue; } Project project = new Project(); project.setTitle("Project's title"); project.setDescription(recentGame); <START> this.recents.addRecent(new ProjectButton(project, this.skin)); <END> } } }</code><technical_language>Project description title stored in path/project.json. json parser read class Project</technical_language>

Target:
private void updateRecents() { this.recents.clearRecents(); String[] recentGames = null; String preference = this.controller.getPreferences().getString( Preferences.RECENT_GAMES); if (preference != null && preference.contains(";")) { recentGames = preference.split(";"); } if (recentGames == null || "".equals(recentGames)) { return; } else { final EditorAssets editorAssets = controller.getEditorAssets(); final String ending = File.separator + "project.json"; for (String recentGame : recentGames) { if (recentGame.isEmpty()) { continue; } Project project = editorAssets.fromJson(Project.class, Gdx.files.absolute(recentGame + ending)); this.recents.addRecent(new ProjectButton(project, this.skin)); } } }