[tasks] Access fields through their getters in implementations of TaskRepository.isConfigured()

Otherwise, if the corresponding field is loaded lazily, it might not be initialized
by the moment of the check.

GitOrigin-RevId: b4954609a7fc49344b306cd107469cc7ab6eea66
This commit is contained in:
Mikhail Golubev
2024-09-02 12:50:06 +03:00
committed by intellij-monorepo-bot
parent f9f3be565f
commit 81f4abc438
4 changed files with 11 additions and 4 deletions

View File

@@ -78,6 +78,13 @@ public abstract class TaskRepository {
myUrl = trimTrailingSlashes(url);
}
/**
* Check if this repository is ready to be used for retrieving issues in "Open Task...".
* <p>
* Note that if you rely on the presence of some secret exposed through {@link com.intellij.tasks.impl.BaseRepository#getPassword()}
* you should access the corresponding field through {@code getPassword()}, not directly via the underlying field.
* Otherwise, it might not be loaded from the system password-safe by the moment of the check.
*/
public boolean isConfigured() {
return StringUtil.isNotEmpty(getUrl());
}

View File

@@ -339,7 +339,7 @@ public class MantisRepository extends BaseRepositoryImpl {
@Override
public boolean isConfigured() {
return super.isConfigured() && StringUtil.isNotEmpty(myUsername) && StringUtil.isNotEmpty(myPassword);
return super.isConfigured() && StringUtil.isNotEmpty(getUsername()) && StringUtil.isNotEmpty(getPassword());
}
@Override

View File

@@ -271,9 +271,9 @@ public class RedmineRepository extends NewBaseRepositoryImpl {
public boolean isConfigured() {
if (!super.isConfigured()) return false;
if (isUseHttpAuthentication()) {
return StringUtil.isNotEmpty(myPassword) && StringUtil.isNotEmpty(myUsername);
return StringUtil.isNotEmpty(getPassword()) && StringUtil.isNotEmpty(getUsername());
}
return StringUtil.isNotEmpty(myAPIKey);
return StringUtil.isNotEmpty(getAPIKey());
}
@Nullable

View File

@@ -385,7 +385,7 @@ public final class TrelloRepository extends NewBaseRepositoryImpl {
@Override
public boolean isConfigured() {
return super.isConfigured() && StringUtil.isNotEmpty(myPassword);
return super.isConfigured() && StringUtil.isNotEmpty(getPassword());
}
@NotNull