auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void loadAllLookupsAndInitStateRef() { if (!lookupConfig.getDisableLookupSyncOnStartup()) { String tier = lookupListeningAnnouncerConfig.getLookupTier(); List<LookupBean> lookupBeanList = getLookupListFromCoordinator(tier); if (lookupBeanList == null) { LOG.info("Coordinator is unavailable. Loading saved snapshot instead"); lookupBeanList = getLookupListFromSnapshot(); } if (lookupBeanList != null) { ImmutableMap.Builder<String, LookupExtractorFactoryContainer> builder = ImmutableMap.builder(); ListeningScheduledExecutorService executorService = MoreExecutors.listeningDecorator( Executors.newScheduledThreadPool( lookupConfig.getNumLookupLoadingThreads(), Execs.makeThreadFactory("LookupReferencesManager-Startup-%s") ) ); try { List<ListenableFuture<Map.Entry>> futures = new ArrayList<>(); LOG.info("Starting lookup loading process"); for (LookupBean lookupBean : lookupBeanList) { futures.add( executorService.submit( () -> { LookupExtractorFactoryContainer container = lookupBean.getContainer(); LOG.info( "Started lookup [%s]:[%s]", lookupBean.getName(), container ); if (container.getLookupExtractorFactory().start()) { return new AbstractMap.SimpleImmutableEntry<>(lookupBean.getName(), container); } else { LOG.error( "Failed to start lookup [%s]:[%s]", lookupBean.getName(), container ); return null; } } ) ); } final ListenableFuture<List<Map.Entry>> futureList = Futures.allAsList(futures); try { futureList.get() .stream() .filter(Objects::nonNull) .forEach(builder::put); } catch (Exception ex) { futureList.cancel(true); throw ex; } stateRef.set(new LookupUpdateState(builder.build(), ImmutableList.of(), ImmutableList.of())); } catch (Exception e) { LOG.error(e, "Failed to finish lookup load process."); } executorService.shutdownNow(); } else { LOG.info("No lookups to be loaded at this point"); stateRef.set(new LookupUpdateState(ImmutableMap.of(), ImmutableList.of(), ImmutableList.of())); } } else { LOG.info("Lookup loading on startup is disabled"); stateRef.set(new LookupUpdateState(ImmutableMap.of(), ImmutableList.of(), ImmutableList.of())); } }

Target:
private void loadAllLookupsAndInitStateRef() { List<LookupBean> lookupBeanList = getLookupsListFromLookupConfig(); if (lookupBeanList != null) { startLookups(lookupBeanList); } else { LOG.info("No lookups to be loaded at this point"); stateRef.set(new LookupUpdateState(ImmutableMap.of(), ImmutableList.of(), ImmutableList.of())); } }
Source:
public void testInitialClone_WithAuthenticationNoCredentials() throws Exception { Repository dst = createBareRepository(); assertFalse(dst.hasObject(A_txt)); try (Transport t = Transport.open(dst, authURI)) { t.fetch(NullProgressMonitor.INSTANCE, mirror(master)); fail("Should not have succeeded -- no authentication"); } catch (TransportException e) { String msg = e.getMessage(); assertTrue("Unexpected exception message: " + msg, msg.contains("no CredentialsProvider")); } List<AccessEvent> requests = getRequests(); assertEquals(1, requests.size()); AccessEvent info = requests.get(0); assertEquals("GET", info.getMethod()); assertEquals(401, info.getStatus()); assertNotNull(info.getResponseHeader(HDR_WWW_AUTHENTICATE)); assertTrue(info.getResponseHeader(HDR_WWW_AUTHENTICATE).toLowerCase().startsWith("basic realm=")); }

Target:
public void testInitialClone_WithAuthenticationNoCredentials() throws Exception { Repository dst = createBareRepository(); assertFalse(dst.hasObject(A_txt)); try (Transport t = Transport.open(dst, authURI)) { t.fetch(NullProgressMonitor.INSTANCE, mirror(master)); fail("Should not have succeeded -- no authentication"); } catch (TransportException e) { String msg = e.getMessage(); assertTrue("Unexpected exception message: " + msg, msg.contains("no CredentialsProvider")); } List<AccessEvent> requests = getRequests(); assertEquals(1, requests.size()); AccessEvent info = requests.get(0); assertEquals("GET", info.getMethod()); assertEquals(401, info.getStatus()); assertStartsWithIgnoreCase(info.getResponseHeader(HDR_WWW_AUTHENTICATE), "basic realm="); }
Source:
public boolean createPdpFeedFile(PdpFeedFileBaseEntry pdpFeedFileBaseEntry, String fullyQualifiedPdpFileName) { boolean success = true; try { File pdpFeedFile = getCuMarshalService().marshalObjectToXML(pdpFeedFileBaseEntry, fullyQualifiedPdpFileName); LOG.info("Created PDP Feed file: " + fullyQualifiedPdpFileName); success = true; } catch (JAXBException | IOException e) { LOG.error("createPdpFeedFile.marshalObjectToXML: There was an error marshalling the PDP feed file: " + fullyQualifiedPdpFileName, e); success = false; } return success; }

Target:
public boolean createPdpFeedFile(PdpFeedFileBaseEntry pdpFeedFileBaseEntry, String fullyQualifiedPdpFileName) { boolean success = true; try { getCuMarshalService().marshalObjectToXML(pdpFeedFileBaseEntry, fullyQualifiedPdpFileName); LOG.info("createPdpFeedFile: Created PDP Feed file: " + fullyQualifiedPdpFileName); success = true; } catch (JAXBException | IOException e) { LOG.error("createPdpFeedFile.marshalObjectToXML: There was an error marshalling the PDP feed file: " + fullyQualifiedPdpFileName, e); success = false; } return success; }
Source:
public static List<String> getAPISecurity(String security){ List<String> apiSecurityList = new ArrayList<>(); if (security != null) { String[] securityList = security.split(","); for (String s : securityList) { if (APIConstants.APPLICATION_LEVEL_SECURITY.contains(s)) { apiSecurityList.add(s); } } } return apiSecurityList; }

Target:
public static List<String> getAPISecurity(String security) { List<String> apiSecurityList = new ArrayList<>(); if (security != null) { String[] securityList = security.split(","); for (String securityType : securityList) { if (APIConstants.APPLICATION_LEVEL_SECURITY.contains(securityType)) { apiSecurityList.add(securityType); } } } return apiSecurityList; }
Source:
private void removeRecentTaskLocked(int userId) { if(userId <= 0) { Slog.i(TAG, "Can't remove recent task on user " + userId); return; } int N = mRecentTasks.size(); for (int i = 0; i < N; i++) { TaskRecord tr = mRecentTasks.get(i); if (tr.userId == userId) { tr.disposeThumbnail(); mRecentTasks.remove(i); Slog.i(TAG, "remove RecentTask " + userId); i--; N--; } } }

Target:
private void removeRecentTaskLocked(int userId) { if(userId <= 0) { Slog.i(TAG, "Can't remove recent task on user " + userId); return; } for (int i = mRecentTasks.size() - 1; i >= 0; --i) { TaskRecord tr = mRecentTasks.get(i); if (tr.userId == userId) { if(DEBUG_TASKS) Slog.i(TAG, "remove RecentTask " + tr + " when finishing user" + userId); tr.disposeThumbnail(); mRecentTasks.remove(i); } } }
Source:
private SearchResponse getScrollResponse(ElasticsearchQueryBuilder queryBuilder, String scrollId) { try { return retry() .maxAttempts(maxAttempts) .exponentialBackoff(maxRetryTime, 2.0) .run("scrollRequest", () -> { return queryBuilder.prepareSearchScroll(scrollId) .execute() .actionGet(requestTimeout.toMillis()); }); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException(e); } catch (Exception e) { throw new RuntimeException(e); } }

Target:
private SearchResponse getScrollResponse(ElasticsearchQueryBuilder queryBuilder, String scrollId) { try { return retry() .maxAttempts(maxAttempts) .exponentialBackoff(maxRetryTime) .run("scrollRequest", () -> queryBuilder.prepareSearchScroll(scrollId) .execute() .actionGet(requestTimeout.toMillis())); } catch (Exception e) { throw new RuntimeException(e); } }
Source:
public ConfigurationClientBuilder httpClient(HttpClient client) { this.httpClient = client; return this; }

Target:
public ConfigurationClientBuilder httpClient(HttpClient client) { if (this.httpClient != null && client == null) { logger.info("HttpClient is being set to 'null' when it was previously configured."); } this.httpClient = client; return this; }
Source:
public ReadOnlyDictionaryInterface getDictionary(int index) { return (ReadOnlyDictionaryInterface) fleeceValueToObject(index); }

Target:
public ReadOnlyDictionary getDictionary(int index) { return (ReadOnlyDictionary) fleeceValueToObject(index); }
Source:
public void deleteBucketAcl() throws IOException, SignatureException { PutBucketAclForUserSpectraS3Response putBucketAclForUserSpectraS3Response = null; putBucketAclForUserSpectraS3Response = client.putBucketAclForUserSpectraS3( new PutBucketAclForUserSpectraS3Request(BUCKET_NAME, BucketAclPermission.DELETE, spectraUUID)); final DeleteBucketAclSpectraS3Response deleteBucketAclSpectraS3Response = client .deleteBucketAclSpectraS3(new DeleteBucketAclSpectraS3Request( putBucketAclForUserSpectraS3Response.getBucketAclResult().getId().toString())); assertThat(deleteBucketAclSpectraS3Response.getStatusCode(), is(204)); }

Target:
public void deleteBucketAcl() throws IOException, SignatureException { final PutBucketAclForUserSpectraS3Response putBucketAclForUserSpectraS3Response = client.putBucketAclForUserSpectraS3( new PutBucketAclForUserSpectraS3Request(BUCKET_NAME, BucketAclPermission.DELETE, spectraUUID)); final DeleteBucketAclSpectraS3Response deleteBucketAclSpectraS3Response = client .deleteBucketAclSpectraS3(new DeleteBucketAclSpectraS3Request( putBucketAclForUserSpectraS3Response.getBucketAclResult().getId().toString())); assertThat(deleteBucketAclSpectraS3Response.getStatusCode(), is(204)); }
Source:
public void sendNotification(URL resetUrl, ILocalAccountPerson account, Locale locale) { log.debug("Sending password reset instructions to user with url " + resetUrl.toString()); List<String> recipients = getRecipientAddresses(account); String subject = formatSubject(account, locale); String body = formatBody(resetUrl, account, locale); try { MimeMessage message = mailSender.createMimeMessage(); MimeMessageHelper helper = new MimeMessageHelper(message, true); for (String recipient : recipients) { helper.addTo(recipient); } helper.setText(body, true); helper.setSubject(subject); helper.setFrom(portalEmailAddress, messageSource.getMessage("portal.name", new Object[]{}, locale)); log.debug("Sending message to " + recipients + " from " + Arrays.toString(message.getFrom()) + " subject " + message.getSubject()); this.mailSender.send(helper.getMimeMessage()); } catch(MailException | MessagingException | UnsupportedEncodingException e) { log.error("Unable to send password reset email ", e); } }

Target:
public void sendNotification(URL resetUrl, ILocalAccountPerson account, Locale locale) { log.debug("Sending password reset instructions to user with url {}", resetUrl.toString()); try { MimeMessage message = mailSender.createMimeMessage(); MimeMessageHelper helper = new MimeMessageHelper(message, true); String email = (String)account.getAttributeValue(ILocalAccountPerson.ATTR_MAIL); String subject = messageSource.getMessage(subjectMessageKey, new Object[]{}, locale); String body = formatBody(resetUrl, account, locale); helper.addTo(email); helper.setText(body, true); helper.setSubject(subject); helper.setFrom(portalEmailAddress, messageSource.getMessage("portal.name", new Object[]{}, locale)); log.debug("Sending message to from subject {}", email, Arrays.toString(message.getFrom()), message.getSubject()); this.mailSender.send(helper.getMimeMessage()); } catch(Exception e) { log.error("Unable to send password reset email", e); } }
Source:
protected void emit(String tuple) { output.emit(tuple); byte[] bytes = tuple.getBytes(); byteOutput.emit(bytes); }

Target:
protected void emit(String tuple) { output.emit(tuple); byteOutput.emit(tuple.getBytes()); }
Source:
private Collection<ResourceLocator> getRatesCurvesResources() { return getAllResources(CURVES_DIR).stream() .filter(res -> !res.getLocator().endsWith(CURVES_GROUPS_FILE) && !res.getLocator().endsWith(CURVES_SETTINGS_FILE)) .collect(Collectors.toList()); }

Target:
private Collection<ResourceLocator> getRatesCurvesResources() { return getAllResources(CURVES_DIR).stream() .filter(res -> !res.getLocator().endsWith(CURVES_GROUPS_FILE)) .filter(res -> !res.getLocator().endsWith(CURVES_SETTINGS_FILE)) .collect(toImmutableList()); }
Source:
public static String doRequestGet(String url, Bundle params) { String newUrl = null; if (params != null) { StringBuilder sb = new StringBuilder(); sb.append(url).append('?'); boolean first = true; for (String key : params.keySet()) { if (!first) { sb.append('&'); } else { first = false; } sb.append(URLEncoder.encode(key)).append('=').append(URLEncoder.encode(params.getString(key))); } newUrl = sb.toString(); } HttpParams httpParameters = new BasicHttpParams(); HttpConnectionParams.setConnectionTimeout(httpParameters, CONNECTION_TIME_OUT); HttpConnectionParams.setSoTimeout(httpParameters, SOCKET_TIME_OUT); try { HttpGet httpRequest = new HttpGet(newUrl); HttpResponse httpResponse = new DefaultHttpClient(httpParameters).execute(httpRequest); if (httpResponse.getStatusLine().getStatusCode() == SUCCESS_STATUS) { return EntityUtils.toString(httpResponse.getEntity()); } else { LogUtils.logD("Http response error when do get operation!"); } } catch (Exception e) { LogUtils.logE(e.getMessage()); } return null; }

Target:
public static String doRequestGet(String url, Bundle params) { String newUrl = url; if (params != null && !params.isEmpty()) { StringBuilder sb = new StringBuilder(); sb.append(url).append('?'); boolean first = true; for (String key : params.keySet()) { if (!first) { sb.append('&'); } else { first = false; } sb.append(URLEncoder.encode(key)).append('=').append(URLEncoder.encode(params.getString(key))); } newUrl = sb.toString(); } HttpParams httpParameters = new BasicHttpParams(); HttpConnectionParams.setConnectionTimeout(httpParameters, CONNECTION_TIME_OUT); HttpConnectionParams.setSoTimeout(httpParameters, SOCKET_TIME_OUT); try { HttpGet httpRequest = new HttpGet(newUrl); HttpResponse httpResponse = new DefaultHttpClient(httpParameters).execute(httpRequest); if (httpResponse.getStatusLine().getStatusCode() == SUCCESS_STATUS) { return EntityUtils.toString(httpResponse.getEntity()); } else { LogUtils.logD("Http response error when do get operation!"); } } catch (Exception e) { LogUtils.logE(e.getMessage()); } return null; }
Source:
private List<Ability> cardPlayableAbilities(Game game, Card card, boolean setControllerId) { List<Ability> playable = new ArrayList(); if (card != null) { for (ActivatedAbility ability : card.getAbilities().getActivatedAbilities(Zone.HAND)) { if (setControllerId) { ability.setControllerId(getId()); } if (ability instanceof SpellAbility && null != game.getContinuousEffects().asThough(card.getId(), AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, ability, getId(), game)) { playable.add(ability); } else if (ability instanceof PlayLandAbility && null != game.getContinuousEffects().asThough(card.getId(), AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, card.getSpellAbility(), getId(), game)) { playable.add(ability); } if (setControllerId) { ability.setControllerId(card.getOwnerId()); } } } return playable; }

Target:
private List<Ability> cardPlayableAbilities(Game game, Card card, boolean setControllerId) { List<Ability> playable = new ArrayList(); if (card != null) { for (ActivatedAbility ability : card.getAbilities().getActivatedAbilities(Zone.HAND)) { if (!ability.canActivate(playerId, game).canActivate()) { continue; } UUID savedControllerId = null; if (setControllerId) { savedControllerId = getId(); ability.setControllerId(getId()); } if (ability instanceof SpellAbility && null != game.getContinuousEffects().asThough(card.getId(), AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, ability, getId(), game)) { playable.add(ability); } else if (ability instanceof PlayLandAbility && null != game.getContinuousEffects().asThough(card.getId(), AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, card.getSpellAbility(), getId(), game)) { playable.add(ability); } if (setControllerId) { ability.setControllerId(savedControllerId); } } } return playable; }
Source:
public void apply(String endpointId, GitCheckoutEventDto dto) { final Type type = dto.getType(); final String name = dto.getName(); switch (type) { case BRANCH: { Log.debug(getClass(), "Received git branch checkout event: " + name); final NotificationManager notificationManager = notificationManagerProvider.get(); if (notificationManager != null) { notificationManager.notify("Git operation", "Branch '" + name + "' is checked out", SUCCESS, EMERGE_MODE); } break; } case REVISION: { Log.debug(getClass(), "Received git revision checkout event: " + name); final NotificationManager notificationManager = notificationManagerProvider.get(); if (notificationManager != null) { notificationManager.notify("Git operation", "Revision '" + name + "' is checked out", SUCCESS, EMERGE_MODE); } break; } } resourceManagerFactory.newResourceManager(appContext.getDevMachine()).getWorkspaceProjects(); }

Target:
public void apply(String endpointId, GitCheckoutEventDto dto) { final Type type = dto.getType(); final String name = dto.getName(); switch (type) { case BRANCH: { Log.debug(getClass(), "Received git branch checkout event: " + name); final NotificationManager notificationManager = notificationManagerProvider.get(); if (notificationManager != null) { notificationManager.notify("Git operation", "Branch '" + name + "' is checked out", SUCCESS, EMERGE_MODE); } break; } case REVISION: { Log.debug(getClass(), "Received git revision checkout event: " + name); final NotificationManager notificationManager = notificationManagerProvider.get(); if (notificationManager != null) { notificationManager.notify("Git operation", "Revision '" + name + "' is checked out", SUCCESS, EMERGE_MODE); } break; } } appContext.getWorkspaceRoot().synchronize(); }
Source:
public int compareTo(CohortMembership o) { if (Objects.equals(this.getPatient().getPatientId(), o.getPatient().getPatientId()) && Objects.equals(this.getCohort().getCohortId(), o.getCohort().getCohortId()) && this.getStartDate().equals(o.getStartDate()) && ((this.getEndDate() != null && o.getEndDate() != null && this.getEndDate().equals(o.getEndDate())) || (this.getEndDate() == null && o.getEndDate() == null))) { return 0; } else if ((this.isMembershipActive() && !o.isMembershipActive()) || (!this.isMembershipActive() && o.isMembershipActive())) { return 1; } else { return -1; } }

Target:
public int compareTo(CohortMembership o) { int ret = -1; if (Objects.equals(this.getPatientId(), o.getPatientId()) && Objects.equals(this.getCohort().getCohortId(), o.getCohort().getCohortId()) && this.getStartDate().equals(o.getStartDate()) && OpenmrsUtil.compare(this.getStartDate(), o.getStartDate()) == 0 && ((this.getEndDate() != null && o.getEndDate() != null && OpenmrsUtil.compare(this.getEndDate(), o.getEndDate()) == 0) || (this.getEndDate() == null && o.getEndDate() == null))) { ret = 0; } else if (this.isActive() && !o.isActive()) { ret = -1; } else if (!this.isActive() && o.isActive()) { ret = 1; } return ret; }
Source:
public APIResult submitExtensionJob(final String extensionName, final String jobName, final String configPath, final String doAsUser) { InputStream configStream = getServletInputStream(configPath); if (!validateExtension(extensionName, jobName, configStream)) { return null; } ClientResponse clientResponse = new ResourceBuilder() .path(ExtensionOperations.SUBMIT.path, extensionName) .addQueryParam(DO_AS_OPT, doAsUser) .call(ExtensionOperations.SUBMIT, configStream); return getResponse(APIResult.class, clientResponse); }

Target:
public APIResult submitExtensionJob(final String extensionName, final String jobName, final String configPath, final String doAsUser) { FormDataMultiPart entitiesForm = getEntitiesForm(extensionName, jobName, configPath); ClientResponse clientResponse = new ResourceBuilder() .path(ExtensionOperations.SUBMIT.path, extensionName) .addQueryParam(DO_AS_OPT, doAsUser) .addQueryParam(JOB_NAME_OPT, jobName) .call(ExtensionOperations.SUBMIT, entitiesForm); return getResponse(APIResult.class, clientResponse); }
Source:
public void scanFile(XmlCheckContext context) { try { NodeList interceptorBindings = context.evaluateXPathExpression("ejb-jar/assembly-descriptor/interceptor-binding"); for (int i = 0; i < interceptorBindings.getLength(); i++) { Node interceptorBinding = interceptorBindings.item(i); if (!isDefaultInterceptor(context, interceptorBinding)) { checkExclusions(context, interceptorBinding); } } } catch (XPathExpressionException e) { throw new IllegalArgumentException("[S3282] Unable evaluate xpath expression for file " + context.getFile().getAbsolutePath(), e); } }

Target:
public void scanFile(XmlCheckContext context) { try { NodeList interceptorBindings = context.evaluateXPathExpression("ejb-jar/assembly-descriptor/interceptor-binding"); for (int i = 0; i < interceptorBindings.getLength(); i++) { Node interceptorBinding = interceptorBindings.item(i); if (!isDefaultInterceptor(context, interceptorBinding)) { checkExclusions(context, interceptorBinding); } } } catch (XPathExpressionException e) { throw new AnalysisException("[S3282] Unable evaluate xpath expression for file " + context.getFile().getAbsolutePath(), e); } }
Source:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.login_site_address_screen, container, false); mSiteAddressEditText = (EditText) rootView.findViewById(R.id.login_site_address); mSiteAddressEditText.addTextChangedListener(this); mSiteAddressTextLayout = (TextInputLayout) rootView.findViewById(R.id.login_site_address_layout); mNextButton = (Button) rootView.findViewById(R.id.login_next_button); mNextButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { discover(); } }); mSiteAddressEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (event != null && event.getAction() == KeyEvent.ACTION_UP && event.getKeyCode() == KeyEvent.KEYCODE_ENTER) { discover(); } return true; } }); rootView.findViewById(R.id.login_site_address_help).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (mLoginListener != null) { showSiteAddressHelp(); } } }); return rootView; }

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.login_site_address_screen, container, false); mSiteAddressEditText = (EditText) rootView.findViewById(R.id.login_site_address); mSiteAddressEditText.addTextChangedListener(this); mSiteAddressTextLayout = (TextInputLayout) rootView.findViewById(R.id.login_site_address_layout); mNextButton = (Button) rootView.findViewById(R.id.login_next_button); mNextButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { discover(); } }); mSiteAddressEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (event != null && event.getAction() == KeyEvent.ACTION_UP && event.getKeyCode() == KeyEvent.KEYCODE_ENTER) { discover(); } return true; } }); rootView.findViewById(R.id.login_site_address_help).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { showSiteAddressHelp(); } }); return rootView; }
Source:
public boolean checkMoment(Date date) { if (calendar != null) { Period period = new Period(new DateTime(date), new Dur(0, 0, 0, 1)); Rule<Component> periodRule = new PeriodRule<Component>(period); Filter<CalendarComponent> filter = new Filter<CalendarComponent>(new Rule[] {periodRule}, Filter.MATCH_ANY); Collection<CalendarComponent> events = filter.filter(calendar.getComponents(Component.VEVENT)); if (events != null && !events.isEmpty()) { return true; } } return false; }

Target:
public boolean checkMoment(Date date) { if (calendar != null) { Period period = new Period(new DateTime(date), new Dur(0, 0, 0, 0)); Rule<Component> periodRule = new PeriodRule<Component>(period); Filter<CalendarComponent> filter = new Filter<CalendarComponent>(new Rule[] {periodRule}, Filter.MATCH_ANY); Collection<CalendarComponent> events = filter.filter(calendar.getComponents(Component.VEVENT)); if (events != null && !events.isEmpty()) { return true; } } return false; }
Source:
public void customRotators_correctlyIgnored() throws IOException, InterruptedException { FreeStyleProject project = j.createFreeStyleProject(); project.setBuildDiscarder( mockCustomRotator1 ); LogRotatorConfiguration config = GlobalConfiguration.all().get( LogRotatorConfiguration.class ); assertNotNull( config ); config.setPolicyForJobsWithCustomLogRotator( LogRotationPolicy.NONE ); config.setGlobalLogRotators(Arrays.asList( new LogRotatorMapping[] { catchallGlobalMapping })); task.execute( listener ); verify( mockCustomRotator1, never() ) .perform( project ); verify( mockCatchallGlobalRotator, never() ) .perform( project ); }

Target:
public void customRotators_correctlyIgnored() throws IOException, InterruptedException { FreeStyleProject project = j.createFreeStyleProject(); project.setBuildDiscarder( mockCustomRotator1 ); LogRotatorConfiguration config = GlobalConfiguration.all().get( LogRotatorConfiguration.class ); assertNotNull( config ); config.setPolicyForJobsWithCustomLogRotator( LogRotationPolicy.NONE ); config.setGlobalLogRotators(Arrays.asList( catchallGlobalMapping )); task.execute( listener ); verify( mockCustomRotator1, never() ) .perform( project ); verify( mockCatchallGlobalRotator, never() ) .perform( project ); }
Source:
public static boolean isTestModeEnabled(Context context, Network network) { ConnectivityManager connectManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkCapabilities networkCapabilities = connectManager.getNetworkCapabilities(network); if (networkCapabilities == null) { return false; } return networkCapabilities.hasCapability(NETWORK_CAPABILITY_TRANSPORT_TEST); }

Target:
public static boolean isTestModeEnabled(Context context, Network network) { ConnectivityManager connectManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkCapabilities networkCapabilities = connectManager.getNetworkCapabilities(network); return networkCapabilities != null && networkCapabilities.hasCapability(NETWORK_CAPABILITY_TRANSPORT_TEST); }
Source:
public String getAddress( final double latitude, final double longitude, final ReverseGeocoderCallback callback) { if (cache != null) { String cachedAddress = cache.get(new AbstractMap.SimpleImmutableEntry<>(latitude, longitude)); if (cachedAddress != null) { if (callback != null) { callback.onSuccess(cachedAddress); } return cachedAddress; } } String urlFormat = String.format(url, latitude, longitude); boolean isAutoNavi = url.contains("restapi.amap.com/v3/geocode/regeo"); if (isAutoNavi){ urlFormat = String.format(url, longitude, latitude); } Invocation.Builder request = Context.getClient().target(urlFormat).request(); if (callback != null) { request.async().get(new InvocationCallback<JsonObject>() { @Override public void completed(JsonObject json) { handleResponse(latitude, longitude, json, callback); } @Override public void failed(Throwable throwable) { callback.onFailure(throwable); } }); } else { try { return handleResponse(latitude, longitude, request.get(JsonObject.class), null); } catch (ClientErrorException e) { LOGGER.warn("Geocoder network error", e); } } return null; }

Target:
public String getAddress( final double latitude, final double longitude, final ReverseGeocoderCallback callback) { if (cache != null) { String cachedAddress = cache.get(new AbstractMap.SimpleImmutableEntry<>(latitude, longitude)); if (cachedAddress != null) { if (callback != null) { callback.onSuccess(cachedAddress); } return cachedAddress; } } String urlFormat = String.format(url, latitude, longitude); if (requestLocationReverse){ urlFormat = String.format(url, longitude, latitude); } Invocation.Builder request = Context.getClient().target(urlFormat).request(); if (callback != null) { request.async().get(new InvocationCallback<JsonObject>() { @Override public void completed(JsonObject json) { handleResponse(latitude, longitude, json, callback); } @Override public void failed(Throwable throwable) { callback.onFailure(throwable); } }); } else { try { return handleResponse(latitude, longitude, request.get(JsonObject.class), null); } catch (ClientErrorException e) { LOGGER.warn("Geocoder network error", e); } } return null; }
Source:
void print(PropertyInfo prop, Printer printer) throws Exception { if (prop.isCustomMapped()) { for (PPath p : prop.locations) { p.replaceBy(new APath(new TId(prop.object.customMappingAlias + "." + prop.name))); } } else { String className = prop.getType(); if (className != null) { prop.alias = printer.getContext().getAliasGenerator().generate(prop.object.alias + "_" + prop.name); printer.from.append(", ").append(className).append(" as ").append(prop.alias); if (className.endsWith("DBStringListProperty")) { printer.from.append(" join ").append(prop.alias).append(".").append(prop.getValueField()) .append(" ").append(prop.alias + prop.getValueField()); } printer.where.append(" and ").append(prop.alias).append(".id.id=").append(prop.object.alias) .append(".id").append(" and ").append(prop.alias).append(".id.name").append("='").append(prop.name) .append("'"); for (PPath p : prop.locations) { String s = prop.alias + "." + prop.getValueField(); if (className.endsWith("DBStringListProperty") && ( p.parent() instanceof PSelectExpression || p.parent().parent() instanceof POrderbyItem || p.parent().parent() instanceof PGroupbyItem)) { s = prop.alias + prop.getValueField(); } p.replaceBy(new APath(new TId(s))); } } } }

Target:
void print(PropertyInfo prop, Printer printer) throws Exception { if (prop.isCustomMapped()) { for (PPath p : prop.locations) { p.replaceBy(new APath(new TId(prop.object.customMappingAlias + "." + prop.name))); } } else { String className = prop.getType(); if (className != null) { prop.alias = printer.getContext().getAliasGenerator().generate(prop.object.alias + "_" + prop.name); printer.from.append(", ").append(className).append(" as ").append(prop.alias); if (className.endsWith("DBStringListProperty")) { printer.from.append(" join ").append(prop.alias).append(".").append(prop.getValueField()) .append(" ").append(prop.alias + prop.getValueField()); } printer.where.append(" and ").append(prop.alias).append(".id.id=").append(prop.object.alias) .append(".id").append(" and ").append(prop.alias).append(".id.name").append("='").append(prop.name) .append("'"); for (PPath p : prop.locations) { String s = prop.alias + "." + prop.getValueField(); if (className.endsWith("DBStringListProperty") && p.parent() != null && ( p.parent() instanceof PSelectExpression || p.parent().parent() instanceof POrderbyItem || p.parent().parent() instanceof PGroupbyItem)) { s = prop.alias + prop.getValueField(); } p.replaceBy(new APath(new TId(s))); } } } }
Source:
public CircuitBreakerRegistry circuitBreakerRegistry(EventConsumerRegistry<CircuitBreakerEvent> eventConsumerRegistry) { CircuitBreakerRegistry circuitBreakerRegistry = CircuitBreakerRegistry.ofDefaults(); circuitBreakerConfiguration.registerPostCreationEventConsumer(circuitBreakerRegistry, eventConsumerRegistry); circuitBreakerRegistry.registerPostCreationConsumer((circuitBreaker, config) -> createHeathIndicatorForCircuitBreaker(circuitBreaker, config)); circuitBreakerConfiguration.initializeBackends(circuitBreakerRegistry, eventConsumerRegistry); return circuitBreakerRegistry; }

Target:
public CircuitBreakerRegistry circuitBreakerRegistry(EventConsumerRegistry<CircuitBreakerEvent> eventConsumerRegistry) { CircuitBreakerRegistry circuitBreakerRegistry = CircuitBreakerRegistry.ofDefaults(); circuitBreakerConfiguration.registerPostCreationEventConsumer(circuitBreakerRegistry, eventConsumerRegistry); circuitBreakerRegistry.registerPostCreationConsumer(this::createHeathIndicatorForCircuitBreaker); circuitBreakerConfiguration.initializeBackends(circuitBreakerRegistry); return circuitBreakerRegistry; }
Source:
public static String getNewUniqueName(DataSource original) { String uniqueName; int index = 0; SourceManager sm = Services.getService(DataManager.class) .getSourceManager(); uniqueName = original.getName() + "_selection"; while (sm.getSource(uniqueName) != null) { index++; uniqueName = original.getName() + "_selection_" + index; } return uniqueName; }

Target:
private static String getNewUniqueName(DataSource original) { String uniqueName; int index = 0; SourceManager sm = Services.getService(DataManager.class) .getSourceManager(); uniqueName = I18N.tr("{0}_selection", original.getName()); while (sm.getSource(uniqueName) != null) { index++; uniqueName = I18N.tr("{0}_selection_{1}", original.getName(), index); } return uniqueName; }
Source:
private List<Class<? extends Vfs.UrlType>> findExtensions() { final List<Class<? extends Vfs.UrlType>> extensions = new ArrayList<>(); for (final URL url : getErraiAppPropertiesFilesUrls()) { InputStream inputStream = null; try { inputStream = url.openStream(); final ResourceBundle props = new PropertyResourceBundle(inputStream); for (final Object o : props.keySet()) { final String key = (String) o; if (key.equals(EXTENSION_KEY)) { final String clsName = props.getString(key); try { final Class<?> aClass = Thread.currentThread().getContextClassLoader().loadClass(clsName); extensions.add(aClass.asSubclass(Vfs.UrlType.class)); } catch (final Throwable t) { throw new RuntimeException("could not load class scanning extension: " + clsName, t); } } } } catch (final IOException e) { throw new RuntimeException("error reading ErraiApp.properties", e); } finally { if (inputStream != null) { try { inputStream.close(); } catch (final IOException e) { } } } } return extensions; }

Target:
private List<Class<? extends Vfs.UrlType>> findExtensions() { final List<Class<? extends Vfs.UrlType>> extensions = new ArrayList<>(); for (final URL url : getErraiAppPropertiesFilesUrls()) { InputStream inputStream = null; try { inputStream = url.openStream(); final ResourceBundle props = new PropertyResourceBundle(inputStream); for (final Object o : props.keySet()) { final String key = (String) o; if (key.equals(EXTENSION_KEY)) { final String clsName = props.getString(key); try { final Class<?> aClass = Thread.currentThread().getContextClassLoader().loadClass(clsName); extensions.add(aClass.asSubclass(Vfs.UrlType.class)); } catch (final Throwable t) { log.warn("could not load class scanning extension: " + clsName, t); } } } } catch (final IOException e) { throw new RuntimeException("error reading ErraiApp.properties", e); } finally { if (inputStream != null) { try { inputStream.close(); } catch (final IOException e) { } } } } return extensions; }
Source:
public void loadUsageRecipes(ItemStack ingredient) { if (ingredient.getItem() == Items.potionitem || ingredients.contains(ingredient)) for (NEIBrewingRecipe recipe : apotions) if (NEIServerUtils.areStacksSameType(recipe.ingredient.item, ingredient) || NEIServerUtils.areStacksSameType(recipe.input.item, ingredient)) arecipes.add(new CachedBrewingRecipe(recipe)); label0: for (IBrewingRecipe recipe : BrewingRecipeRegistry.getRecipes()) if (recipe instanceof BrewingRecipe || recipe instanceof BrewingOreRecipe) if (NEIServerUtils.areStacksSameType(((AbstractBrewingRecipe<?>) recipe).input, ingredient)) arecipes.add(new CachedBrewingRecipe((AbstractBrewingRecipe<?>) recipe)); else { ItemStack[] recipeIngredients = NEIServerUtils.extractRecipeItems(((AbstractBrewingRecipe<?>) recipe).ingredient); for (ItemStack recipeIngredient : recipeIngredients) if (NEIServerUtils.areStacksSameType(recipeIngredient, ingredient)) { arecipes.add(new CachedBrewingRecipe((AbstractBrewingRecipe<?>) recipe)); continue label0; } } }

Target:
public void loadUsageRecipes(ItemStack ingredient) { if (ingredient.getItem() == Items.potionitem || ingredients.contains(ingredient)) for (NEIBrewingRecipe recipe : apotions) if (NEIServerUtils.areStacksSameType(recipe.ingredient.item, ingredient) || NEIServerUtils.areStacksSameType(recipe.input.item, ingredient)) arecipes.add(new CachedBrewingRecipe(recipe)); nextRecipe: for (IBrewingRecipe recipe : BrewingRecipeRegistry.getRecipes()) if (recipe instanceof BrewingRecipe || recipe instanceof BrewingOreRecipe) { AbstractBrewingRecipe<?> arecipe = (AbstractBrewingRecipe<?>) recipe; if (NEIServerUtils.areStacksSameType(arecipe.input, ingredient)) arecipes.add(new CachedBrewingRecipe(arecipe)); else { ItemStack[] recipeIngredients = NEIServerUtils.extractRecipeItems(arecipe.ingredient); for (ItemStack recipeIngredient : recipeIngredients) if (NEIServerUtils.areStacksSameType(recipeIngredient, ingredient)) { arecipes.add(new CachedBrewingRecipe(arecipe)); continue nextRecipe; } } } }
Source:
private void displayKeyBinding(KeyCode key, int y) { Vec2d pos = keymap.get(key); if (pos == null) { return; } GraphicsContext gc = keyboard.getGraphicsContext2D(); gc.strokeLine(pos.x / 2 + 18, pos.y / 2 + 18, 850, y + 8); Image img = Preloader.getImageOrLoad("keyboard.png"); gc.drawImage(img, pos.x, pos.y, 72, 72, pos.x / 2, pos.y / 2, 36, 36); }

Target:
private void displayKeyBinding(KeyCode key, int y) { Vec2d pos = KEYMAP.get(key); if (pos == null) { return; } GraphicsContext gc = keyboard.getGraphicsContext2D(); gc.strokeLine(pos.x / 2 + 18, pos.y / 2 + 18, 850, y + 8); Image img = Preloader.getImageOrLoad("keyboard.png"); gc.drawImage(img, pos.x, pos.y, 72, 72, pos.x / 2, pos.y / 2, 36, 36); }
Source:
protected DataSetReadyCallback createDataSetTaskCallback(final int startRange, final FilterSettings tableSettings) { return new AbstractDataSetReadyCallback(errorPopup, view, tableSettings.getUUID()) { @Override public void callback(DataSet dataSet) { if (dataSet != null && dataSetQueryHelper.getCurrentTableSettings().getKey().equals(tableSettings.getKey())) { final List<TaskSummary> myTasksFromDataSet = new ArrayList<TaskSummary>(); for (int i = 0; i < dataSet.getRowCount(); i++) { if(HUMAN_TASKS_WITH_ADMIN_DATASET.equals(dataSet.getUUID())) { myTasksFromDataSet.add(new TaskAdminSummaryDataSetMapper().apply(dataSet, i)); }else { myTasksFromDataSet.add(new TaskSummaryDataSetMapper().apply(dataSet, i)); } } boolean lastPageExactCount = false; if (dataSet.getRowCount() < view.getListGrid().getPageSize()) { lastPageExactCount = true; } List<DataSetOp> ops = tableSettings.getDataSetLookup().getOperationList(); String filterValue = isFilteredByTaskName(ops); if (AbstractMultiGridView.TAB_SEARCH.equals(tableSettings.getKey()) == false && filterValue != null) { getDomainSpecifDataForTasks(startRange, filterValue, myTasksFromDataSet, lastPageExactCount); } else { updateDataOnCallback(myTasksFromDataSet, startRange, startRange + myTasksFromDataSet.size(), lastPageExactCount); } } view.hideBusyIndicator(); } @Override public boolean onError(final ClientRuntimeError error) { view.hideBusyIndicator(); showErrorPopup(Constants.INSTANCE.TaskListCouldNotBeLoaded()); return false; } }; }

Target:
protected DataSetReadyCallback createDataSetTaskCallback(final int startRange, final FilterSettings tableSettings) { return new AbstractDataSetReadyCallback(errorPopup, view, tableSettings.getUUID()) { @Override public void callback(DataSet dataSet) { if (dataSet != null && dataSetQueryHelper.getCurrentTableSettings().getKey().equals(tableSettings.getKey())) { final List<TaskSummary> myTasksFromDataSet = new ArrayList<TaskSummary>(); for (int i = 0; i < dataSet.getRowCount(); i++) { myTasksFromDataSet.add(new TaskSummaryDataSetMapper().apply(dataSet, i)); } boolean lastPageExactCount = false; if (dataSet.getRowCount() < view.getListGrid().getPageSize()) { lastPageExactCount = true; } List<DataSetOp> ops = tableSettings.getDataSetLookup().getOperationList(); String filterValue = isFilteredByTaskName(ops); if (AbstractMultiGridView.TAB_SEARCH.equals(tableSettings.getKey()) == false && filterValue != null) { getDomainSpecifDataForTasks(startRange, filterValue, myTasksFromDataSet, lastPageExactCount); } else { updateDataOnCallback(myTasksFromDataSet, startRange, startRange + myTasksFromDataSet.size(), lastPageExactCount); } } view.hideBusyIndicator(); } @Override public boolean onError(final ClientRuntimeError error) { view.hideBusyIndicator(); showErrorPopup(Constants.INSTANCE.TaskListCouldNotBeLoaded()); return false; } }; }
Source:
public String generateRandomNoForDisplayId() { int discrepancyNoteLength; try { discrepancyNoteLength = Integer.parseInt(CoreResources.getField("dicrepancyNote.DisplayId.GenerationLength")); if (discrepancyNoteLength <= 0 || discrepancyNoteLength > 9) { discrepancyNoteLength = 9; logger.error("Maximum DiscrepancyNoteLength is 9"); } }catch (Exception e){ discrepancyNoteLength = 9; logger.error("Error fetching DiscrepancyNoteLength from properties file"); } int max = (int) Math.pow(10, discrepancyNoteLength); return StringUtils.leftPad(Integer.toString(RandomUtils.nextInt(0, max)), discrepancyNoteLength, '0'); }

Target:
public String generateRandomNoForDisplayId() { int discrepancyNoteLength; try { discrepancyNoteLength = Integer.parseInt(CoreResources.getField("discrepancyNote.displayId.length")); if (discrepancyNoteLength <= 0 || discrepancyNoteLength > DEFAULT_DISCREPANCY_NOTE_DISPLAYID_LENGTH) { discrepancyNoteLength = DEFAULT_DISCREPANCY_NOTE_DISPLAYID_LENGTH; logger.error("Maximum DiscrepancyNoteLength is "+DEFAULT_DISCREPANCY_NOTE_DISPLAYID_LENGTH); } }catch (Exception e){ discrepancyNoteLength = DEFAULT_DISCREPANCY_NOTE_DISPLAYID_LENGTH; logger.error("Error fetching DiscrepancyNoteLength from properties file"); } int max = (int) Math.pow(10, discrepancyNoteLength); return StringUtils.leftPad(Integer.toString(RandomUtils.nextInt(0, max)), discrepancyNoteLength, '0'); }
Source:
private GlusterVolumeTaskStatusEntity fetchTaskStatusDetails() { VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GetGlusterVolumeRebalanceStatus, new GlusterVolumeVDSParameters(getUpServerId(clusterId), volume.getName())); GlusterVolumeTaskStatusEntity entity = (GlusterVolumeTaskStatusEntity) returnValue.getReturnValue(); List<Step> stepsList = getStepDao().getStepsByExternalId(volume.getAsyncTask().getTaskId()); if (stepsList != null && !stepsList.isEmpty()) { entity.setStartTime(stepsList.get(0).getStartTime()); } return entity; }

Target:
private GlusterVolumeTaskStatusEntity fetchTaskStatusDetails() { VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GetGlusterVolumeRebalanceStatus, new GlusterVolumeVDSParameters(getUpServerId(clusterId), volume.getName())); GlusterVolumeTaskStatusEntity entity = (GlusterVolumeTaskStatusEntity) returnValue.getReturnValue(); GlusterAsyncTask asyncTask = volume.getAsyncTask(); if (asyncTask != null) { List<Step> stepsList = getStepDao().getStepsByExternalId(asyncTask.getTaskId()); if (stepsList != null && !stepsList.isEmpty()) { entity.setStartTime(stepsList.get(0).getStartTime()); } } return entity; }
Source:
public IndexedInts get(int index) { final int offset = offsets.get(index); final int size = offsets.get(index + 1) - offset; return new IndexedInts() { @Override public int size() { return size; } @Override public int get(int index) { if (index >= size) { throw new IllegalArgumentException(String.format("Index[%s] >= size[%s]", index, size)); } return values.get(index + offset); } @Override public void fill(int index, int[] toFill) { throw new UnsupportedOperationException("fill not supported"); } @Override public void close() throws IOException { } @Override public Iterator<Integer> iterator() { return new Iterator<Integer>() { int currentIndex = 0; @Override public boolean hasNext() { return currentIndex < size; } @Override public Integer next() { return get(currentIndex++); } @Override public void remove() { throw new UnsupportedOperationException("remove not supported"); } }; } }; }

Target:
public IndexedInts get(int index) { final int offset = offsets.get(index); final int size = offsets.get(index + 1) - offset; return new IndexedInts() { @Override public int size() { return size; } @Override public int get(int index) { if (index >= size) { throw new IllegalArgumentException(String.format("Index[%s] >= size[%s]", index, size)); } return values.get(index + offset); } @Override public void fill(int index, int[] toFill) { throw new UnsupportedOperationException("fill not supported"); } @Override public void close() throws IOException { } @Override public Iterator<Integer> iterator() { return new IndexedIntsIterator(this); } }; }
Source:
public void equal_shouldReturnTrueIfObjectReferenceAreTheSame() { CohortMembership cohortMembership = new CohortMembership(12); boolean result = cohortMembership.equals(cohortMembership); assertTrue(result); }

Target:
public void equal_shouldReturnTrueIfObjectReferenceAreTheSame() { CohortMembership cohortMembership = new CohortMembership(12); assertTrue(cohortMembership.equals(cohortMembership)); }
Source:
private static Object deserializePayload(byte[] bytes, MimeType contentType, Map<String, Class<?>> payloadTypeCache, Codec codec) { if ("text".equalsIgnoreCase(contentType.getType()) || MimeTypeUtils.APPLICATION_JSON.equals(contentType)) { try { return new String(bytes, "UTF-8"); } catch (UnsupportedEncodingException e) { String errorMessage = "unable to deserialize [java.lang.String]. Encoding not supported. " + e.getMessage(); MessageSerializationUtils.LOGGER.error(errorMessage); throw new SerializationFailedException(errorMessage, e); } } else { String className = JavaClassMimeTypeUtils.classNameFromMimeType(contentType); try { Class<?> targetType = payloadTypeCache.get(className); if (targetType == null) { targetType = ClassUtils.forName(className, null); payloadTypeCache.put(className, targetType); } return codec.decode(bytes, targetType); } catch (Exception e) { String errorMessage = "Unable to deserialize [" + className + "] using the contentType [" + contentType + "] " + e.getMessage(); MessageSerializationUtils.LOGGER.error(errorMessage); throw new SerializationFailedException(errorMessage, e); } } }

Target:
private static Object deserializePayload(byte[] bytes, MimeType contentType, Map<String, Class<?>> payloadTypeCache, Codec codec) { if ("text".equalsIgnoreCase(contentType.getType()) || MimeTypeUtils.APPLICATION_JSON.equals(contentType)) { try { return new String(bytes, "UTF-8"); } catch (UnsupportedEncodingException e) { String errorMessage = "unable to deserialize [java.lang.String]. Encoding not supported. " + e.getMessage(); throw new SerializationFailedException(errorMessage, e); } } else { String className = JavaClassMimeTypeUtils.classNameFromMimeType(contentType); try { Class<?> targetType = payloadTypeCache.get(className); if (targetType == null) { targetType = ClassUtils.forName(className, null); payloadTypeCache.put(className, targetType); } return codec.decode(bytes, targetType); } catch (Exception e) { String errorMessage = "Unable to deserialize [" + className + "] using the contentType [" + contentType + "] " + e.getMessage(); throw new SerializationFailedException(errorMessage, e); } } }
Source:
public RowSignature resultArraySignature(TimeseriesQuery query) { RowSignature.Builder rowSignatureBuilder = RowSignature.builder(); if (query.getDimensionSpec() != null) { rowSignatureBuilder.addDimensions(Collections.singletonList(query.getDimensionSpec())); } else { rowSignatureBuilder.addTimeColumn(); } rowSignatureBuilder.addAggregators(query.getAggregatorSpecs()); rowSignatureBuilder.addPostAggregators(query.getPostAggregatorSpecs()); return rowSignatureBuilder.build(); }

Target:
public RowSignature resultArraySignature(TimeseriesQuery query) { RowSignature.Builder rowSignatureBuilder = RowSignature.builder(); rowSignatureBuilder.addTimeColumn(); if (StringUtils.isNotEmpty(query.getTimestampResultField())) { rowSignatureBuilder.add(query.getTimestampResultField(), ValueType.LONG); } rowSignatureBuilder.addAggregators(query.getAggregatorSpecs()); rowSignatureBuilder.addPostAggregators(query.getPostAggregatorSpecs()); return rowSignatureBuilder.build(); }
Source:
Optional<FileSystem> create(Configuration conf) { Supplier<FileSystem> fileSystemSupplier = () -> { try { return FileSystem.get(conf); } catch (Exception e) { logger.error("FileSystem creation failed."); e.printStackTrace(); return null; } }; return create(fileSystemSupplier); }

Target:
Optional<FileSystem> create(Configuration conf) { Supplier<FileSystem> fileSystemSupplier = () -> { try { return FileSystem.get(conf); } catch (Exception e) { logger.error("FileSystem creation failed.", e); return null; } }; return create(fileSystemSupplier); }