auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static double krcc(List<Double> uItems, List<Double> vItems) { int common = 0, all = 0; double sum = 0; List<Integer> temp = new ArrayList<>(); Set<Double> items = new HashSet<>(); items.addAll(uItems); items.addAll(vItems); all = items.size(); common = uItems.size() + vItems.size() - all; for (int i = 0; i < uItems.size(); i++) { if (uItems.get(i) > 0 && vItems.get(i) > 0) { temp.add(i); } } for (int m = 0; m < temp.size(); m++) { for (int n = m + 1; n < temp.size(); n++) { if ((uItems.get(temp.get(m)) - uItems.get(temp.get(n))) * (vItems.get(temp.get(m)) - vItems.get(temp.get(n))) < 0) { sum += 1; } } } <START> return 1 - 4 * sum / (common * (common - 1)); <END> }</code><technical_language>right, is sum/common/(common-1). revise re-send a pull request</technical_language>

Target:
public static double krcc(List<Double> uItems, List<Double> vItems) { int common = 0, all = 0; double sum = 0; List<Integer> temp = new ArrayList<>(); Set<Double> items = new HashSet<>(); items.addAll(uItems); items.addAll(vItems); all = items.size(); common = uItems.size() + vItems.size() - all; for (int i = 0; i < uItems.size(); i++) { if (uItems.get(i) > 0 && vItems.get(i) > 0) { temp.add(i); } } for (int m = 0; m < temp.size(); m++) { for (int n = m + 1; n < temp.size(); n++) { if ((uItems.get(temp.get(m)) - uItems.get(temp.get(n))) * (vItems.get(temp.get(m)) - vItems.get(temp.get(n))) < 0) { sum += 1; } } } return 1 - 4 * sum / common / (common - 1); }
Source:
<code>public Identity(MerchantConfig merchantConfig,X509Certificate x509Certificate) throws SignException { this.merchantConfig = merchantConfig; this.x509Cert=x509Certificate; <START> if(merchantConfig.getEnablejdkcert()){ <END> setUpJdkServer(); } else{ setUpServer(); } }</code><technical_language>change method name isJdkCertEnabled ()</technical_language>

Target:
public Identity(MerchantConfig merchantConfig,X509Certificate x509Certificate) throws SignException { this.merchantConfig = merchantConfig; this.x509Cert=x509Certificate; if(merchantConfig.isJdkCertEnabled()){ setupJdkServerCerts(); } else{ setUpServer(); } }
Source:
<code>public static KerberosHadoopAuthentication createKerberosHadoopAuthentication(KerberosAuthentication kerberosAuthentication, HdfsConfigurationUpdater updater) { <START> initializeConfigs(getConfiguration(updater)); <END> return new KerberosHadoopAuthentication(kerberosAuthentication); }</code><technical_language>I inline initializeConfigs (if is in single place) getConfiguration</technical_language>

Target:
public static KerberosHadoopAuthentication createKerberosHadoopAuthentication(KerberosAuthentication kerberosAuthentication, HdfsConfigurationUpdater updater) { Configuration configuration = getInitialConfiguration(); updater.updateConfiguration(configuration); configuration.set("hadoop.security.authentication", "kerberos"); String authToLocalRules = configuration.get("hadoop.security.auth_to_local"); if (authToLocalRules == null) { KerberosName.setRules("DEFAULT"); } UserGroupInformation.setConfiguration(configuration); return new KerberosHadoopAuthentication(kerberosAuthentication); }
Source:
<code>public void load(Map<?, ?> options) throws IOException { if (!isLoaded) { useURIFragmentAsId = Boolean.TRUE.equals(options.get(DescriptionResourceImpl.OPTION_USE_URI_FRAGMENT_AS_ID)) && getURI().isPlatformPlugin(); Diagnostic migrationMismatchDiagnostic = <START> migrationHandler.handleMigrationOptions(getURI(), <END> this.getDefaultLoadOptions(), this.getDefaultSaveOptions()); super.load(options); if (migrationMismatchDiagnostic != null) { getErrors().add(migrationMismatchDiagnostic); } } }</code><technical_language>Missing check for migrationHandler != null</technical_language>

Target:
public void load(Map<?, ?> options) throws IOException { if (!isLoaded) { useURIFragmentAsId = Boolean.TRUE.equals(options.get(DescriptionResourceImpl.OPTION_USE_URI_FRAGMENT_AS_ID)) && getURI().isPlatformPlugin(); Diagnostic migrationMismatchDiagnostic = null; if (migrationHandler.isPresent()) { migrationMismatchDiagnostic = migrationHandler.get().handleMigrationOptions(getURI(), this.getDefaultLoadOptions(), this.getDefaultSaveOptions()); } super.load(options); if (migrationMismatchDiagnostic != null) { getErrors().add(migrationMismatchDiagnostic); } } }
Source:
<code>private void preloadEventTypes(final EventTypeRepository eventTypeRepository) { final long start = System.currentTimeMillis(); eventTypeRepository.list().stream().map(EventType::getName).forEach((name) -> { try { <START> this.getEventType(name); <END> } catch (NoSuchEventTypeException | InternalNakadiException e) { LOG.warn("Failed to preload event type {}", name, e); } }); LOG.info("Cache preload complete, load event types within ms", this.eventTypeCache.size(), System.currentTimeMillis() - start); }</code><technical_language>Is provide a solution get event-types DB one-by-one</technical_language>

Target:
private void preloadEventTypes(final EventTypeRepository eventTypeRepository) { final long start = System.currentTimeMillis(); rwLock.writeLock().lock(); try { final Map<String, CachedValue> preloaded = eventTypeRepository.list().stream().collect(Collectors.toMap( EventType::getName, et -> new CachedValue(et, EventValidation.forType(et)) )); new ArrayList<>(preloaded.keySet()).forEach(eventType -> { try { created(eventType); } catch (final Exception e) { LOG.error("Failed to create node for {}", eventType, e); preloaded.remove(eventType); } }); this.eventTypeCache.putAll(preloaded); LOG.info("Cache preload complete, load event types within ms", preloaded.size(), System.currentTimeMillis() - start); } finally { rwLock.writeLock().unlock(); } }
Source:
<code>protected void testAccessControl() throws Exception { String[] submissionParams = new String[] { Const.ParamsNames.USER_ID, account.googleId, Const.ParamsNames.BLOB_KEY, account.studentProfile.pictureKey }; <START> verifyAnyRegisteredUserCanAccess(submissionParams); <END> }</code><technical_language>Access control for this action tested existing methods. Move relevant methods testExecuteAndPostProcess testAccessControl</technical_language>

Target:
protected void testAccessControl() throws Exception { testActionWithEmailAndCourseUnauthorisedInstructorOrStudent(); testActionWithEmailAndCourseUnauthorisedInstructorOrStudentMasquerade(); }
Source:
<code>public String toString() { return "Task["+(Strings.isNonEmpty(displayName) ? displayName : <START> job + <END> (tags!=null && !tags.isEmpty() ? ";"+tags : "")) + ":"+getId()+"]"; }</code><technical_language>good put more brackets obvious glance + job is in else case (which I is). previous toString impl this replaces bad for finding : was</technical_language>

Target:
public String toString() { return "Task["+ (Strings.isNonEmpty(displayName) ? displayName : (job + (tags!=null && !tags.isEmpty() ? ";"+tags : "")) ) + ":"+getId()+"]"; }
Source:
<code>public void getBucketSerials_shouldReturnAnArrayOfIllegalSerials_whenBucketsAreNull() { RegionAttributes regionAttributes = mock(RegionAttributes.class); PartitionAttributes partitionAttributes = mock(PartitionAttributes.class); when(partitionedRegion.getAttributes()).thenReturn(regionAttributes); when(regionAttributes.getPartitionAttributes()).thenReturn(partitionAttributes); <START> when(partitionAttributes.getTotalNumBuckets()).thenReturn(3); <END> assertThat(regionAdvisor.getBucketSerials()).containsExactly(serials); }</code><technical_language>this hardcoded 3 replaced serials.length ensure test fail if modifies size of serials</technical_language>

Target:
public void getBucketSerials_shouldReturnAnArrayOfIllegalSerials_whenBucketsAreNull() { RegionAttributes regionAttributes = mock(RegionAttributes.class); PartitionAttributes partitionAttributes = mock(PartitionAttributes.class); when(partitionedRegion.getAttributes()).thenReturn(regionAttributes); when(regionAttributes.getPartitionAttributes()).thenReturn(partitionAttributes); when(partitionAttributes.getTotalNumBuckets()).thenReturn(serials.length); assertThat(regionAdvisor.getBucketSerials()).containsExactly(serials); }
Source:
<code>public CoreCollection(Path path){ this.path = path; <START> this.allowedFileSuffix = new HashSet<>(Arrays.asList(".json.xz", "json")); <END> }</code><technical_language>Set.of(...)</technical_language>

Target:
public CoreCollection(Path path){ this.path = path; this.allowedFileSuffix = Set.of(".json.xz", "json"); }
Source:
<code><START> protected CacheEntryEvent<K, V> shouldInvoke(CacheEntryEvent<K, V> event, boolean isLocalNodePrimaryOwner) { <END> if (onlyPrimary && !isLocalNodePrimaryOwner) return null; if (event instanceof EventImpl) { EventImpl<K, V> eventImpl = (EventImpl<K, V>)event; if (eventImpl.isPre() && clustered) return null; EventType eventType; if (filter != null && (eventType = getEvent(eventImpl)) != null) { if (filter == converter && filter instanceof CacheEventFilterConverter) { Object newValue = ((CacheEventFilterConverter)filter).filterAndConvert(eventImpl.getKey(), eventImpl.getOldValue(), eventImpl.getOldMetadata(), eventImpl.getValue(), eventImpl.getMetadata(), eventType); if (newValue != null) { eventImpl.setValue((V) newValue); } else { return null; } } else if (!filter.accept(eventImpl.getKey(), eventImpl.getOldValue(), eventImpl.getOldMetadata(), eventImpl.getValue(), eventImpl.getMetadata(), eventType)) { return null; } } } return event; }</code><technical_language>explain this change? this method is in if (shouldInvoke(event, isLocalNodePrimaryOwner) != null) (line 962)</technical_language>

Target:
protected CacheEntryEvent<K, V> shouldInvoke(CacheEntryEvent<K, V> event, boolean isLocalNodePrimaryOwner) { if (onlyPrimary && !isLocalNodePrimaryOwner) return null; if (event instanceof EventImpl) { EventImpl<K, V> eventImpl = (EventImpl<K, V>)event; if (eventImpl.isPre() && clustered) return null; EventType eventType; if (filter != null && (eventType = getEvent(eventImpl)) != null) { if (filter == converter && filter instanceof CacheEventFilterConverter) { Object newValue = ((CacheEventFilterConverter)filter).filterAndConvert(eventImpl.getKey(), eventImpl.getOldValue(), eventImpl.getOldMetadata(), eventImpl.getValue(), eventImpl.getMetadata(), eventType); if (newValue != null) { EventImpl<K, V> clone = eventImpl.clone(); clone.setValue((V) newValue); return clone; } else { return null; } } else if (!filter.accept(eventImpl.getKey(), eventImpl.getOldValue(), eventImpl.getOldMetadata(), eventImpl.getValue(), eventImpl.getMetadata(), eventType)) { return null; } } } return event; }
Source:
<code>public TestRunner addOverrideConfig(String key, String value) { Preconditions.checkNotNull(key); Preconditions.checkNotNull(value); <START> configs.put(String.format("jobs.%s.%s", JOB_NAME, key), value); <END> return this; }</code><technical_language>Rather, I recommend move JobNode.CONFIG_JOB_PREFIX JobConfig here, instead of hard code string</technical_language>

Target:
public TestRunner addOverrideConfig(String key, String value) { Preconditions.checkNotNull(key); Preconditions.checkNotNull(value); String configKeyPrefix = String.format(JobConfig.CONFIG_JOB_PREFIX(), JOB_NAME); configs.put(String.format("%s%s", configKeyPrefix, key), value); return this; }
Source:
<code>public void deleteSurveyThrowsGoodExceptionIfSurveyDoesntExist() throws Exception { setupContext(API_STUDY_ID, DEVELOPER, UNCONSENTED, null); when(service.getSurvey(TestConstants.TEST_STUDY, KEYS, false, false)).thenReturn(null); Result result = controller.deleteSurvey(SURVEY_GUID, CREATED_ON.toString(), "false"); <START> TestUtils.assertResult(result, 200, "Survey deleted."); <END> }</code><technical_language>Nitpick: controller.deleteSurvey() throws, assert checked</technical_language>

Target:
public void deleteSurveyThrowsGoodExceptionIfSurveyDoesntExist() throws Exception { setupContext(API_STUDY_ID, DEVELOPER, UNCONSENTED, null); when(service.getSurvey(ImmutableSet.of(DEVELOPER), TestConstants.TEST_STUDY, KEYS, false, false)).thenReturn(null); controller.deleteSurvey(SURVEY_GUID, CREATED_ON.toString(), "false"); }
Source:
<code>private boolean hasServerPropertyChanged(MavenProject project, MavenProject backupProject) { Properties p = getPropertiesWithKeyPrefix(project.getProperties(), "liberty.bootstrap."); Properties q = getPropertiesWithKeyPrefix(backupProject.getProperties(), "liberty.bootstrap."); if (!Objects.equals(p, q)) { return true; } else { p = getPropertiesWithKeyPrefix(project.getProperties(), "liberty.jvm."); q = getPropertiesWithKeyPrefix(backupProject.getProperties(), "liberty.jvm."); if (!Objects.equals(p, q)) { return true; } else { p = getPropertiesWithKeyPrefix(project.getProperties(), "liberty.env."); <START> q = getPropertiesWithKeyPrefix(backupProject.getProperties(), "liberty.env."); <END> if (!Objects.equals(p, q)) { return true; } } } return false; }</code><technical_language>reason call project.getProperties() times backupProject.getProperties() times. Get store in variable. need for else statements if statements return true</technical_language>

Target:
private boolean hasServerPropertyChanged(MavenProject project, MavenProject backupProject) { Properties projProp = project.getProperties(); Properties backupProjProp = backupProject.getProperties(); if (!Objects.equals(getPropertiesWithKeyPrefix(projProp, LIBERTY_BOOTSTRAP_PROP), getPropertiesWithKeyPrefix(backupProjProp, LIBERTY_BOOTSTRAP_PROP))) { return true; } if (!Objects.equals(getPropertiesWithKeyPrefix(projProp, LIBERTY_JVM_PROP), getPropertiesWithKeyPrefix(backupProjProp, LIBERTY_JVM_PROP))) { return true; } if (!Objects.equals(getPropertiesWithKeyPrefix(projProp, LIBERTY_ENV_PROP), getPropertiesWithKeyPrefix(backupProjProp, LIBERTY_ENV_PROP))) { return true; } return false; }
Source:
<code>public Observable<Void> change(final Interest<InstanceInfo> newInterest) { if (state.get() == STATE.Closed) { return Observable.error(CHANNEL_CLOSED_EXCEPTION); } Observable<Void> serverRequest = connect() .switchMap(new Func1<MessageConnection, Observable<Void>>() { @Override public Observable<Void> call(MessageConnection serverConnection) { return sendExpectAckOnConnection(serverConnection, new InterestRegistration(newInterest)); } }); return Observable.create(new Observable.OnSubscribe<Void>() { @Override public void call(Subscriber<? super Void> subscriber) { if (STATE.Closed == state.get()) { subscriber.onError(CHANNEL_CLOSED_EXCEPTION); } else if (moveToState(STATE.Idle, STATE.Open)) { logger.debug("First time registration: {}", newInterest); channelInterestStream.subscribe(channelInterestSubscriber); <START> remoteBatchingRegistry.subscribe(channelInterestStream); <END> } else { logger.debug("Channel changes: {}", newInterest); } remoteBatchingRegistry.retainAll(newInterest); subscriber.onCompleted(); } }).concatWith(serverRequest); }</code><technical_language>is channelInterestStream, able attach remoteBatchingRegistry channelInterestStream is created in constructor need reattach time do a change()</technical_language>

Target:
public Observable<Void> change(final Interest<InstanceInfo> newInterest) { if (state.get() == STATE.Closed) { return Observable.error(CHANNEL_CLOSED_EXCEPTION); } Observable<Void> serverRequest = connect() .switchMap(new Func1<MessageConnection, Observable<Void>>() { @Override public Observable<Void> call(MessageConnection serverConnection) { return sendExpectAckOnConnection(serverConnection, new InterestRegistration(newInterest)); } }); return Observable.create(new Observable.OnSubscribe<Void>() { @Override public void call(Subscriber<? super Void> subscriber) { if (STATE.Closed == state.get()) { subscriber.onError(CHANNEL_CLOSED_EXCEPTION); } else if (moveToState(STATE.Idle, STATE.Open)) { logger.debug("First time registration: {}", newInterest); channelInterestStream.subscribe(channelInterestSubscriber); remoteBatchingRegistry.connectTo(channelInterestStream); } else { logger.debug("Channel changes: {}", newInterest); } remoteBatchingRegistry.retainAll(newInterest); subscriber.onCompleted(); } }).concatWith(serverRequest); }
Source:
<code>public List<ResponseInfo> sendAndPoll(List<RequestInfo> requestInfos, int pollTimeoutMs) { if (closed) { throw new IllegalStateException("The NetworkClient is closed."); } long startTime = time.milliseconds(); List<ResponseInfo> responseInfoList = new ArrayList<>(); try { for (RequestInfo requestInfo : requestInfos) { ClientNetworkRequestMetrics clientNetworkRequestMetrics = new ClientNetworkRequestMetrics(networkMetrics.requestQueueTime, networkMetrics.requestSendTime, networkMetrics.requestSendTotalTime, 0); pendingRequests.add(new RequestMetadata(time.milliseconds(), requestInfo, clientNetworkRequestMetrics)); } List<NetworkSend> sends = prepareSends(responseInfoList); selector.poll(pollTimeoutMs, sends); handleSelectorEvents(responseInfoList); } catch (Exception e) { <START> networkMetrics.networkClientException.inc(); <END> } finally { numPendingRequests.set(pendingRequests.size()); networkMetrics.networkClientSendAndPollTime.update(time.milliseconds() - startTime); } return responseInfoList; }</code><technical_language>log error</technical_language>

Target:
public List<ResponseInfo> sendAndPoll(List<RequestInfo> requestInfos, int pollTimeoutMs) { if (closed || !selector.isOpen()) { throw new IllegalStateException("The NetworkClient is closed."); } long startTime = time.milliseconds(); List<ResponseInfo> responseInfoList = new ArrayList<>(); try { for (RequestInfo requestInfo : requestInfos) { ClientNetworkRequestMetrics clientNetworkRequestMetrics = new ClientNetworkRequestMetrics(networkMetrics.requestQueueTime, networkMetrics.requestSendTime, networkMetrics.requestSendTotalTime, 0); pendingRequests.add(new RequestMetadata(time.milliseconds(), requestInfo, clientNetworkRequestMetrics)); } List<NetworkSend> sends = prepareSends(responseInfoList); selector.poll(pollTimeoutMs, sends); handleSelectorEvents(responseInfoList); } catch (Exception e) { logger.error("Received an unexpected error during sendAndPoll(): ", e); networkMetrics.networkClientException.inc(); } finally { numPendingRequests.set(pendingRequests.size()); networkMetrics.networkClientSendAndPollTime.update(time.milliseconds() - startTime); } return responseInfoList; }
Source:
<code>public void onRunFinish(boolean succeeded, BatchSourceContext context) { super.onRunFinish(succeeded, context); if (StringUtils.isNotEmpty(this.config.tableName)) { try { File file = new File(this.config.tableName); BufferedReader reader = new BufferedReader(new FileReader(file)); String line = null; while ((line = reader.readLine()) != null) { long processingTime = new Date().getTime(); <START> processedFileTrackingTable.write(line.getBytes(Charsets.UTF_8), <END> String.valueOf(processingTime).getBytes(Charsets.UTF_8)); } reader.close(); file.delete(); } catch (IOException exception) { exception.printStackTrace(); } } }</code><technical_language>This dataset bigger bigger a period of time</technical_language>

Target:
public void onRunFinish(boolean succeeded, BatchSourceContext context) { super.onRunFinish(succeeded, context); try { FileStatus[] status = fileSystem.listStatus(tempDirectoryPath); long processingTime = new Date().getTime(); Path[] paths = FileUtil.stat2Paths(status); if (paths != null && paths.length > 0) { for (Path path : paths) { try (FSDataInputStream input = fileSystem.open(path)) { String key = input.readUTF(); processedFileTrackingTable.write(Bytes.toBytes(key), Bytes.toBytes(processingTime)); } } } } catch (IOException exception) { LOG.error("IOException occurred while reading temp directory path : " + exception.getMessage()); } }
Source:
<code>AuthenticationSessionModel createAuthenticationSessionForClient(String clientID) throws UriBuilderException, IllegalArgumentException { AuthenticationSessionModel authSession; ClientModel client = session.realms().getClientByClientId(clientID, realm); String redirectUri = null; if (client == null) { client = SystemClientUtil.getSystemClient(realm); } else { <START> redirectUri = client.getRedirectUris() <END> .stream() .findFirst() .orElse(null); } if (redirectUri == null) { redirectUri = Urls.accountBase(session.getContext().getUri().getBaseUri()).path("/").build(realm.getName()).toString(); } RootAuthenticationSessionModel rootAuthSession = new AuthenticationSessionManager(session).createAuthenticationSession(realm, true); authSession = rootAuthSession.createAuthenticationSession(client); authSession.setAction(AuthenticationSessionModel.Action.AUTHENTICATE.name()); END_AFTER_REQUIRED_ACTIONS, "true"); authSession.setProtocol(OIDCLoginProtocol.LOGIN_PROTOCOL); authSession.setRedirectUri(redirectUri); authSession.setClientNote(OIDCLoginProtocol.RESPONSE_TYPE_PARAM, OAuth2Constants.CODE); authSession.setClientNote(OIDCLoginProtocol.REDIRECT_URI_PARAM, redirectUri); authSession.setClientNote(OIDCLoginProtocol.ISSUER, Urls.realmIssuer(session.getContext().getUri().getBaseUri(), realm.getName())); return authSession; }</code><technical_language>I lines 409-411 removed line 410 moved line 401 - redirectUri is set redirectUri of account client in case corresponds account client? this: if (client == null) { client = SystemClientUtil.getSystemClient(realm); redirectUri = Urls.accountBase(session.getContext().getUri().getBaseUri()).path("/").build(realm.getName()).toString(); } WDYT</technical_language>

Target:
AuthenticationSessionModel createAuthenticationSessionForClient(String clientID) throws UriBuilderException, IllegalArgumentException { AuthenticationSessionModel authSession; ClientModel client = session.realms().getClientByClientId(clientID, realm); String redirectUri; if (client == null) { client = SystemClientUtil.getSystemClient(realm); redirectUri = Urls.accountBase(session.getContext().getUri().getBaseUri()).path("/").build(realm.getName()).toString(); } else { redirectUri = RedirectUtils.getFirstValidRedirectUri(session, client.getRootUrl(), client.getRedirectUris()); } RootAuthenticationSessionModel rootAuthSession = new AuthenticationSessionManager(session).createAuthenticationSession(realm, true); authSession = rootAuthSession.createAuthenticationSession(client); authSession.setAction(AuthenticationSessionModel.Action.AUTHENTICATE.name()); END_AFTER_REQUIRED_ACTIONS, "true"); authSession.setProtocol(OIDCLoginProtocol.LOGIN_PROTOCOL); authSession.setRedirectUri(redirectUri); authSession.setClientNote(OIDCLoginProtocol.RESPONSE_TYPE_PARAM, OAuth2Constants.CODE); authSession.setClientNote(OIDCLoginProtocol.REDIRECT_URI_PARAM, redirectUri); authSession.setClientNote(OIDCLoginProtocol.ISSUER, Urls.realmIssuer(session.getContext().getUri().getBaseUri(), realm.getName())); return authSession; }
Source:
<code>public void invokeLocalBuildPipeLine( LocalBuildRequest buildRequest, Consumer< LocalBinaryConfig > consumer ) { Pipeline pipe = pipelineRegistry.getPipelineByName( BuildPipelineInitializer.LOCAL_BUILD_PIPELINE ); Input input = new Input( ) { { put( LocalSourceConfig.ROOT_PATH, buildRequest.getProject( ).getRootPath( ).toURI( ) ); put( LocalBuildConfig.BUILD_TYPE, buildRequest.getBuildType( ).name( ) ); if ( buildRequest.isSingleResource( ) ) { put( LocalBuildConfig.RESOURCE, encodePath( buildRequest.getResource( ) ) ); } else { addResourceChanges( this, buildRequest.getResourceChanges( ) ); } if ( buildRequest.getDeploymentType( ) != null ) { put( LocalBuildConfig.DEPLOYMENT_TYPE, buildRequest.getDeploymentType( ).name( ) ); put( LocalBuildConfig.SUPPRESS_HANDLERS, Boolean.toString( buildRequest.isSuppressHandlers( ) ) ); } } }; <START> buildPipelineInitializer.getExecutor( ).execute( input, pipe, ( Consumer< LocalBinaryConfig > ) binary -> { <END> consumer.accept( binary ); } ); }</code><technical_language>simplify java buildPipelineInitializer.getExecutor( ).execute( input, pipe, consumer::accept ); just: java buildPipelineInitializer.getExecutor( ).execute( input, pipe, consumer );</technical_language>

Target:
public void invokeLocalBuildPipeLine( LocalBuildRequest buildRequest, Consumer< LocalBinaryConfig > consumer ) { Pipeline pipe = pipelineRegistry.getPipelineByName( BuildPipelineInitializer.LOCAL_BUILD_PIPELINE ); Input input = new Input( ) { { put( LocalSourceConfig.ROOT_PATH, buildRequest.getProject( ).getRootPath( ).toURI( ) ); put( LocalBuildConfig.BUILD_TYPE, buildRequest.getBuildType( ).name( ) ); if ( buildRequest.isSingleResource( ) ) { put( LocalBuildConfig.RESOURCE, encodePath( buildRequest.getResource( ) ) ); } else { addResourceChanges( this, buildRequest.getResourceChanges( ) ); } if ( buildRequest.getDeploymentType( ) != null ) { put( LocalBuildConfig.DEPLOYMENT_TYPE, buildRequest.getDeploymentType( ).name( ) ); put( LocalBuildConfig.SUPPRESS_HANDLERS, Boolean.toString( buildRequest.isSuppressHandlers( ) ) ); } } }; executor.execute( input, pipe, consumer ); }
Source:
<code>public void run() { Iterable<HTInterval> currentIntervals; try { boolean done = false; currentIntervals = intervalQueue.take(); while (!done) { for (HTInterval currentInterval : currentIntervals) { if (currentInterval.getAttribute() == -1) { done = true; break; } getSHT().insertInterval(currentInterval); } if (!done) { currentIntervals = intervalQueue.take(); } } <START> for (HTInterval currentInterval : currentIntervals) { <END> getSHT().closeTree(currentInterval.getEndTime()); return; } } catch (InterruptedException e) { Activator.getDefault().logError("State History Tree interrupted!", e); } catch (TimeRangeException e) { Activator.getDefault().logError("Error starting the state system", e); } }</code><technical_language>get here, hit "poison pill", other real intervals left. assuming a for loop do Iterable.get(0) ? (Guava's) Iterables.getOnlyElement() though</technical_language>

Target:
public void run() { Iterable<HTInterval> currentIntervals; try { currentIntervals = intervalQueue.take(); while (true) { for (HTInterval currentInterval : currentIntervals) { if (currentInterval.getAttribute() == -1) { getSHT().closeTree(currentInterval.getEndTime()); return; } getSHT().insertInterval(currentInterval); } currentIntervals = intervalQueue.take(); } } catch (InterruptedException e) { Activator.getDefault().logError("State History Tree interrupted!", e); } catch (TimeRangeException e) { Activator.getDefault().logError("Error starting the state system", e); } }
Source:
<code>public void testNotSoundsLikeAndNotMatches() { final String ruleName = "test not soundslike constraint"; final RuleModel model = new RuleModel(); model.name = ruleName; final FactPattern pattern = new FactPattern("Person"); <START> final CompositeFieldConstraint notMatchesAndNotSounsLike = new CompositeFieldConstraint(); <END> notMatchesAndNotSounsLike.setCompositeJunctionType(CompositeFieldConstraint.COMPOSITE_TYPE_AND); pattern.addConstraint(notMatchesAndNotSounsLike); final SingleFieldConstraint fieldNotSoundsLikeGoo = new SingleFieldConstraint(); fieldNotSoundsLikeGoo.setFieldType(DataType.TYPE_STRING); fieldNotSoundsLikeGoo.setFieldName("field"); fieldNotSoundsLikeGoo.setOperator("not soundslike"); fieldNotSoundsLikeGoo.setValue("goo"); fieldNotSoundsLikeGoo.setConstraintValueType(SingleFieldConstraint.TYPE_LITERAL); notMatchesAndNotSounsLike.addConstraint(fieldNotSoundsLikeGoo); final SingleFieldConstraint fieldNotMatchesGoo = new SingleFieldConstraint(); fieldNotMatchesGoo.setFieldType(DataType.TYPE_STRING); fieldNotMatchesGoo.setFieldName("field"); fieldNotMatchesGoo.setOperator("not matches"); fieldNotMatchesGoo.setValue("goo"); fieldNotMatchesGoo.setConstraintValueType(SingleFieldConstraint.TYPE_LITERAL); notMatchesAndNotSounsLike.addConstraint(fieldNotMatchesGoo); model.addLhsItem(pattern); String expected = "rule \"" + ruleName + "\"" + "\tdialect \"mvel\"\n when " + "Person( field not soundslike \"goo\" && field not matches \"goo\" )" + "then" + "end"; checkMarshalling(expected, model); }</code><technical_language>Type "notMatchesAndNotSound**s**Like"</technical_language>

Target:
public void testNotSoundsLikeAndNotMatches() { final String ruleName = "test not soundslike constraint"; final RuleModel model = new RuleModel(); model.name = ruleName; final FactPattern pattern = new FactPattern("Person"); final CompositeFieldConstraint notMatchesAndNotSoundsLike = new CompositeFieldConstraint(); notMatchesAndNotSoundsLike.setCompositeJunctionType(CompositeFieldConstraint.COMPOSITE_TYPE_AND); pattern.addConstraint(notMatchesAndNotSoundsLike); final SingleFieldConstraint fieldNotSoundsLikeGoo = new SingleFieldConstraint(); fieldNotSoundsLikeGoo.setFieldType(DataType.TYPE_STRING); fieldNotSoundsLikeGoo.setFieldName("field"); fieldNotSoundsLikeGoo.setOperator("not soundslike"); fieldNotSoundsLikeGoo.setValue("goo"); fieldNotSoundsLikeGoo.setConstraintValueType(SingleFieldConstraint.TYPE_LITERAL); notMatchesAndNotSoundsLike.addConstraint(fieldNotSoundsLikeGoo); final SingleFieldConstraint fieldNotMatchesGoo = new SingleFieldConstraint(); fieldNotMatchesGoo.setFieldType(DataType.TYPE_STRING); fieldNotMatchesGoo.setFieldName("field"); fieldNotMatchesGoo.setOperator("not matches"); fieldNotMatchesGoo.setValue("goo"); fieldNotMatchesGoo.setConstraintValueType(SingleFieldConstraint.TYPE_LITERAL); notMatchesAndNotSoundsLike.addConstraint(fieldNotMatchesGoo); model.addLhsItem(pattern); String expected = "rule \"" + ruleName + "\"" + "\tdialect \"mvel\"\n when " + "Person( field not soundslike \"goo\" && field not matches \"goo\" )" + "then" + "end"; checkMarshalling(expected, model); }
Source:
<code>public void testUntrackedNotIgnoredFolders() throws Exception { Git git = new Git(db); IndexDiff diff = new IndexDiff(db, Constants.HEAD, new FileTreeIterator(db)); diff.diff(); assertEquals(Collections.EMPTY_SET, diff.getUntrackedFolders()); writeTrashFile("readme", ""); writeTrashFile("src/com/A.java", ""); writeTrashFile("src/com/B.java", ""); writeTrashFile("src/org/A.java", ""); writeTrashFile("src/org/B.java", ""); writeTrashFile("target/com/A.java", ""); writeTrashFile("target/com/B.java", ""); writeTrashFile("target/org/A.java", ""); writeTrashFile("target/org/B.java", ""); writeTrashFile(".gitignore", "/target"); git.add().addFilepattern("readme").call(); git.commit().setMessage("initial").call(); diff = new IndexDiff(db, Constants.HEAD, new FileTreeIterator(db)); diff.diff(); assertEquals(new HashSet<String>(Arrays.asList("src")), <START> diff.getUntrackedFolders()); <END> git.add().addFilepattern("src").call(); writeTrashFile("src/tst/A.java", ""); writeTrashFile("src/tst/B.java", ""); deleteTrashFile(".gitignore"); diff = new IndexDiff(db, Constants.HEAD, new FileTreeIterator(db)); diff.diff(); assertEquals(new HashSet<String>(Arrays.asList("target", "src/tst")), diff.getUntrackedFolders()); }</code><technical_language>include a folder name sr anc called srcs</technical_language>

Target:
public void testUntrackedNotIgnoredFolders() throws Exception { Git git = new Git(db); IndexDiff diff = new IndexDiff(db, Constants.HEAD, new FileTreeIterator(db)); diff.diff(); assertEquals(Collections.EMPTY_SET, diff.getUntrackedFolders()); writeTrashFile("readme", ""); writeTrashFile("sr/com/X.java", ""); writeTrashFile("src/com/A.java", ""); writeTrashFile("src/org/B.java", ""); writeTrashFile("srcs/org/Y.java", ""); writeTrashFile("target/com/A.java", ""); writeTrashFile("target/org/B.java", ""); writeTrashFile(".gitignore", "/target\n/sr"); git.add().addFilepattern("readme").addFilepattern(".gitignore") .addFilepattern("srcs/").call(); git.commit().setMessage("initial").call(); diff = new IndexDiff(db, Constants.HEAD, new FileTreeIterator(db)); diff.diff(); assertEquals(new HashSet<String>(Arrays.asList("src")), diff.getUntrackedFolders()); git.add().addFilepattern("src").call(); writeTrashFile("sr/com/X1.java", ""); writeTrashFile("src/tst/A.java", ""); writeTrashFile("src/tst/B.java", ""); writeTrashFile("srcs/com/Y1.java", ""); deleteTrashFile(".gitignore"); diff = new IndexDiff(db, Constants.HEAD, new FileTreeIterator(db)); diff.diff(); assertEquals( new HashSet<String>(Arrays.asList("srcs/com", "sr", "src/tst", "target")), diff.getUntrackedFolders()); }
Source:
<code>public void testParseGrantQuery() throws Exception { String sql0 = "GRANT 'RX' ON SYSTEM.\"SEQUENCE\" TO 'user'"; parseQuery(sql0); String sql1 = "GRANT 'RWXCA' ON TABLE some_table0 TO 'user0'"; parseQuery(sql1); String sql2 = "GRANT 'RWX' ON some_table1 TO 'user1'"; parseQuery(sql2); String sql3 = "GRANT 'CA' ON SCHEMA some_schema2 TO 'user2'"; parseQuery(sql3); String sql4 = "GRANT 'RXW' ON some_table3 TO GROUP 'group3'"; parseQuery(sql4); String sql5 = "GRANT 'RXW' ON \"some_schema5\".\"some_table5\" TO GROUP 'group5'"; parseQuery(sql5); String sql6 = "GRANT 'RWA' TO 'user6'"; parseQuery(sql6); String sql7 = "GRANT 'A' TO GROUP 'group7'"; <START> parseQuery(sql7); <END> }</code><technical_language>Do validation permission type fail permission is other 'RWXCA' parsing side</technical_language>

Target:
public void testParseGrantQuery() throws Exception { String sql0 = "GRANT 'RX' ON SYSTEM.\"SEQUENCE\" TO 'user'"; parseQuery(sql0); String sql1 = "GRANT 'RWXCA' ON TABLE some_table0 TO 'user0'"; parseQuery(sql1); String sql2 = "GRANT 'RWX' ON some_table1 TO 'user1'"; parseQuery(sql2); String sql3 = "GRANT 'CA' ON SCHEMA some_schema2 TO 'user2'"; parseQuery(sql3); String sql4 = "GRANT 'RXW' ON some_table3 TO GROUP 'group3'"; parseQuery(sql4); String sql5 = "GRANT 'RXW' ON \"some_schema5\".\"some_table5\" TO GROUP 'group5'"; parseQuery(sql5); String sql6 = "GRANT 'RWA' TO 'user6'"; parseQuery(sql6); String sql7 = "GRANT 'A' TO GROUP 'group7'"; parseQuery(sql7); String sql8 = "GRANT 'ARXRRRRR' TO GROUP 'group8'"; parseQueryThatShouldFail(sql8); }
Source:
<code>public int compare(Type type1, Type type2) { String errorMessage = "No label for the %s type, using its id instead."; String translatedLabel1 = null; String label1 = type1.getLabel(); if (label1 == null) { String type1Id = type1.getId(); log.error(String.format(errorMessage, type1Id)); translatedLabel1 = type1Id; } else { <START> translatedLabel1 = messages.get(label1); <END> if (translatedLabel1 == null) { translatedLabel1 = label1; } } String translatedLabel2 = null; String label2 = type2.getLabel(); if (label2 == null) { String type2Id = type2.getId(); log.error(String.format(errorMessage, type2Id)); translatedLabel2 = type2Id; } else { translatedLabel2 = messages.get(label2); if (translatedLabel2 == null) { translatedLabel2 = label2; } } return translatedLabel1.compareTo(translatedLabel2); }</code><technical_language>extract blocks a method</technical_language>

Target:
public int compare(Type type1, Type type2) { return getTranslatedLabel(type1).compareTo(getTranslatedLabel(type2)); }
Source:
<code><START> protected void addProjectedField(String s) <END> { try { Field f = inClazz.getDeclaredField(s); TypeInfo t = new TypeInfo(f.getName(), ClassUtils.primitiveToWrapper(f.getType())); t.getter = PojoUtils.createGetter(inClazz, t.name, t.type); logger.debug("Creating setter {}", projectedClazz, t.name, t.type); t.setter = PojoUtils.createSetter(projectedClazz, t.name, t.type); projectedFields.add(t); } catch (NoSuchFieldException e) { throw new RuntimeException("Field " + s + " not found in class " + inClazz, e); } }</code><technical_language>Suggesting method private is a need methods overridden subclass</technical_language>

Target:
protected void addProjectedField(String s) { try { Field f = inClazz.getDeclaredField(s); TypeInfo t = new TypeInfo(f.getName(), ClassUtils.primitiveToWrapper(f.getType())); t.getter = PojoUtils.createGetter(inClazz, t.name, t.type); t.setter = PojoUtils.createSetter(projectedClazz, t.name, t.type); projectedFields.add(t); } catch (NoSuchFieldException e) { throw new RuntimeException("Field " + s + " not found in class " + inClazz, e); } }
Source:
<code>public void init() throws URISyntaxException, IOException { mapper = TestSyncUtils.getTestSyncUtils(new MapConfiguration( new HashMap<String, String>() { { put(ConfigProperties.FAIL_ON_UNKNOWN_IMPORT_PROPERTIES, "false"); } } )); i18n = I18nFactory.getI18n(getClass(), Locale.US, I18nFactory.FALLBACK); config = new CandlepinCommonTestConfig(); pc = Mockito.mock(ProductCurator.class); ec = Mockito.mock(EntitlementCurator.class); this.environmentCurator = Mockito.mock(EnvironmentCurator.class); ProductCachedSerializationModule productCachedModule = new ProductCachedSerializationModule(pc); su = new SyncUtils(config, productCachedModule); PrintStream ps = new PrintStream( new File(this.getClass().getClassLoader().getResource("version.properties").toURI())); ps.println("version=0.0.3"); ps.println("release=1"); ps.close(); mockJsPath = new File(folder.getRoot(), "empty.js").getPath(); this.mockSubReconciler = Mockito.mock(SubscriptionReconciler.class); this.consumerTypeCurator = Mockito.mock(ConsumerTypeCurator.class); oc = mock(OwnerCurator.class); entitlementCurator = mock(EntitlementCurator.class); this.translator = new StandardTranslator(this.consumerTypeCurator, this.environmentCurator, this.oc <START> , this.entitlementCurator); <END> }</code><technical_language>Trailing punctuation previous line. If fit, bring chunk of code down. In this case, guessing this.oc, 171</technical_language>

Target:
public void init() throws URISyntaxException, IOException { mapper = TestSyncUtils.getTestSyncUtils(new MapConfiguration( new HashMap<String, String>() { { put(ConfigProperties.FAIL_ON_UNKNOWN_IMPORT_PROPERTIES, "false"); } } )); i18n = I18nFactory.getI18n(getClass(), Locale.US, I18nFactory.FALLBACK); config = new CandlepinCommonTestConfig(); pc = Mockito.mock(ProductCurator.class); ec = Mockito.mock(EntitlementCurator.class); this.environmentCurator = Mockito.mock(EnvironmentCurator.class); ProductCachedSerializationModule productCachedModule = new ProductCachedSerializationModule(pc); su = new SyncUtils(config, productCachedModule); PrintStream ps = new PrintStream( new File(this.getClass().getClassLoader().getResource("version.properties").toURI())); ps.println("version=0.0.3"); ps.println("release=1"); ps.close(); mockJsPath = new File(folder.getRoot(), "empty.js").getPath(); this.mockSubReconciler = Mockito.mock(SubscriptionReconciler.class); this.consumerTypeCurator = Mockito.mock(ConsumerTypeCurator.class); oc = mock(OwnerCurator.class); this.translator = new StandardTranslator(this.consumerTypeCurator, this.environmentCurator, this.oc); }
Source:
<code><START> public Map<String, Object> getStats() throws IOException { <END> final Object result = this.client.call( LuaCommand.STATS.toString(), this.name, ClientHelper.getCurrentSeconds()); final JavaType javaType = new ObjectMapper().getTypeFactory().constructMapType( HashMap.class, String.class, Object.class); return JsonUtils.parse(result.toString(), javaType); }</code><technical_language>provide a version accepts some sort of date, this version delegating out it. java public Map<String, Object> getStats() throws IOException { return getStats(new Date()); } public Map<String, Object> getStats(final Date date) throws IOException { ... }</technical_language>

Target:
public Map<String, Object> getStats() throws IOException { return this.getStats(new Date()); }
Source:
<code>protected void showPageRec(PageRec pageRec) { IDebuggerConsole recConsole = fPartToConsole.get(pageRec.part); if (recConsole != null && recConsole.equals(getCurrentConsole())) { return; } super.showPageRec(pageRec); <START> fActiveConsole = recConsole; <END> activateParticipants(fActiveConsole); updateTitle(); }</code><technical_language>Console view Debugger Console view multiple pages, console. is showing a time. ConsoleView code, activate participants of console page is top (the active one), while disactivating participant of page is hidden. do same</technical_language>

Target:
protected void showPageRec(PageRec pageRec) { IDebuggerConsole recConsole = fPartToConsole.get(pageRec.part); if (recConsole != null && recConsole.equals(getCurrentConsole())) { return; } super.showPageRec(pageRec); fActiveConsole = recConsole; IDebuggerConsole topOfStack = null; if (!fStack.isEmpty()) { topOfStack = fStack.get(0); } if (topOfStack != null && !topOfStack.equals(fActiveConsole) && fActive) { deactivateParticipants(topOfStack); } if (fActiveConsole != null && !fActiveConsole.equals(topOfStack)) { fStack.remove(fActiveConsole); fStack.add(0, fActiveConsole); activateParticipants(fActiveConsole); } updateTitle(); }
Source:
<code>public void createControl(Composite parent) { Composite comp = new Composite(parent, SWT.NONE); comp.setLayout(new GridLayout()); <START> this.createProjectGroup(comp, 4); <END> createVerticalSpacer(comp, 1); this.createExeFileGroup(comp, 4); createVerticalSpacer(comp, 1); createRemoteConfigurationGroup(comp); createVerticalSpacer(comp, 1); setControl(comp); PlatformUI .getWorkbench() .getHelpSystem() .setHelp(getControl(), Activator.PLUGIN_ID + ".launchgroup"); }</code><technical_language>Remove 'this' prefix, is needed it</technical_language>

Target:
public void createControl(Composite parent) { Composite comp = new Composite(parent, SWT.NONE); comp.setLayout(new GridLayout()); createProjectGroup(comp, 4); createVerticalSpacer(comp, 1); createExeFileGroup(comp, 4); createVerticalSpacer(comp, 1); createRemoteConfigurationGroup(comp); createVerticalSpacer(comp, 1); setControl(comp); PlatformUI .getWorkbench() .getHelpSystem() .setHelp(getControl(), Activator.PLUGIN_ID + ".launchgroup"); }
Source:
<code>private static boolean equals(String i, String j) { if (Objects.equals(i, j)) { return true; } <START> Number number1 = toNumber(i); <END> Number number2 = toNumber(j); if (number1 == null || number2 == null) { return false; } if (number1 instanceof Double || number2 instanceof Double || number1 instanceof Float || number2 instanceof Float) { return number1.doubleValue() == number2.doubleValue(); } return number1.longValue() == number2.longValue(); }</code><technical_language>If number1 is null, return false early</technical_language>

Target:
private static boolean equals(String i, String j) { if (Objects.equals(i, j)) { return true; } Number number1 = toNumber(i); if (number1 == null) { return false; } Number number2 = toNumber(j); if (number2 == null) { return false; } if (number1 instanceof Double || number2 instanceof Double || number1 instanceof Float || number2 instanceof Float) { return number1.doubleValue() == number2.doubleValue(); } return number1.longValue() == number2.longValue(); }
Source:
<code>final Map<ChannelOption<?>, Object> options() { <START> return Collections.unmodifiableMap(options); <END> }</code><technical_language>I this copy preserve existing semantics <LINK_0></technical_language>

Target:
final Map<ChannelOption<?>, Object> options() { return copiedMap(options); }
Source:
<code>@NonNull public PreparedPutObjects<T> prepare() { <START> Checks.checkNotNull(mapFunc, "Please specify map function"); <END> Checks.checkNotNull(putResolver, "Please specify put resolver"); return new PreparedPutObjects<>( storIOSQLiteDb, putResolver, objects, mapFunc, useTransactionIfPossible); }</code><technical_language>Static import</technical_language>

Target:
@NonNull public PreparedPutObjects<T> prepare() { checkNotNull(mapFunc, "Please specify map function"); checkNotNull(putResolver, "Please specify put resolver"); return new PreparedPutObjects<>( storIOSQLiteDb, putResolver, objects, mapFunc, useTransactionIfPossible); }
Source:
<code>public static Map<String, String> getTags(String key, String entityId, Map<String, String> entity) { Map<String, String> tags = new HashMap<>(); tags.put("entity", entityId.replace("[", "_").replace("]", "_").replace(":", "_").replace("@", "_")); for (String field : TAG_FIELDS) { if (entity.containsKey(field)) { String fieldValue = entity.get(field); if (null != fieldValue && !"".equals(fieldValue)) { tags.put(field, entity.get(field)); } } } if (null != key && !"".equals(key)) { <START> tags.put("key", key.replace(":", "_").replace("@", "_").replace("?","_").replace("=","_")); <END> } String metricName = extractMetricName(key); if (null != metricName) { tags.put("metric", metricName.replace(":", "_").replace("@", "_").replace("?","_").replace("=","_")); } return tags; }</code><technical_language>regex Pattern compile reuse</technical_language>

Target:
public static Map<String, String> getTags(String key, String entityId, Map<String, String> entity) { Map<String, String> tags = new HashMap<>(); tags.put("entity", KAIROSDB_INVALID_TAG_CHARS.matcher(entityId).replaceAll(REPLACE_CHAR)); for (String field : TAG_FIELDS) { if (entity.containsKey(field)) { String fieldValue = entity.get(field); if (null != fieldValue && !"".equals(fieldValue)) { tags.put(field, entity.get(field)); } } } if (null != key && !"".equals(key)) { tags.put("key", KAIROSDB_INVALID_TAG_CHARS.matcher(key).replaceAll(REPLACE_CHAR)); } String metricName = extractMetricName(key); if (null != metricName) { tags.put("metric", KAIROSDB_INVALID_TAG_CHARS.matcher(metricName).replaceAll(REPLACE_CHAR)); } return tags; }
Source:
<code>private void trySaveNoteIfNotAlreadyInBucket(Bundle data) { if (SimperiumUtils.getNotesBucket() != null) { String noteId = data.getString(PUSH_ARG_NOTE_ID, ""); try { SimperiumUtils.getNotesBucket().get(noteId); } catch (BucketObjectMissingException e) { AppLog.e(T.NOTIFS, e); SimperiumUtils.trackBucketObjectMissingWarning(e.getMessage(), noteId); <START> if (data.containsKey(PUSH_ARG_NOTE_FULL_DATA)) { <END> String base64FullData = data.getString(PUSH_ARG_NOTE_FULL_DATA); Note note = new Note.Schema().buildFromBase64EncodedData(noteId, base64FullData); SimperiumUtils.saveNote(note); } } } }</code><technical_language>if trySaveNoteIfNotAlreadyInBucket is called a non-null data param, checking for null this method risky hit a NPE here. I prefer leave null check was, in case some other point in time decide re-factor this end this method</technical_language>

Target:
private void trySaveNoteIfNotAlreadyInBucket(Bundle data) { if (SimperiumUtils.getNotesBucket() != null) { if (data == null) { AppLog.e(T.NOTIFS, "Bundle is null! Cannot read '" + PUSH_ARG_NOTE_ID +"'."); return; } String noteId = data.getString(PUSH_ARG_NOTE_ID, ""); try { SimperiumUtils.getNotesBucket().get(noteId); } catch (BucketObjectMissingException e) { AppLog.e(T.NOTIFS, e); SimperiumUtils.trackBucketObjectMissingWarning(e.getMessage(), noteId); if (data.containsKey(PUSH_ARG_NOTE_FULL_DATA)) { String base64FullData = data.getString(PUSH_ARG_NOTE_FULL_DATA); Note note = new Note.Schema().buildFromBase64EncodedData(noteId, base64FullData); SimperiumUtils.saveNote(note); } } } }