Skip to content

Commit 75caaf7

Browse files
committed
Merge pull request #28 from DevFactory/release/Dead-stores-should-be-removed-fix1
Fixing squid:S1854- Dead stores should be removed
2 parents 479bfe9 + 160fa72 commit 75caaf7

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

src/main/java/org/audit4j/core/Configurations.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ static Configuration loadConfig(ConfigurationStream stream) throws Configuration
9292
* @throws ConfigurationException the configuration exception
9393
*/
9494
static ConfigurationStream resolveConfigFileAsStream(String configFilePath) throws ConfigurationException {
95-
InputStream fileStream = null;
96-
String fileExtention = null;
95+
InputStream fileStream;
96+
String fileExtention;
9797

9898
if (configFilePath != null) {
9999
if (new File(configFilePath).isDirectory()) {
@@ -142,7 +142,7 @@ static String scanConfigFile(String dirPath) throws ConfigurationException {
142142

143143
String filePath = dirPath + File.separator + CONFIG_FILE_NAME + ".";
144144

145-
String fullFilePath = null;
145+
String fullFilePath;
146146
// Scan for Yaml file
147147
if (AuditUtil.isFileExists(filePath + YML_EXTENTION)) {
148148
fullFilePath = filePath + YML_EXTENTION;
@@ -182,7 +182,7 @@ static void generateConfigFile(String configFilePath) throws ConfigurationExcept
182182
* @throws ConfigurationException
183183
*/
184184
private static ConfigProvider<Configuration> getProviderByFileExtention(String extention) throws ConfigurationException {
185-
ConfigProvider<Configuration> provider = null;
185+
ConfigProvider<Configuration> provider;
186186
if (XML_EXTENTION.equals(extention)) {
187187
provider = new XMLConfigProvider<>(Configuration.class);
188188
} else if (YML_EXTENTION.equals(extention) || YAML_EXTENTION.equals(extention)) {

src/main/java/org/audit4j/core/annotation/AuditFieldAnnotationAttribute.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public List<Field> getAllFields(final Method method, final Object[] arg1) {
5252
int i = 0;
5353
String paramName = null;
5454
String paramValue = null;
55-
Class<?> paramType = null;
55+
Class<?> paramType;
5656
for (final Annotation[] annotations : parameterAnnotations) {
5757
final Object object = arg1[i++];
5858
//paramValue = ObjectToStringSerializer.(object);
@@ -99,7 +99,7 @@ public List<Field> getMarkedFields(final Method method, final Object[] arg1) {
9999
int i = 0;
100100
String paramName = null;
101101
String paramValue = null;
102-
Class<?> paramType = null;
102+
Class<?> paramType;
103103
for (final Annotation[] annotations : parameterAnnotations) {
104104
final Object object = arg1[i++];
105105
//paramValue = ObjectToStringSerializer.toStringIfNotImplemented(object);

src/main/java/org/audit4j/core/annotation/DeIdentifyUtil.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ private DeIdentifyUtil(){
4747
* @since 2.0.0
4848
*/
4949
public static String deidentifyLeft(String str, int size) {
50-
int repeat = 0;
50+
int repeat;
5151
if (size > str.length()) {
5252
repeat = str.length();
5353
} else {
@@ -67,7 +67,7 @@ public static String deidentifyLeft(String str, int size) {
6767
*/
6868
public static String deidentifyRight(String str, int size) {
6969
int end = str.length();
70-
int repeat = 0;
70+
int repeat;
7171
if (size > str.length()) {
7272
repeat = str.length();
7373
} else {
@@ -87,7 +87,7 @@ public static String deidentifyRight(String str, int size) {
8787
*/
8888
public static String deidentifyFromLeft(String str, int size) {
8989
int end = str.length();
90-
int repeat = 0;
90+
int repeat;
9191
if (size > str.length()) {
9292
repeat = 0;
9393
} else {
@@ -107,7 +107,7 @@ public static String deidentifyFromLeft(String str, int size) {
107107
*/
108108
public static String deidentifyFromRight(String str, int size) {
109109
int end = str.length();
110-
int repeat = 0;
110+
int repeat;
111111
if (size > str.length()) {
112112
repeat = str.length();
113113
} else {
@@ -128,7 +128,7 @@ public static String deidentifyFromRight(String str, int size) {
128128
*/
129129
public static String deidentifyMiddle(String str, int start, int end) {
130130

131-
int repeat = 0;
131+
int repeat;
132132
if (end - start > str.length()) {
133133
repeat = str.length();
134134
} else {

0 commit comments

Comments
 (0)