syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject syncope git commit: Finished Findbugs sweep apart from core
Date Mon, 12 Dec 2016 11:17:32 GMT
Repository: syncope
Updated Branches:
  refs/heads/master 367bf6160 -> e9fa33703


Finished Findbugs sweep apart from core


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

Branch: refs/heads/master
Commit: e9fa33703e97f738db468380eff8dd8f43d29c67
Parents: 367bf61
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Mon Dec 12 11:17:19 2016 +0000
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Mon Dec 12 11:17:19 2016 +0000

----------------------------------------------------------------------
 .../buildtools/ApacheDSStartStopListener.java   |  6 +-
 .../fit/buildtools/cxf/ProvisioningImpl.java    | 11 +++
 .../core/reference/DoubleValueLogicActions.java |  4 +-
 .../ide/eclipse/plugin/views/SyncopeView.java   |  4 +-
 .../installer/files/ConsoleProperties.java      |  4 +-
 .../installer/files/EnduserProperties.java      |  4 +-
 .../installer/files/MasterProperties.java       | 90 ++++++++++----------
 .../syncope/installer/utilities/HttpUtils.java  |  2 +-
 8 files changed, 68 insertions(+), 57 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/e9fa3370/fit/build-tools/src/main/java/org/apache/syncope/fit/buildtools/ApacheDSStartStopListener.java
----------------------------------------------------------------------
diff --git a/fit/build-tools/src/main/java/org/apache/syncope/fit/buildtools/ApacheDSStartStopListener.java
b/fit/build-tools/src/main/java/org/apache/syncope/fit/buildtools/ApacheDSStartStopListener.java
index 50049c8..7fae668 100644
--- a/fit/build-tools/src/main/java/org/apache/syncope/fit/buildtools/ApacheDSStartStopListener.java
+++ b/fit/build-tools/src/main/java/org/apache/syncope/fit/buildtools/ApacheDSStartStopListener.java
@@ -77,7 +77,7 @@ public class ApacheDSStartStopListener implements ServletContextListener
{
     private Partition addPartition(final String partitionId, final String partitionDn, final
DnFactory dnFactory)
             throws Exception {
 
-        // Create a new partition with the given partition id 
+        // Create a new partition with the given partition id
         JdbmPartition partition = new JdbmPartition(service.getSchemaManager(), dnFactory);
         partition.setId(partitionId);
         partition.setPartitionPath(new File(service.getInstanceLayout().getPartitionsDirectory(),
partitionId).toURI());
@@ -173,7 +173,7 @@ public class ApacheDSStartStopListener implements ServletContextListener
{
         // then the system partition
         // this is a MANDATORY partition
         // DO NOT add this via addPartition() method, trunk code complains about duplicate
partition
-        // while initializing 
+        // while initializing
         JdbmPartition systemPartition = new JdbmPartition(service.getSchemaManager(), service.getDnFactory());
         systemPartition.setId("system");
         systemPartition.setPartitionPath(
@@ -229,7 +229,7 @@ public class ApacheDSStartStopListener implements ServletContextListener
{
             initDirectoryService(sce.getServletContext(), workDir, loadDefaultContent);
 
             server = new LdapServer();
-            server.setTransports(new TcpTransport(Integer.valueOf(
+            server.setTransports(new TcpTransport(Integer.parseInt(
                     WebApplicationContextUtils.getWebApplicationContext(sce.getServletContext()).
                     getBean("testds.port", String.class))));
             server.setDirectoryService(service);

http://git-wip-us.apache.org/repos/asf/syncope/blob/e9fa3370/fit/build-tools/src/main/java/org/apache/syncope/fit/buildtools/cxf/ProvisioningImpl.java
----------------------------------------------------------------------
diff --git a/fit/build-tools/src/main/java/org/apache/syncope/fit/buildtools/cxf/ProvisioningImpl.java
b/fit/build-tools/src/main/java/org/apache/syncope/fit/buildtools/cxf/ProvisioningImpl.java
index e384734..6eefe5c 100644
--- a/fit/build-tools/src/main/java/org/apache/syncope/fit/buildtools/cxf/ProvisioningImpl.java
+++ b/fit/build-tools/src/main/java/org/apache/syncope/fit/buildtools/cxf/ProvisioningImpl.java
@@ -73,6 +73,8 @@ public class ProvisioningImpl implements Provisioning {
 
             statement.executeUpdate();
 
+            statement.close();
+
             return accountid;
         } catch (SQLException e) {
             throw new ProvisioningException("Delete operation failed", e);
@@ -164,6 +166,7 @@ public class ProvisioningImpl implements Provisioning {
                 LOG.debug("Execute query: " + query);
 
                 statement.executeUpdate();
+                statement.close();
             }
 
             return accountid;
@@ -225,6 +228,8 @@ public class ProvisioningImpl implements Provisioning {
             }
 
             LOG.debug("Retrieved users: {}", results);
+            rs.close();
+            statement.close();
         } catch (SQLException e) {
             LOG.error("Search operation failed", e);
         } finally {
@@ -307,6 +312,8 @@ public class ProvisioningImpl implements Provisioning {
 
             statement.executeUpdate(query);
 
+            statement.close();
+
             return accountid;
         } catch (SQLException e) {
             LOG.error("Creation failed:\n" + query, e);
@@ -356,6 +363,8 @@ public class ProvisioningImpl implements Provisioning {
 
             resolved = rs.next() ? rs.getString(1) : null;
 
+            statement.close();
+
             if (resolved == null) {
                 statement = conn.prepareStatement("SELECT roleName FROM role WHERE roleName=?");
                 statement.setString(1, username);
@@ -365,6 +374,8 @@ public class ProvisioningImpl implements Provisioning {
                 rs = statement.executeQuery();
 
                 resolved = rs.next() ? rs.getString(1) : null;
+
+                statement.close();
             }
         } catch (SQLException e) {
             throw new ProvisioningException("Resolve operation failed", e);

http://git-wip-us.apache.org/repos/asf/syncope/blob/e9fa3370/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/DoubleValueLogicActions.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/DoubleValueLogicActions.java
b/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/DoubleValueLogicActions.java
index 4e416df..2ae268e 100644
--- a/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/DoubleValueLogicActions.java
+++ b/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/DoubleValueLogicActions.java
@@ -40,7 +40,7 @@ public class DoubleValueLogicActions extends DefaultLogicActions {
                 List<String> values = new ArrayList<>(attr.getValues().size());
                 for (String value : attr.getValues()) {
                     try {
-                        values.add(String.valueOf(2 * Long.valueOf(value)));
+                        values.add(String.valueOf(2 * Long.parseLong(value)));
                     } catch (NumberFormatException e) {
                         // ignore
                     }
@@ -60,7 +60,7 @@ public class DoubleValueLogicActions extends DefaultLogicActions {
                 List<String> values = new ArrayList<>(patch.getAttrTO().getValues().size());
                 for (String value : patch.getAttrTO().getValues()) {
                     try {
-                        values.add(String.valueOf(2 * Long.valueOf(value)));
+                        values.add(String.valueOf(2 * Long.parseLong(value)));
                     } catch (NumberFormatException e) {
                         // ignore
                     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/e9fa3370/ide/eclipse/bundles/org.apache.syncope.ide.eclipse.plugin/src/main/java/org/apache/syncope/ide/eclipse/plugin/views/SyncopeView.java
----------------------------------------------------------------------
diff --git a/ide/eclipse/bundles/org.apache.syncope.ide.eclipse.plugin/src/main/java/org/apache/syncope/ide/eclipse/plugin/views/SyncopeView.java
b/ide/eclipse/bundles/org.apache.syncope.ide.eclipse.plugin/src/main/java/org/apache/syncope/ide/eclipse/plugin/views/SyncopeView.java
index af97021..bfa40f0 100644
--- a/ide/eclipse/bundles/org.apache.syncope.ide.eclipse.plugin/src/main/java/org/apache/syncope/ide/eclipse/plugin/views/SyncopeView.java
+++ b/ide/eclipse/bundles/org.apache.syncope.ide.eclipse.plugin/src/main/java/org/apache/syncope/ide/eclipse/plugin/views/SyncopeView.java
@@ -349,7 +349,7 @@ public class SyncopeView extends ViewPart {
                 ISelection selection = viewer.getSelection();
                 TreeObject obj = (TreeObject) ((IStructuredSelection) selection).getFirstElement();
                 TreeParent tp = (TreeParent) vcp.getParent(obj);
-                if (tp.getName().equals(MAIL_TEMPLATE_LABEL)) {
+                if (MAIL_TEMPLATE_LABEL.equals(tp.getName())) {
                     MailTemplateService mailTemplateService = SYNCOPE_CLIENT.getService(
                         MailTemplateService.class);
                     mailTemplateService.delete(obj.getName());
@@ -366,7 +366,7 @@ public class SyncopeView extends ViewPart {
 
     protected void openTemplateInEditor(final TreeObject obj) {
         TreeParent tp = (TreeParent) vcp.getParent(obj);
-        if (tp.getName().equals(MAIL_TEMPLATE_LABEL)) {
+        if (MAIL_TEMPLATE_LABEL.equals(tp.getName())) {
             final MailTemplateService mailTemplateService = SYNCOPE_CLIENT.getService(
                 MailTemplateService.class);
             final String[] templateData = new String[2];

http://git-wip-us.apache.org/repos/asf/syncope/blob/e9fa3370/installer/src/main/java/org/apache/syncope/installer/files/ConsoleProperties.java
----------------------------------------------------------------------
diff --git a/installer/src/main/java/org/apache/syncope/installer/files/ConsoleProperties.java
b/installer/src/main/java/org/apache/syncope/installer/files/ConsoleProperties.java
index 26532f2..790f05a 100644
--- a/installer/src/main/java/org/apache/syncope/installer/files/ConsoleProperties.java
+++ b/installer/src/main/java/org/apache/syncope/installer/files/ConsoleProperties.java
@@ -24,8 +24,8 @@ public final class ConsoleProperties {
             + "host=localhost\n"
             + "port=8080";
 
-    public static final String CONSOLE = "scheme=%s\n"
-            + "host=%s\n"
+    public static final String CONSOLE = "scheme=%s%n"
+            + "host=%s%n"
             + "port=%s";
 
     private ConsoleProperties() {

http://git-wip-us.apache.org/repos/asf/syncope/blob/e9fa3370/installer/src/main/java/org/apache/syncope/installer/files/EnduserProperties.java
----------------------------------------------------------------------
diff --git a/installer/src/main/java/org/apache/syncope/installer/files/EnduserProperties.java
b/installer/src/main/java/org/apache/syncope/installer/files/EnduserProperties.java
index 26dc304..95cf256 100644
--- a/installer/src/main/java/org/apache/syncope/installer/files/EnduserProperties.java
+++ b/installer/src/main/java/org/apache/syncope/installer/files/EnduserProperties.java
@@ -24,8 +24,8 @@ public final class EnduserProperties {
             + "host=localhost\n"
             + "port=8080";
 
-    public static final String ENDUSER = "scheme=%s\n"
-            + "host=%s\n"
+    public static final String ENDUSER = "scheme=%s%n"
+            + "host=%s%n"
             + "port=%s";
 
     private EnduserProperties() {

http://git-wip-us.apache.org/repos/asf/syncope/blob/e9fa3370/installer/src/main/java/org/apache/syncope/installer/files/MasterProperties.java
----------------------------------------------------------------------
diff --git a/installer/src/main/java/org/apache/syncope/installer/files/MasterProperties.java
b/installer/src/main/java/org/apache/syncope/installer/files/MasterProperties.java
index 259795d..aa43826 100644
--- a/installer/src/main/java/org/apache/syncope/installer/files/MasterProperties.java
+++ b/installer/src/main/java/org/apache/syncope/installer/files/MasterProperties.java
@@ -36,59 +36,59 @@ public final class MasterProperties {
             + "# under the License.\n";
 
     public static final String POSTGRES = ""
-            + "Master.driverClassName=org.postgresql.Driver\n"
-            + "Master.url=%s\n"
-            + "Master.schema=\n"
-            + "Master.username=%s\n"
-            + "Master.password=%s\n"
-            + "Master.databasePlatform=org.apache.openjpa.jdbc.sql.PostgresDictionary\n"
-            + "Master.orm=META-INF/spring-orm.xml\n"
-            + "Master.pool.validationQuery=SELECT 1\n"
-            + "Master.audit.sql=audit.sql\n";
+            + "Master.driverClassName=org.postgresql.Driver%n"
+            + "Master.url=%s%n"
+            + "Master.schema=%n"
+            + "Master.username=%s%n"
+            + "Master.password=%s%n"
+            + "Master.databasePlatform=org.apache.openjpa.jdbc.sql.PostgresDictionary%n"
+            + "Master.orm=META-INF/spring-orm.xml%n"
+            + "Master.pool.validationQuery=SELECT 1%n"
+            + "Master.audit.sql=audit.sql%n";
 
     public static final String MYSQL = ""
-            + "Master.driverClassName=com.mysql.jdbc.Driver\n"
-            + "Master.url=%s\n"
-            + "Master.schema=\n"
-            + "Master.username=%s\n"
-            + "Master.password=%s\n"
-            + "Master.databasePlatform=org.apache.openjpa.jdbc.sql.MySQLDictionary\n"
-            + "Master.orm=META-INF/spring-orm.xml\n"
-            + "Master.pool.validationQuery=SELECT 1\n"
-            + "Master.audit.sql=audit.sql\n";
+            + "Master.driverClassName=com.mysql.jdbc.Driver%n"
+            + "Master.url=%s%n"
+            + "Master.schema=%n"
+            + "Master.username=%s%n"
+            + "Master.password=%s%n"
+            + "Master.databasePlatform=org.apache.openjpa.jdbc.sql.MySQLDictionary%n"
+            + "Master.orm=META-INF/spring-orm.xml%n"
+            + "Master.pool.validationQuery=SELECT 1%n"
+            + "Master.audit.sql=audit.sql%n";
 
     public static final String MARIADB = ""
-            + "Master.driverClassName=org.mariadb.jdbc.Driver\n"
-            + "Master.url=%s\n"
-            + "Master.schema=\n"
-            + "Master.username=%s\n"
-            + "Master.password=%s\n"
-            + "Master.databasePlatform=org.apache.openjpa.jdbc.sql.MariaDBDictionary\n"
-            + "Master.orm=META-INF/spring-orm.xml\n"
-            + "Master.pool.validationQuery=SELECT 1\n"
-            + "Master.audit.sql=audit.sql\n";
+            + "Master.driverClassName=org.mariadb.jdbc.Driver%n"
+            + "Master.url=%s%n"
+            + "Master.schema=%n"
+            + "Master.username=%s%n"
+            + "Master.password=%s%n"
+            + "Master.databasePlatform=org.apache.openjpa.jdbc.sql.MariaDBDictionary%n"
+            + "Master.orm=META-INF/spring-orm.xml%n"
+            + "Master.pool.validationQuery=SELECT 1%n"
+            + "Master.audit.sql=audit.sql%n";
 
     public static final String ORACLE = ""
-            + "Master.driverClassName=oracle.jdbc.OracleDriver\n"
-            + "Master.url=%s\n"
-            + "Master.schema=%s\n"
-            + "Master.username=%s\n"
-            + "Master.password=%s\n"
-            + "Master.databasePlatform=org.apache.openjpa.jdbc.sql.OracleDictionary\n"
-            + "Master.orm=META-INF/spring-orm-oracle.xml\n"
-            + "Master.pool.validationQuery=SELECT 1 FROM DUAL\n"
-            + "Master.audit.sql=audit_oracle.sql\n";
+            + "Master.driverClassName=oracle.jdbc.OracleDriver%n"
+            + "Master.url=%s%n"
+            + "Master.schema=%s%n"
+            + "Master.username=%s%n"
+            + "Master.password=%s%n"
+            + "Master.databasePlatform=org.apache.openjpa.jdbc.sql.OracleDictionary%n"
+            + "Master.orm=META-INF/spring-orm-oracle.xml%n"
+            + "Master.pool.validationQuery=SELECT 1 FROM DUAL%n"
+            + "Master.audit.sql=audit_oracle.sql%n";
 
     public static final String SQLSERVER = ""
-            + "Master.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver\n"
-            + "Master.url=%s\n"
-            + "Master.schema=%s\n"
-            + "Master.username=%s\n"
-            + "Master.password=%s\n"
-            + "Master.databasePlatform=org.apache.openjpa.jdbc.sql.SQLServerDictionary\n"
-            + "Master.orm=META-INF/spring-orm-sqlserver.xml\n"
-            + "Master.pool.validationQuery=SELECT 1\n"
-            + "Master.audit.sql=audit_sqlserver.sql\n";
+            + "Master.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver%n"
+            + "Master.url=%s%n"
+            + "Master.schema=%s%n"
+            + "Master.username=%s%n"
+            + "Master.password=%s%n"
+            + "Master.databasePlatform=org.apache.openjpa.jdbc.sql.SQLServerDictionary%n"
+            + "Master.orm=META-INF/spring-orm-sqlserver.xml%n"
+            + "Master.pool.validationQuery=SELECT 1%n"
+            + "Master.audit.sql=audit_sqlserver.sql%n";
 
     private MasterProperties() {
         // private constructor for static utility class

http://git-wip-us.apache.org/repos/asf/syncope/blob/e9fa3370/installer/src/main/java/org/apache/syncope/installer/utilities/HttpUtils.java
----------------------------------------------------------------------
diff --git a/installer/src/main/java/org/apache/syncope/installer/utilities/HttpUtils.java
b/installer/src/main/java/org/apache/syncope/installer/utilities/HttpUtils.java
index fbd18e9..43443d3 100644
--- a/installer/src/main/java/org/apache/syncope/installer/utilities/HttpUtils.java
+++ b/installer/src/main/java/org/apache/syncope/installer/utilities/HttpUtils.java
@@ -75,7 +75,7 @@ public class HttpUtils {
 
         this.isSsl = isSsl;
         this.host = host;
-        this.port = Integer.valueOf(port);
+        this.port = Integer.parseInt(port);
 
         if (isSsl) {
             httpClient = createHttpsClient();


Mime
View raw message