This is an automated email from the ASF dual-hosted git repository.
pingsutw pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/submarine.git
The following commit(s) were added to refs/heads/master by this push:
new a1436e3 SUBMARINE-1149. Sonar: Fix reliability issues in
submarine-server
a1436e3 is described below
commit a1436e3dda20f1bfc4a94ff233c284aa51202a9a
Author: Kevin Su <[email protected]>
AuthorDate: Mon Dec 20 13:07:04 2021 +0800
SUBMARINE-1149. Sonar: Fix reliability issues in submarine-server
Signed-off-by: Kevin Su <pingsutwapache.org>
### What is this PR for?
<!-- A few sentences describing the overall goals of the pull request's
commits.
First time? Check out the contributing guide -
https://submarine.apache.org/contribution/contributions.html
-->
Try to fix the issues on the sonarcloud.
https://sonarcloud.io/project/issues?id=apache_submarine&resolved=false&sinceLeakPeriod=true&types=BUG
### What type of PR is it?
[Bug Fix]
### Todos
* [ ] - Task
### What is the Jira issue?
<!-- * Open an issue on Jira
https://issues.apache.org/jira/browse/SUBMARINE/
* Put link here, and add [SUBMARINE-*Jira number*] in PR title, eg.
`SUBMARINE-23. PR title`
-->
https://issues.apache.org/jira/browse/SUBMARINE-1149
### How should this be tested?
<!--
* First time? Setup Travis CI as described on
https://submarine.apache.org/contribution/contributions.html#continuous-integration
* Strongly recommended: add automated unit tests for any new or changed
behavior
* Outline any manual steps to test the PR here.
-->
pass the cis
### Screenshots (if appropriate)
### Questions:
* Do the license files need updating? No
* Are there breaking changes for older versions? No
* Does this need new documentation? No
Author: Kevin Su <[email protected]>
Signed-off-by: Kevin <[email protected]>
Closes #841 from pingsutw/SUBMARINE-1149 and squashes the following commits:
65519363 [Kevin Su] Sonar: Fix reliability issues in submarine-server
---
.../java/org/apache/submarine/server/model/ModelManager.java | 2 +-
.../server/workbench/database/utils/MybatisGenerator.java | 11 +++++------
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git
a/submarine-server/server-core/src/main/java/org/apache/submarine/server/model/ModelManager.java
b/submarine-server/server-core/src/main/java/org/apache/submarine/server/model/ModelManager.java
index 3a6aa65..09bc136 100644
---
a/submarine-server/server-core/src/main/java/org/apache/submarine/server/model/ModelManager.java
+++
b/submarine-server/server-core/src/main/java/org/apache/submarine/server/model/ModelManager.java
@@ -36,7 +36,7 @@ import
org.apache.submarine.server.model.database.service.ModelVersionService;
public class ModelManager {
private static final Logger LOG =
LoggerFactory.getLogger(ModelManager.class);
- private static volatile ModelManager manager;
+ private static ModelManager manager;
private final Submitter submitter;
diff --git
a/submarine-server/server-core/src/main/java/org/apache/submarine/server/workbench/database/utils/MybatisGenerator.java
b/submarine-server/server-core/src/main/java/org/apache/submarine/server/workbench/database/utils/MybatisGenerator.java
index 20f8d1b..ef98f3a 100644
---
a/submarine-server/server-core/src/main/java/org/apache/submarine/server/workbench/database/utils/MybatisGenerator.java
+++
b/submarine-server/server-core/src/main/java/org/apache/submarine/server/workbench/database/utils/MybatisGenerator.java
@@ -47,27 +47,26 @@ public class MybatisGenerator {
Configuration config = null;
try {
config = cp.parseConfiguration(configFile);
- } catch (IOException e) {
- LOG.error(e.getMessage(), e);
- } catch (XMLParserException e) {
+ } catch (IOException | XMLParserException e) {
LOG.error(e.getMessage(), e);
}
DefaultShellCallback callback = new DefaultShellCallback(overwrite);
MyBatisGenerator myBatisGenerator = null;
try {
+ assert config != null;
myBatisGenerator = new MyBatisGenerator(config, callback, warnings);
} catch (InvalidConfigurationException e) {
LOG.error(e.getMessage(), e);
}
try {
+ assert myBatisGenerator != null;
myBatisGenerator.generate(null);
- } catch (SQLException e) {
- LOG.error(e.getMessage(), e);
- } catch (IOException e) {
+ } catch (SQLException | IOException e) {
LOG.error(e.getMessage(), e);
} catch (InterruptedException e) {
LOG.error(e.getMessage(), e);
+ throw new RuntimeException(e);
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]