auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static Date parseDate(final String date) { <START> final String trimmedDate = date.replaceAll(";.*$",""); <END> ParsePosition pp = new ParsePosition(0); SimpleDateFormat dateFormat = RFC1123_PATTERN_FORMAT.get(); Date val = dateFormat.parse(trimmedDate, pp); if (val != null && pp.getIndex() == trimmedDate.length()) { return val; } pp = new ParsePosition(0); dateFormat = new SimpleDateFormat(RFC1036_PATTERN, LOCALE_US); dateFormat.setTimeZone(GMT_ZONE); val = dateFormat.parse(trimmedDate, pp); if (val != null && pp.getIndex() == trimmedDate.length()) { return val; } pp = new ParsePosition(0); dateFormat = new SimpleDateFormat(ASCITIME_PATTERN, LOCALE_US); dateFormat.setTimeZone(GMT_ZONE); val = dateFormat.parse(trimmedDate, pp); if (val != null && pp.getIndex() == trimmedDate.length()) { return val; } pp = new ParsePosition(0); dateFormat = new SimpleDateFormat(OLD_COOKIE_PATTERN, LOCALE_US); dateFormat.setTimeZone(GMT_ZONE); val = dateFormat.parse(trimmedDate, pp); if (val != null && pp.getIndex() == trimmedDate.length()) { return val; } return null; }</code><technical_language>This is super slow. Please regex for simple problem. If put in account date header processing expensive part of request processing (before user application) simply afford expensive operation</technical_language>

Target:
public static Date parseDate(final String date) { final int semicolonIndex = date.indexOf(';'); final String trimmedDate = semicolonIndex >=0 ? date.substring(0, semicolonIndex) : date; ParsePosition pp = new ParsePosition(0); SimpleDateFormat dateFormat = RFC1123_PATTERN_FORMAT.get(); Date val = dateFormat.parse(trimmedDate, pp); if (val != null && pp.getIndex() == trimmedDate.length()) { return val; } pp = new ParsePosition(0); dateFormat = new SimpleDateFormat(RFC1036_PATTERN, LOCALE_US); dateFormat.setTimeZone(GMT_ZONE); val = dateFormat.parse(trimmedDate, pp); if (val != null && pp.getIndex() == trimmedDate.length()) { return val; } pp = new ParsePosition(0); dateFormat = new SimpleDateFormat(ASCITIME_PATTERN, LOCALE_US); dateFormat.setTimeZone(GMT_ZONE); val = dateFormat.parse(trimmedDate, pp); if (val != null && pp.getIndex() == trimmedDate.length()) { return val; } pp = new ParsePosition(0); dateFormat = new SimpleDateFormat(OLD_COOKIE_PATTERN, LOCALE_US); dateFormat.setTimeZone(GMT_ZONE); val = dateFormat.parse(trimmedDate, pp); if (val != null && pp.getIndex() == trimmedDate.length()) { return val; } return null; }
Source:
<code>private void updateSyncRefreshRate(RefreshTimerTriggeredEvent e) { ApiQuotaInfo info = e.getApiQuotaInfo(); if (remainingApiRequests == UNINITIALIZED){ remainingApiRequests = info.getRemainingRequests(); return; } apiCallsUsedInPreviousRefresh = computeApiCallsUsedInPreviousRefresh(info.getRemainingRequests()); remainingApiRequests = info.getRemainingRequests(); refreshDurationInMinutes = computeRefreshTimerPeriod(info.getRemainingRequests(), Utility.minutesFromNow(info.getNextRefreshInMillisecs()), apiCallsUsedInPreviousRefresh, API_QUOTA_BUFFER, DEFAULT_REFRESH_PERIOD_IN_MINS); this.refreshTimer.restartTimer((int) Utility.minsToSecs(refreshDurationInMinutes)); <START> logger.info("Refresh period updated to " + refreshDurationInMinutes <END> + "mins with API calls used in previous refresh cycle is " + apiCallsUsedInPreviousRefresh + ", current API quota is " + info.getRemainingRequests() + " and next API quota top-up in " + info.getNextRefreshInMinutesFromNow() + "mins."); }</code><technical_language>Add a blank line this end-of-method log message is a separate step</technical_language>

Target:
private void updateSyncRefreshRate(RefreshTimerTriggeredEvent e) { updateSyncRefreshRate(e.getApiQuotaInfo().getRemainingQuota(), e.getApiQuotaInfo().minutesToNextQuotaTopup()); }
Source:
<code>public String search(HttpServletRequest request, Model model, @SiteParam Site site, @RequestParam MultiValueMap<String, String> params) throws IOException { CommonParams commonParams = modelCommonParams(request, model, site, params); String queryString = params.getFirst("q"); ArticleSearchQuery.Builder query = ArticleSearchQuery.builder() .setQuery(queryString) .setSimple(commonParams.isSimpleSearch(queryString)); commonParams.fill(query); ArticleSearchQuery queryObj = query.build(); Map<?, ?> searchResults; try { searchResults = solrSearchService.search(queryObj); } catch (ServiceRequestException sre) { <START> return handleInvalidSolrResponse(model, site, queryString, sre); <END> } model.addAttribute("searchResults", solrSearchService.addArticleLinks(searchResults, request, site, siteSet)); Set<SearchFilterItem> activeFilterItems; if ((Double) searchResults.get("numFound") == 0.0) { activeFilterItems = commonParams.setActiveFilterParams(model, request); } else { Map<String, SearchFilter> filters = searchFilterService.getSearchFilters(queryObj, rebuildUrlParameters(queryObj)); filters.values().forEach(commonParams::setActiveAndInactiveFilterItems); activeFilterItems = new LinkedHashSet<>(); filters.values().forEach(filter -> activeFilterItems.addAll(filter.getActiveFilterItems())); model.addAttribute("searchFilters", filters); } model.addAttribute("activeFilterItems", activeFilterItems); return site.getKey() + "/ftl/search/searchResults"; }</code><technical_language>rename this hanldeInvalidSolrSyntax, solr returns a valid response IMO</technical_language>

Target:
public String search(HttpServletRequest request, Model model, @SiteParam Site site, @RequestParam MultiValueMap<String, String> params) throws IOException { CommonParams commonParams = modelCommonParams(request, model, site, params); String queryString = params.getFirst("q"); ArticleSearchQuery.Builder query = ArticleSearchQuery.builder() .setQuery(queryString) .setSimple(commonParams.isSimpleSearch(queryString)); commonParams.fill(query); ArticleSearchQuery queryObj = query.build(); Map<?, ?> searchResults; try { searchResults = solrSearchService.search(queryObj); } catch (ServiceRequestException sre) { return handleFailedSolrRequest(model, site, queryString, sre); } model.addAttribute("searchResults", solrSearchService.addArticleLinks(searchResults, request, site, siteSet)); Set<SearchFilterItem> activeFilterItems; if ((Double) searchResults.get("numFound") == 0.0) { activeFilterItems = commonParams.setActiveFilterParams(model, request); } else { Map<String, SearchFilter> filters = searchFilterService.getSearchFilters(queryObj, rebuildUrlParameters(queryObj)); filters.values().forEach(commonParams::setActiveAndInactiveFilterItems); activeFilterItems = new LinkedHashSet<>(); filters.values().forEach(filter -> activeFilterItems.addAll(filter.getActiveFilterItems())); model.addAttribute("searchFilters", filters); } model.addAttribute("activeFilterItems", activeFilterItems); return site.getKey() + "/ftl/search/searchResults"; }
Source:
<code>public void setMinimumDelay(int delay) { if (delay < CONFIG_MIN_MINIMUM_DELAY) { logger.warn( "Minimum Delay of below minimum permitted, used.", minimumDelay, CONFIG_MIN_MINIMUM_DELAY); <START> minimumDelay = CONFIG_MIN_MINIMUM_DELAY; <END> } this.minimumDelay = delay; }</code><technical_language>I want set parameter delay a new value, else check work</technical_language>

Target:
public void setMinimumDelay(int delay) { if (delay < CONFIG_MIN_MINIMUM_DELAY) { logger.warn( "Minimum Delay of below minimum permitted, used.", minimumDelay, CONFIG_MIN_MINIMUM_DELAY); delay = CONFIG_MIN_MINIMUM_DELAY; } this.minimumDelay = delay; }
Source:
<code>public static String extractSSNIdentifier(PRPAMT201306UV02ParameterList params) { LOG.trace("Entering HL7DbParser201305.ExtractSSNIdentifier method..."); String ssn = null; if (CollectionUtils.isNotEmpty(params.getLivingSubjectId()) && params.getLivingSubjectId().get(0) != null) { for (PRPAMT201306UV02LivingSubjectId livingSubjectId : params.getLivingSubjectId()) { if (CollectionUtils.isNotEmpty(livingSubjectId.getValue()) && livingSubjectId.getValue().get(0) != null) { II subjectId = livingSubjectId.getValue().get(0); if (subjectId.getExtension() != null && subjectId.getExtension().length() > 0 && subjectId.getRoot() != null && subjectId.getRoot().length() > 0) { if (subjectId.getRoot().equals(SSN_ROOT_IDENTIFIER)) { Identifier ssnId = new Identifier(); ssnId.setId(subjectId.getExtension()); ssnId.setOrganizationId(subjectId.getRoot()); LOG.info("Created id from ssn identifier [organization=", ssnId.getOrganizationId() <START> + "][id=" + ssnId.getId() + "]"); <END> ssn = ssnId.getId(); } } else { LOG.info("message does not contain an id"); } } else { LOG.info("message does not contain an id"); } } } else { LOG.info("message does not contain an id"); } LOG.trace("Exiting HL7DbParser201305.ExtractSSNIdentifier method..."); return ssn; }</code><technical_language>multiple log parameters for logging LOG.info("Created id ssn identifier [organization: ][id: ]", ssnId.getOrganizationId(), ssnId.getId());</technical_language>

Target:
public static String extractSSNIdentifier(PRPAMT201306UV02ParameterList params) { LOG.trace("Entering HL7DbParser201305.ExtractSSNIdentifier method..."); String ssn = null; if (CollectionUtils.isNotEmpty(params.getLivingSubjectId()) && params.getLivingSubjectId().get(0) != null) { for (PRPAMT201306UV02LivingSubjectId livingSubjectId : params.getLivingSubjectId()) { if (CollectionUtils.isNotEmpty(livingSubjectId.getValue()) && livingSubjectId.getValue().get(0) != null) { II subjectId = livingSubjectId.getValue().get(0); if (subjectId.getExtension() != null && subjectId.getExtension().length() > 0 && subjectId.getRoot() != null && subjectId.getRoot().length() > 0) { if (subjectId.getRoot().equals(SSN_ROOT_IDENTIFIER)) { Identifier ssnId = new Identifier(); ssnId.setId(subjectId.getExtension()); ssnId.setOrganizationId(subjectId.getRoot()); LOG.info("Created id from ssn identifier [organization : {}][id : {}] ", ssnId.getOrganizationId(), ssnId.getId()); ssn = ssnId.getId(); } } else { LOG.info("message does not contain an id"); } } else { LOG.info("message does not contain an id"); } } } else { LOG.info("message does not contain an id"); } LOG.trace("Exiting HL7DbParser201305.ExtractSSNIdentifier method..."); return ssn; }
Source:
<code>public static Object getMaxValueForType(FieldType type) { switch (type) { case INTEGER: { return Long.MAX_VALUE; } break; case REAL: { return Double.MAX_VALUE; } break; case DECIMAL: { return BigDecimal.valueOf(Double.MAX_VALUE); } break; case STRING: { return maxStringValue; } break; default: throw new Exception("Invalid field type for index field."); <START> break; <END> } }</code><technical_language>reach break;</technical_language>

Target:
public static Object getMaxValueForType(FieldType type) throws Exception { switch (type) { case INTEGER: { return Long.MAX_VALUE; } case BOOLEAN: { return true; } case REAL: { return Double.MAX_VALUE; } case DECIMAL: { return BigDecimal.valueOf(Double.MAX_VALUE); } case STRING: { return maxStringValue; } default: throw new Exception("Invalid field type for index field."); } }
Source:
<code>public void isEmpty_acrossLinkingObjectListLink() { createIsEmptyDataSet(realm); assertEquals(2, realm.where(AllJavaTypes.class).findAll().size()); for (RealmFieldType type : SUPPORTED_IS_EMPTY_TYPES) { switch (type) { case STRING: <START> assertEquals(0, realm.where(AllJavaTypes.class).isEmpty(AllJavaTypes.FIELD_LO_LIST + "." + AllJavaTypes.FIELD_STRING).count()); <END> break; case BINARY: assertEquals(0, realm.where(AllJavaTypes.class).isEmpty(AllJavaTypes.FIELD_LO_LIST + "." + AllJavaTypes.FIELD_BINARY).count()); break; case LIST: assertEquals(1, realm.where(AllJavaTypes.class).isEmpty(AllJavaTypes.FIELD_LO_LIST + "." + AllJavaTypes.FIELD_LIST).count()); break; case LINKING_OBJECTS: assertEquals(1, realm.where(AllJavaTypes.class).isEmpty(AllJavaTypes.FIELD_LO_LIST + "." + AllJavaTypes.FIELD_LO_OBJECT).count()); assertEquals(1, realm.where(AllJavaTypes.class).isEmpty(AllJavaTypes.FIELD_LO_LIST + "." + AllJavaTypes.FIELD_LO_LIST).count()); break; default: fail("Unknown type: " + type); } } }</code><technical_language>I suspect this test is robust. ways query fail return entries. Is fiddle data is there</technical_language>

Target:
public void isEmpty_acrossLinkingObjectListLink() { createIsEmptyDataSet(realm); assertEquals(3, realm.where(AllJavaTypes.class).findAll().size()); for (RealmFieldType type : SUPPORTED_IS_EMPTY_TYPES) { switch (type) { case STRING: assertEquals(1, realm.where(AllJavaTypes.class).isEmpty(AllJavaTypes.FIELD_LO_LIST + "." + AllJavaTypes.FIELD_STRING).count()); break; case BINARY: assertEquals(1, realm.where(AllJavaTypes.class).isEmpty(AllJavaTypes.FIELD_LO_LIST + "." + AllJavaTypes.FIELD_BINARY).count()); break; case LIST: assertEquals(1, realm.where(AllJavaTypes.class).isEmpty(AllJavaTypes.FIELD_LO_LIST + "." + AllJavaTypes.FIELD_LIST).count()); break; case LINKING_OBJECTS: assertEquals(2, realm.where(AllJavaTypes.class).isEmpty(AllJavaTypes.FIELD_LO_LIST + "." + AllJavaTypes.FIELD_LO_OBJECT).count()); assertEquals(2, realm.where(AllJavaTypes.class).isEmpty(AllJavaTypes.FIELD_LO_LIST + "." + AllJavaTypes.FIELD_LO_LIST).count()); break; default: fail("Unknown type: " + type); } } }
Source:
<code>void calculateDoubleHitProbability() { final List<Unit> attackingOrderOfLoss = new ArrayList<>(); attackingOrderOfLoss.add(new Unit(INFANTRY, BRITISH, data)); attackingOrderOfLoss.add(new Unit(ARMOUR, BRITISH, data)); final int diceSides = data.getDiceSides(); final Map<Integer, Integer> diceGrouped = getDiceGrouped(attackingOrderOfLoss, List.of()); final StepUnits attackingUnits = new StepUnits(attackingOrderOfLoss, BRITISH, List.of(), GERMAN); final BattleStep root = new BattleStep(attackingUnits, BRITISH, 0, createParameters()); final List<Double> hitProbability = root.calculateHitProbabilities(BattleStep.RollData.of(2, diceGrouped, diceSides)); assertEquals(0.4166, hitProbability.get(0), 0.0001); assertEquals(0.5, hitProbability.get(1), 0.0001); <START> assertEquals(0.0833, hitProbability.get(2), 0.0001); <END> }</code><technical_language>I assume probabilities for win, lose, draw? If List a dedicated type instead, this clearer</technical_language>

Target:
void calculateDoubleHitProbability() { final List<Unit> attackingOrderOfLoss = new ArrayList<>(); attackingOrderOfLoss.add(INFANTRY.create(BRITISH)); attackingOrderOfLoss.add(ARMOUR.create(BRITISH)); final int diceSides = data.getDiceSides(); final Map<Integer, Integer> diceGrouped = getDiceGrouped(attackingOrderOfLoss, List.of()); final StepUnits attackingUnits = new StepUnits(attackingOrderOfLoss, BRITISH, List.of(), GERMAN); final BattleStep root = new BattleStep(attackingUnits, BRITISH, 0, createLandParameters()); final List<Double> hitProbability = root.calculateHitProbabilities(BattleStep.RollData.of(2, diceGrouped, diceSides)); final BinomialDistribution infantryDistribution = new BinomialDistribution(null, 1, 1.0 / 6.0); final BinomialDistribution armourDistribution = new BinomialDistribution(null, 1, 3.0 / 6.0); assertEquals( infantryDistribution.probability(0) * armourDistribution.probability(0), hitProbability.get(0), 0.0001); assertEquals( infantryDistribution.probability(1) * armourDistribution.probability(0) + infantryDistribution.probability(0) * armourDistribution.probability(0), hitProbability.get(1), 0.0001); assertEquals( infantryDistribution.probability(1) * armourDistribution.probability(1), hitProbability.get(2), 0.0001); }
Source:
<code>public void testAbfsOutputStreamDurationTrackerPutRequest() throws IOException { describe("Testing to check if DurationTracker for PUT request is working " + "correctly."); AzureBlobFileSystem fs = getFileSystem(); Path pathForPutRequest = path(getMethodName()); try(AbfsOutputStream outputStream = createAbfsOutputStreamWithFlushEnabled(fs, pathForPutRequest)) { outputStream.write('a'); outputStream.hflush(); AbfsOutputStreamStatisticsImpl abfsOutputStreamStatistics = getAbfsOutputStreamStatistics(outputStream); Assertions.assertThat(abfsOutputStreamStatistics.getTimeSpentOnPutRequest()) <START> .describedAs("Mismatch in timeTakenForPutRequest DurationTracker") <END> .isGreaterThan(0.0); } }</code><technical_language>timeSpentOnPutRequest</technical_language>

Target:
public void testAbfsOutputStreamDurationTrackerPutRequest() throws IOException { describe("Testing to check if DurationTracker for PUT request is working " + "correctly."); AzureBlobFileSystem fs = getFileSystem(); Path pathForPutRequest = path(getMethodName()); try(AbfsOutputStream outputStream = createAbfsOutputStreamWithFlushEnabled(fs, pathForPutRequest)) { outputStream.write('a'); outputStream.hflush(); AbfsOutputStreamStatisticsImpl abfsOutputStreamStatistics = getAbfsOutputStreamStatistics(outputStream); Assertions.assertThat(abfsOutputStreamStatistics.getTimeSpentOnPutRequest()) .describedAs("Mismatch in timeSpentOnPutRequest DurationTracker") .isGreaterThan(0.0); } }
Source:
<code>public void run() { try (SweepLocks locks = createSweepLocks()) { waitUntilSpecificTableSweeperIsInitialized(); Thread.sleep(getBackoffTimeWhenSweepHasNotRun()); log.info("Starting background sweeper."); while (true) { if (Thread.currentThread().isInterrupted()) { <START> break; <END> } SweepOutcome outcome = checkConfigAndRunSweep(locks); log.info("Sweep iteration finished with outcome: {}", SafeArg.of("sweepOutcome", outcome)); updateBatchSize(outcome); updateMetrics(outcome); sleepUntilNextRun(outcome); } } catch (InterruptedException e) { log.warn("Shutting down background sweeper. Please restart the service to rerun background sweep."); sweepOutcomeMetrics.registerOccurrenceOf(SweepOutcome.SHUTDOWN); } catch (Throwable t) { log.error("BackgroundSweeper failed fatally and will not rerun until restarted: {}", UnsafeArg.of("message", t.getMessage()), t); sweepOutcomeMetrics.registerOccurrenceOf(SweepOutcome.FATAL); } }</code><technical_language>rethrow InterruptedException instead? This hit catch block move SHUTDOWN state. Useful for metrics monitoring</technical_language>

Target:
public void run() { try (SweepLocks locks = createSweepLocks()) { waitUntilSpecificTableSweeperIsInitialized(); Thread.sleep(getBackoffTimeWhenSweepHasNotRun()); log.info("Starting background sweeper."); while (true) { if (Thread.currentThread().isInterrupted()) { throw new InterruptedException("The background sweeper thread is interrupted."); } SweepOutcome outcome = checkConfigAndRunSweep(locks); log.info("Sweep iteration finished with outcome: {}", SafeArg.of("sweepOutcome", outcome)); updateBatchSize(outcome); updateMetrics(outcome); sleepUntilNextRun(outcome); } } catch (InterruptedException e) { log.warn("Shutting down background sweeper. Please restart the service to rerun background sweep."); sweepOutcomeMetrics.registerOccurrenceOf(SweepOutcome.SHUTDOWN); } catch (Throwable t) { log.error("BackgroundSweeper failed fatally and will not rerun until restarted: {}", UnsafeArg.of("message", t.getMessage()), t); sweepOutcomeMetrics.registerOccurrenceOf(SweepOutcome.FATAL); } }
Source:
<code>private void sleepGroup(GroupInfo group, JobInfo info) { Object[] listenersArray = listeners.getListeners(); <START> for (Object element : listenersArray) { <END> IJobProgressManagerListener listener = (IJobProgressManagerListener) element; if (isNeverDisplaying(info.getJob(), listener.showsDebug())) continue; if (listener.showsDebug() || group.isActive()) listener.refreshGroup(group); else listener.removeGroup(group); } }</code><technical_language>inline listeners.getListeners()</technical_language>

Target:
private void sleepGroup(GroupInfo group, JobInfo info) { for (Object element : listeners.getListeners()) { IJobProgressManagerListener listener = (IJobProgressManagerListener) element; if (isNeverDisplaying(info.getJob(), listener.showsDebug())) continue; if (listener.showsDebug() || group.isActive()) listener.refreshGroup(group); else listener.removeGroup(group); } }
Source:
<code>private void assertSingleAccessibleListener() throws Exception { <START> PlatformUI.getWorkbench().getDisplay().asyncExec(() -> { <END> try { assertEquals(1, getAccessibleListenersSize(getToolBar(animationItem).getAccessible())); } catch (Exception e) { throw new RuntimeException(e); } }); Display display = Display.getCurrent(); while (display.readAndDispatch()) { } }</code><technical_language>a race condition here</technical_language>

Target:
private void assertSingleAccessibleListener() throws Exception { Display display = PlatformUI.getWorkbench().getDisplay(); display.asyncExec(() -> { try { assertEquals(1, getAccessibleListenersSize(getToolBar(animationItem).getAccessible())); } catch (Exception e) { throw new RuntimeException(e); } }); while (display.readAndDispatch()) { } }
Source:
<code>BlobStoreCompactor(String dataDir, String storeId, StoreKeyFactory storeKeyFactory, StoreConfig config, StoreMetrics srcMetrics, StoreMetrics tgtMetrics, DiskIOScheduler diskIOScheduler, DiskSpaceAllocator diskSpaceAllocator, Log srcLog, Time time, UUID sessionId, UUID incarnationId) throws IOException, StoreException { this.dataDir = new File(dataDir); this.storeId = storeId; this.storeKeyFactory = storeKeyFactory; this.config = config; this.srcMetrics = srcMetrics; this.tgtMetrics = tgtMetrics; this.srcLog = srcLog; this.diskIOScheduler = diskIOScheduler; this.diskSpaceAllocator = diskSpaceAllocator; this.time = time; this.sessionId = sessionId; this.incarnationId = incarnationId; this.useDirectIO = Utils.isLinux() && config.storeCompactionEnableDirectIO; IndexSegmentValidEntryFilter filter; if (config.storeCompactionFilter.equals(IndexSegmentValidEntryFilterWithoutUndelete.class.getSimpleName())) { filter = new IndexSegmentValidEntryFilterWithoutUndelete(); } else { filter = new IndexSegmentValidEntryFilterWithUndelete(); } <START> validEntryFilter = filter; <END> fixStateIfRequired(); logger.trace("Constructed BlobStoreCompactor for {}", dataDir); }</code><technical_language>filter is unnecessary, removed</technical_language>

Target:
BlobStoreCompactor(String dataDir, String storeId, StoreKeyFactory storeKeyFactory, StoreConfig config, StoreMetrics srcMetrics, StoreMetrics tgtMetrics, DiskIOScheduler diskIOScheduler, DiskSpaceAllocator diskSpaceAllocator, Log srcLog, Time time, UUID sessionId, UUID incarnationId) throws IOException, StoreException { this.dataDir = new File(dataDir); this.storeId = storeId; this.storeKeyFactory = storeKeyFactory; this.config = config; this.srcMetrics = srcMetrics; this.tgtMetrics = tgtMetrics; this.srcLog = srcLog; this.diskIOScheduler = diskIOScheduler; this.diskSpaceAllocator = diskSpaceAllocator; this.time = time; this.sessionId = sessionId; this.incarnationId = incarnationId; this.useDirectIO = Utils.isLinux() && config.storeCompactionEnableDirectIO; if (config.storeCompactionFilter.equals(IndexSegmentValidEntryFilterWithoutUndelete.class.getSimpleName())) { validEntryFilter = new IndexSegmentValidEntryFilterWithoutUndelete(); } else { validEntryFilter = new IndexSegmentValidEntryFilterWithUndelete(); } fixStateIfRequired(); logger.trace("Constructed BlobStoreCompactor for {}", dataDir); }
Source:
<code>public void testForExisting() { String url = "/v2/identifiers/ss481155011?species=hsapiens&assembly=grch37"; ResponseEntity<List<Variant>> response = restTemplate.exchange(url, HttpMethod.GET, null, new ParameterizedTypeReference<List<Variant>>() { }); assertEquals(HttpStatus.OK, response.getStatusCode()); List<Variant> variantList = response.getBody(); assertEquals("1", variantList.get(0).getChromosome()); assertEquals("T", variantList.get(0).getAlternate()); assertEquals("A", variantList.get(0).getReference()); <START> assertTrue(variantList.size() > 0); <END> }</code><technical_language>This assert executed access element in list</technical_language>

Target:
public void testForExisting() { String url = "/v2/identifiers/ss481155011?species=hsapiens&assembly=grch37"; ResponseEntity<List<Variant>> response = restTemplate.exchange(url, HttpMethod.GET, null, new ParameterizedTypeReference<List<Variant>>() { }); assertEquals(HttpStatus.OK, response.getStatusCode()); List<Variant> variantList = response.getBody(); assertTrue(variantList.size() > 0); assertEquals("1", variantList.get(0).getChromosome()); assertEquals("T", variantList.get(0).getAlternate()); assertEquals("A", variantList.get(0).getReference()); }
Source:
<code>public static Interval umbrellaInterval(Iterable<Interval> intervals) { DateTime minStart = null; DateTime maxEnd = null; for (Interval interval : intervals) { DateTime curStart = interval.getStart(); DateTime curEnd = interval.getEnd(); if (minStart == null || maxEnd == null) { minStart = curStart; maxEnd = curEnd; } if (curStart.isBefore(minStart)) { minStart = curStart; <START> } <END> if (curEnd.isAfter(maxEnd)) { maxEnd = curEnd; } } if (minStart == null || maxEnd == null) { throw new IllegalArgumentException("Empty list of intervals"); } return new Interval(minStart, maxEnd); }</code><technical_language>want minDateTime() maxDateTime() huh? :P</technical_language>

Target:
public static Interval umbrellaInterval(Iterable<Interval> intervals) { ArrayList<DateTime> startDates = Lists.newArrayList(); ArrayList<DateTime> endDates = Lists.newArrayList(); for (Interval interval : intervals) { startDates.add(interval.getStart()); endDates.add(interval.getEnd()); } DateTime minStart = minDateTime(startDates.toArray(new DateTime[]{})); DateTime maxEnd = maxDateTime(endDates.toArray(new DateTime[]{})); if (minStart == null || maxEnd == null) { throw new IllegalArgumentException("Empty list of intervals"); } return new Interval(minStart, maxEnd); }
Source:
<code>public PageFileFooterOutput(List<Long> stripeOffsets) { this.stripeOffsets = ImmutableList.copyOf(requireNonNull(stripeOffsets, "stripeOffsets is null")); <START> checkArgument(!stripeOffsets.isEmpty(), "stripeOffsets should at least contain offset 0"); <END> }</code><technical_language>nit: lets move assignment</technical_language>

Target:
public PageFileFooterOutput(List<Long> stripeOffsets) { this.stripeOffsets = ImmutableList.copyOf(requireNonNull(stripeOffsets, "stripeOffsets is null")); }
Source:
<code>public void define(NewController context) { WebService.NewAction action = context.createAction("add_member") .setDescription("Add a user as a member of an organization.<br>" + "Requires 'Administer System' permission on the specified organization.") .setSince("6.4") <START> .setPost(true) <END> .setHandler(this); action .createParam(PARAM_ORGANIZATION) .setDescription("Organization key") .setRequired(true) .setExampleValue(KEY_ORG_EXAMPLE_001); action .createParam("login") .setDescription("User login") .setRequired(true) .setExampleValue("ray.bradbury"); }</code><technical_language>other actions internal, this action internal</technical_language>

Target:
public void define(NewController context) { WebService.NewAction action = context.createAction("add_member") .setDescription("Add a user as a member of an organization.<br>" + "Requires 'Administer System' permission on the specified organization.") .setSince("6.4") .setPost(true) .setInternal(true) .setHandler(this); action .createParam(PARAM_ORGANIZATION) .setDescription("Organization key") .setRequired(true) .setExampleValue(KEY_ORG_EXAMPLE_001); action .createParam(PARAM_LOGIN) .setDescription("User login") .setRequired(true) .setExampleValue("ray.bradbury"); }
Source:
<code>private boolean isDiscardable() { if (!PostUtils.isPublishable(mPost) && isNewPost()) { return true; } return false; <START> } <END></code><technical_language>isDiscardable method simplified this: java private boolean isDiscardable() { return !PostUtils.isPublishable(mPost) && isNewPost(); }</technical_language>

Target:
private boolean isDiscardable() { return !PostUtils.isPublishable(mPost) && isNewPost(); }
Source:
<code>void typeParameterExceptionToRuntimeException() { fix().addInputLines( "Test.java", "class Test {", " <T extends RuntimeException> void f(ThrowingRunnable<T> in) {", " try {", " in.run();", <START> " } catch (RuntimeException e) {", <END> " System.out.println(\"foo\");", " }", " }", " interface ThrowingRunnable<T extends Exception> {", " void run() throws T;", " }", "}") .expectUnchanged() .doTest(BugCheckerRefactoringTestHelper.TestMode.TEXT_MATCH); }</code><technical_language>turns out this is a bit more subtle -- a java9+ compiler target java8 this works expected, java 8 compiler compile this output! recommending revert 11+ soon, rare enough suppress</technical_language>

Target:
void typeParameterExceptionToRuntimeException() { fix().addInputLines( "Test.java", "class Test {", " <T extends RuntimeException> void f(ThrowingRunnable<T> in) {", " try {", " in.run();", " } catch (Exception e) {", " System.out.println(\"foo\");", " }", " }", " interface ThrowingRunnable<T extends Exception> {", " void run() throws T;", " }", "}") .addOutputLines( "Test.java", "class Test {", " <T extends RuntimeException> void f(ThrowingRunnable<T> in) {", " try {", " in.run();", " } catch (RuntimeException e) {", " System.out.println(\"foo\");", " }", " }", " interface ThrowingRunnable<T extends Exception> {", " void run() throws T;", " }", "}") .doTest(BugCheckerRefactoringTestHelper.TestMode.TEXT_MATCH); }
Source:
<code>private void createBinaryAddress(byte[] nodeIdByteArray){ if (nodeIdByteArray.length != 6) { <START> throw new NumberFormatException("Ethernet address has to consist of 6 bytes"); <END> } long l = nodeIdByteArray[0] & 0xFF; for (int i = 1; i < 6; ++i) { l = (l << 8) | (nodeIdByteArray[i] & 0xFF); } _address = l; }</code><technical_language>relation ethernet address</technical_language>

Target:
private void createBinaryAddress(byte[] nodeIdByteArray) { if (nodeIdByteArray.length != 6) { throw new NumberFormatException("Node ID address has to consist of 6 bytes"); } long l = nodeIdByteArray[0] & 0xFF; for (int i = 1; i < 6; ++i) { l = (l << 8) | (nodeIdByteArray[i] & 0xFF); } address = l; }
Source:
<code>public Optional<ConnectorNewTableLayout> getInsertLayout(ConnectorSession session, ConnectorTableHandle tableHandle) { HiveTableHandle hiveTableHandle = (HiveTableHandle) tableHandle; SchemaTableName tableName = hiveTableHandle.getSchemaTableName(); Table table = metastore.getTable(tableName.getSchemaName(), tableName.getTableName()) .orElseThrow(() -> new TableNotFoundException(tableName)); Optional<HiveBucketHandle> hiveBucketHandle = getHiveBucketHandle(table); if (!hiveBucketHandle.isPresent()) { return Optional.empty(); } if (!bucketWritingEnabled) { throw new PrestoException(NOT_SUPPORTED, "Writing to bucketed Hive table has been temporarily disabled"); } HiveBucketProperty bucketProperty = table.getStorage().getBucketProperty() .orElseThrow(() -> new NoSuchElementException("Bucket property should be set")); if (!bucketProperty.getSortedBy().isEmpty() && !isSortedWritingEnabled(session)) { throw new PrestoException(NOT_SUPPORTED, "Writing to bucketed sorted Hive tables is disabled"); } HivePartitioningHandle partitioningHandle = new HivePartitioningHandle( hiveBucketHandle.get().getBucketCount(), hiveBucketHandle.get().getColumns().stream() .map(HiveColumnHandle::getHiveType) .collect(Collectors.toList())); List<String> partitionColumns = hiveBucketHandle.get().getColumns().stream() .map(HiveColumnHandle::getName) .collect(Collectors.toList()); return Optional.of(new ConnectorNewTableLayout(partitioningHandle, partitionColumns)); <START> } <END></code><technical_language>this check above</technical_language>

Target:
public Optional<ConnectorNewTableLayout> getInsertLayout(ConnectorSession session, ConnectorTableHandle tableHandle) { HiveTableHandle hiveTableHandle = (HiveTableHandle) tableHandle; SchemaTableName tableName = hiveTableHandle.getSchemaTableName(); Table table = metastore.getTable(tableName.getSchemaName(), tableName.getTableName()) .orElseThrow(() -> new TableNotFoundException(tableName)); Optional<HiveBucketHandle> hiveBucketHandle = getHiveBucketHandle(table); if (!hiveBucketHandle.isPresent()) { return Optional.empty(); } HiveBucketProperty bucketProperty = table.getStorage().getBucketProperty() .orElseThrow(() -> new NoSuchElementException("Bucket property should be set")); if (!bucketProperty.getSortedBy().isEmpty() && !isSortedWritingEnabled(session)) { throw new PrestoException(NOT_SUPPORTED, "Writing to bucketed sorted Hive tables is disabled"); } HivePartitioningHandle partitioningHandle = new HivePartitioningHandle( hiveBucketHandle.get().getBucketCount(), hiveBucketHandle.get().getColumns().stream() .map(HiveColumnHandle::getHiveType) .collect(Collectors.toList())); List<String> partitionColumns = hiveBucketHandle.get().getColumns().stream() .map(HiveColumnHandle::getName) .collect(Collectors.toList()); return Optional.of(new ConnectorNewTableLayout(partitioningHandle, partitionColumns)); }
Source:
<code>public String createPackage() throws IOException { String packagePath = outputFilePath(); FileOutputStream fileOutputStream = new FileOutputStream(packagePath); ZipOutputStream zipOutputStream = new ZipOutputStream(fileOutputStream); addResourceToPackage(this.manifest, zipOutputStream); for (Resource artifact : this.artifacts) { addResourceToPackage(artifact, zipOutputStream); } <START> zipOutputStream.closeEntry(); <END> zipOutputStream.close(); fileOutputStream.close(); return packagePath; }</code><technical_language>close in finally</technical_language>

Target:
public String createPackage() throws IOException { String packagePath = outputFilePath(); try (FileOutputStream fileOutputStream = new FileOutputStream(packagePath); ZipOutputStream zipOutputStream = new ZipOutputStream(fileOutputStream)) { addManifest(this.manifest, zipOutputStream); zipOutputStream.putNextEntry(new ZipEntry(this.packageName + File.separator)); for (Resource artifact : this.artifacts) { addArtifact(artifact, zipOutputStream); zipOutputStream.closeEntry(); } } return packagePath; }
Source:
<code>public static boolean validConstant(Object o, Litmus litmus) { <START> if (o == null <END> || o instanceof Boolean || o instanceof BigDecimal || o instanceof NlsString || o instanceof ByteString || o instanceof DateString || o instanceof TimeString || o instanceof TimestampString) { return litmus.succeed(); } else if (o instanceof List) { List list = (List) o; for (Object o1 : list) { if (!validConstant(o1, litmus)) { return litmus.fail("not a constant: {}", o1); } } return litmus.succeed(); } else if (o instanceof Map) { @SuppressWarnings("unchecked") final Map<Object, Object> map = (Map) o; for (Map.Entry entry : map.entrySet()) { if (!validConstant(entry.getKey(), litmus)) { return litmus.fail("not a constant: {}", entry.getKey()); } if (!validConstant(entry.getValue(), litmus)) { return litmus.fail("not a constant: {}", entry.getValue()); } } return litmus.succeed(); } else { return litmus.fail("not a constant: {}", o); } }</code><technical_language>this method is in tests</technical_language>

Target:
public static boolean validConstant(Object o, Litmus litmus) { if (o == null || o instanceof Integer || o instanceof Long || o instanceof Float || o instanceof Double || o instanceof Boolean || o instanceof BigDecimal || o instanceof NlsString || o instanceof ByteString || o instanceof DateString || o instanceof TimeString || o instanceof TimestampString) { return litmus.succeed(); } else if (o instanceof List) { List list = (List) o; for (Object o1 : list) { if (!validConstant(o1, litmus)) { return litmus.fail("not a constant: {}", o1); } } return litmus.succeed(); } else if (o instanceof Map) { @SuppressWarnings("unchecked") final Map<Object, Object> map = (Map) o; for (Map.Entry entry : map.entrySet()) { if (!validConstant(entry.getKey(), litmus)) { return litmus.fail("not a constant: {}", entry.getKey()); } if (!validConstant(entry.getValue(), litmus)) { return litmus.fail("not a constant: {}", entry.getValue()); } } return litmus.succeed(); } else { return litmus.fail("not a constant: {}", o); } }
Source:
<code>public boolean isRowSorted(List<String> row) { for(int i=1;i<row.size()-1;i++) { if(row.get(i).compareTo(row.get(i+1))>0) { return false; } } <START> return true; <END> }</code><technical_language>Wdyt a java 8 method check lists ? public boolean isRowSorted(List<String> info) { return info.equals(info.stream().sorted().collect(Collectors.toList())); }</technical_language>

Target:
public boolean isRowSorted(List<String> row) { return row.equals(row.stream().sorted().collect(Collectors.toList())); }
Source:
<code><START> public synchronized NettyClientBase getTajoMasterConnection() throws ServiceException { <END> if (client == null || !client.isConnected()) { try { RpcClientManager.cleanup(client); this.client = manager.newClient(getTajoMasterAddr(), TajoMasterClientProtocol.class, false, manager.getRetries(), manager.getTimeoutSeconds(), TimeUnit.SECONDS, false); } catch (Exception e) { throw new ServiceException(e); } } return client; }</code><technical_language>I know, SessionConnection is created for client. Do need declare synchronized for this method</technical_language>

Target:
public synchronized NettyClientBase getTajoMasterConnection() throws ServiceException { if (client != null && client.isConnected()) return client; else { try { RpcClientManager.cleanup(client); this.client = manager.newClient(getTajoMasterAddr(), TajoMasterClientProtocol.class, false, manager.getRetries(), 0, TimeUnit.SECONDS, false); } catch (Exception e) { throw new ServiceException(e); } return client; } }
Source:
<code>private JsonObject toJsonObject(final UserProfile up) { final JsonObject object = new JsonObject(); object.addProperty("username", up.getUser().getUsername()); object.addProperty("givenNames", up.getGivenNames()); object.addProperty("familyNames", up.getFamilyNames()); object.addProperty("displayName", up.getDisplayName()); object.addProperty("email", up.getEmail()); <START> object.addProperty("userAliasses", aliassesFor(up)); <END> LocalDate expiration = up.getUser().getExpiration(); object.addProperty("expiration", expiration == null ? null : expiration.toString()); object.add("roles", LegacyRoleUtils.mainRoleKeys(up.getUser()).stream().map(JsonPrimitive::new).collect(toJsonArray())); return object; }</code><technical_language>aliases</technical_language>

Target:
private JsonObject toJsonObject(final UserProfile up) { final JsonObject object = new JsonObject(); object.addProperty("username", up.getUser().getUsername()); object.addProperty("givenNames", up.getGivenNames()); object.addProperty("familyNames", up.getFamilyNames()); object.addProperty("displayName", up.getDisplayName()); object.addProperty("email", up.getEmail()); object.add("userAliases", aliasesFor(up)); LocalDate expiration = up.getUser().getExpiration(); object.addProperty("expiration", expiration == null ? null : expiration.toString()); object.add("roles", LegacyRoleUtils.mainRoleKeys(up.getUser()).stream().map(JsonPrimitive::new).collect(toJsonArray())); return object; }
Source:
<code>public void testSetEditorDoesUpdateReturnToDRGTextWhenHasNameIsNotEmpty() { final String NAME = "NAME"; final Name name = new Name(NAME); final Optional<HasName> hasName = Optional.of(new HasName() { @Override public Name getName() { return name; } @Override public void setName(final Name name) { } <START> }); <END> final Optional<Expression> expression = Optional.empty(); view.setEditor(editorDefinition, hasExpression, hasName, expression); verify(returnToDRG).setTextContent(eq(NAME)); }</code><technical_language>I test shorter if mock of HasName. java final HasName hasNameMock = mock(HasName.class); doReturn(name).when(hasNameMock).getName(); final Optional<HasName> hasName = Optional.of(hasNameMock);</technical_language>

Target:
public void testSetEditorDoesUpdateReturnToDRGTextWhenHasNameIsNotEmpty() { final String NAME = "NAME"; final Name name = new Name(NAME); final HasName hasNameMock = mock(HasName.class); doReturn(name).when(hasNameMock).getName(); final Optional<HasName> hasName = Optional.of(hasNameMock); final Optional<Expression> expression = Optional.empty(); view.setEditor(editorDefinition, hasExpression, hasName, expression); verify(returnToDRG).setTextContent(eq(NAME)); }
Source:
<code>public WorkspaceProject resolveProject(final Space space, final Path path) { final org.uberfire.java.nio.file.Path repositoryRoot = Paths.convert(path).getRoot(); final Repository repository = repositoryService.getRepository(space, Paths.convert(repositoryRoot)); if (repository == null) { <START> return null; <END> } final Branch branch = resolveBranch(repositoryRoot, repository); return new WorkspaceProject(organizationalUnitService.getOrganizationalUnit(repository.getSpace().getName()), repository, branch, moduleService.resolveModule(Paths.convert(Paths.convert(branch.getPath()).getRoot()))); }</code><technical_language>this handled some exception? Optional better, this change need more changes I guess. Returning null is a good idea. lead NPE Unexpected exception in BC UI</technical_language>

Target:
public WorkspaceProject resolveProject(final Space space, final Path path) { final org.uberfire.java.nio.file.Path repositoryRoot = Paths.convert(path).getRoot(); final Repository repository = repositoryService.getRepository(space, Paths.convert(repositoryRoot)); if (repository == null) { throw new RuntimeException("Repository not found inside space " + space.getName() + " with path " + path.toURI() + " (root path " + repositoryRoot.toUri() + ")"); } final Branch branch = resolveBranch(repositoryRoot, repository); return new WorkspaceProject(organizationalUnitService.getOrganizationalUnit(repository.getSpace().getName()), repository, branch, moduleService.resolveModule(Paths.convert(Paths.convert(branch.getPath()).getRoot()))); }
Source:
<code>@Bean PaArchivesUpdater paRecentArchivesUpdater() { PaProgDataUpdatesProcessor paProgDataUpdatesProcessor = new PaProgrammeProcessor(contentWriter, contentBuffer(), log, <START> new PaTagMap(topicStore, new MongoSequentialIdGenerator(mongo, "topics"))); <END> PaUpdatesProcessor updatesProcessor = new PaUpdatesProcessor(paProgDataUpdatesProcessor, contentWriter); PaArchivesUpdater updater = new PaRecentArchiveUpdater(paProgrammeDataStore(), fileUploadResultStore(), updatesProcessor); return updater; }</code><technical_language>extract "new PaTagMap" method, times</technical_language>

Target:
@Bean PaArchivesUpdater paRecentArchivesUpdater() { PaProgDataUpdatesProcessor paProgDataUpdatesProcessor = new PaProgrammeProcessor(contentWriter, contentBuffer(), log, paTagMap); PaUpdatesProcessor updatesProcessor = new PaUpdatesProcessor(paProgDataUpdatesProcessor, contentWriter); PaArchivesUpdater updater = new PaRecentArchiveUpdater(paProgrammeDataStore(), fileUploadResultStore(), updatesProcessor); return updater; }
Source:
<code>protected TmfCommonXAxisModel extractModelFromChart(final Chart chart, String... otherSeries) { <START> String mainSeriesName = getMainSeriesName(); <END> ISeries mainSeries = chart.getSeriesSet().getSeries(mainSeriesName); assertNotNull(mainSeries); double[] xMain = mainSeries.getXSeries(); double[] yMain = mainSeries.getYSeries(); Map<@NonNull String, @NonNull IYModel> yModels = new LinkedHashMap<>(); yModels.put(mainSeriesName, new YModel(mainSeriesName, Objects.requireNonNull(yMain))); for (String other : otherSeries) { if (other != null) { ISeries series = chart.getSeriesSet().getSeries(other); double[] xSeries = series.getXSeries(); double[] ySeries = series.getYSeries(); assertTrue("Series should have the same x axis values", Arrays.equals(xMain, xSeries)); yModels.put(other, new YModel(other, Objects.requireNonNull(ySeries))); } } long[] x = Longs.toArray(Doubles.asList(xMain)); assertNotNull(x); return new TmfCommonXAxisModel(getTitle(), x, yModels); }</code><technical_language>convinced, I belongs in setup waiting for analysis is setup: preparing workspace for in expected state</technical_language>

Target:
protected TmfCommonXAxisModel extractModelFromChart(final Chart chart, String... otherSeries) { String analysisId = getAnalysisId(); if (analysisId != null) { ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace(); assertNotNull(trace); IAnalysisModule module = trace.getAnalysisModule(analysisId); assertNotNull(module); module.schedule(); assertTrue(module.waitForCompletion()); } String mainSeriesName = getMainSeriesName(); ISeries mainSeries = chart.getSeriesSet().getSeries(mainSeriesName); assertNotNull(mainSeries); double[] xMain = mainSeries.getXSeries(); double[] yMain = mainSeries.getYSeries(); Map<@NonNull String, @NonNull IYModel> yModels = new LinkedHashMap<>(); yModels.put(mainSeriesName, new YModel(mainSeriesName, Objects.requireNonNull(yMain))); for (String other : otherSeries) { if (other != null) { ISeries series = chart.getSeriesSet().getSeries(other); double[] xSeries = series.getXSeries(); double[] ySeries = series.getYSeries(); assertTrue("Series should have the same x axis values", Arrays.equals(xMain, xSeries)); yModels.put(other, new YModel(other, Objects.requireNonNull(ySeries))); } } long[] x = Longs.toArray(Doubles.asList(xMain)); assertNotNull(x); return new TmfCommonXAxisModel(getTitle(), x, yModels); }
Source:
<code>public void onAttach(final Activity activity) { super.onAttach(activity); try { mListener = (Listener) activity; <START> } catch (final ClassCastException e) { <END> Lg.e(activity.getClass().getName(), " should implement ", Listener.class.getName()); } }</code><technical_language>instanceof</technical_language>

Target:
public void onAttach(final Activity activity) { super.onAttach(activity); if (activity instanceof Listener) { mListener = (Listener) activity; } else { Lg.e(activity.getClass().getName(), " should implement ", Listener.class.getName()); } }
Source:
<code>private static Timestamp getTimestampValue(final PluginTask task, final Column column, final String value) { final List<ColumnConfig> columnConfigs = task.getColumns().getColumns(); String pattern = DEFAULT_TIMESTAMP_PATTERN; <START> for (final ColumnConfig config : columnConfigs) { final ConfigSource columnConfig = config.getConfigSource(); <END> if (config.getName().equals(column.getName()) && columnConfig != null && columnConfig.has("format")) { pattern = columnConfig.get(String.class, "format"); break; } } final TimestampParser parser = TimestampParser.of(pattern, "UTC"); Timestamp result = null; try { result = parser.parse(value); } catch (final Exception e) { } return result; }</code><technical_language>variable names sound confusing. suggest change: for (final ColumnConfig columnConfig : columnConfigs) { final ConfigSource columnConfigSource = config.getConfigSource(); show column config config source</technical_language>

Target:
private static Timestamp getTimestampValue(final PluginTask task, final Column column, final String value) { final List<ColumnConfig> columnConfigs = task.getColumns().getColumns(); String pattern = DEFAULT_TIMESTAMP_PATTERN; for (final ColumnConfig columnConfig : columnConfigs) { final ConfigSource columnConfigSource = columnConfig.getConfigSource(); if (columnConfig.getName().equals(column.getName()) && columnConfigSource != null && columnConfigSource.has("format")) { pattern = columnConfigSource.get(String.class, "format"); break; } } final TimestampParser parser = TimestampParser.of(pattern, "UTC"); Timestamp result = null; try { result = parser.parse(value); } catch (final Exception e) { } return result; }