Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/main/java/org/audit4j/core/ValidationManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ static boolean isSerializable(Object object) {
} else {
retVal = false;
}
return (retVal);
return retVal;
}

/**
Expand All @@ -108,8 +108,8 @@ static boolean isSerializable(Object object) {
*/
private static boolean implementsInterface(final Object o) {
final boolean retVal;
retVal = ((o instanceof Serializable) || (o instanceof Externalizable));
return (retVal);
retVal = (o instanceof Serializable) || (o instanceof Externalizable);
return retVal;
}

/**
Expand All @@ -131,7 +131,7 @@ private static boolean attemptToSerialize(final Object o) {
stream.writeObject(o);
// could also re-serilalize at this point too
} catch (final IOException ex) {
return (false);
return false;
} finally {
if (stream != null) {
try {
Expand All @@ -142,7 +142,7 @@ private static boolean attemptToSerialize(final Object o) {
}
}

return (true);
return true;
}

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ public ConcurrentTaskScheduler(Executor concurrentExecutor, ScheduledExecutorSer
public final void setScheduledExecutor(ScheduledExecutorService scheduledExecutor) {
if (scheduledExecutor != null) {
this.scheduledExecutor = scheduledExecutor;
this.enterpriseConcurrentScheduler = (managedScheduledExecutorServiceClass != null && managedScheduledExecutorServiceClass
.isInstance(scheduledExecutor));
this.enterpriseConcurrentScheduler = managedScheduledExecutorServiceClass != null && managedScheduledExecutorServiceClass
.isInstance(scheduledExecutor);
} else {
this.scheduledExecutor = Executors.newSingleThreadScheduledExecutor();
this.enterpriseConcurrentScheduler = false;
Expand Down Expand Up @@ -173,8 +173,8 @@ public ScheduledFuture<?> schedule(Runnable task, Trigger trigger) {
if (this.enterpriseConcurrentScheduler) {
return new EnterpriseConcurrentTriggerScheduler().schedule(decorateTask(task, true), trigger);
} else {
ErrorHandler errorHandler = (this.errorHandler != null ? this.errorHandler : TaskUtils
.getDefaultErrorHandler(true));
ErrorHandler errorHandler = this.errorHandler != null ? this.errorHandler : TaskUtils
.getDefaultErrorHandler(true);
return new ReschedulingRunnable(task, trigger, this.scheduledExecutor, errorHandler).schedule();
}
} catch (RejectedExecutionException ex) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/audit4j/core/schedule/CronTrigger.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ public String getExpression() {
*/
@Override
public boolean equals(Object obj) {
return (this == obj || (obj instanceof CronTrigger && this.sequenceGenerator
.equals(((CronTrigger) obj).sequenceGenerator)));
return this == obj || (obj instanceof CronTrigger && this.sequenceGenerator
.equals(((CronTrigger) obj).sequenceGenerator));
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/audit4j/core/schedule/PeriodicTrigger.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public PeriodicTrigger(long period) {
*/
public PeriodicTrigger(long period, TimeUnit timeUnit) {
//Assert.isTrue(period >= 0, "period must not be negative");
this.timeUnit = (timeUnit != null ? timeUnit : TimeUnit.MILLISECONDS);
this.timeUnit = timeUnit != null ? timeUnit : TimeUnit.MILLISECONDS;
this.period = this.timeUnit.toMillis(period);
}

Expand Down Expand Up @@ -114,7 +114,7 @@ public boolean equals(Object obj) {
return false;
}
PeriodicTrigger other = (PeriodicTrigger) obj;
return (this.fixedRate == other.fixedRate && this.initialDelay == other.initialDelay && this.period == other.period);
return this.fixedRate == other.fixedRate && this.initialDelay == other.initialDelay && this.period == other.period;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,6 @@ public int compareTo(Delayed other) {
return 0;
}
long diff = getDelay(TimeUnit.MILLISECONDS) - other.getDelay(TimeUnit.MILLISECONDS);
return (diff == 0 ? 0 : ((diff < 0) ? -1 : 1));
return diff == 0 ? 0 : (diff < 0) ? -1 : 1;
}
}
4 changes: 2 additions & 2 deletions src/main/java/org/audit4j/core/schedule/TaskUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static DelegatingErrorHandlingRunnable decorateTaskWithErrorHandler(Runna
if (task instanceof DelegatingErrorHandlingRunnable) {
return (DelegatingErrorHandlingRunnable) task;
}
ErrorHandler eh = (errorHandler != null ? errorHandler : getDefaultErrorHandler(isRepeatingTask));
ErrorHandler eh = errorHandler != null ? errorHandler : getDefaultErrorHandler(isRepeatingTask);
return new DelegatingErrorHandlingRunnable(task, eh);
}

Expand All @@ -69,7 +69,7 @@ public static DelegatingErrorHandlingRunnable decorateTaskWithErrorHandler(Runna
* @return the default error handler
*/
public static ErrorHandler getDefaultErrorHandler(boolean isRepeatingTask) {
return (isRepeatingTask ? LOG_AND_SUPPRESS_ERROR_HANDLER : LOG_AND_PROPAGATE_ERROR_HANDLER);
return isRepeatingTask ? LOG_AND_SUPPRESS_ERROR_HANDLER : LOG_AND_PROPAGATE_ERROR_HANDLER;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,8 @@ public boolean prefersShortLivedTasks() {
public ScheduledFuture<?> schedule(Runnable task, Trigger trigger) {
ScheduledExecutorService executor = getScheduledExecutor();
try {
ErrorHandler errorHandler = (this.errorHandler != null ? this.errorHandler : TaskUtils
.getDefaultErrorHandler(true));
ErrorHandler errorHandler = this.errorHandler != null ? this.errorHandler : TaskUtils
.getDefaultErrorHandler(true);
return new ReschedulingRunnable(task, trigger, executor, errorHandler).schedule();
} catch (RejectedExecutionException ex) {
throw new TaskRejectedException("Executor [" + executor + "] did not accept task: " + task, ex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ private ClassUtils(){
* @see Class#getMethod
*/
public static boolean hasMethod(Class<?> clazz, String methodName, Class<?>... paramTypes) {
return (getMethodIfAvailable(clazz, methodName, paramTypes) != null);
return getMethodIfAvailable(clazz, methodName, paramTypes) != null;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ public CustomizableThreadCreator() {
* the prefix to use for the names of newly created threads
*/
public CustomizableThreadCreator(String threadNamePrefix) {
this.threadNamePrefix = (threadNamePrefix != null ? threadNamePrefix : getDefaultThreadNamePrefix());
this.threadNamePrefix = threadNamePrefix != null ? threadNamePrefix : getDefaultThreadNamePrefix();
}

/**
* Specify the prefix to use for the names of newly created threads. Default
* is "SimpleAsyncTaskExecutor-".
*/
public void setThreadNamePrefix(String threadNamePrefix) {
this.threadNamePrefix = (threadNamePrefix != null ? threadNamePrefix : getDefaultThreadNamePrefix());
this.threadNamePrefix = threadNamePrefix != null ? threadNamePrefix : getDefaultThreadNamePrefix();
}

/**
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/org/audit4j/core/schedule/util/StringUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ private StringUtils(){
* @since 3.2.1
*/
public static boolean isEmpty(Object str) {
return (str == null || "".equals(str));
return str == null || "".equals(str);
}

/**
Expand All @@ -70,7 +70,7 @@ public static boolean isEmpty(Object str) {
* @see #hasText(String)
*/
public static boolean hasLength(CharSequence str) {
return (str != null && str.length() > 0);
return str != null && str.length() > 0;
}

/**
Expand Down Expand Up @@ -470,7 +470,7 @@ public static String deleteAny(String inString, String charsToDelete) {
* input was {@code null}
*/
public static String quote(String str) {
return (str != null ? "'" + str + "'" : null);
return str != null ? "'" + str + "'" : null;
}

/**
Expand All @@ -483,7 +483,7 @@ public static String quote(String str) {
* if not a String
*/
public static Object quoteIfString(Object obj) {
return (obj instanceof String ? quote((String) obj) : obj);
return obj instanceof String ? quote((String) obj) : obj;
}

/**
Expand Down Expand Up @@ -561,7 +561,7 @@ public static String getFilename(String path) {
return null;
}
int separatorIndex = path.lastIndexOf(FOLDER_SEPARATOR);
return (separatorIndex != -1 ? path.substring(separatorIndex + 1) : path);
return separatorIndex != -1 ? path.substring(separatorIndex + 1) : path;
}

/**
Expand Down Expand Up @@ -726,8 +726,8 @@ public static boolean pathEquals(String path1, String path2) {
*/
public static Locale parseLocaleString(String localeString) {
String[] parts = tokenizeToStringArray(localeString, "_ ", false, false);
String language = (parts.length > 0 ? parts[0] : "");
String country = (parts.length > 1 ? parts[1] : "");
String language = parts.length > 0 ? parts[0] : "";
String country = parts.length > 1 ? parts[1] : "";
validateLocalePart(language);
validateLocalePart(country);
String variant = "";
Expand All @@ -743,7 +743,7 @@ public static Locale parseLocaleString(String localeString) {
variant = trimLeadingCharacter(variant, '_');
}
}
return (language.length() > 0 ? new Locale(language, country, variant) : null);
return language.length() > 0 ? new Locale(language, country, variant) : null;
}

private static void validateLocalePart(String localePart) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/audit4j/core/util/EnvUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ static public boolean isJaninoAvailable() {
ClassLoader classLoader = EnvUtil.class.getClassLoader();
try {
Class<?> bindingClass = classLoader.loadClass("org.codehaus.janino.ScriptEvaluator");
return (bindingClass != null);
return bindingClass != null;
} catch (ClassNotFoundException e) {
return false;
}
Expand Down