auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void deleteProcessorNode(String processorId) { for (ProcessorNode processorNode : getAllProcessorNodes()) { if (processorNode.getProcessorData().getProcessorId().equals(processorId)) { LOG.info("Deleting the ephemeral node: of the processor: in zookeeper.", processorNode.getEphemeralPath(), processorId); zkClient.delete(processorNode.getEphemeralPath()); } } }

Target:
public synchronized void deleteProcessorNode(String processorId) { try { if (ephemeralPath != null) { LOG.info("Deleting the ephemeral node: of the processor: in zookeeper.", ephemeralPath, processorId); zkClient.delete(ephemeralPath); } } catch (Exception e) { LOG.error("Exception occurred on deletion of ephemeral node: {}.", ephemeralPath, e); } }
Source:
private UsngCoordinate parseMgrsString(String mgrs) { try { return translator.parseMgrsString(mgrs); } catch (ParseException e) { LOGGER.debug("Detected string was not actually valid MGRS", e); return null; } }

Target:
private UsngCoordinate parseMgrsString(String mgrs) { try { return translator.parseMgrsString(mgrs); } catch (ParseException e) { LOGGER.debug("Detected string was not valid MGRS", mgrs, e); return null; } }
Source:
public CorfuTable(Index.Registry<K, V> indices, Supplier<ContextAwareMap<K, V>> streamingMapSupplier, VersionPolicy versionPolicy) { this.indexSpec = new HashSet<>(); this.secondaryIndexes = new HashMap<>(); this.mainMap = streamingMapSupplier.get(); this.versionPolicy = versionPolicy; this.optimisticTable = new CorfuTable<>(this.mainMap.getOptimisticMap(), this.indexSpec, this.secondaryIndexes, null); indices.forEach(index -> { secondaryIndexes.put(index.getName().get(), new HashMap<>()); indexSpec.add(index); }); if (secondaryIndexes.keySet().size() > 0) { log.info( "CorfuTable: creating CorfuTable with the following indexes: {}", secondaryIndexes.keySet() ); } }

Target:
public CorfuTable(Index.Registry<K, V> indices, Supplier<ContextAwareMap<K, V>> streamingMapSupplier, VersionPolicy versionPolicy) { this.indexSpec = new HashSet<>(); this.secondaryIndexes = new HashMap<>(); this.mainMap = streamingMapSupplier.get(); this.versionPolicy = versionPolicy; this.optimisticTable = new CorfuTable<>(this.mainMap.getOptimisticMap(), this.indexSpec, this.secondaryIndexes, null); indices.forEach(index -> { secondaryIndexes.put(index.getName().get(), new HashMap<>()); indexSpec.add(index); }); if (!secondaryIndexes.isEmpty()) { log.info( "CorfuTable: creating CorfuTable with the following indexes: {}", secondaryIndexes.keySet() ); } }
Source:
private Mono<Void> run(CancellationToken cancellationToken) { return Flux.just(this) .flatMap(value -> this.leaseContainer.getAllLeases()) .collectList() .flatMap(allLeases -> { if (cancellationToken.isCancellationRequested()) return Mono.empty(); List<Lease> leasesToTake = this.partitionLoadBalancingStrategy.selectLeasesToTake(allLeases); this.logger.debug("Found leases, taking {}", allLeases.size(), leasesToTake.size()); if (cancellationToken.isCancellationRequested()) return Mono.empty(); return Flux.fromIterable(leasesToTake) .flatMap(lease -> { if (cancellationToken.isCancellationRequested()) return Mono.empty(); return this.partitionController.addOrUpdateLease(lease); }) .then(Mono.just(this) .flatMap(value -> { if (cancellationToken.isCancellationRequested()) { return Mono.empty(); } ZonedDateTime stopTimer = ZonedDateTime.now().plus(this.leaseAcquireInterval); return Mono.just(value) .delayElement(Duration.ofMillis(100)) .repeat( () -> { ZonedDateTime currentTime = ZonedDateTime.now(); return !cancellationToken.isCancellationRequested() && currentTime.isBefore(stopTimer); }).last(); }) ); }) .onErrorResume(throwable -> { logger.warn("Unexpected exception thown while trying to acquire available leases", throwable); return Mono.empty(); }) .repeat(() -> { return !cancellationToken.isCancellationRequested(); }) .then() .onErrorResume(throwable -> { logger.info("Partition load balancer task stopped."); return this.stop(); }); }

Target:
private Mono<Void> run(CancellationToken cancellationToken) { return Flux.just(this) .flatMap(value -> this.leaseContainer.getAllLeases()) .collectList() .flatMap(allLeases -> { if (cancellationToken.isCancellationRequested()) return Mono.empty(); List<Lease> leasesToTake = this.partitionLoadBalancingStrategy.selectLeasesToTake(allLeases); this.logger.debug("Found leases, taking {}", allLeases.size(), leasesToTake.size()); if (cancellationToken.isCancellationRequested()) return Mono.empty(); return Flux.fromIterable(leasesToTake) .flatMap(lease -> { if (cancellationToken.isCancellationRequested()) return Mono.empty(); return this.partitionController.addOrUpdateLease(lease); }) .then(Mono.just(this) .flatMap(value -> { if (cancellationToken.isCancellationRequested()) { return Mono.empty(); } ZonedDateTime stopTimer = ZonedDateTime.now().plus(this.leaseAcquireInterval); return Mono.just(value) .delayElement(Duration.ofMillis(100)) .repeat( () -> { ZonedDateTime currentTime = ZonedDateTime.now(); return !cancellationToken.isCancellationRequested() && currentTime.isBefore(stopTimer); }).last(); }) ); }) .onErrorResume(throwable -> { logger.warn("Unexpected exception thrown while trying to acquire available leases", throwable); return Mono.empty(); }) .repeat(() -> { return !cancellationToken.isCancellationRequested(); }) .then() .onErrorResume(throwable -> { logger.info("Partition load balancer task stopped."); return this.stop(); }); }
Source:
public void reblog(ReaderPost post) { List<SiteModel> sites = mSiteStore.getVisibleSites(); switch (sites.size()) { case 0: ToastUtils.showToast(getActivity(), R.string.reader_no_site_to_reblog); break; case 1: ActivityLauncher.openEditorForReblog(getActivity(), getSelectedSite(), this.mPostToReblog); break; default: this.mPostToReblog = post; ActivityLauncher.showSitePickerForResult(this, getSelectedSite()); break; } }

Target:
public void reblog(ReaderPost post) { mViewModel.onReblogButtonClicked(post); }
Source:
public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = LayoutInflater.from(getContext()).inflate(R.layout.custom_list_item, parent, false); } convertView.setEnabled(true); TextView tvName = convertView.findViewById(android.R.id.text1); TextView tvFiles = convertView.findViewById(android.R.id.text2); DatumTransformation transformation = getItem(position); tvName.setText(transformation.getName()); StringBuilder sb = new StringBuilder(); if (transformation.isMissingProjectionEngineFiles()) { sb.append("Missing grid files"); if (transformation instanceof GeographicTransformation) { GeographicTransformation gt = (GeographicTransformation)transformation; for (GeographicTransformationStep step : gt.getSteps()) { if (step.isMissingProjectionEngineFiles()) { sb.append(": " ); sb.append(TextUtils.join(", ", step.getProjectionEngineFilenames())); } } } convertView.setEnabled(false); } if ((defaultValue != null) && (defaultValue.equals(transformation) )) { tvName.setTypeface(null, Typeface.BOLD); } else { tvName.setTypeface(null, Typeface.NORMAL); } tvFiles.setText(sb.toString()); return convertView; }

Target:
public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = LayoutInflater.from(getContext()).inflate(R.layout.custom_list_item, parent, false); } convertView.setEnabled(true); TextView tvName = convertView.findViewById(android.R.id.text1); TextView tvFiles = convertView.findViewById(android.R.id.text2); DatumTransformation transformation = getItem(position); tvName.setText(transformation.getName()); StringBuilder sb = new StringBuilder(); if (transformation.isMissingProjectionEngineFiles()) { sb.append(getContext().getResources().getString(R.string.adapter_missing_files)); if (transformation instanceof GeographicTransformation) { GeographicTransformation gt = (GeographicTransformation)transformation; for (GeographicTransformationStep step : gt.getSteps()) { if (step.isMissingProjectionEngineFiles()) { sb.append(": " ); sb.append(TextUtils.join(", ", step.getProjectionEngineFilenames())); } } } convertView.setEnabled(false); } if ((defaultValue != null) && (defaultValue.equals(transformation) )) { tvName.setTypeface(null, Typeface.BOLD); } else { tvName.setTypeface(null, Typeface.NORMAL); } tvFiles.setText(sb.toString()); return convertView; }
Source:
public static void deleteDirIfExists(String hdfsPath, FileSystem fs) throws IOException { Path path = new Path(hdfsPath); if (fs.exists(path)) { System.out.println("Deleting HDFS path: "+ path + " on "+fs.getConf().get("fs.default.name")); fs.delete(path, true); } }

Target:
public static void deleteDirIfExists(String hdfsPath, FileSystem fs) throws IOException { Path path = new Path(hdfsPath); if (fs.exists(path)) { logger.info("Deleting HDFS path: "+ path + " on "+fs.getConf().get("fs.default.name")); fs.delete(path, true); } }
Source:
private ITimeGraphState createTimeGraphState(ITmfStateInterval interval, ITmfStateSystem ss) throws StateSystemDisposedException { long startTime = interval.getStartTime(); long endTime = interval.getEndTime(); long duration = endTime - startTime + 1; Object statusObj = interval.getValue(); Type type = fEntryModelTypes.get(interval.getAttribute()); if (statusObj instanceof Integer) { int status = (int) statusObj; if (type == Type.CPU) { if (status == StateValues.CPU_STATUS_RUN_USERMODE || status == StateValues.CPU_STATUS_RUN_SYSCALL) { return fTimeEventNames.getUnchecked(interval); } } else if (type == Type.CURRENT_THREAD) { Object processName = null; synchronized (fExecNamesCache) { if (fExecNamesCache.containsEntry(status, interval)) { processName = fExecNamesCache.get(status).first().getValue(); } else { int quark = ss.optQuarkAbsolute(Attributes.THREADS, Integer.toString(status), Attributes.EXEC_NAME); if (quark != ITmfStateSystem.INVALID_ATTRIBUTE) { ITmfStateInterval namedInterval = ss.querySingleState(endTime, quark); fExecNamesCache.put(status, namedInterval); processName = namedInterval.getValue(); } } } if (processName instanceof String) { return new TimeGraphState(startTime, duration, status, (String) processName); } } return new TimeGraphState(startTime, duration, status); } return new TimeGraphState(startTime, duration, Integer.MIN_VALUE); }

Target:
private ITimeGraphState createTimeGraphState(ITmfStateInterval interval, ITmfStateSystem ss) throws StateSystemDisposedException { long startTime = interval.getStartTime(); long endTime = interval.getEndTime(); long duration = endTime - startTime + 1; Object statusObj = interval.getValue(); Type type = fEntryModelTypes.get(interval.getAttribute()); if (statusObj instanceof Integer) { int status = (int) statusObj; if (type == Type.CPU) { if (status == StateValues.CPU_STATUS_RUN_USERMODE || status == StateValues.CPU_STATUS_RUN_SYSCALL) { return fTimeEventNames.getUnchecked(interval); } } else if (type == Type.CURRENT_THREAD) { Object processName = null; if (fExecNamesCache.containsEntry(status, interval)) { processName = fExecNamesCache.get(status).first().getValue(); } else { int quark = ss.optQuarkAbsolute(Attributes.THREADS, Integer.toString(status), Attributes.EXEC_NAME); if (quark != ITmfStateSystem.INVALID_ATTRIBUTE) { ITmfStateInterval namedInterval = ss.querySingleState(endTime, quark); fExecNamesCache.put(status, namedInterval); processName = namedInterval.getValue(); } } if (processName instanceof String) { return new TimeGraphState(startTime, duration, status, (String) processName); } } return new TimeGraphState(startTime, duration, status); } return new TimeGraphState(startTime, duration, Integer.MIN_VALUE); }
Source:
private synchronized void onSenderInitialized(final String senderId) { senderRepresenterMap.get(senderId) .checkAndSetState(PushShuffleSenderImpl.State.CREATED, PushShuffleSenderImpl.State.SENDING); LOG.log(Level.FINE, "A sender is initialized " + senderId); initializedSenderNum++; broadcastIfShuffleIsInitialized(); }

Target:
private synchronized void onSenderInitialized(final String senderId) { if (initialized) { sendSenderCanSendMessage(senderId); } else { initializedSenderIdList.add(senderId); } }
Source:
public void cancel(Cancellable cancellable) { if (cancellable.getCancellationUrl() != null) { String url = cancellable.getCancellationUrl().getUrl(); Response response = postEmptyEntity(url); Status status = Status.fromStatusCode(response.getStatus()); if (status == OK) { return; } else if (status == CONFLICT) { throw new NotCancellableException(); } throw handleGeneralError(response, status); } else { throw new NotCancellableException(); } }

Target:
public void cancel(Cancellable cancellable) { if (cancellable.getCancellationUrl() != null) { String url = cancellable.getCancellationUrl().getUrl(); Response response = postEmptyEntity(url); Status status = Status.fromStatusCode(response.getStatus()); if (status == OK) { return; } else if (status == CONFLICT) { throw new JobIsCompletedException(); } throw handleGeneralError(response, status); } else { throw new NotCancellableException(); } }
Source:
public DatabaseChunkedReader(Properties props, DataSource source, String sourceQuery, String table, DatabaseSource databaseSource, String id) throws SQLException, SchemaGenerationException { _databaseChunkedReaderConfig = new DatabaseChunkedReaderConfig(props); _sourceQuery = sourceQuery; _dataSource = source; _databaseSource = databaseSource; _readerId = id; _chunkingTable = table; _fetchSize = _databaseChunkedReaderConfig.getFetchSize(); _queryTimeoutSecs = _databaseChunkedReaderConfig.getQueryTimeout(); _maxChunkIndex = _databaseChunkedReaderConfig.getNumChunkBuckets() - 1; _chunkSize = _databaseChunkedReaderConfig.getChunkSize(); _chunkIndex = _databaseChunkedReaderConfig.getChunkIndex(); _connection = source.getConnection(); _hashFunction = _databaseChunkedReaderConfig.getHashFunction(); _concatFunction = _databaseChunkedReaderConfig.getConcatFunction(); _interpreter = _databaseChunkedReaderConfig.getDatabaseInterpreter(); getChunkingKeyInfo(); validateQuery(sourceQuery); }

Target:
public DatabaseChunkedReader(Properties props, DataSource source, String sourceQuery, String table, DatabaseSource databaseSource, String id) throws SQLException { _databaseChunkedReaderConfig = new DatabaseChunkedReaderConfig(props); _sourceQuery = sourceQuery; _dataSource = source; _databaseSource = databaseSource; _readerId = id; _chunkingTable = table; _fetchSize = _databaseChunkedReaderConfig.getFetchSize(); _queryTimeoutSecs = _databaseChunkedReaderConfig.getQueryTimeout(); _maxChunkIndex = _databaseChunkedReaderConfig.getNumChunkBuckets() - 1; _chunkSize = _databaseChunkedReaderConfig.getChunkSize(); _chunkIndex = _databaseChunkedReaderConfig.getChunkIndex(); _connection = source.getConnection(); _interpreter = _databaseChunkedReaderConfig.getDatabaseInterpreter(); _chunkedQueryManager = _databaseChunkedReaderConfig.getChunkedQueryManager(); validateQuery(sourceQuery); }
Source:
public void shouldEditConceptAttributeOfConcept() throws Exception { executeDataSet(RestTestConstants2_0.CONCEPT_ATTRIBUTE_DATA_SET); String json = "{ \"uuid\":\"" + RestTestConstants2_0.CONCEPT_UUID + "\"," + "\"attributes\":[{\"uuid\":\"" + RestTestConstants2_0.CONCEPT_ATTRIBUTE_UUID + "\"," + "\"attributeType\":\"" + RestTestConstants2_0.CONCEPT_ATTRIBUTE_TYPE_UUID + "\",\"value\":\"2001-01-01\"}]}"; Concept concept = Context.getConceptService().getConceptByUuid(RestTestConstants2_0.CONCEPT_UUID); int before = concept.getAttributes().size(); Assert.assertEquals(before, concept.getAttributes().size()); ConceptAttribute conceptAttributeBeforeEdit = Context.getConceptService().getConceptAttributeByUuid(RestTestConstants2_0.CONCEPT_ATTRIBUTE_UUID); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); Assert.assertEquals("2011-04-25", simpleDateFormat.format(conceptAttributeBeforeEdit.getValue())); handle(newPostRequest(getURI() + "/" + getUuid(), json)); Assert.assertEquals(before, concept.getAttributes().size()); ConceptAttribute actualConceptAttribute = Context.getConceptService().getConceptAttributeByUuid(RestTestConstants2_0.CONCEPT_ATTRIBUTE_UUID); Assert.assertEquals("2001-01-01", simpleDateFormat.format(actualConceptAttribute.getValue())); }

Target:
public void shouldEditConceptAttributeOfConcept() throws Exception { executeDataSet(RestTestConstants2_0.CONCEPT_ATTRIBUTE_DATA_SET); String json = "{ \"uuid\":\"" + RestTestConstants2_0.CONCEPT_UUID + "\"," + "\"attributes\":[{\"uuid\":\"" + RestTestConstants2_0.CONCEPT_ATTRIBUTE_UUID + "\"," + "\"attributeType\":\"" + RestTestConstants2_0.CONCEPT_ATTRIBUTE_TYPE_UUID + "\",\"value\":\"2001-01-01\"}]}"; Concept concept = Context.getConceptService().getConceptByUuid(RestTestConstants2_0.CONCEPT_UUID); int before = concept.getAttributes().size(); ConceptAttribute conceptAttributeBeforeEdit = Context.getConceptService().getConceptAttributeByUuid(RestTestConstants2_0.CONCEPT_ATTRIBUTE_UUID); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); Assert.assertEquals("2011-04-25", simpleDateFormat.format(conceptAttributeBeforeEdit.getValue())); handle(newPostRequest(getURI() + "/" + getUuid(), json)); Assert.assertEquals(before, concept.getAttributes().size()); ConceptAttribute actualConceptAttribute = Context.getConceptService().getConceptAttributeByUuid(RestTestConstants2_0.CONCEPT_ATTRIBUTE_UUID); Assert.assertEquals("2001-01-01", simpleDateFormat.format(actualConceptAttribute.getValue())); }
Source:
public void refreshCache() { this.blacklistedPartitions = SystemDistributedKeyspace.getBlacklistedPartitions(); if (DatabaseDescriptor.getBlackListedPartitionsCacheSizeWarnThresholdInMB() > 0) { long cacheSize = 0; for (BlacklistedPartition blacklistedPartition : blacklistedPartitions) { cacheSize += blacklistedPartition.unsharedHeapSize(); } if (cacheSize / (1024 * 1024) >= DatabaseDescriptor.getBlackListedPartitionsCacheSizeWarnThresholdInMB()) { logger.warn(String.format("BlacklistedPartition cache size (%d) MB exceeds threshold size (%d) MB", cacheSize / (1024 * 1024), DatabaseDescriptor.getBlackListedPartitionsCacheSizeWarnThresholdInMB())); } } }

Target:
public void refreshCache() { UntypedResultSet results = SystemDistributedKeyspace.getBlacklistedPartitions(); Set<BlacklistedPartition> partitions = new HashSet<>(); if (results != null) { int cacheSizeBytes = 0; for (UntypedResultSet.Row row : results) { try { BlacklistedPartition blacklistedPartition = new BlacklistedPartition(row.getString("keyspace_name"), row.getString("columnfamily_name"), row.getString("partition_key")); cacheSizeBytes += blacklistedPartition.unsharedHeapSize(); if (cacheSizeBytes / (1024 * 1024) > DatabaseDescriptor.getBlackListedPartitionsCacheSizeLimitInMB()) { logger.warn("BlacklistedPartitions cache size limit of MB reached. Unable to load more blacklisted partitions. BlacklistedPartitions cache working in degraded mode.", DatabaseDescriptor.getBlackListedPartitionsCacheSizeLimitInMB()); break; } partitions.add(blacklistedPartition); } catch (IllegalArgumentException ex) { logger.warn("Exception parsing blacklisted partition. {}", ex.getMessage()); } } } this.blacklistedPartitions = partitions; }
Source:
public void open(TableInputSplit split) throws IOException { initTable(); if (table == null) { throw new IOException("The HBase table has not been opened! " + "This needs to be done in configure()."); } if (scan == null) { throw new IOException("Scan has not been initialized! " + "This needs to be done in configure()."); } if (split == null) { throw new IOException("Input split is null!"); } logSplitInfo("opening", split); currentRow = split.getStartRow(); scan.setStartRow(currentRow); scan.setStopRow(split.getEndRow()); resultScanner = table.getScanner(scan); endReached = false; scannedRows = 0; }

Target:
public void open(TableInputSplit split) throws IOException { initTable(); if (split == null) { throw new IOException("Input split is null!"); } logSplitInfo("opening", split); currentRow = split.getStartRow(); scan.setStartRow(currentRow); scan.setStopRow(split.getEndRow()); resultScanner = table.getScanner(scan); endReached = false; scannedRows = 0; }
Source:
protected void updateServer(boolean limit) { if (optOut || offline) { return; } if (!uploadingCurrently.getAndSet(true)) { long totalEventCount = dbHelper.getTotalEventCount(); long batchSize = Math.min( limit ? backoffUploadBatchSize : eventUploadMaxBatchSize, totalEventCount ); if (batchSize <= 0) { uploadingCurrently.set(false); return; } try { List<JSONObject> events = dbHelper.getEvents(lastEventId, batchSize); List<JSONObject> identifys = dbHelper.getIdentifys(lastIdentifyId, batchSize); final Pair<Pair<Long, Long>, JSONArray> merged = mergeEventsAndIdentifys( events, identifys, batchSize); final JSONArray mergedEvents = merged.second; if (mergedEvents.length() == 0) { uploadingCurrently.set(false); return; } final long maxEventId = merged.first.first; final long maxIdentifyId = merged.first.second; final String mergedEventsString = merged.second.toString(); httpThread.post(new Runnable() { @Override public void run() { makeEventUploadPostRequest(httpClient, mergedEventsString, maxEventId, maxIdentifyId); } }); } catch (JSONException e) { uploadingCurrently.set(false); logger.e(TAG, e.toString()); } catch (RuntimeException e) { String message = e.getMessage(); if (!TextUtils.isEmpty(message) && message.startsWith("Cursor window")) { uploadingCurrently.set(false); logger.e(TAG, String.format( "Caught Cursor window exception during event upload, deferring upload: %s", message )); } else { throw e; } } } }

Target:
protected void updateServer(boolean limit) { if (optOut || offline) { return; } if (!uploadingCurrently.getAndSet(true)) { long totalEventCount = dbHelper.getTotalEventCount(); long batchSize = Math.min( limit ? backoffUploadBatchSize : eventUploadMaxBatchSize, totalEventCount ); if (batchSize <= 0) { uploadingCurrently.set(false); return; } try { List<JSONObject> events = dbHelper.getEvents(lastEventId, batchSize); List<JSONObject> identifys = dbHelper.getIdentifys(lastIdentifyId, batchSize); final Pair<Pair<Long, Long>, JSONArray> merged = mergeEventsAndIdentifys( events, identifys, batchSize); final JSONArray mergedEvents = merged.second; if (mergedEvents.length() == 0) { uploadingCurrently.set(false); return; } final long maxEventId = merged.first.first; final long maxIdentifyId = merged.first.second; final String mergedEventsString = merged.second.toString(); httpThread.post(new Runnable() { @Override public void run() { makeEventUploadPostRequest(httpClient, mergedEventsString, maxEventId, maxIdentifyId); } }); } catch (JSONException e) { uploadingCurrently.set(false); logger.e(TAG, e.toString()); } catch (CursorWindowAllocationException e) { uploadingCurrently.set(false); logger.e(TAG, String.format( "Caught Cursor window exception during event upload, deferring upload: %s", e.getMessage() )); } } }
Source:
public void configure(JobConf job) { setConf(job); this.scfilters = new ScoringFilters(job); skipTruncated = job.getBoolean(SKIP_TRUNCATED, true); filterflag = job.getBoolean(PARSER_MODELFILTER, true); if (filterflag) { String[] args = new String[2]; args[0] = getConf().get(TRAINFILE_MODELFILTER); args[1] = getConf().get(DICTFILE_MODELFILTER); if (args[0] == null || args[0].trim().length() == 0 || args[1] == null || args[1].trim().length() == 0) { String message = "Model URLFilter: trainfile or wordlist not set in the urlfilter.model.trainfile or urlfilter.model.wordlist"; if (LOG.isErrorEnabled()) { filterflag = false; LOG.error(message); } throw new IllegalArgumentException(message); } else { try { filters = new URLFilters(job); filter = (ModelURLFilterAbstract) filters .getFilter("org.apache.nutch.urlfilter.model.ModelURLFilter"); filter.configure(args); } catch (Exception e) { LOG.warn("There was some problem while getting the model filter or training it. Not using the filter"); filterflag = false; } } } }

Target:
public void configure(JobConf job) { setConf(job); this.scfilters = new ScoringFilters(job); skipTruncated = job.getBoolean(SKIP_TRUNCATED, true); }
Source:
private String buildWhereClause(Query query) { String whereClause = Column.has_phone_number + " !=0 AND (" + Column.mimetype + " = ? OR " + Column.mimetype + " = ? ) "; if (query != null) { return (whereClause + " AND " + query.getWhereClause()); } return whereClause; }

Target:
private String buildWhereClause(Query query) { StringBuilder stringBuilder = new StringBuilder(staticWhereClause); if (query != null) { stringBuilder.append("AND "); stringBuilder.append(query.getWhereClause()); } return stringBuilder.toString(); }
Source:
private void breakModifies(ProgressMonitor pm) throws IOException { if (modifyScore <= 0) return; pm.beginTask(JGitText.get().renamesBreakingModifies, entries.size()); for (int i = 0; i < entries.size(); i++) { DiffEntry e = entries.get(i); if (e.getChangeType() == ChangeType.MODIFY) { if (modifyScore > 100) { List<DiffEntry> tmp = DiffEntry.breakModify(e); deleted.add(tmp.get(0)); added.add(tmp.get(1)); entries.remove(i); i--; } else if (!e.newId.equals(e.oldId)) { if (calculateModifyScore(e) < modifyScore) { List<DiffEntry> tmp = DiffEntry.breakModify(e); deleted.add(tmp.get(0)); added.add(tmp.get(1)); entries.remove(i); i--; } } } pm.update(1); } }

Target:
private void breakModifies(ProgressMonitor pm) throws IOException { if (breakScore <= 0) return; ArrayList<DiffEntry> newEntries = new ArrayList<DiffEntry>(entries.size()); pm.beginTask(JGitText.get().renamesBreakingModifies, entries.size()); for (int i = 0; i < entries.size(); i++) { DiffEntry e = entries.get(i); if (e.getChangeType() == ChangeType.MODIFY) { final int score = calculateModifyScore(e); if (score < breakScore) { List<DiffEntry> tmp = DiffEntry.breakModify(e); DiffEntry del = tmp.get(0); del.score = score; deleted.add(del); added.add(tmp.get(1)); i--; } else { newEntries.add(e); } } pm.update(1); } entries = newEntries; }
Source:
public SwaggerInterfaceParser(Class<?> swaggerInterface, SerializerAdapter serializer, String host) { if (!ImplUtils.isNullOrEmpty(host)) { this.host = host; } else { final Host hostAnnotation = swaggerInterface.getAnnotation(Host.class); if (hostAnnotation != null && !hostAnnotation.value().isEmpty()) { this.host = hostAnnotation.value(); } else { throw logger.logExceptionAsError(new MissingRequiredAnnotationException(Host.class, swaggerInterface)); } } ServiceInterface serviceAnnotation = swaggerInterface.getAnnotation(ServiceInterface.class); if (serviceAnnotation != null && !serviceAnnotation.name().isEmpty()) { serviceName = serviceAnnotation.name(); } else { throw logger.logExceptionAsError(new MissingRequiredAnnotationException(ServiceInterface.class, swaggerInterface)); } }

Target:
public SwaggerInterfaceParser(Class<?> swaggerInterface, SerializerAdapter serializer, String host) { if (!ImplUtils.isNullOrEmpty(host)) { this.host = host; } else { final Host hostAnnotation = swaggerInterface.getAnnotation(Host.class); if (hostAnnotation != null && !hostAnnotation.value().isEmpty()) { this.host = hostAnnotation.value(); } else { throw new MissingRequiredAnnotationException(Host.class, swaggerInterface); } } ServiceInterface serviceAnnotation = swaggerInterface.getAnnotation(ServiceInterface.class); if (serviceAnnotation != null && !serviceAnnotation.name().isEmpty()) { serviceName = serviceAnnotation.name(); } else { throw new MissingRequiredAnnotationException(ServiceInterface.class, swaggerInterface); } }
Source:
public static CommandElement entity(Text key, EntityType type) { return new EntityCommandElement(key, false, false, type.getEntityClass()); }

Target:
public static CommandElement entity(Text key, EntityType type) { return new EntityCommandElement(key, false, false, type); }
Source:
public abstract void activate(Context c, XmlWorkflowItem wf) throws SQLException, IOException, AuthorizeException, WorkflowException; public abstract ActionResult execute(Context c, XmlWorkflowItem wfi, Step step, HttpServletRequest request) throws SQLException, AuthorizeException, IOException, WorkflowException; public abstract List<String> getOptions(); protected boolean isInOptions(HttpServletRequest request) { for (String option: this.getOptions()) { if (request.getParameter(option) != null) { return true; } } return false; }

Target:
public abstract void activate(Context c, XmlWorkflowItem wf) throws SQLException, IOException, AuthorizeException, WorkflowException; public abstract ActionResult execute(Context c, XmlWorkflowItem wfi, Step step, HttpServletRequest request) throws SQLException, AuthorizeException, IOException, WorkflowException; public abstract List<String> getOptions(); protected boolean isOptionInParam(HttpServletRequest request) { for (String option: this.getOptions()) { if (request.getParameter(option) != null) { return true; } } return false; }
Source:
private static int getThreadProcessId(String name, @Nullable Object value) { if (value instanceof Number) { return ((Number) value).intValue(); } try { return Integer.parseInt(name); } catch (NumberFormatException e) { } return -1; }

Target:
private static int getThreadProcessId(String name, @Nullable Object value) { if (value instanceof Number) { return ((Number) value).intValue(); } try { return Integer.parseInt(name); } catch (NumberFormatException e) { return UNKNOWN_TID; } }
Source:
public void merge(ClientIOTaskResult.ThreadCountResult result) { mRecordStartMs = result.mRecordStartMs; mEndMs = Math.max(mEndMs, result.mEndMs); mIOBytes += result.mIOBytes; mErrors.addAll(result.mErrors); update(); }

Target:
public void merge(ClientIOTaskResult.ThreadCountResult result) { mRecordStartMs = Math.min(mRecordStartMs, result.mRecordStartMs); mEndMs = Math.max(mEndMs, result.mEndMs); mIOBytes += result.mIOBytes; mErrors.addAll(result.mErrors); }
Source:
public boolean isCheckPointCompleted(){ boolean checkPointCompleted = this.status != GeoRepSessionStatus.FAULTY; for (GlusterGeoRepSessionDetails details : getSessionDetails()) { if (details.getStatus() == GeoRepSessionStatus.ACTIVE && !details.isCheckpointCompleted()) { checkPointCompleted = false; } } return checkPointCompleted; }

Target:
public boolean isCheckPointCompleted(){ for (GlusterGeoRepSessionDetails details : getSessionDetails()) { if (details.getStatus() == GeoRepSessionStatus.ACTIVE && !details.isCheckpointCompleted()) { return false; } } return this.status != GeoRepSessionStatus.FAULTY; }
Source:
private void serverAboutToStart(FMLServerAboutToStartEvent event) { if (BotaniaAPI.instance().getClass() != BotaniaAPIImpl.class) { String clname = BotaniaAPI.instance().getClass().getName(); throw new IllegalAccessError("The Botania API has been overriden. " + "This will cause crashes and compatibility issues, and that's why it's marked as" + " \"Do not Override\". Whoever had the brilliant idea of overriding it needs to go" + " back to elementary school and learn to read. (Actual classname: " + clname + ")"); } if (Botania.gardenOfGlassLoaded) { WorldTypeUtil.setupForDedicatedServer((DedicatedServer) event.getServer()); } }

Target:
private void serverAboutToStart(FMLServerAboutToStartEvent event) { if (BotaniaAPI.instance().getClass() != BotaniaAPIImpl.class) { String clname = BotaniaAPI.instance().getClass().getName(); throw new IllegalAccessError("The Botania API has been overriden. " + "This will cause crashes and compatibility issues, and that's why it's marked as" + " \"Do not Override\". Whoever had the brilliant idea of overriding it needs to go" + " back to elementary school and learn to read. (Actual classname: " + clname + ")"); } if (Botania.gardenOfGlassLoaded && event.getServer() instanceof DedicatedServer) { WorldTypeUtil.setupForDedicatedServer((DedicatedServer) event.getServer()); } }
Source:
private void run() { try { boolean valid = connectionSanityCheck.isValid(); if (!valid) { onInvalidConnection.run(); } } catch (Exception e) { logger.warn("Impossible to correctly monitor the Axon Server connection state."); } }

Target:
private void run() { try { boolean valid = connectionSanityCheck.isValid(); if (!valid) { onInvalidConnection.run(); } } catch (Exception e) { logger.warn("Impossible to correctly monitor the Axon Server connection state.", e); } }
Source:
public void testNavWithoutAutoSelect() { SessionWrapper session = mApp.getSession(); sessionNavigator.startNextSessionStep(); Assert.assertEquals(SessionNavigator.GET_COMMAND, mSessionNavigationResponder.getLastResultCode()); session.setCommand("m0"); sessionNavigator.startNextSessionStep(); Assert.assertEquals(SessionNavigator.GET_COMMAND, mSessionNavigationResponder.getLastResultCode()); session.setCommand("m0-f1"); sessionNavigator.startNextSessionStep(); Assert.assertEquals(SessionNavigator.START_ENTITY_SELECTION, mSessionNavigationResponder.getLastResultCode()); session.stepBack(); sessionNavigator.startNextSessionStep(); Assert.assertEquals(SessionNavigator.GET_COMMAND, mSessionNavigationResponder.getLastResultCode()); session.setCommand("m0-f0"); sessionNavigator.startNextSessionStep(); Assert.assertEquals(SessionNavigator.START_FORM_ENTRY, mSessionNavigationResponder.getLastResultCode()); }

Target:
public void testNavWithoutAutoSelect() { SessionWrapper session = mApp.getSession(); triggerSessionStepAndCheckResultCode(SessionNavigator.GET_COMMAND); session.setCommand("m0"); triggerSessionStepAndCheckResultCode(SessionNavigator.GET_COMMAND); session.setCommand("m0-f1"); triggerSessionStepAndCheckResultCode(SessionNavigator.START_ENTITY_SELECTION); session.stepBack(); triggerSessionStepAndCheckResultCode(SessionNavigator.GET_COMMAND); session.setCommand("m0-f0"); triggerSessionStepAndCheckResultCode(SessionNavigator.START_FORM_ENTRY); }
Source:
public boolean isActivated() { boolean isResourceRootUrlSet = ResourceDomainConfiguration.isResourceDomainConfigured(); boolean isOverriddenCSP = SystemProperties.getString(DirectoryBrowserSupport.class.getName() + ".CSP") != null; return isOverriddenCSP && !isResourceRootUrlSet; }

Target:
public boolean isActivated() { boolean isResourceRootUrlSet = ResourceDomainConfiguration.isResourceDomainConfigured(); boolean isOverriddenCSP = SystemProperties.getString(DirectoryBrowserSupport.CSP_PROPERTY_NAME) != null; return isOverriddenCSP && !isResourceRootUrlSet; }
Source:
private void loadImage(@NonNull String mediaUri) { int width = DisplayUtils.getDisplayPixelWidth(this); int height = DisplayUtils.getDisplayPixelHeight(this); if (mediaUri.startsWith("http")) { showProgress(true); String imageUrl = PhotonUtils.getPhotonImageUrl(mediaUri, width, height); mImageLoader.get(imageUrl, new ImageLoader.ImageListener() { @Override public void onResponse(ImageLoader.ImageContainer response, boolean isImmediate) { if (response.getBitmap() != null) { showProgress(false); mImageView.setImageBitmap(response.getBitmap()); } } @Override public void onErrorResponse(VolleyError error) { AppLog.e(AppLog.T.MEDIA, error); showProgress(false); delayedFinish(true); } }, width, height); } else { byte[] bytes = ImageUtils.createThumbnailFromUri(this, Uri.parse(mediaUri), width, null, 0); if (bytes == null) { delayedFinish(true); return; } Bitmap bmp = BitmapFactory.decodeByteArray(bytes, 0, bytes.length); if (bmp != null) { mImageView.setImageBitmap(bmp); } else { delayedFinish(true); } } PhotoViewAttacher attacher = new PhotoViewAttacher(mImageView); attacher.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() { @Override public void onPhotoTap(View view, float v, float v2) { finish(); } }); attacher.setOnViewTapListener(new PhotoViewAttacher.OnViewTapListener() { @Override public void onViewTap(View view, float v, float v2) { finish(); } }); }

Target:
private void loadImage(@NonNull String mediaUri) { int width = DisplayUtils.getDisplayPixelWidth(this); int height = DisplayUtils.getDisplayPixelHeight(this); if (mediaUri.startsWith("http")) { showProgress(true); String imageUrl = PhotonUtils.getPhotonImageUrl(mediaUri, width, height); mImageLoader.get(imageUrl, new ImageLoader.ImageListener() { @Override public void onResponse(ImageLoader.ImageContainer response, boolean isImmediate) { if (!isFinishing() && response.getBitmap() != null) { showProgress(false); mImageView.setImageBitmap(response.getBitmap()); } } @Override public void onErrorResponse(VolleyError error) { AppLog.e(AppLog.T.MEDIA, error); if (!isFinishing()) { showProgress(false); delayedFinish(true); } } }, width, height); } else { byte[] bytes = ImageUtils.createThumbnailFromUri(this, Uri.parse(mediaUri), width, null, 0); if (bytes == null) { delayedFinish(true); return; } Bitmap bmp = BitmapFactory.decodeByteArray(bytes, 0, bytes.length); if (bmp != null) { mImageView.setImageBitmap(bmp); } else { delayedFinish(true); } } PhotoViewAttacher attacher = new PhotoViewAttacher(mImageView); attacher.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() { @Override public void onPhotoTap(View view, float v, float v2) { finish(); } }); attacher.setOnViewTapListener(new PhotoViewAttacher.OnViewTapListener() { @Override public void onViewTap(View view, float v, float v2) { finish(); } }); }
Source:
public Attribute createAttribute(HttpRequest request, String name, long definedSize) { Attribute attribute; if (useDisk) { attribute = new DiskAttribute(name, definedSize, charset); } else if (checkSize) { attribute = new MixedAttribute(name, definedSize, minSize, charset); } else { attribute = new MemoryAttribute(name, definedSize); } attribute.setMaxSize(maxSize); List<HttpData> list = getList(request); list.add(attribute); return attribute; }

Target:
public Attribute createAttribute(HttpRequest request, String name, long definedSize) { final Attribute attribute; if (useDisk) { attribute = new DiskAttribute(name, definedSize, charset); } else if (checkSize) { attribute = new MixedAttribute(name, definedSize, minSize, charset); } else { attribute = new MemoryAttribute(name, definedSize); } attribute.setMaxSize(maxSize); List<HttpData> list = getList(request); list.add(attribute); return attribute; }
Source:
public ArrayList<RemoteXBeeDevice> getDevices() { ArrayList<RemoteXBeeDevice> nodes = new ArrayList<RemoteXBeeDevice>(); nodes.addAll(remotesBy64BitAddr.values()); nodes.addAll(remotesBy16BitAddr.values()); return nodes; }

Target:
public List<RemoteXBeeDevice> getDevices() { List<RemoteXBeeDevice> nodes = new ArrayList<RemoteXBeeDevice>(); nodes.addAll(remotesBy64BitAddr.values()); nodes.addAll(remotesBy16BitAddr.values()); return nodes; }
Source:
private void addAttributeArgument(Argument argument, EntityProjectionBuilder projectionBuilder) { String argumentName = argument.getName(); Class<?> entityType = projectionBuilder.getType(); Attribute argumentAttribute = projectionBuilder.getAttributeByAlias(argumentName); com.yahoo.elide.request.Argument elideArgument = com.yahoo.elide.request.Argument.builder() .name(argumentName) .value(variableResolver.resolveValue(argument.getValue())) .build(); if (argumentAttribute == null) { Class<?> attributeType = entityDictionary.getParameterizedType(entityType, argumentName); if (attributeType == null) { throw new InvalidEntityBodyException( String.format("Invalid attribute field/alias for argument: {%s}.{%s}", entityType, argumentName) ); } argumentAttribute = Attribute.builder() .type(attributeType) .name(argumentName) .alias(argumentName) .argument(elideArgument) .build(); projectionBuilder.attribute(argumentAttribute); } else { argumentAttribute.getArguments().add(elideArgument); } }

Target:
private void addAttributeArgument(Argument argument, EntityProjectionBuilder projectionBuilder) { String argumentName = argument.getName(); Class<?> entityType = projectionBuilder.getType(); Attribute existingAttribute = projectionBuilder.getAttributeByAlias(argumentName); com.yahoo.elide.request.Argument elideArgument = com.yahoo.elide.request.Argument.builder() .name(argumentName) .value(variableResolver.resolveValue(argument.getValue())) .build(); if (existingAttribute != null) { Attribute toAdd = Attribute.builder() .type(existingAttribute.getType()) .name(existingAttribute.getName()) .alias(existingAttribute.getAlias()) .argument(elideArgument) .build(); projectionBuilder.attribute(toAdd); } else { Class<?> attributeType = entityDictionary.getType(entityType, argumentName); if (attributeType == null) { throw new InvalidEntityBodyException( String.format("Invalid attribute field/alias for argument: {%s}.{%s}", entityType, argumentName) ); } Attribute toAdd = Attribute.builder() .type(attributeType) .name(argumentName) .alias(argumentName) .argument(elideArgument) .build(); projectionBuilder.attribute(toAdd); } }
Source:
public void scheduleJob(CronTaskConfigurationDto cronTaskConfiguration) { String jobClassName = cronTaskConfiguration.getProperty("jobClass"); Class<? extends Job> jobClass; try { jobClass = (Class<? extends Job>) Class.forName(jobClassName); } catch (ClassNotFoundException e1) { logger.error(String.format("Failed to shcedule cron job [%s]", jobClassName)); return; } String cronExpression = cronTaskConfiguration.getProperty("cronExpression"); JobDataMap jobDataMap = new JobDataMap(); jobDataMap.put("config", cronTaskConfiguration); JobKey jobKey = JobKey.jobKey(cronTaskConfiguration.getName()); JobDetail jobDetail = JobBuilder.newJob(jobClass) .withIdentity(jobKey) .setJobData(jobDataMap) .build(); TriggerKey triggerKey = TriggerKey.triggerKey(cronTaskConfiguration.getName()); TriggerBuilder<Trigger> triggerBuilder = TriggerBuilder.newTrigger() .withIdentity(triggerKey) .forJob(jobDetail); if (cronTaskConfiguration.isOneTimeExecution()) { triggerBuilder.startNow(); } else { triggerBuilder.withSchedule(CronScheduleBuilder.cronSchedule(cronExpression)); } Trigger trigger = triggerBuilder.build(); try { scheduler.scheduleJob(jobDetail, Collections.singleton(trigger), true); } catch (SchedulerException e) { logger.error(String.format("Failed to add Cron Job:\n [%s]", cronTaskConfiguration), e); return; } logger.debug("Job '" + cronTaskConfiguration.getName() + "' scheduled."); }

Target:
public void scheduleJob(CronTaskConfigurationDto cronTaskConfiguration) { String jobClassName = cronTaskConfiguration.getProperty("jobClass"); Class<? extends Job> jobClass; try { jobClass = (Class<? extends Job>) Class.forName(jobClassName); } catch (ClassNotFoundException e1) { logger.error(String.format("Failed to shcedule cron job [%s]", jobClassName)); return; } JobDataMap jobDataMap = new JobDataMap(); jobDataMap.put("config", cronTaskConfiguration); JobKey jobKey = JobKey.jobKey(cronTaskConfiguration.getName()); JobDetail jobDetail = JobBuilder.newJob(jobClass) .withIdentity(jobKey) .setJobData(jobDataMap) .storeDurably() .build(); TriggerKey triggerKey = TriggerKey.triggerKey(cronTaskConfiguration.getName()); TriggerBuilder<Trigger> triggerBuilder = TriggerBuilder.newTrigger() .withIdentity(triggerKey) .forJob(jobDetail); if (cronTaskConfiguration.isOneTimeExecution()) { triggerBuilder.startNow(); } else { String cronExpression = cronTaskConfiguration.getProperty("cronExpression"); triggerBuilder.withSchedule(CronScheduleBuilder.cronSchedule(cronExpression)); } Trigger trigger = triggerBuilder.build(); try { doScheduleJob(cronTaskConfiguration, jobKey, jobDetail, trigger); } catch (SchedulerException e) { logger.error(String.format("Failed to add Cron Job:%n [%s]", cronTaskConfiguration), e); return; } logger.debug("Job '" + cronTaskConfiguration.getName() + "' scheduled."); }
Source:
private void updateEid() { List<UiccCardInfo> infos = mTelephonyManager.getUiccCardsInfo(); if (!infos.isEmpty()) { for (UiccCardInfo info : infos) { if (info != null && info.getSlotIndex() == mSlotId) { if (info.isEuicc()) { String eid = info.getEid(); if (!TextUtils.isEmpty(eid)) { mDialog.setText(EID_INFO_VALUE_ID, eid); } } else { mDialog.removeSettingFromScreen(EID_INFO_LABEL_ID); mDialog.removeSettingFromScreen(EID_INFO_VALUE_ID); } break; } } } }

Target:
private void updateEid() { List<UiccCardInfo> infos = mTelephonyManager.getUiccCardsInfo(); for (UiccCardInfo info : infos) { if (info != null && info.getSlotIndex() == mSlotId) { if (info.isEuicc()) { String eid = info.getEid(); if (!TextUtils.isEmpty(eid)) { mDialog.setText(EID_INFO_VALUE_ID, eid); } } else { mDialog.removeSettingFromScreen(EID_INFO_LABEL_ID); mDialog.removeSettingFromScreen(EID_INFO_VALUE_ID); } break; } } }
Source:
public Collection<DataSource> listDataSources() throws IOException, IllegalAccessException, InstantiationException { Collection<DataSource> dataSources = this.dao.<DataSource>list(DATA_SOURCE_NAMESPACE); if (dataSources != null) { for (DataSource ds : dataSources) { DataSourceSubType dataSourcesubType = getSubtypeFromDataSource(ds); ds.setTypeConfig(CoreUtils.storableToJson(dataSourcesubType)); ds.setTags(tagService.getTags(new EntityId(ds.getId(), ds.getNameSpace()))); } } return dataSources; }

Target:
public Collection<DataSource> listDataSources() throws IOException, IllegalAccessException, InstantiationException { Collection<DataSource> dataSources = this.dao.<DataSource>list(DATA_SOURCE_NAMESPACE); if (dataSources != null) { for (DataSource ds : dataSources) { DataSourceSubType dataSourcesubType = getSubtypeFromDataSource(ds); ds.setTypeConfig(CoreUtils.storableToJson(dataSourcesubType)); ds.setTags(tagClient.getTags(new TaggedEntity(ds))); } } return dataSources; }
Source:
private Pair<Date, Date> parseDateRange(String dateRange) throws ParseException { if (StringUtils.isEmpty(dateRange) || dateRange.length() != 24) { dateRange = dateRange == null ? KFSConstants.EMPTY_STRING : dateRange; throw new ParseException("The Date Range is Invalid [" + dateRange + "]. The expected length is 24 (YYYY-MM-DD to YYYY-MM-DD).", 0); } DateTimeService dateTimeService = SpringContext.getBean(DateTimeService.class); Date endDate = dateTimeService.convertToSqlDate(dateRange.substring(14)); Date startDate = dateTimeService.convertToSqlDate(dateRange.substring(0, 10)); return new Pair<>(startDate, endDate); }

Target:
private Pair<Date, Date> parseDateRange(String dateRange) throws ParseException { if (StringUtils.length(dateRange) != CuArConstants.CINV_DATE_RANGE_EXPECTED_FORMAT_LENGTH) { dateRange = StringUtils.defaultString(dateRange); String errorMessage = SpringContext.getBean(ConfigurationService.class).getPropertyValueAsString(CUKFSKeyConstants.WARNING_CINV_DATE_RANGE_INVALID_FORMAT_LENGTH); throw new ParseException(MessageFormat.format(errorMessage, new String[] {dateRange}), 0); } DateTimeService dateTimeService = SpringContext.getBean(DateTimeService.class); Date startDate = dateTimeService.convertToSqlDate(dateRange.substring(CuArConstants.CINV_DATE_RANGE_START_DATE_START_INDEX, CuArConstants.CINV_DATE_RANGE_START_DATE_END_INDEX)); Date endDate = dateTimeService.convertToSqlDate(dateRange.substring(CuArConstants.CINV_DATE_RANGE_END_DATE_START_INDEX)); return Pair.of(startDate, endDate); }
Source:
public LocalPageStore(LocalPageStoreOptions options) throws IOException { mRoot = options.getRootDir(); mPageSize = options.getPageSize(); Path rootDir = Paths.get(mRoot); try { boolean invalidPage = Files.exists(rootDir) && Files.walk(rootDir) .filter(Files::isRegularFile) .anyMatch(path -> { if (getPageId(path) == null) { return true; } mSize.incrementAndGet(); return false; }); if (invalidPage || (long) mSize.get() * mPageSize > options.getCacheSize()) { FileUtils.cleanDirectory(new File(mRoot)); mSize.set(0); } } catch (IOException e) { throw new IOException(String.format("can't initialize page store at %s", mRoot), e); } }

Target:
public LocalPageStore(LocalPageStoreOptions options) throws IOException { mRoot = options.getRootDir(); mPageSize = options.getPageSize(); Path rootDir = Paths.get(mRoot); mPagePattern = Pattern.compile( String.format("%s/%d/(\\d+)/(\\d+)", Pattern.quote(rootDir.toString()), mPageSize)); try { boolean invalidPage = Files.exists(rootDir) && Files.walk(rootDir) .filter(Files::isRegularFile) .anyMatch(path -> { if (getPageId(path) == null) { LOG.warn("Invalid page path {}", path); return true; } mSize.incrementAndGet(); return false; }); if (invalidPage || (long) mSize.get() * mPageSize > options.getCacheSize()) { LOG.warn("Cannot recover from cached data: {}", invalidPage ? "Invalid page file found" : "Cached data size exceeded configured value"); FileUtils.cleanDirectory(new File(mRoot)); mSize.set(0); } } catch (IOException e) { throw new IOException(String.format("can't initialize page store at %s", mRoot), e); } }