Return-Path: X-Original-To: apmail-syncope-commits-archive@www.apache.org Delivered-To: apmail-syncope-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 8F4A0E974 for ; Tue, 22 Jan 2013 15:21:27 +0000 (UTC) Received: (qmail 72482 invoked by uid 500); 22 Jan 2013 15:21:27 -0000 Delivered-To: apmail-syncope-commits-archive@syncope.apache.org Received: (qmail 72420 invoked by uid 500); 22 Jan 2013 15:21:26 -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 72393 invoked by uid 99); 22 Jan 2013 15:21:25 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Jan 2013 15:21:25 +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, 22 Jan 2013 15:21:21 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 091F223888CD; Tue, 22 Jan 2013 15:21:01 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1436993 - in /syncope/branches/1_0_X/core/src: main/java/org/apache/syncope/core/propagation/ test/java/org/apache/syncope/core/rest/ Date: Tue, 22 Jan 2013 15:21:00 -0000 To: commits@syncope.apache.org From: fmartelli@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130122152101.091F223888CD@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: fmartelli Date: Tue Jan 22 15:21:00 2013 New Revision: 1436993 URL: http://svn.apache.org/viewvc?rev=1436993&view=rev Log: SYNCOPE-279 - little refactoring Modified: syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/propagation/AsyncConnectorFacade.java syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/propagation/ConnectorFacadeProxy.java syncope/branches/1_0_X/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java Modified: syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/propagation/AsyncConnectorFacade.java URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/propagation/AsyncConnectorFacade.java?rev=1436993&r1=1436992&r2=1436993&view=diff ============================================================================== --- syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/propagation/AsyncConnectorFacade.java (original) +++ syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/propagation/AsyncConnectorFacade.java Tue Jan 22 15:21:00 2013 @@ -147,12 +147,11 @@ public class AsyncConnectorFacade { Attribute attribute = null; - try { - final ConnectorObject object = connector.getObject(objectClass, uid, options); - attribute = object.getAttributeByName(attributeName); - } catch (NullPointerException e) { - // ignore exception + final ConnectorObject object = connector.getObject(objectClass, uid, options); + if (object == null) { LOG.debug("Object for '{}' not found", uid.getUidValue()); + } else { + attribute = object.getAttributeByName(attributeName); } return new AsyncResult(attribute); @@ -167,15 +166,14 @@ public class AsyncConnectorFacade { final Set attributes = new HashSet(); - try { - final ConnectorObject object = connector.getObject(objectClass, uid, options); + final ConnectorObject object = connector.getObject(objectClass, uid, options); + if (object == null) { + LOG.debug("Object for '{}' not found", uid.getUidValue()); + } else { for (String attribute : options.getAttributesToGet()) { attributes.add(object.getAttributeByName(attribute)); } - } catch (NullPointerException e) { - // ignore exception - LOG.debug("Object for '{}' not found", uid.getUidValue()); } return new AsyncResult>(attributes); Modified: syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/propagation/ConnectorFacadeProxy.java URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/propagation/ConnectorFacadeProxy.java?rev=1436993&r1=1436992&r2=1436993&view=diff ============================================================================== --- syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/propagation/ConnectorFacadeProxy.java (original) +++ syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/propagation/ConnectorFacadeProxy.java Tue Jan 22 15:21:00 2013 @@ -24,10 +24,8 @@ import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; -import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; -import java.util.logging.Level; import javassist.NotFoundException; import org.apache.syncope.core.persistence.beans.ConnInstance; import org.apache.syncope.core.persistence.beans.ExternalResource; @@ -487,17 +485,9 @@ public class ConnectorFacadeProxy { */ public Attribute getObjectAttribute(final ObjectClass objectClass, final Uid uid, final OperationOptions options, final String attributeName) { - - Attribute attribute = null; - try { - final Future future = - asyncFacade.getObjectAttribute(connector, objectClass, uid, options, attributeName); - - attribute = future.get(timeout, TimeUnit.SECONDS); - } catch (NullPointerException e) { - // ignore exception - LOG.debug("Object for '{}' not found", uid.getUidValue()); + return asyncFacade.getObjectAttribute(connector, objectClass, uid, options, attributeName). + get(timeout, TimeUnit.SECONDS); } catch (java.util.concurrent.TimeoutException e) { throw new TimeoutException("Request timeout"); } catch (Exception e) { @@ -508,8 +498,6 @@ public class ConnectorFacadeProxy { throw new IllegalArgumentException(e.getCause()); } } - - return attribute; } /** @@ -523,14 +511,8 @@ public class ConnectorFacadeProxy { public Set getObjectAttributes(final ObjectClass objectClass, final Uid uid, final OperationOptions options) { - final Set attributes = new HashSet(); - try { - final Future> future = asyncFacade.getObjectAttributes(connector, objectClass, uid, options); - attributes.addAll(future.get(timeout, TimeUnit.SECONDS)); - } catch (NullPointerException e) { - // ignore exception - LOG.debug("Object for '{}' not found", uid.getUidValue()); + return asyncFacade.getObjectAttributes(connector, objectClass, uid, options).get(timeout, TimeUnit.SECONDS); } catch (java.util.concurrent.TimeoutException e) { throw new TimeoutException("Request timeout"); } catch (Exception e) { @@ -541,8 +523,6 @@ public class ConnectorFacadeProxy { throw new IllegalArgumentException(e.getCause()); } } - - return attributes; } /** @@ -552,12 +532,8 @@ public class ConnectorFacadeProxy { * @return a list of schema names. */ public Set getSchema(final boolean showall) { - final Set resourceSchemaNames = new HashSet(); - - final Future> future = asyncFacade.getSchema(connector, showall); - try { - resourceSchemaNames.addAll(future.get(timeout, TimeUnit.SECONDS)); + return asyncFacade.getSchema(connector, showall).get(timeout, TimeUnit.SECONDS); } catch (java.util.concurrent.TimeoutException e) { throw new TimeoutException("Request timeout"); } catch (Exception e) { @@ -568,9 +544,6 @@ public class ConnectorFacadeProxy { throw new IllegalArgumentException(e.getCause()); } } - - return resourceSchemaNames; - } /** Modified: syncope/branches/1_0_X/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java?rev=1436993&r1=1436992&r2=1436993&view=diff ============================================================================== --- syncope/branches/1_0_X/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java (original) +++ syncope/branches/1_0_X/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java Tue Jan 22 15:21:00 2013 @@ -2210,7 +2210,7 @@ public class UserTestITCase extends Abst @Test(expected = SyncopeClientCompositeErrorException.class) public void issueSYNCOPE279() { - UserTO userTO = getSampleTO("syncope260@apache.org"); + UserTO userTO = getSampleTO("syncope279@apache.org"); userTO.getResources().clear(); userTO.addResource("ws-target-resource-3"); restTemplate.postForObject(BASE_URL + "user/create", userTO, UserTO.class);