Repository: syncope
Updated Branches:
  refs/heads/master 8a78765ee -> 5cab8afc9


FindBugs sweep of common


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/5cab8afc
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/5cab8afc
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/5cab8afc

Branch: refs/heads/master
Commit: 5cab8afc94a1520accfcbeac30ab7da4a3dcc1ab
Parents: 8a78765
Author: Colm O hEigeartaigh <cohei...@apache.org>
Authored: Wed Dec 7 11:48:38 2016 +0000
Committer: Colm O hEigeartaigh <cohei...@apache.org>
Committed: Wed Dec 7 11:48:38 2016 +0000

----------------------------------------------------------------------
 .../common/lib/to/AbstractAnnotatedBean.java    | 22 ++++++++--
 .../apache/syncope/common/lib/to/UserTO.java    | 31 ++++++++++----
 .../syncope/common/lib/to/WorkflowFormTO.java   | 22 ++++++++--
 .../syncope/common/rest/api/beans/AnyQuery.java |  2 +-
 .../rest/api/beans/BulkExecDeleteQuery.java     | 44 ++++++++++++++++----
 .../rest/api/beans/ConnObjectTOListQuery.java   |  4 +-
 .../common/rest/api/beans/ExecuteQuery.java     | 13 ++++--
 .../common/rest/api/beans/TaskQuery.java        |  2 +-
 8 files changed, 110 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/5cab8afc/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractAnnotatedBean.java
----------------------------------------------------------------------
diff --git 
a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractAnnotatedBean.java
 
b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractAnnotatedBean.java
index c0f7155..1459211 100644
--- 
a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractAnnotatedBean.java
+++ 
b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractAnnotatedBean.java
@@ -73,11 +73,18 @@ public class AbstractAnnotatedBean extends AbstractBaseBean 
{
     }
 
     public Date getCreationDate() {
-        return creationDate;
+        if (creationDate != null) {
+            return new Date(creationDate.getTime());
+        }
+        return null;
     }
 
     public void setCreationDate(final Date creationDate) {
-        this.creationDate = creationDate;
+        if (creationDate != null) {
+            this.creationDate = new Date(creationDate.getTime());
+        } else {
+            this.creationDate = null;
+        }
     }
 
     public String getLastModifier() {
@@ -89,11 +96,18 @@ public class AbstractAnnotatedBean extends AbstractBaseBean 
{
     }
 
     public Date getLastChangeDate() {
-        return lastChangeDate;
+        if (lastChangeDate != null) {
+            return new Date(lastChangeDate.getTime());
+        }
+        return null;
     }
 
     public void setLastChangeDate(final Date lastChangeDate) {
-        this.lastChangeDate = lastChangeDate;
+        if (lastChangeDate != null) {
+            this.lastChangeDate = new Date(lastChangeDate.getTime());
+        } else {
+            this.lastChangeDate = null;
+        }
     }
 
     @JsonIgnore

http://git-wip-us.apache.org/repos/asf/syncope/blob/5cab8afc/common/lib/src/main/java/org/apache/syncope/common/lib/to/UserTO.java
----------------------------------------------------------------------
diff --git 
a/common/lib/src/main/java/org/apache/syncope/common/lib/to/UserTO.java 
b/common/lib/src/main/java/org/apache/syncope/common/lib/to/UserTO.java
index 4ec8181..c575d90 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/UserTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/UserTO.java
@@ -113,14 +113,17 @@ public class UserTO extends AnyTO implements 
GroupableRelatableTO {
     }
 
     public Date getTokenExpireTime() {
-        return tokenExpireTime == null
-                ? null
-                : new Date(tokenExpireTime.getTime());
+        if (tokenExpireTime != null) {
+            return new Date(tokenExpireTime.getTime());
+        }
+        return null;
     }
 
     public void setTokenExpireTime(final Date tokenExpireTime) {
         if (tokenExpireTime != null) {
             this.tokenExpireTime = new Date(tokenExpireTime.getTime());
+        } else {
+            this.tokenExpireTime = null;
         }
     }
 
@@ -133,7 +136,10 @@ public class UserTO extends AnyTO implements 
GroupableRelatableTO {
     }
 
     public Date getChangePwdDate() {
-        return changePwdDate;
+        if (changePwdDate != null) {
+            return new Date(changePwdDate.getTime());
+        }
+        return null;
     }
 
     public Integer getFailedLogins() {
@@ -141,11 +147,18 @@ public class UserTO extends AnyTO implements 
GroupableRelatableTO {
     }
 
     public Date getLastLoginDate() {
-        return lastLoginDate;
+        if (lastLoginDate != null) {
+            return new Date(lastLoginDate.getTime());
+        }
+        return null;
     }
 
     public void setChangePwdDate(final Date changePwdDate) {
-        this.changePwdDate = changePwdDate;
+        if (changePwdDate != null) {
+            this.changePwdDate = new Date(changePwdDate.getTime());
+        } else {
+            this.changePwdDate = null;
+        }
     }
 
     public void setFailedLogins(final Integer failedLogins) {
@@ -153,7 +166,11 @@ public class UserTO extends AnyTO implements 
GroupableRelatableTO {
     }
 
     public void setLastLoginDate(final Date lastLoginDate) {
-        this.lastLoginDate = lastLoginDate;
+        if (lastLoginDate != null) {
+            this.lastLoginDate = new Date(lastLoginDate.getTime());
+        } else {
+            this.lastLoginDate = null;
+        }
     }
 
     public String getSecurityQuestion() {

http://git-wip-us.apache.org/repos/asf/syncope/blob/5cab8afc/common/lib/src/main/java/org/apache/syncope/common/lib/to/WorkflowFormTO.java
----------------------------------------------------------------------
diff --git 
a/common/lib/src/main/java/org/apache/syncope/common/lib/to/WorkflowFormTO.java 
b/common/lib/src/main/java/org/apache/syncope/common/lib/to/WorkflowFormTO.java
index e6027f1..1748435 100644
--- 
a/common/lib/src/main/java/org/apache/syncope/common/lib/to/WorkflowFormTO.java
+++ 
b/common/lib/src/main/java/org/apache/syncope/common/lib/to/WorkflowFormTO.java
@@ -77,19 +77,33 @@ public class WorkflowFormTO extends AbstractBaseBean {
     }
 
     public Date getCreateTime() {
-        return createTime;
+        if (createTime != null) {
+            return new Date(createTime.getTime());
+        }
+        return null;
     }
 
     public void setCreateTime(final Date createTime) {
-        this.createTime = createTime;
+        if (createTime != null) {
+            this.createTime = new Date(createTime.getTime());
+        } else {
+            this.createTime = null;
+        }
     }
 
     public Date getDueDate() {
-        return dueDate;
+        if (dueDate != null) {
+            return new Date(dueDate.getTime());
+        }
+        return null;
     }
 
     public void setDueDate(final Date dueDate) {
-        this.dueDate = dueDate;
+        if (dueDate != null) {
+            this.dueDate = new Date(dueDate.getTime());
+        } else {
+            this.dueDate = null;
+        }
     }
 
     public String getOwner() {

http://git-wip-us.apache.org/repos/asf/syncope/blob/5cab8afc/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AnyQuery.java
----------------------------------------------------------------------
diff --git 
a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AnyQuery.java
 
b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AnyQuery.java
index 5b5b79c..1ce1233 100644
--- 
a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AnyQuery.java
+++ 
b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AnyQuery.java
@@ -69,7 +69,7 @@ public class AnyQuery extends AbstractQuery {
     }
 
     public Boolean getDetails() {
-        return details == null ? true : details;
+        return details == null ? Boolean.TRUE : details;
     }
 
     @QueryParam(JAXRSService.PARAM_DETAILS)

http://git-wip-us.apache.org/repos/asf/syncope/blob/5cab8afc/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/BulkExecDeleteQuery.java
----------------------------------------------------------------------
diff --git 
a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/BulkExecDeleteQuery.java
 
b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/BulkExecDeleteQuery.java
index 10e36bc..d975a98 100644
--- 
a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/BulkExecDeleteQuery.java
+++ 
b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/BulkExecDeleteQuery.java
@@ -83,39 +83,67 @@ public class BulkExecDeleteQuery extends AbstractBaseBean {
     }
 
     public Date getStartedBefore() {
-        return startedBefore;
+        if (startedBefore != null) {
+            return new Date(startedBefore.getTime());
+        }
+        return null;
     }
 
     @QueryParam("startedBefore")
     public void setStartedBefore(final Date startedBefore) {
-        this.startedBefore = startedBefore;
+        if (startedBefore != null) {
+            this.startedBefore = new Date(startedBefore.getTime());
+        } else {
+            this.startedBefore = null;
+        }
     }
 
     public Date getStartedAfter() {
-        return startedAfter;
+        if (startedAfter != null) {
+            return new Date(startedAfter.getTime());
+        }
+        return null;
     }
 
     @QueryParam("startedAfter")
     public void setStartedAfter(final Date startedAfter) {
-        this.startedAfter = startedAfter;
+        if (startedAfter != null) {
+            this.startedAfter = new Date(startedAfter.getTime());
+        } else {
+            this.startedAfter = null;
+        }
     }
 
     public Date getEndedBefore() {
-        return endedBefore;
+        if (endedBefore != null) {
+            return new Date(endedBefore.getTime());
+        }
+        return null;
     }
 
     @QueryParam("endedBefore")
     public void setEndedBefore(final Date endedBefore) {
-        this.endedBefore = endedBefore;
+        if (endedBefore != null) {
+            this.endedBefore = new Date(endedBefore.getTime());
+        } else {
+            this.endedBefore = null;
+        }
     }
 
     public Date getEndedAfter() {
-        return endedAfter;
+        if (endedAfter != null) {
+            return new Date(endedAfter.getTime());
+        }
+        return null;
     }
 
     @QueryParam("endedAfter")
     public void setEndedAfter(final Date endedAfter) {
-        this.endedAfter = endedAfter;
+        if (endedAfter != null) {
+            this.endedAfter = new Date(endedAfter.getTime());
+        } else {
+            this.endedAfter = null;
+        }
     }
 
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/5cab8afc/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/ConnObjectTOListQuery.java
----------------------------------------------------------------------
diff --git 
a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/ConnObjectTOListQuery.java
 
b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/ConnObjectTOListQuery.java
index 16d0e66..7ab27b0 100644
--- 
a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/ConnObjectTOListQuery.java
+++ 
b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/ConnObjectTOListQuery.java
@@ -68,9 +68,9 @@ public class ConnObjectTOListQuery implements Serializable {
 
     public Integer getSize() {
         return size == null
-                ? 25
+                ? Integer.valueOf(25)
                 : size > MAX_SIZE
-                        ? MAX_SIZE
+                        ? Integer.valueOf(MAX_SIZE)
                         : size;
     }
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/5cab8afc/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/ExecuteQuery.java
----------------------------------------------------------------------
diff --git 
a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/ExecuteQuery.java
 
b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/ExecuteQuery.java
index 1b1f5ca..c1fe6ec 100644
--- 
a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/ExecuteQuery.java
+++ 
b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/ExecuteQuery.java
@@ -70,16 +70,23 @@ public class ExecuteQuery extends AbstractBaseBean {
     }
 
     public Date getStartAt() {
-        return startAt;
+        if (startAt != null) {
+            return new Date(startAt.getTime());
+        }
+        return null;
     }
 
     @QueryParam("startAt")
     public void setStartAt(final Date startAt) {
-        this.startAt = startAt;
+        if (startAt != null) {
+            this.startAt = new Date(startAt.getTime());
+        } else {
+            this.startAt = null;
+        }
     }
 
     public Boolean getDryRun() {
-        return dryRun == null ? false : dryRun;
+        return dryRun == null ? Boolean.FALSE : dryRun;
     }
 
     @QueryParam("dryRun")

http://git-wip-us.apache.org/repos/asf/syncope/blob/5cab8afc/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/TaskQuery.java
----------------------------------------------------------------------
diff --git 
a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/TaskQuery.java
 
b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/TaskQuery.java
index 7674053..4ea0ea3 100644
--- 
a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/TaskQuery.java
+++ 
b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/TaskQuery.java
@@ -166,7 +166,7 @@ public class TaskQuery extends AbstractQuery {
     }
 
     public Boolean getDetails() {
-        return details == null ? true : details;
+        return details == null ? Boolean.TRUE : details;
     }
 
     @QueryParam(JAXRSService.PARAM_DETAILS)

Reply via email to