diff options
author | 2021-07-29 17:09:24 +0200 | |
---|---|---|
committer | 2021-07-29 17:09:24 +0200 | |
commit | 97ea34af2f8e5d0ca9da5dda331a9f54e580c4c6 (patch) | |
tree | 2f58b2e34609439b53e3a7ddd5337bb4733ce707 /language-web/src/main/java/org/eclipse/viatra/solver/language/web/ProblemServlet.java | |
parent | Appearance fixes (diff) | |
download | refinery-97ea34af2f8e5d0ca9da5dda331a9f54e580c4c6.tar.gz refinery-97ea34af2f8e5d0ca9da5dda331a9f54e580c4c6.tar.zst refinery-97ea34af2f8e5d0ca9da5dda331a9f54e580c4c6.zip |
Refactoring based on Sonar reports
Diffstat (limited to 'language-web/src/main/java/org/eclipse/viatra/solver/language/web/ProblemServlet.java')
-rw-r--r-- | language-web/src/main/java/org/eclipse/viatra/solver/language/web/ProblemServlet.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/language-web/src/main/java/org/eclipse/viatra/solver/language/web/ProblemServlet.java b/language-web/src/main/java/org/eclipse/viatra/solver/language/web/ProblemServlet.java index 5de708f0..337df54b 100644 --- a/language-web/src/main/java/org/eclipse/viatra/solver/language/web/ProblemServlet.java +++ b/language-web/src/main/java/org/eclipse/viatra/solver/language/web/ProblemServlet.java | |||
@@ -3,9 +3,9 @@ | |||
3 | */ | 3 | */ |
4 | package org.eclipse.viatra.solver.language.web; | 4 | package org.eclipse.viatra.solver.language.web; |
5 | 5 | ||
6 | import com.google.inject.Injector; | ||
7 | import javax.servlet.ServletException; | 6 | import javax.servlet.ServletException; |
8 | import javax.servlet.annotation.WebServlet; | 7 | import javax.servlet.annotation.WebServlet; |
8 | |||
9 | import org.eclipse.xtext.util.DisposableRegistry; | 9 | import org.eclipse.xtext.util.DisposableRegistry; |
10 | import org.eclipse.xtext.web.servlet.XtextServlet; | 10 | import org.eclipse.xtext.web.servlet.XtextServlet; |
11 | 11 | ||
@@ -17,14 +17,18 @@ public class ProblemServlet extends XtextServlet { | |||
17 | 17 | ||
18 | private static final long serialVersionUID = 1L; | 18 | private static final long serialVersionUID = 1L; |
19 | 19 | ||
20 | DisposableRegistry disposableRegistry; | 20 | // Xtext requires a mutable servlet instance field. |
21 | @SuppressWarnings("squid:S2226") | ||
22 | private DisposableRegistry disposableRegistry; | ||
21 | 23 | ||
24 | @Override | ||
22 | public void init() throws ServletException { | 25 | public void init() throws ServletException { |
23 | super.init(); | 26 | super.init(); |
24 | Injector injector = new ProblemWebSetup().createInjectorAndDoEMFRegistration(); | 27 | var injector = new ProblemWebSetup().createInjectorAndDoEMFRegistration(); |
25 | this.disposableRegistry = injector.getInstance(DisposableRegistry.class); | 28 | this.disposableRegistry = injector.getInstance(DisposableRegistry.class); |
26 | } | 29 | } |
27 | 30 | ||
31 | @Override | ||
28 | public void destroy() { | 32 | public void destroy() { |
29 | if (disposableRegistry != null) { | 33 | if (disposableRegistry != null) { |
30 | disposableRegistry.dispose(); | 34 | disposableRegistry.dispose(); |