Skip to content

Commit fbcd5b0

Browse files
committed
fix: 'Class initialization must not depend on service' (redhat-developer#921)
Signed-off-by: Andre Dietisheim <[email protected]>
1 parent 3e8bcaf commit fbcd5b0

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/main/java/org/jboss/tools/intellij/openshift/oauth/AccountService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ public class AccountService {
2828

2929
private static final AccountService INSTANCE = new AccountService();
3030

31-
private final LoginProvider provider = LoginProvider.get();
32-
3331
private IAccountModel model;
3432

3533
private AccountService() {
@@ -109,7 +107,9 @@ public String getToken(String serverId, int tokenType, Object context) {
109107
}
110108
}
111109

110+
112111
private String performLogin(IAuthorizationServer server, IAccount account, int tokenType, Object context) {
112+
LoginProvider provider = LoginProvider.get();
113113
if (null != provider) {
114114
LoginResponse response = provider.login(server, context);
115115
if (null != response) {

src/main/java/org/jboss/tools/intellij/openshift/oauth/model/AccountModel.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717

1818
public class AccountModel implements IAccountModel {
1919

20-
private final ServersRepository repository = ApplicationManager.getApplication().getService(ServersRepository.class);
21-
2220
@Override
2321
public IAuthorizationServer createAuthorizationServer(String id) {
2422
return new AuthorizationServer(id);
@@ -34,6 +32,7 @@ private IAuthorizationServer merge(ServerExtensionPoint registeredServer, Author
3432

3533
@Override
3634
public List<IAuthorizationServer> getAuthorizationServers() {
35+
ServersRepository repository = ApplicationManager.getApplication().getService(ServersRepository.class);
3736
List<IAuthorizationServer> servers = repository.getServers();
3837
List<ServerExtensionPoint> registeredServers = ServerExtensionPoint.EP_NAME.getExtensionList();
3938
List<IAuthorizationServer> nservers = registeredServers

src/main/java/org/jboss/tools/intellij/openshift/tree/application/ApplicationsRootNode.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ public ApplicationsRootNode getRoot() {
320320
@Override
321321
public void dispose() {
322322
disposeClientAwareCLIs();
323+
client.close();
323324
}
324325

325326
protected KubernetesClient getClient() {

0 commit comments

Comments
 (0)