Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id C064A200BDB for ; Mon, 12 Dec 2016 12:18:01 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id BEDA1160B22; Mon, 12 Dec 2016 11:18:01 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 94299160B0D for ; Mon, 12 Dec 2016 12:18:00 +0100 (CET) Received: (qmail 21035 invoked by uid 500); 12 Dec 2016 11:17:59 -0000 Mailing-List: contact commits-help@syncope.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@syncope.apache.org Delivered-To: mailing list commits@syncope.apache.org Received: (qmail 21025 invoked by uid 99); 12 Dec 2016 11:17:59 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Dec 2016 11:17:59 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id B38D1E3934; Mon, 12 Dec 2016 11:17:59 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: coheigea@apache.org To: commits@syncope.apache.org Message-Id: <4d01e6e855c14213a6e17c6af13084fa@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: syncope git commit: Finished Findbugs sweep apart from core Date: Mon, 12 Dec 2016 11:17:59 +0000 (UTC) archived-at: Mon, 12 Dec 2016 11:18:01 -0000 Repository: syncope Updated Branches: refs/heads/2_0_X 778cb32ca -> b738c07b9 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/b738c07b Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/b738c07b Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/b738c07b Branch: refs/heads/2_0_X Commit: b738c07b9d7e1a3c89300dbd0b557a8525f45e4b Parents: 778cb32 Author: Colm O hEigeartaigh Authored: Mon Dec 12 11:17:19 2016 +0000 Committer: Colm O hEigeartaigh Committed: Mon Dec 12 11:17:54 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/b738c07b/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/b738c07b/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/b738c07b/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 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 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/b738c07b/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/b738c07b/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/b738c07b/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/b738c07b/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/b738c07b/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();