Return-Path: X-Original-To: apmail-ace-commits-archive@www.apache.org Delivered-To: apmail-ace-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0F07210DCB for ; Tue, 5 Nov 2013 14:11:09 +0000 (UTC) Received: (qmail 54483 invoked by uid 500); 5 Nov 2013 14:11:08 -0000 Delivered-To: apmail-ace-commits-archive@ace.apache.org Received: (qmail 54461 invoked by uid 500); 5 Nov 2013 14:11:06 -0000 Mailing-List: contact commits-help@ace.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ace.apache.org Delivered-To: mailing list commits@ace.apache.org Received: (qmail 54448 invoked by uid 99); 5 Nov 2013 14:11:04 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Nov 2013 14:11:04 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Nov 2013 14:11:02 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id B28202388900; Tue, 5 Nov 2013 14:10:42 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1539002 - /ace/trunk/org.apache.ace.configurator/src/org/apache/ace/configurator/useradmin/task/UpdateUserAdminTask.java Date: Tue, 05 Nov 2013 14:10:42 -0000 To: commits@ace.apache.org From: jawi@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20131105141042.B28202388900@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: jawi Date: Tue Nov 5 14:10:42 2013 New Revision: 1539002 URL: http://svn.apache.org/r1539002 Log: ACE-199: log only a single message in case of connection refused errors. Modified: ace/trunk/org.apache.ace.configurator/src/org/apache/ace/configurator/useradmin/task/UpdateUserAdminTask.java Modified: ace/trunk/org.apache.ace.configurator/src/org/apache/ace/configurator/useradmin/task/UpdateUserAdminTask.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.configurator/src/org/apache/ace/configurator/useradmin/task/UpdateUserAdminTask.java?rev=1539002&r1=1539001&r2=1539002&view=diff ============================================================================== --- ace/trunk/org.apache.ace.configurator/src/org/apache/ace/configurator/useradmin/task/UpdateUserAdminTask.java (original) +++ ace/trunk/org.apache.ace.configurator/src/org/apache/ace/configurator/useradmin/task/UpdateUserAdminTask.java Tue Nov 5 14:10:42 2013 @@ -22,6 +22,7 @@ import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; +import java.net.ConnectException; import java.util.Dictionary; import java.util.Properties; @@ -39,12 +40,11 @@ import org.osgi.service.cm.ManagedServic import org.osgi.service.log.LogService; /** - * UpdateUserAdminTask processes the contents of a repository containing - * an XML description of the users that should be present in this system's - * user admin.
+ * UpdateUserAdminTask processes the contents of a repository containing an XML description of the users that should be + * present in this system's user admin.
*
- * From the first run on, this task will keep a local copy of the user repository, - * so login can happen when the server is offline. + * From the first run on, this task will keep a local copy of the user repository, so login can happen when the server + * is offline. */ public class UpdateUserAdminTask implements Runnable, ManagedService { /** @@ -68,14 +68,15 @@ public class UpdateUserAdminTask impleme private BackupRepository m_backup; private String m_repoFilter; private File m_properties; - + /** * Called by Dependency Manager upon initialization of this component. *

* Due to the dependency on the configuration; the {@link #updated(Dictionary)} method is already called! *

* - * @param comp this component, cannot be null. + * @param comp + * this component, cannot be null. */ public void init(Component comp) { final DependencyManager dm = comp.getDependencyManager(); @@ -89,7 +90,8 @@ public class UpdateUserAdminTask impleme } /** - * Checks whether there are updates to the remote repository, and if so, updates the users' backend with its contents. + * Checks whether there are updates to the remote repository, and if so, updates the users' backend with its + * contents. * * @see java.lang.Runnable#run() */ @@ -101,23 +103,32 @@ public class UpdateUserAdminTask impleme saveVersion(m_properties, m_repo.getMostRecentVersion()); } } + catch (ConnectException e) { + // ACE-199: log only a single line, instead of a complete stack trace... + m_log.log(LogService.LOG_WARNING, "Failed to update UserAdmin repository. Connection refused (is the server down?!)"); + } catch (IOException e) { // If anything went wrong, this means the remote repository is not available; // this also means the UserAdmin is left undisturbed. - m_log.log(LogService.LOG_WARNING, "Error running update UserAdmin task.", e); + m_log.log(LogService.LOG_WARNING, "Failed to update UserAdmin repository.", e); } } /** * Called by Dependency Manager upon starting of this component. * - * @param comp this component, cannot be null. + * @param comp + * this component, cannot be null. */ public void start(Component comp) { try { // Try to read the server data m_configurator.setUsers(m_repo.checkout(true)); } + catch (ConnectException e) { + // ACE-199: log only a single line, instead of a complete stack trace... + m_log.log(LogService.LOG_WARNING, "Failed to update UserAdmin repository. Connection refused (is the server down?!)"); + } catch (IOException e) { try { m_log.log(LogService.LOG_DEBUG, "UpdateUserAdminTask failed to load remote data; falling back to local data."); @@ -147,9 +158,9 @@ public class UpdateUserAdminTask impleme File local = getFile(fileRoot + "local"); File backup = getFile(fileRoot + "backup"); m_backup = new FilebasedBackupRepository(local, backup); - + m_properties = getFile(fileRoot + "properties"); - + m_repoFilter = "(&(customer=" + customer + ")(name=" + name + "))"; } } @@ -157,7 +168,8 @@ public class UpdateUserAdminTask impleme /** * Creates the cached repository when given a remote repository. * - * @param remoteRepo the remote repository to add, cannot be null. + * @param remoteRepo + * the remote repository to add, cannot be null. */ final void addRepo(Repository remoteRepo) { m_repo = new CachedRepositoryImpl(remoteRepo, m_backup, loadVersion(m_properties)); @@ -166,7 +178,8 @@ public class UpdateUserAdminTask impleme /** * Removes the cached repository when given a remote repository. * - * @param remoteRepo the remote repository to remove, cannot be null. + * @param remoteRepo + * the remote repository to remove, cannot be null. */ final void removeRepo(Repository remoteRepo) { m_repo = null; @@ -218,4 +231,4 @@ public class UpdateUserAdminTask impleme m_log.log(LogService.LOG_ERROR, "UpdateUserAdminTask failed to save local version number."); } } -} \ No newline at end of file +}