auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static boolean isRecoverableException(ExecutionException e) { if (!(e.getCause() instanceof SdkException)) { return false; } SdkException ase = (SdkException) e.getCause(); <START> return ase instanceof LimitExceededException || ase instanceof ProvisionedThroughputExceededException || ase instanceof ResourceInUseException; <END> }</code><technical_language>@xiaolong-sn ase instanceof ResourceInUseException replaced isResourceInUse(ase)</technical_language>

Target:
public static boolean isRecoverableException(ExecutionException e) { if (!(e.getCause() instanceof SdkException)) { return false; } SdkException ase = (SdkException) e.getCause(); return ase instanceof LimitExceededException || ase instanceof ProvisionedThroughputExceededException; }
Source:
<code>public String getUnmodifiedInstance() { <START> return m_ipAddress + "[" + m_serviceName + "]"; <END> }</code><technical_language>suggestion return getInstance();</technical_language>

Target:
public String getUnmodifiedInstance() { return getInstance(); }
Source:
<code>private static short configureAcks(ProducerConfig config, Logger log) { boolean userConfiguredAcks = config.originals().containsKey(ProducerConfig.ACKS_CONFIG); <START> short acks = (short) ProducerConfig.parseAcks(config.getString(ProducerConfig.ACKS_CONFIG)); <END> if (config.idempotenceEnabled() && !userConfiguredAcks) { log.info("Overriding the default to all since idempotence is enabled.", ProducerConfig.ACKS_CONFIG); } if (config.idempotenceEnabled() && acks != -1) { throw new ConfigException("Must set " + ProducerConfig.ACKS_CONFIG + " to all in order to use the idempotent " + "producer. Otherwise we cannot guarantee idempotence."); } return acks; }</code><technical_language>Minor: override override acks trimmed string postProcessParsedConfig, check is not; this parseAcks private static ProducerConfig</technical_language>

Target:
private static short configureAcks(ProducerConfig config, Logger log) { boolean userConfiguredAcks = config.originals().containsKey(ProducerConfig.ACKS_CONFIG); short acks = Short.valueOf(config.getString(ProducerConfig.ACKS_CONFIG)); if (config.idempotenceEnabled()) { if (!userConfiguredAcks) log.info("Overriding the default to all since idempotence is enabled.", ProducerConfig.ACKS_CONFIG); else if (acks != -1) throw new ConfigException("Must set " + ProducerConfig.ACKS_CONFIG + " to all in order to use the idempotent " + "producer. Otherwise we cannot guarantee idempotence."); } return acks; }
Source:
<code>public void fetchAndMerge(BibEntry entry, List<Field> fields) { for (Field field : fields) { Optional<String> fieldContent = entry.getField(field); if (fieldContent.isPresent()) { Optional<IdBasedFetcher> fetcher = WebFetchers.getIdBasedFetcherForField(field, Globals.prefs.getImportFormatPreferences()); if (fetcher.isPresent()) { BackgroundTask.wrap(() -> fetcher.get().performSearchById(fieldContent.get())) .onSuccess(fetchedEntry -> { <START> ImportCleanup cleanup = new ImportCleanup(BibDatabaseModeDetection.inferMode(new BibDatabase(List.of(entry)))); <END> cleanup.doPostCleanup(entry); String type = field.getDisplayName(); if (fetchedEntry.isPresent()) { showMergeDialog(entry, fetchedEntry.get(), fetcher.get()); } else { dialogService.notify(Localization.lang("Cannot get info based on given %0: %1", type, fieldContent.get())); } }) .onFailure(exception -> { LOGGER.error("Error while fetching bibliographic information", exception); dialogService.showErrorDialogAndWait(exception); }) .executeWith(Globals.TASK_EXECUTOR); } } else { dialogService.notify(Localization.lang("No %0 found", field.getDisplayName())); } } }</code><technical_language>BasePanel (panel) mode? mode instead of guessing</technical_language>

Target:
public void fetchAndMerge(BibEntry entry, List<Field> fields) { for (Field field : fields) { Optional<String> fieldContent = entry.getField(field); if (fieldContent.isPresent()) { Optional<IdBasedFetcher> fetcher = WebFetchers.getIdBasedFetcherForField(field, Globals.prefs.getImportFormatPreferences()); if (fetcher.isPresent()) { BackgroundTask.wrap(() -> fetcher.get().performSearchById(fieldContent.get())) .onSuccess(fetchedEntry -> { ImportCleanup cleanup = new ImportCleanup(panel.getBibDatabaseContext().getMode()); cleanup.doPostCleanup(entry); String type = field.getDisplayName(); if (fetchedEntry.isPresent()) { showMergeDialog(entry, fetchedEntry.get(), fetcher.get()); } else { dialogService.notify(Localization.lang("Cannot get info based on given %0: %1", type, fieldContent.get())); } }) .onFailure(exception -> { LOGGER.error("Error while fetching bibliographic information", exception); dialogService.showErrorDialogAndWait(exception); }) .executeWith(Globals.TASK_EXECUTOR); } } else { dialogService.notify(Localization.lang("No %0 found", field.getDisplayName())); } } }
Source:
<code>private void loadWordAndShow(String serverID) { Word word = wordsStorage.getWordFromLocal(serverID, langCode); if (word != null) { showWord(word); } else { progress = ProgressDialog.show(this, getString(R.string.dialog_downloading), getString(R.string.dialog_download_word_please_wait), true); wordsStorage.getWordFromServer(serverID, langCode, new DownloadWordListener() { @Override public void onWordReceived(Word word) { progress.dismiss(); showWord(word); } @Override public void onError(int errorType, Exception e) { progress.dismiss(); <START> Toast.makeText(CardActivity.this, e.getMessage(), <END> Toast.LENGTH_LONG).show(); } }); } }</code><technical_language>1. error message localized. 2. close this activity further</technical_language>

Target:
private void loadWordAndShow(String serverID) { Word word = wordsStorage.getWordFromLocal(serverID, langCode); if (word != null) { showWord(word); } else { progress = ProgressDialog.show(this, getString(R.string.dialog_title_downloading), getString(R.string.dialog_desc_downloading), true); wordsStorage.getWordFromServer(serverID, langCode, new DownloadWordListener() { @Override public void onWordReceived(Word word) { progress.dismiss(); showWord(word); } @Override public void onError(int errorType, Exception e) { String title = ""; String desc = ""; switch (errorType) { case DownloadWordListener.NETWORK_ERROR: title = getString(R.string.dialog_title_network_error); desc = getString(R.string.dialog_desc_network_error); break; case DownloadWordListener.HTTP_ERROR: title = getString(R.string.dialog_title_http_error); desc = getString(R.string.dialog_desc_http_error); break; case DownloadWordListener.INTERNAL_ERROR: title = getString(R.string.dialog_title_internal_error); desc = getString(R.string.dialog_desc_internal_error); break; } failOccurIndex = currentIndex--; progress.dismiss(); ShowAlertDialog(title, desc, failOccurIndex == 0); } }); } }
Source:
<code><START> public HashMap<String, <END> ArrayList<Order>> getSellOrders() { return sellOrders; }</code><technical_language>this method changed private</technical_language>

Target:
private HashMap<String, ArrayList<Order>> getSellOrders() { return sellOrders; }
Source:
<code><START> public void dropTableIfExistsCascade(final RelationKey relationKey) throws DbException { <END> execute("DROP TABLE IF EXISTS " + relationKey.toString(MyriaConstants.STORAGE_SYSTEM_SQLITE)); }</code><technical_language>log a warning SQLite support CASCADE</technical_language>

Target:
public void dropTableIfExistsCascade(final RelationKey relationKey) throws DbException { LOGGER.warn("SQLite does not implement DROP TABLE...CASCADE, attempting DROP TABLE instead"); execute("DROP TABLE IF EXISTS " + relationKey.toString(MyriaConstants.STORAGE_SYSTEM_SQLITE)); }
Source:
<code>public void setSpecialSelectionProvider(ISelectionProvider provider) { if (fSite.getSelectionProvider() != null) { <START> ISelectionProvider currentProvider = fSpecialProvider != null ? fSpecialProvider : fSite.getSelectionProvider(); <END> disposeAction(fFindDeclarationsAction, currentProvider); disposeAction(fFindDeclarationsInProjectAction, currentProvider); disposeAction(fFindDeclarationsInHierarchyAction, currentProvider); disposeAction(fFindDeclarationsInWorkingSetAction, currentProvider); } fSpecialProvider = provider; fFindDeclarationsAction.setSpecialSelectionProvider(provider); fFindDeclarationsInProjectAction.setSpecialSelectionProvider(provider); fFindDeclarationsInWorkingSetAction.setSpecialSelectionProvider(provider); fFindDeclarationsInHierarchyAction.setSpecialSelectionProvider(provider); if (provider != null && fSite.getSelectionProvider() != null) { ISelection selection = provider.getSelection(); registerAction(fFindDeclarationsAction, provider, selection); registerAction(fFindDeclarationsInProjectAction, provider, selection); registerAction(fFindDeclarationsInHierarchyAction, provider, selection); registerAction(fFindDeclarationsInWorkingSetAction, provider, selection); } }</code><technical_language>in dispose method. currentProvider checked for null. Perhaps, worth extracting this if block in a separate disposeActions() method</technical_language>

Target:
public void setSpecialSelectionProvider(ISelectionProvider provider) { if (fRegisterInProvider) { unregisterActions(); } fSelectionProvider = provider; fFindDeclarationsAction.setSpecialSelectionProvider(provider); fFindDeclarationsInProjectAction.setSpecialSelectionProvider(provider); fFindDeclarationsInWorkingSetAction.setSpecialSelectionProvider(provider); fFindDeclarationsInHierarchyAction.setSpecialSelectionProvider(provider); if (fRegisterInProvider) { registerActions(); } }
Source:
<code>public void save(String pluginName, String message) throws IOException { Repository repo = new FileRepository(path); try { inserter = repo.newObjectInserter(); reader = repo.newObjectReader(); try { RevWalk rw = new RevWalk(reader); try { RevTree srcTree = revision != null ? rw.parseTree(revision) : null; newTree = readTree(srcTree); saveConfig(ProjectConfig.PROJECT_CONFIG, cfg); ObjectId res = newTree.writeTree(inserter); if (res.equals(srcTree)) { return; } PersonIdent ident = new PersonIdent(pluginName, pluginName + "@gerrit"); String msg = "Update from plugin " + pluginName + ": " + message; CommitBuilder commit = new CommitBuilder(); commit.setAuthor(ident); commit.setCommitter(ident); commit.setMessage(msg); commit.setTreeId(res); if (revision != null) { commit.addParentId(revision); } ObjectId newRevision = inserter.insert(commit); updateRef(repo, ident, newRevision, "commit: " + msg); revision = newRevision; } finally { rw.release(); } } finally { <START> if (inserter != null) { inserter.release(); } <END> if (reader != null) { reader.release(); } } } finally { repo.close(); } }</code><technical_language>null inserter reader</technical_language>

Target:
public void save(String pluginName, String message) throws IOException { Repository repo = new FileRepository(path); try { inserter = repo.newObjectInserter(); reader = repo.newObjectReader(); try { RevWalk rw = new RevWalk(reader); try { RevTree srcTree = revision != null ? rw.parseTree(revision) : null; newTree = readTree(srcTree); saveConfig(ProjectConfig.PROJECT_CONFIG, cfg); ObjectId res = newTree.writeTree(inserter); if (res.equals(srcTree)) { return; } PersonIdent ident = new PersonIdent(pluginName, pluginName + "@gerrit"); String msg = "Update from plugin " + pluginName + ": " + message; CommitBuilder commit = new CommitBuilder(); commit.setAuthor(ident); commit.setCommitter(ident); commit.setMessage(msg); commit.setTreeId(res); if (revision != null) { commit.addParentId(revision); } ObjectId newRevision = inserter.insert(commit); updateRef(repo, ident, newRevision, "commit: " + msg); revision = newRevision; } finally { rw.release(); } } finally { if (inserter != null) { inserter.release(); inserter = null; } if (reader != null) { reader.release(); reader = null; } } } finally { repo.close(); } }
Source:
<code>private void setVideo() { StepVideo video = mStep.getVideo(); StepVideoThumbnail thumb = video.getThumbnail(); fitVideoToSpace(thumb); mMainImage.setVisibility(View.VISIBLE); mVideoPlayButtonContainer.setVisibility(View.VISIBLE); mMainWebView.setVisibility(View.GONE); mMainProgress.setVisibility(View.GONE); mImageManager.displayImage(thumb.getUrl(), mContext, mMainImage); <START> String videoURL = video.getEncodings().get(0).getURL(); <END> mVideoPlayButton.setTag(R.id.guide_step_view_video_url, videoURL); mVideoPlayButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { String url = (String) v.getTag(R.id.guide_step_view_video_url); Intent i = new Intent(mContext, VideoViewActivity.class); i.putExtra(VideoViewActivity.VIDEO_URL, url); startActivity(i); } }); }</code><technical_language>want one? guaranteed one</technical_language>

Target:
private void setVideo() { StepVideo video = mStep.getVideo(); StepVideoThumbnail thumb = video.getThumbnail(); ViewGroup.LayoutParams params = fitToSpace(mMainImage, thumb.getWidth(), thumb.getHeight()); mMainImage.setLayoutParams(params); mVideoPlayButtonContainer.setLayoutParams(params); mMainImage.setVisibility(View.VISIBLE); mVideoPlayButtonContainer.setVisibility(View.VISIBLE); mMainWebView.setVisibility(View.GONE); mMainProgress.setVisibility(View.GONE); mImageManager.displayImage(thumb.getUrl(), mContext, mMainImage); String videoURL = video.getEncodings().get(0).getURL(); mVideoPlayButton.setTag(R.id.guide_step_view_video_url, videoURL); mVideoPlayButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { String url = (String) v.getTag(R.id.guide_step_view_video_url); Intent i = new Intent(mContext, VideoViewActivity.class); i.putExtra(VideoViewActivity.VIDEO_URL, url); startActivity(i); } }); }
Source:
<code>private void onGameLaunchMessage(GameLaunchMessage message) { if (message.getInitMode() != LobbyMode.AUTO_LOBBY) { return; } <START> matchmakingQueues.stream().filter(q -> q.getMatchingStatus() != null).forEach(q -> { <END> q.setTimedOutMatchingStatus(MatchingStatus.GAME_LAUNCHING, Duration.ofSeconds(15), taskScheduler); }); matchFoundAndWaitingForGameLaunch = false; gameService.onMatchmakerSearchStopped(); }</code><technical_language>linebreaks stream operator</technical_language>

Target:
protected void onGameLaunchMessage(GameLaunchMessage message) { if (message.getInitMode() != LobbyMode.AUTO_LOBBY) { return; } matchmakingQueues.stream() .filter(q -> q.getMatchingStatus() != null) .forEach(q -> q.setTimedOutMatchingStatus(MatchingStatus.GAME_LAUNCHING, Duration.ofSeconds(15), taskScheduler)); matchFoundAndWaitingForGameLaunch = false; gameService.onMatchmakerSearchStopped(); }
Source:
<code>protected List<URL> getUrls() throws MalformedURLException { List<URL> urls = Lists.newArrayList(); if (jars.isEmpty()) { if (!yaml.isEmpty()) { try { File yamlFolder = new File(yaml); if (yamlFolder.isDirectory()) { File[] fileList = yamlFolder.listFiles(); for (File file : fileList) { if (file.isFile() && (file.getName().contains(".yaml") || file.getName().contains(".bom"))) { urls.add(file.toURI().toURL()); } } } else { urls.add(new File(yaml).toURI().toURL()); } } catch (IOException e) { <START> e.printStackTrace(); <END> } } else { String classpath = System.getenv("INITIAL_CLASSPATH"); if (Strings.isNonBlank(classpath)) { List<String> entries = Splitter.on(":").omitEmptyStrings().trimResults().splitToList(classpath); for (String entry : entries) { if (entry.endsWith(".jar") || entry.endsWith("/*")) { urls.addAll(ClassFinder.toJarUrls(entry.replace("/*", ""))); } } } else { throw new IllegalArgumentException("No Jars to process"); } } } else { for (String jar : jars) { List<URL> expanded = ClassFinder.toJarUrls(jar); if (expanded.isEmpty()) LOG.warn("No jars found at: "+jar); urls.addAll(expanded); } } return urls; }</code><technical_language>catch all, add method signature instead</technical_language>

Target:
protected List<URL> getUrls() throws MalformedURLException, IOException { List<URL> urls = Lists.newArrayList(); if (jars.isEmpty()) { if (!yaml.isEmpty()) { File yamlFolder = new File(yaml); if (yamlFolder.isDirectory()) { File[] fileList = yamlFolder.listFiles(); for (File file : fileList) { if (file.isFile() && (file.getName().contains(".yaml") || file.getName().contains(".bom"))) { urls.add(file.toURI().toURL()); } } } else { urls.add(new File(yaml).toURI().toURL()); } } else { String classpath = System.getenv("INITIAL_CLASSPATH"); if (Strings.isNonBlank(classpath)) { List<String> entries = Splitter.on(":").omitEmptyStrings().trimResults().splitToList(classpath); for (String entry : entries) { if (entry.endsWith(".jar") || entry.endsWith("/*")) { urls.addAll(ClassFinder.toJarUrls(entry.replace("/*", ""))); } } } else { throw new IllegalArgumentException("No Jars to process"); } } } else { for (String jar : jars) { List<URL> expanded = ClassFinder.toJarUrls(jar); if (expanded.isEmpty()) LOG.warn("No jars found at: "+jar); urls.addAll(expanded); } } return urls; }
Source:
<code>protected void doDeactivate() throws Exception { CDOViewRegistryImpl.INSTANCE.deregister(this); LifecycleUtil.deactivate(invalidationRunner, OMLogger.Level.WARN); try { CDOSessionProtocol sessionProtocol = session.getSessionProtocol(); if (LifecycleUtil.isActive(sessionProtocol)) { sessionProtocol.closeView(viewID); } } catch (Exception ex) { OM.LOG.error(ex); } finally { synchronized (lockStates) { <START> options.lockStatePrefetcher.dispose(); <END> options.lockStatePrefetcher = null; if (!lockStates.isEmpty()) { List<CDOLockState> result = new ArrayList<CDOLockState>(); for (CDOLockState lockState : lockStates.values()) { if (((InternalCDOLockState)lockState).removeOwner(lockOwner)) { result.add(lockState); } } if (!result.isEmpty()) { CDOLockState[] deactivateLockStates = result.toArray(new CDOLockState[result.size()]); long timeStamp = session.getLastUpdateTime(); notifyOtherViewsAboutLockChanges(Operation.UNLOCK, null, timeStamp, deactivateLockStates); } lockStates.clear(); lockOwner = null; } } } try { session.viewDetached(this); } catch (Exception ex) { OM.LOG.error(ex); } changeSubscriptionManager = null; super.doDeactivate(); }</code><technical_language>options.lockStatePrefetcher null, I missing something</technical_language>

Target:
protected void doDeactivate() throws Exception { CDOViewRegistryImpl.INSTANCE.deregister(this); LifecycleUtil.deactivate(invalidationRunner, OMLogger.Level.WARN); try { CDOSessionProtocol sessionProtocol = session.getSessionProtocol(); if (LifecycleUtil.isActive(sessionProtocol)) { sessionProtocol.closeView(viewID); } } catch (Exception ex) { OM.LOG.error(ex); } finally { synchronized (lockStates) { if (options.lockStatePrefetcher != null) { options.lockStatePrefetcher.dispose(); options.lockStatePrefetcher = null; } if (!lockStates.isEmpty()) { List<CDOLockState> result = new ArrayList<CDOLockState>(); for (CDOLockState lockState : lockStates.values()) { if (((InternalCDOLockState)lockState).removeOwner(lockOwner)) { result.add(lockState); } } if (!result.isEmpty()) { CDOLockState[] deactivateLockStates = result.toArray(new CDOLockState[result.size()]); long timeStamp = session.getLastUpdateTime(); notifyOtherViewsAboutLockChanges(Operation.UNLOCK, null, timeStamp, deactivateLockStates); } lockStates.clear(); lockOwner = null; } } } try { session.viewDetached(this); } catch (Exception ex) { OM.LOG.error(ex); } changeSubscriptionManager = null; super.doDeactivate(); }
Source:
<code>public List<TriggerEventRequest> buildTriggers() { List<TriggerEventRequest> triggers = new ArrayList<>(); Map<String, Set<String>> caseTypes = new HashMap<>(); for (Config config : configService.getConfigs().getConfigs()) { for (CommcareApplicationJson application : applicationService.getByConfigName(config.getName())) { for (CommcareModuleJson module : application.getModules()) { <START> if (!caseTypes.containsKey(module.getCaseType())) { <END> caseTypes.put(module.getCaseType(), new HashSet<>(module.getCaseProperties())); String applicationName = application.getApplicationName(); List<EventParameterRequest> parameterRequests = new ArrayList<>(); parameterRequests.add(new EventParameterRequest("commcare.field.configName", CONFIG_NAME)); addCommonCaseFields(parameterRequests); for (String caseProperty : module.getCaseProperties()) { parameterRequests.add(new EventParameterRequest(caseProperty, caseProperty)); } String displayName = DisplayNameHelper.buildDisplayName(RECEIVED_CASE, module.getCaseType(), applicationName, config.getName()); triggers.add(new TriggerEventRequest(displayName, CASE_EVENT + "." + config.getName() + "." + module.getCaseType(), null, parameterRequests, CASE_EVENT)); } } } } triggers.addAll(buildTriggersForMinimalStrategy()); return triggers; }</code><technical_language>I missing something, I this map - is point of it? a set</technical_language>

Target:
public List<TriggerEventRequest> buildTriggers() { List<TriggerEventRequest> triggers = new ArrayList<>(); Set<String> caseTypes = new HashSet<>(); for (Config config : configService.getConfigs().getConfigs()) { for (CommcareApplicationJson application : schemaService.retrieveApplications(config.getName())) { for (CommcareModuleJson module : application.getModules()) { if (!caseTypes.contains(module.getCaseType())) { caseTypes.add(module.getCaseType()); String applicationName = application.getApplicationName(); List<EventParameterRequest> parameterRequests = new ArrayList<>(); parameterRequests.add(new EventParameterRequest("commcare.field.configName", CONFIG_NAME)); addCommonCaseFields(parameterRequests); for (String caseProperty : module.getCaseProperties()) { parameterRequests.add(new EventParameterRequest(caseProperty, caseProperty)); } String displayName = DisplayNameHelper.buildDisplayName(RECEIVED_CASE, module.getCaseType(), applicationName, config.getName()); triggers.add(new TriggerEventRequest(displayName, CASE_EVENT + "." + config.getName() + "." + module.getCaseType(), null, parameterRequests, CASE_EVENT)); } } } } triggers.addAll(buildTriggersForMinimalStrategy()); return triggers; }
Source:
<code>private void doCopyRetry(FileSystem sourceFs, List<ReplChangeManager.FileInfo> srcFileList, FileSystem destinationFs, Path destination, boolean useRegularCopy) throws IOException, LoginException { int repeat = 0; boolean isCopyError = false; List<Path> pathList = Lists.transform(srcFileList, ReplChangeManager.FileInfo::getEffectivePath); while (!pathList.isEmpty() && (repeat < MAX_COPY_RETRY)) { LOG.info("Attempt: " + (repeat+1) + ". Copying files: " + pathList); try { isCopyError = false; doCopyOnce(sourceFs, pathList, destinationFs, destination, useRegularCopy); } catch (IOException e) { isCopyError = true; } pathList = getFilesToRetry(sourceFs, srcFileList, destinationFs, destination, isCopyError); repeat++; } <START> if (!pathList.isEmpty() || isCopyError) { <END> LOG.error("File copy failed even after several attempts. Files list: " + srcFileList); throw new IOException("File copy failed even after several attempts."); } }</code><technical_language>in scenario path list empty copy error set true</technical_language>

Target:
private void doCopyRetry(FileSystem sourceFs, List<ReplChangeManager.FileInfo> srcFileList, FileSystem destinationFs, Path destination, boolean useRegularCopy) throws IOException, LoginException { int repeat = 0; boolean isCopyError = false; List<Path> pathList = Lists.transform(srcFileList, ReplChangeManager.FileInfo::getEffectivePath); while (!pathList.isEmpty() && (repeat < MAX_COPY_RETRY)) { LOG.info("Attempt: " + (repeat+1) + ". Copying files: " + pathList); try { isCopyError = false; doCopyOnce(sourceFs, pathList, destinationFs, destination, useRegularCopy); } catch (IOException e) { isCopyError = true; } pathList = getFilesToRetry(sourceFs, srcFileList, destinationFs, destination, isCopyError); repeat++; } if (!pathList.isEmpty()) { LOG.error("File copy failed even after several attempts. Files list: " + srcFileList); throw new IOException("File copy failed even after several attempts."); } }
Source:
<code>public void setBuildContext(String buildContext) { <START> this.buildContext = buildContext; <END> }</code><technical_language>optional => <code>@ChechForNull</code> convert empty strings</technical_language>

Target:
public void setBuildContext(String buildContext) { this.buildContext = Util.fixEmptyAndTrim(buildContext); }
Source:
<code>private void showQrCode() { RestApi restApi = mActivity.getApi(); if (restApi == null) { Toast.makeText(mActivity, R.string.syncthing_terminated, Toast.LENGTH_SHORT).show(); return; } String apiKey = restApi.getGui().apiKey; <START> String deviceId = restApi.getLocalDevice().deviceID; <END> URL url = restApi.getUrl(); new ImageGetRequest(mActivity, url, ImageGetRequest.QR_CODE_GENERATOR, apiKey, ImmutableMap.of("text", deviceId),qrCodeBitmap -> { mActivity.showQrCodeDialog(deviceId, qrCodeBitmap); mActivity.closeDrawer(); }, error -> Toast.makeText(mActivity, R.string.could_not_access_deviceid, Toast.LENGTH_SHORT).show()); }</code><technical_language>throw exceptions if syncthing shutdown checking rest api calling getLocalDevice etc</technical_language>

Target:
private void showQrCode() { RestApi restApi = mActivity.getApi(); if (restApi == null) { Toast.makeText(mActivity, R.string.syncthing_terminated, Toast.LENGTH_SHORT).show(); return; } try { String apiKey = restApi.getGui().apiKey; String deviceId = restApi.getLocalDevice().deviceID; URL url = restApi.getUrl(); new ImageGetRequest(mActivity, url, ImageGetRequest.QR_CODE_GENERATOR, apiKey, ImmutableMap.of("text", deviceId),qrCodeBitmap -> { mActivity.showQrCodeDialog(deviceId, qrCodeBitmap); mActivity.closeDrawer(); }, error -> Toast.makeText(mActivity, R.string.could_not_access_deviceid, Toast.LENGTH_SHORT).show()); } catch (Exception e) { Log.e(TAG, "showQrCode", e); } }
Source:
<code><START> private boolean checkMutable(BundlePermissions bundlePermissions, EvaluationCacheKey evaluationCacheKey, SecurityRow row) { Condition[] conditions = row.getConditions(bundlePermissions.getBundle()); for (Condition condition : conditions) { if (condition.isMutable()) { evaluationCache.put(evaluationCacheKey, MUTABLE); return true; } } return false; } <END></code><technical_language>This method utilize rows cached conditions get cached SecurityRow.evaluate(). This result in conditions create for non-mutable cases, for mutable cases create conditions permission check. mutable flag encoded Decision.decision bit row.eveluate return Decision if decision is mutable? I this require create more constants for mutable instances of following: static final Decision DECISION_ABSTAIN = new Decision(SecurityTable.ABSTAIN, null, null, null); static final Decision DECISION_GRANTED = new Decision(SecurityTable.GRANTED, null, null, null); static final Decision DECISION_DENIED = new Decision(SecurityTable.DENIED, null, null, null); if do encode mutability Decision object need this method looping determine if row decision is mutable</technical_language>

Target:
private boolean checkMutable(BundlePermissions bundlePermissions, EvaluationCacheKey evaluationCacheKey, SecurityRow row) { Condition[] conditions = row.getConditions(bundlePermissions); if (conditions != null) { for (Condition condition : conditions) { if (condition.isMutable()) { evaluationCache.put(evaluationCacheKey, MUTABLE); return true; } } } return false; }
Source:
<code>public void configureSchemaCrawler(SchemaCrawlerOptions options) { options.setTableInclusionRule(new InclusionRule() { private static final long serialVersionUID = -1559715487368953641L; @Override public boolean test(String t) { <START> final Pattern uca_metadata_TablePattern = Pattern.compile("\\w*.UCA_METADATA.\\w*"); <END> boolean isuca_metadata_Table = uca_metadata_TablePattern.matcher(t).matches(); if (isuca_metadata_Table) { return false; } return true; } }); }</code><technical_language>Ah, excludes tables in UCA_METADATA schema? I exclude tables in SYS schema, do a reason mappable in hale</technical_language>

Target:
public void configureSchemaCrawler(SchemaCrawlerOptions options) { options.setTableInclusionRule(new InclusionRule() { private static final long serialVersionUID = -1559715487368953641L; @Override public boolean test(String t) { final Pattern uca_metadata_TablePattern = Pattern.compile("\\w*.UCA_METADATA.\\w*"); final Pattern sys_TablePattern = Pattern.compile("\\w*.SYS.\\w*"); boolean isuca_metadata_Table = uca_metadata_TablePattern.matcher(t).matches(); if (isuca_metadata_Table) { return false; } boolean isSys_Table = sys_TablePattern.matcher(t).matches(); if (isSys_Table) { return false; } return true; } }); }
Source:
<code><START> private ProgramState initialStateWithArgumentConstraints(ProgramState initialState, Map<Symbol, Constraint> argumentConstraints) { <END> for (Entry<Symbol, Constraint> entry : argumentConstraints.entrySet()) { initialState = initialState.newSymbolicValue(entry.getKey(), entry.getValue()); } return initialState; }</code><technical_language>![MAJOR](<LINK_1> 'Severity: MAJOR') "initialStateWithArgumentConstraints" a "static" method. [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
private static ProgramState initialStateWithArgumentConstraints(ProgramState initialState, Map<Symbol, Constraint> argumentConstraints) { ProgramState updatedInitialState = initialState; for (Entry<Symbol, Constraint> entry : argumentConstraints.entrySet()) { updatedInitialState = updatedInitialState.newSymbolicValue(entry.getKey(), entry.getValue()); } return updatedInitialState; }
Source:
<code>public void setPreview(final Preview preview) { if (preview == null) { return; } preview.setSurfaceTextureListener(new TextureView.SurfaceTextureListener() { @Override public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int width, int height) { try { logger.debug("Player state=" + state); Surface surface = new Surface(surfaceTexture); setSurface(surface); logger.debug("Surface created and set to the player"); if (!isPlaying()) { seekTo(lastCurrentPosition); } } catch (Exception ex) { logger.error(ex); <START> } <END> } @Override public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) { } @Override public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) { return true; } @Override public void onSurfaceTextureUpdated(SurfaceTexture surface) { } }); preview.setOnTouchListener(new OnSwipeListener(preview.getContext()) { @Override public void onSwipeLeft() { super.onSwipeLeft(); if (controller != null) { controller.playNext(); } } @Override public void onSwipeRight() { super.onSwipeRight(); if (controller != null) { controller.playPrevious(); } } @Override public void onClick() { super.onClick(); if (controller != null && state != PlayerState.RESET && state != PlayerState.URI_SET) { logger.debug("Player touched"); if (controller.isShowing()) { controller.hide(); } else { controller.setLmsUrl(lmsURL); controller.setTitle(videoTitle); controller.show(); } } } }); }</code><technical_language>Good catch -.-</technical_language>

Target:
public void setPreview(final Preview preview) { if (preview == null) { return; } preview.setSurfaceTextureListener(new TextureView.SurfaceTextureListener() { @Override public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int width, int height) { try { logger.debug("Player state=" + state); Surface surface = new Surface(surfaceTexture); setSurface(surface); logger.debug("Surface created and set to the player"); if (!isPlaying()) { seekTo(lastCurrentPosition); } } catch (Exception ex) { logger.error(ex); } } @Override public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) { } @Override public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) { return true; } @Override public void onSurfaceTextureUpdated(SurfaceTexture surface) { } }); preview.setOnTouchListener(new OnSwipeListener(preview.getContext()) { @Override public void onSwipeLeft() { super.onSwipeLeft(); if (controller != null) { controller.playNext(); } } @Override public void onSwipeRight() { super.onSwipeRight(); if (controller != null) { controller.playPrevious(); } } @Override public void onClick() { super.onClick(); if (controller != null && state != PlayerState.RESET && state != PlayerState.URI_SET) { logger.debug("Player touched"); if (controller.isShowing() && autoHideControls) { controller.hide(); } else { controller.setLmsUrl(lmsURL); controller.setTitle(videoTitle); controller.show(); } } } }); }
Source:
<code>public void unsubscribe() { <START> synchronized (this) { <END> if (ONCE_UPDATER.getAndSet(this, 1) == 0) { worker.schedule(new Action0() { @Override public void call() { worker.unsubscribe(); } }); } } }</code><technical_language>This synchronized removed</technical_language>

Target:
public void unsubscribe() { if (ONCE_UPDATER.getAndSet(this, 1) == 0) { worker.schedule(new Action0() { @Override public void call() { worker.unsubscribe(); } }); } }
Source:
<code>default Flux<Aggregation> aggregate(Consumer<SearchRequest> consumer) { <START> <END> SearchRequest request = new SearchRequest(); consumer.accept(request); return aggregate(request); }</code><technical_language>suggestion Assert.notNull(consumer, "consumer null"): Parameters annotated @Nullable checked</technical_language>

Target:
default Flux<Aggregation> aggregate(Consumer<SearchRequest> consumer) { Assert.notNull(consumer, "consumer must not be null"); SearchRequest request = new SearchRequest(); consumer.accept(request); return aggregate(request); }
Source:
<code>protected void writeKeySpecification( String key, String type, GraphMLMetadata<?> ds, BufferedWriter bw) throws IOException { bw.write("<key id=\"" + key + "\" for=\"" + type + "\""); if (null != ds.attributeName) bw.write(" attr.name=\"" + ds.attributeName.replace("\"", "&quot;") + "\""); <START> if (null != ds.attributeType) bw.write(" attr.type=\"" + ds.attributeType.getValue() + "\""); <END> boolean closed = false; String desc = ds.description; if (desc != null) { if (!closed) { bw.write(">\n"); closed = true; } bw.write("<desc>" + desc + "</desc>\n"); } Object def = ds.default_value; if (def != null) { if (!closed) { bw.write(">\n"); closed = true; } bw.write("<default>" + def.toString() + "</default>\n"); } if (!closed) { bw.write("/>\n"); } else { bw.write("</key>\n"); } }</code><technical_language>if statements lacking braces. Please run mvn fmt:format fix this other formatting errors I missed. :)</technical_language>

Target:
protected void writeKeySpecification( String key, String type, GraphMLMetadata<?> ds, BufferedWriter bw) throws IOException { bw.write("<key id=\"" + key + "\" for=\"" + type + "\""); if (null != ds.attributeName) { bw.write(" attr.name=\"" + ds.attributeName.replace("\"", "&quot;") + "\""); } if (null != ds.attributeType) { bw.write(" attr.type=\"" + ds.attributeType.getValue() + "\""); } boolean closed = false; String desc = ds.description; if (desc != null) { if (!closed) { bw.write(">\n"); closed = true; } bw.write("<desc>" + desc + "</desc>\n"); } Object def = ds.default_value; if (def != null) { if (!closed) { bw.write(">\n"); closed = true; } bw.write("<default>" + def.toString() + "</default>\n"); } if (!closed) { bw.write("/>\n"); } else { bw.write("</key>\n"); } }
Source:
<code>protected List<? extends Block> getBlockTitle(RssMacroParameters parameters, String content, MacroTransformationContext context) { <START> return generateBoxTitle("rsschanneltitle", getFeed()); <END> }</code><technical_language>do if block title is set in parameters ? thinking expose this parameter cost do instead of completely ignoring it</technical_language>

Target:
protected List<? extends Block> getBlockTitle(RssMacroParameters parameters, String content, MacroTransformationContext context) { List<? extends Block> blockTitle = super.getBlockTitle(parameters, content, context); if (blockTitle == null) { return generateBoxTitle("rsschanneltitle", getFeed()); } else { return blockTitle; } }
Source:
<code>public EventPublishingController eventPublishingController() { <START> return new EventPublishingController(new InMemoryTopicRepository(), new InMemoryEventTypeRepository()); <END> }</code><technical_language>InMemoryTopicRepository here</technical_language>

Target:
public EventPublishingController eventPublishingController() { return new EventPublishingController(kafkaRepository, new InMemoryEventTypeRepository()); }
Source:
<code>public void setAwake(final Registration reg) { if (reg.usesQueueMode()) { boolean stateChanged; final AtomicReference<ScheduledFuture<?>> timerFuture = new AtomicReference<>(); AtomicReference<ScheduledFuture<?>> previous = clientPrecenses.put(reg.getEndpoint(), timerFuture); if (previous != null) { stateChanged = false; <START> previous.get().cancel(false); <END> } else { stateChanged = true; } int clientAwakeTime = awakeTimeProvider.getClientAwakeTime(reg); if (clientAwakeTime != 0) { timerFuture.set(clientTimersExecutor.schedule(new Runnable() { @Override public void run() { boolean removed = clientPrecenses.remove(reg.getEndpoint(), timerFuture); if (removed) { for (PresenceListener listener : listeners) { listener.onSleeping(reg); } } } }, clientAwakeTime, TimeUnit.MILLISECONDS)); } if (stateChanged) { for (PresenceListener listener : listeners) { listener.onAwake(reg); } } } }</code><technical_language>potential NPE if previous future is set yet</technical_language>

Target:
public void setAwake(final Registration reg) { if (reg.usesQueueMode()) { boolean stateChanged; final AtomicReference<ScheduledFuture<?>> timerFuture = new AtomicReference<>(); AtomicReference<ScheduledFuture<?>> previous = clientPresences.put(reg.getEndpoint(), timerFuture); if (previous != null) { stateChanged = false; if (previous.get() != null) { previous.get().cancel(false); } } else { stateChanged = true; } int clientAwakeTime = awakeTimeProvider.getClientAwakeTime(reg); if (clientAwakeTime != 0) { timerFuture.set(clientTimersExecutor.schedule(new Runnable() { @Override public void run() { boolean removed = clientPresences.remove(reg.getEndpoint(), timerFuture); if (removed) { for (PresenceListener listener : listeners) { listener.onSleeping(reg); } } } }, clientAwakeTime, TimeUnit.MILLISECONDS)); if (clientPresences.get(reg.getEndpoint()) != timerFuture) { timerFuture.get().cancel(false); } } if (stateChanged) { for (PresenceListener listener : listeners) { listener.onAwake(reg); } } } }
Source:
<code>private boolean validateAccountingLine(ConcurStandardAccountingExtractDetailLine line, ConcurStandardAccountingExtractBatchReportData reportData) { if (!getConcurStandardAccountingExtractCashAdvanceService().isCashAdvanceLine(line)) { <START> ConcurAccountInfo accountingInformation = buildConcurAccountingInformation(line, line.getJournalAccountCode(), line.getSubObjectCode()); <END> ValidationResult validationResults = buildValidationResult(accountingInformation, false); if (validationResults.isNotValid()) { reportData.addValidationErrorFileLine(new ConcurBatchReportLineValidationErrorItem(line.getReportId(), line.getEmployeeId(), line.getEmployeeLastName(), line.getEmployeeFirstName(), line.getEmployeeMiddleInitital(), validationResults.getMessages())); } return validationResults.isValid(); } else { LOG.debug("validateAccountingLine, found a cash advance line, no need to validate"); return true; } }</code><technical_language>in sub-object code is set buildConcurAccountingInformation() need adjusted allow for report/header sub-object code in case of personal expense lines. I I accidentally omitted handling for I modified this class handle report/header accounting fields; that</technical_language>

Target:
private boolean validateAccountingLine(ConcurStandardAccountingExtractDetailLine line, ConcurStandardAccountingExtractBatchReportData reportData) { if (!getConcurStandardAccountingExtractCashAdvanceService().isCashAdvanceLine(line)) { ConcurAccountInfo accountingInformation = buildConcurAccountingInformation(line); ValidationResult validationResults = buildValidationResult(accountingInformation, false); if (validationResults.isNotValid()) { reportData.addValidationErrorFileLine(new ConcurBatchReportLineValidationErrorItem(line.getReportId(), line.getEmployeeId(), line.getEmployeeLastName(), line.getEmployeeFirstName(), line.getEmployeeMiddleInitital(), validationResults.getMessages())); } return validationResults.isValid(); } else { LOG.debug("validateAccountingLine, found a cash advance line, no need to validate"); return true; } }
Source:
<code>public Subscriber<? super T> call(final Subscriber<? super T> child) { <START> return new Subscriber<T>(child) { <END> @Override public void onCompleted() { child.onCompleted(); } @Override public void onError(Throwable e) { child.onError(e); } @Override public void onNext(T t) { } }; }</code><technical_language>This child's requests hang child receive element is requesting more. instead write this: java Subscriber<T> result = new Subscribeer<T>() { ... } child.add(result); return result;</technical_language>

Target:
public Subscriber<? super T> call(final Subscriber<? super T> child) { Subscriber<T> parent = new Subscriber<T>() { @Override public void onCompleted() { child.onCompleted(); } @Override public void onError(Throwable e) { child.onError(e); } @Override public void onNext(T t) { } }; child.add(parent); return parent; }
Source:
<code>static TypeMirror asMemberOf(Types typeUtils, ProcessingEnvironment env, VersionInformation versionInformation, DeclaredType containing, Element element) { TypeMirror result = null; Exception lastException = null; try { try { result = typeUtils.asMemberOf( containing, element ); } catch ( IllegalArgumentException e ) { lastException = e; if ( versionInformation.isEclipseJDTCompiler() ) { <START> result = (TypeMirror) ClassLoaderHelper.getAsMemberOf( element.getClass().getClassLoader() ) <END> .invoke( null, env, containing, element ); } } } catch ( Exception e ) { lastException = e; } if ( null == result ) { throw new RuntimeException( "Fallback implementation of asMemberOf didn't work for " + element + " in " + containing, lastException ); } return result; }</code><technical_language>check for Eclipse JDT compiler version perform this trick</technical_language>

Target:
static TypeMirror asMemberOf(Types typeUtils, ProcessingEnvironment env, VersionInformation versionInformation, DeclaredType containing, Element element) { TypeMirror result = null; Exception lastException = null; try { try { result = typeUtils.asMemberOf( containing, element ); } catch ( IllegalArgumentException e ) { lastException = e; if ( versionInformation.isEclipseJDTCompiler() ) { result = EclipseClassLoaderBridge.invokeAsMemberOfWorkaround( env, containing, element ); } } } catch ( Exception e ) { lastException = e; } if ( null == result ) { throw new RuntimeException( "Fallback implementation of asMemberOf didn't work for " + element + " in " + containing, lastException ); } return result; }
Source:
<code>public void pulse() { <START> <END> Location location = parentEntity.getLocation(); World w = location.getWorld(); double x = location.getX() % 1; double y = location.getY() % 1; double z = location.getZ() % 1; Block[] blocksTouching = new Block[]{null, null, new Location(w, location.getX(), location.getY() - 1, location.getZ()).getBlock()}; if (x >= 0.7) { blocksTouching[0] = new Location(w, location.getX() + 1, location.getY(), location.getZ()).getBlock(); } else if (x <= 0.3) { blocksTouching[0] = new Location(w, location.getX() - 1, location.getY(), location.getZ()).getBlock(); } if (z >= 0.7) { blocksTouching[1] = new Location(w, location.getX(), location.getY(), location.getZ() + 1).getBlock(); } else if (z <= 0.3) { blocksTouching[1] = new Location(w, location.getX(), location.getY(), location.getZ() - 1).getBlock(); } if (y > 0.9) { blocksTouching[2] = new Location(w, location.getX(), location.getY(), location.getZ()).getBlock(); } for (Block touching : blocksTouching) { if (touching == null) continue; if (touching.getType().equals(Material.CACTUS)) { if (lastCactusDamageTick + 10 < parentEntity.getWorld().getWorldAge()) { EntityDamageByBlockEvent ev = new EntityDamageByBlockEvent(touching, parentEntity, EntityDamageEvent.DamageCause.CONTACT, 1.0); damage(1.0, ev); lastCactusDamageTick = parentEntity.getWorld().getWorldAge(); } } } }</code><technical_language>Whitespace</technical_language>

Target:
public void pulse() { Location location = parentEntity.getLocation(); World w = location.getWorld(); double x = location.getX() % 1; double y = location.getY() % 1; double z = location.getZ() % 1; Location[] blocksTouching = new Location[]{null, null, new Location(w, location.getX(), location.getY() - 1, location.getZ())}; if ((x > 0 && x >= 0.7) || (x < 0 && x > -0.3)) { blocksTouching[0] = new Location(w, location.getX() + 1, location.getY(), location.getZ()); } else if ((x > 0 && x <= 0.3) || (x < 0 && x < -0.7)) { blocksTouching[0] = new Location(w, location.getX() - 1, location.getY(), location.getZ()); } if ((z > 0 && z >= 0.7) || (z < 0 && z > -0.3)) { blocksTouching[1] = new Location(w, location.getX(), location.getY(), location.getZ() + 1); } else if ((z > 0 && z <= 0.3) || (z < 0 && z < -0.7)) { blocksTouching[1] = new Location(w, location.getX(), location.getY(), location.getZ() - 1); } if (y > 0.9) { blocksTouching[2] = new Location(w, location.getX(), location.getY(), location.getZ()); } for (Location touchingLoc : blocksTouching) { if (touchingLoc == null) { continue; } Block touching = w.getBlockAt(touchingLoc); if (touching == null) { continue; } if (touching.getType() == Material.CACTUS) { if (lastCactusDamageTick + 10 < parentEntity.getWorld().getWorldAge()) { EntityDamageByBlockEvent ev = new EntityDamageByBlockEvent(touching, parentEntity, EntityDamageEvent.DamageCause.CONTACT, 1.0); this.parentEntity.getServer().getPluginManager().callEvent(ev); damage(ev); lastCactusDamageTick = parentEntity.getWorld().getWorldAge(); } } } }
Source:
<code>private File createZipFile1(IPath out, String[] fileEntries) throws Exception { String c = "this is a file"; out.toFile().getParentFile().mkdirs(); File f = out.toFile(); <START> FileOutputStream fos = new FileOutputStream(f); <END> ZipOutputStream zos = new ZipOutputStream(fos); for( int i = 0; i < fileEntries.length; i++ ) { addToZipFile(toIS(c), fileEntries[i], zos); } zos.close(); fos.close(); return f; }</code><technical_language>call java try (FileOutputStream fos = new FileOutputStream(f); ZipOutputStream zos = new ZipOutputStream(fos)) { ... } resources automatically closed, similar a finally block</technical_language>

Target:
private File createZipFile1(IPath out, String[] fileEntries) throws Exception { String c = "this is a file"; out.toFile().getParentFile().mkdirs(); File f = out.toFile(); try (FileOutputStream fos = new FileOutputStream(f); ZipOutputStream zos = new ZipOutputStream(fos); ) { for( int i = 0; i < fileEntries.length; i++ ) { addToZipFile(toIS(c), fileEntries[i], zos); } } return f; }
Source:
<code>protected void dispatchOnRangeSelected(final CalendarDay firstDay, final CalendarDay lastDay) { final OnRangeSelectedListener listener = rangeListener; final List<CalendarDay> days = new ArrayList<>(); <START> final SortedSet<Date> sortedDays = new TreeSet<>(); <END> sortedDays.add(firstDay.getDate()); sortedDays.add(lastDay.getDate()); final Date first = sortedDays.first(); final Date last = sortedDays.last(); final Calendar counter = Calendar.getInstance(); counter.setTime(first); final Calendar end = Calendar.getInstance(); end.setTime(last); while (counter.before(end) || counter.equals(end)) { final CalendarDay current = CalendarDay.from(counter); adapter.setDateSelected(current, true); days.add(current); counter.add(Calendar.DATE, 1); } if (listener != null) { listener.onRangeSelected(MaterialCalendarView.this, days); } }</code><technical_language>This sort is unnecessary--we dates. If day is day, call method inverted params: if (firstDay.isAfter(lastDay)) { dispatchOnRangeSelected(lastDay, firstDay); return; }</technical_language>

Target:
protected void dispatchOnRangeSelected(final CalendarDay firstDay, final CalendarDay lastDay) { final OnRangeSelectedListener listener = rangeListener; final List<CalendarDay> days = new ArrayList<>(); final Calendar counter = Calendar.getInstance(); counter.setTime(firstDay.getDate()); final Calendar end = Calendar.getInstance(); end.setTime(lastDay.getDate()); while (counter.before(end) || counter.equals(end)) { final CalendarDay current = CalendarDay.from(counter); adapter.setDateSelected(current, true); days.add(current); counter.add(Calendar.DATE, 1); } if (listener != null) { listener.onRangeSelected(MaterialCalendarView.this, days); } }