Skip to content

Commit f06859f

Browse files
committed
Fixed sonar bugs
1 parent bff4308 commit f06859f

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

src/main/java/in/erail/scheduler/QuartzJobFactory.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
public class QuartzJobFactory implements JobFactory {
2929

3030
public static final String COMPONENT_PATH = "_comp";
31-
31+
3232
private boolean warnIfNotFound = false;
3333
private boolean throwIfNotFound = false;
3434
private Logger mLog = LogManager.getLogger(QuartzJobFactory.class);
@@ -39,12 +39,12 @@ public Job newJob(TriggerFiredBundle bundle, Scheduler scheduler) throws Schedul
3939
Optional<String> compPath = Optional
4040
.ofNullable(data.getString(COMPONENT_PATH))
4141
.filter(t -> !Strings.isNullOrEmpty(t));
42-
42+
4343
Job job;
44-
45-
if(compPath.isPresent()){
44+
45+
if (compPath.isPresent()) {
4646
job = Glue.instance().resolve(compPath.get());
47-
}else {
47+
} else {
4848
job = (Job) Util.createInstance(bundle.getJobDetail().getJobClass());
4949
getLog().warn(() -> "Create job instance from class, Instead of Component. Are you sure, you don't want to use Component:" + bundle.getJobDetail().getJobClass().getCanonicalName());
5050
}
@@ -95,6 +95,10 @@ protected void setBeanProps(Object obj, JobDataMap data) throws SchedulerExcepti
9595
paramType = setMeth.getParameterTypes()[0];
9696
o = entry.getValue();
9797

98+
if (o == null) {
99+
continue;
100+
}
101+
98102
Object parm = null;
99103
if (paramType.isPrimitive()) {
100104
if (o == null) {

src/main/java/in/erail/security/SecurityTools.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,10 @@ protected Single<byte[]> generateKey() {
7979
public String getGlobalUniqueString() {
8080
try {
8181
return mGlobalUniqueString.get();
82-
} catch (InterruptedException | ExecutionException ex) {
82+
} catch (ExecutionException ex) {
8383
getLog().error("Global Unique not working", ex);
84+
} catch (InterruptedException ex) {
85+
throw new RuntimeException(ex);
8486
}
8587
return "ERROR_GLOBAL_KEY";
8688
}
@@ -110,9 +112,10 @@ public String encrypt(String value) {
110112
| NoSuchPaddingException
111113
| IllegalBlockSizeException
112114
| BadPaddingException
113-
| InterruptedException
114115
| ExecutionException ex) {
115116
getLog().error(ex);
117+
} catch (InterruptedException ex) {
118+
throw new RuntimeException(ex);
116119
}
117120

118121
return null;
@@ -137,9 +140,10 @@ public String decrypt(String encrypted) {
137140
| InvalidAlgorithmParameterException
138141
| IllegalBlockSizeException
139142
| BadPaddingException
140-
| InterruptedException
141143
| ExecutionException ex) {
142144
getLog().error(ex);
145+
} catch (InterruptedException ex) {
146+
throw new RuntimeException(ex);
143147
}
144148

145149
return null;

0 commit comments

Comments
 (0)