Return-Path: X-Original-To: apmail-chemistry-commits-archive@www.apache.org Delivered-To: apmail-chemistry-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 CE67817E57 for ; Tue, 7 Oct 2014 14:58:11 +0000 (UTC) Received: (qmail 14141 invoked by uid 500); 7 Oct 2014 14:58:11 -0000 Delivered-To: apmail-chemistry-commits-archive@chemistry.apache.org Received: (qmail 14096 invoked by uid 500); 7 Oct 2014 14:58:11 -0000 Mailing-List: contact commits-help@chemistry.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@chemistry.apache.org Delivered-To: mailing list commits@chemistry.apache.org Received: (qmail 14085 invoked by uid 99); 7 Oct 2014 14:58:11 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Oct 2014 14:58:11 +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, 07 Oct 2014 14:57:48 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 752C42388868; Tue, 7 Oct 2014 14:57:47 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1629905 - /chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConverter.java Date: Tue, 07 Oct 2014 14:57:47 -0000 To: commits@chemistry.apache.org From: fmui@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20141007145747.752C42388868@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: fmui Date: Tue Oct 7 14:57:47 2014 New Revision: 1629905 URL: http://svn.apache.org/r1629905 Log: AtomPub client: added workaround for repositories that send invalid property values Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConverter.java Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConverter.java URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConverter.java?rev=1629905&r1=1629904&r2=1629905&view=diff ============================================================================== --- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConverter.java (original) +++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConverter.java Tue Oct 7 14:57:47 2014 @@ -2151,7 +2151,14 @@ public final class XMLConverter { protected boolean read(XMLStreamReader parser, QName name, ChoiceImpl target) throws XMLStreamException { if (isCmisNamespace(name)) { if (isTag(name, TAG_PROPERTY_TYPE_CHOICE_VALUE)) { - addValue(parser, target); + try { + addValue(parser, target); + } catch (CmisInvalidArgumentException e) { + // a few repositories send invalid values here + if (LOG.isWarnEnabled()) { + LOG.warn("Found invalid choice value for choice entry \"{}\"!", target.getDisplayName(), e); + } + } return true; } @@ -2591,7 +2598,19 @@ public final class XMLConverter { protected boolean read(XMLStreamReader parser, QName name, T target) throws XMLStreamException { if (isCmisNamespace(name)) { if (isTag(name, TAG_PROPERTY_VALUE)) { - addValue(parser, target); + try { + addValue(parser, target); + } catch (CmisInvalidArgumentException e) { + // a few repositories send invalid values here + // for example, in some cases SharePoint sends an empty + // "value" tag instead of omitting the "value" tag to + // indicate a "not set" value + // -> being tolerant is better than breaking an + // application because of this + if (LOG.isWarnEnabled()) { + LOG.warn("Found invalid property value for property {}!", target.getId(), e); + } + } return true; } }