Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 11f2c29

Browse files
lots more sonar cleanup (#1110)
1 parent c2ec60c commit 11f2c29

File tree

66 files changed

+416
-773
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+416
-773
lines changed

‎core/src/main/java/oracle/weblogic/deploy/aliases/TypeUtils.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2021, Oracle Corporation and/or its affiliates.
2+
* Copyright (c) 2017, 2022, Oracle Corporation and/or its affiliates.
33
* Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
44
*/
55
package oracle.weblogic.deploy.aliases;
@@ -291,7 +291,7 @@ public static Object[] convertToObjectArray(Object value, String strValue, Strin
291291
return result;
292292
}
293293

294-
private static List convertToList(Object value, String strValue, String delimiter) throws AliasException {
294+
private static List<?> convertToList(Object value, String strValue, String delimiter) throws AliasException {
295295
List<?> result = null;
296296
if (value instanceof List) {
297297
result = (List<?>) value;
@@ -372,7 +372,7 @@ private static PyDictionary convertToDictionary(Object value, String delimiter,
372372
return dictionary.__len__() == 0 ? null : dictionary;
373373
}
374374

375-
private static Map convertToMap(Object value, String strValue, String delimiter) throws AliasException {
375+
private static Map<?,?> convertToMap(Object value, String strValue, String delimiter) throws AliasException {
376376
Map<?,?> result;
377377
if (Map.class.isAssignableFrom(value.getClass())) {
378378
result = (Map<?,?>)value;

‎core/src/main/java/oracle/weblogic/deploy/exception/BundleAwareException.java‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2019, Oracle Corporation and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2017, 2022, Oracle Corporation and/or its affiliates. All rights reserved.
33
* Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
44
*/
55
package oracle.weblogic.deploy.exception;
@@ -38,7 +38,7 @@ public abstract class BundleAwareException extends Exception {
3838
/**
3939
* Constructs a default exception.
4040
*/
41-
public BundleAwareException() {
41+
protected BundleAwareException() {
4242
super();
4343
}
4444

@@ -47,7 +47,7 @@ public BundleAwareException() {
4747
*
4848
* @param messageID the message to use
4949
*/
50-
public BundleAwareException(String messageID) {
50+
protected BundleAwareException(String messageID) {
5151
super();
5252
this.messageID = messageID;
5353
}
@@ -58,7 +58,7 @@ public BundleAwareException(String messageID) {
5858
* @param messageID the message to use
5959
* @param params the arguments to use to fill in the placeholders in the message
6060
*/
61-
public BundleAwareException(String messageID, Object... params) {
61+
protected BundleAwareException(String messageID, Object... params) {
6262
super();
6363
this.messageID = messageID;
6464
this.params = params;
@@ -70,7 +70,7 @@ public BundleAwareException(String messageID, Object... params) {
7070
* @param messageID the message to use
7171
* @param cause the nested exception
7272
*/
73-
public BundleAwareException(String messageID, Throwable cause) {
73+
protected BundleAwareException(String messageID, Throwable cause) {
7474
super(cause);
7575
if (messageID != null) {
7676
this.messageID = messageID;
@@ -86,7 +86,7 @@ public BundleAwareException(String messageID, Throwable cause) {
8686
* @param cause the nested exception
8787
* @param params the arguments to use to fill in the placeholders in the message
8888
*/
89-
public BundleAwareException(String messageID, Throwable cause, Object... params) {
89+
protected BundleAwareException(String messageID, Throwable cause, Object... params) {
9090
super(cause);
9191
if (messageID != null) {
9292
this.messageID = messageID;
@@ -103,7 +103,7 @@ public BundleAwareException(String messageID, Throwable cause, Object... params)
103103
*
104104
* @param cause the nested exception
105105
*/
106-
public BundleAwareException(Throwable cause) {
106+
protected BundleAwareException(Throwable cause) {
107107
super(cause);
108108
if (cause != null) {
109109
copyFromCause(cause);
Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2019, Oracle Corporation and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2017, 2022, Oracle Corporation and/or its affiliates. All rights reserved.
33
* Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
44
*/
55
package oracle.weblogic.deploy.util;
@@ -13,62 +13,80 @@
1313
public class CLAException extends BundleAwareException {
1414
private static final long serialVersionUID = 1L;
1515

16-
private int exitCode;
16+
private finalint exitCode;
1717

1818
/**
19-
* Constructs a default exception.
19+
* Constructs a default exception with exit code of 2.
2020
*/
2121
public CLAException() {
22-
// default constructor
22+
this.exitCode = 2;
23+
}
24+
25+
/**
26+
* Construct a default exception with specified exit code
27+
* @param exitCode the exit code to use
28+
*/
29+
public CLAException(int exitCode) {
30+
this.exitCode = exitCode;
2331
}
2432

2533
/**
2634
* Constructs a new exception with the specified message id.
2735
*
36+
* @param exitCode the exit code to use
2837
* @param messageID the message ID
2938
*/
30-
public CLAException(String messageID) {
39+
public CLAException(intexitCode, String messageID) {
3140
super(messageID);
41+
this.exitCode = exitCode;
3242
}
3343

3444
/**
3545
* Constructs a new exception with the specified message id and parameters.
3646
*
47+
* @param exitCode the exit code to use
3748
* @param messageID the message ID
3849
* @param params the parameters to use to fill in the message tokens
3950
*/
40-
public CLAException(String messageID, Object... params) {
51+
public CLAException(intexitCode, String messageID, Object... params) {
4152
super(messageID, params);
53+
this.exitCode = exitCode;
4254
}
4355

4456
/**
4557
* Constructs a new exception with the specified message id and cause.
4658
*
59+
* @param exitCode the exit code to use
4760
* @param messageID the message ID
4861
* @param cause the exception that triggered the creation of this exception
4962
*/
50-
public CLAException(String messageID, Throwable cause) {
63+
public CLAException(intexitCode, String messageID, Throwable cause) {
5164
super(messageID, cause);
65+
this.exitCode = exitCode;
5266
}
5367

5468
/**
5569
* Constructs a new exception with passed message id, cause, and parameters.
5670
*
71+
* @param exitCode the exit code to use
5772
* @param messageID the message ID
5873
* @param cause the exception that triggered the creation of this exception
5974
* @param params the parameters to use to fill in the message tokens
6075
*/
61-
public CLAException(String messageID, Throwable cause, Object... params) {
76+
public CLAException(intexitCode, String messageID, Throwable cause, Object... params) {
6277
super(messageID, cause, params);
78+
this.exitCode = exitCode;
6379
}
6480

6581
/**
6682
* Constructs a new exception with the specified cause.
6783
*
84+
* @param exitCode the exit code to use
6885
* @param cause the exception that triggered the creation of this exception
6986
*/
70-
public CLAException(Throwable cause) {
87+
public CLAException(intexitCode, Throwable cause) {
7188
super(cause);
89+
this.exitCode = exitCode;
7290
}
7391

7492
/**
@@ -87,13 +105,4 @@ public String getBundleName() {
87105
public int getExitCode() {
88106
return this.exitCode;
89107
}
90-
91-
/**
92-
* Set the exit code for this exception.
93-
*
94-
* @param exitCode the exit code for this exception
95-
*/
96-
public void setExitCode(int exitCode) {
97-
this.exitCode = exitCode;
98-
}
99108
}

‎core/src/main/java/oracle/weblogic/deploy/util/PyOrderedDict.java‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,14 @@ public static PyObject fromkeys(PyObject keys, PyObject value) {
9797
* {@inheritDoc}
9898
*/
9999
@Override
100-
public int __cmp__(PyObject ob_other) {
100+
public int __cmp__(PyObject obOther) {
101101
int result = 0;
102102

103103
PyOrderedDict other = null;
104-
if (ob_other == null || ob_other.getType() != getType()) {
104+
if (obOther == null || obOther.getType() != getType()) {
105105
return -2;
106106
} else {
107-
other = (PyOrderedDict) ob_other;
107+
other = (PyOrderedDict) obOther;
108108
int an = this.linkedHashMap.size();
109109
int bn = other.linkedHashMap.size();
110110
if (an < bn) {
@@ -212,13 +212,13 @@ public void __delitem__(PyObject key) {
212212
* {@inheritDoc}
213213
*/
214214
@Override
215-
public PyObject __eq__(PyObject ob_other) {
216-
if (ob_other.getType() != getType()) {
215+
public PyObject __eq__(PyObject obOther) {
216+
if (obOther.getType() != getType()) {
217217
return null;
218218
}
219219

220220
PyObject result = Py.One;
221-
PyOrderedDict other = (PyOrderedDict)ob_other;
221+
PyOrderedDict other = (PyOrderedDict)obOther;
222222
int an = this.linkedHashMap.size();
223223
int bn = other.linkedHashMap.size();
224224
if (an != bn) {
@@ -321,10 +321,10 @@ public PyObject get(PyObject key) {
321321
* {@inheritDoc}
322322
*/
323323
@Override
324-
public PyObject get(PyObject key, PyObject default_object) {
324+
public PyObject get(PyObject key, PyObject defaultObject) {
325325
// Cannot use getOrDefault() as this is a Java 8 method and
326326
// the project is attempting to be compatible with Java 7...
327-
PyObject result = default_object;
327+
PyObject result = defaultObject;
328328
if (linkedHashMap.containsKey(key)) {
329329
result = linkedHashMap.get(key);
330330
}

‎core/src/main/java/oracle/weblogic/deploy/util/PyRealBoolean.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ public PyRealBoolean __deepcopy__(PyObject memo) {
3232

3333
@Override
3434
// for Python equality checks like abc == xyz
35-
public PyObject __eq__(PyObject ob_other) {
36-
return equals(ob_other) ? Py.One : Py.Zero;
35+
public PyObject __eq__(PyObject obOther) {
36+
return equals(obOther) ? Py.One : Py.Zero;
3737
}
3838

3939
@Override
4040
// for Python inequality checks like abc != xyz
41-
public PyObject __ne__(PyObject ob_other) {
42-
return equals(ob_other) ? Py.Zero : Py.One;
41+
public PyObject __ne__(PyObject obOther) {
42+
return equals(obOther) ? Py.Zero : Py.One;
4343
}
4444

4545
@Override

‎core/src/main/java/oracle/weblogic/deploy/util/WLSDeployContext.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, 2019, Oracle Corporation and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2018, 2022, Oracle Corporation and/or its affiliates. All rights reserved.
33
* Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
44
*/
55
package oracle.weblogic.deploy.util;
@@ -9,7 +9,7 @@
99
*/
1010
public class WLSDeployContext {
1111

12-
public staticenum WLSTMode {
12+
public enum WLSTMode {
1313

1414
OFFLINE("offline"), ONLINE("online");
1515

‎core/src/main/java/oracle/weblogic/deploy/util/WLSDeployExit.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ private WLSDeployExit() {
2929
* @param errorCode for exit from the JVM
3030
*/
3131
public static void exit(WLSDeployContext deployContext, int errorCode) {
32-
String METHOD = "exit";
32+
finalString METHOD = "exit";
3333
LOGGER.entering(errorCode, CLASS, METHOD);
3434
logCleanup(deployContext);
3535
LOGGER.exiting(CLASS, METHOD);
@@ -39,11 +39,11 @@ public static void exit(WLSDeployContext deployContext, int errorCode) {
3939
/**
4040
* Exit the JVM with the provided exit code.
4141
*
42-
* @param error_code for exit from the JVM
42+
* @param errorCode for exit from the JVM
4343
*/
44-
public static void exit(int error_code) {
44+
public static void exit(int errorCode) {
4545
// might want to validate the exit code first
46-
System.exit(error_code);
46+
System.exit(errorCode);
4747
}
4848

4949
private static void logCleanup(WLSDeployContext context) {

‎core/src/main/java/oracle/weblogic/deploy/util/XPathUtil.java‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@
3131
*/
3232
public class XPathUtil {
3333
private static final PlatformLogger LOGGER = WLSDeployLogFactory.getLogger("wlsdeploy.util");
34-
String oracle_home;
35-
String patches_home;
36-
public XPathUtil(String oracle_home){
37-
this.oracle_home = oracle_home;
38-
patches_home = Paths.get(oracle_home, "inventory", "patches").toString();
34+
String oracleHome;
35+
String patchesHome;
36+
public XPathUtil(String oracleHome){
37+
this.oracleHome = oracleHome;
38+
patchesHome = Paths.get(oracleHome, "inventory", "patches").toString();
3939
}
4040

4141
public XPathUtil() {
@@ -57,13 +57,13 @@ private static synchronized XPathFactory factory() {
5757
*/
5858
public String getPSU() {
5959
// find the names in the directory first
60-
if (!(new File(patches_home)).exists()) {
61-
LOGGER.info("No patches home at {0}", patches_home);
60+
if (!(new File(patchesHome)).exists()) {
61+
LOGGER.info("No patches home at {0}", patchesHome);
6262
return null;
6363
}
64-
List<String> patch_files = findPatchFiles();
64+
List<String> patchFiles = findPatchFiles();
6565
List<String> list = new ArrayList<>();
66-
for (String patch_file : patch_files){
66+
for (String patch_file : patchFiles){
6767
Document doc = readXmlFile(patch_file);
6868
String descrip = description(doc, "//@description");
6969
LOGGER.fine("Description {0}", descrip);
@@ -92,15 +92,15 @@ public String extractPsu(String descrip) {
9292
* @return list of patch file names.
9393
*/
9494
public List<String> findPatchFiles() {
95-
List<String> patch_files = new ArrayList<String>();
96-
try (DirectoryStream<Path> stream = Files.newDirectoryStream(new File(patches_home).toPath())){
95+
List<String> patchFiles = new ArrayList<>();
96+
try (DirectoryStream<Path> stream = Files.newDirectoryStream(new File(patchesHome).toPath())){
9797
for (Path path : stream) {
98-
patch_files.add(path.toString());
98+
patchFiles.add(path.toString());
9999
}
100100
} catch (IOException ieo) {
101-
LOGGER.info("Unable to locate the patch files at {0}", patches_home);
101+
LOGGER.info("Unable to locate the patch files at {0}", patchesHome);
102102
}
103-
return patch_files;
103+
return patchFiles;
104104
}
105105

106106
/**

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /