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 8AD6D9B08 for ; Thu, 19 Apr 2012 18:37:24 +0000 (UTC) Received: (qmail 6770 invoked by uid 500); 19 Apr 2012 18:37:24 -0000 Delivered-To: apmail-chemistry-commits-archive@chemistry.apache.org Received: (qmail 6734 invoked by uid 500); 19 Apr 2012 18:37:24 -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 6724 invoked by uid 99); 19 Apr 2012 18:37:24 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Apr 2012 18:37:24 +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; Thu, 19 Apr 2012 18:37:22 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 062F7238897A; Thu, 19 Apr 2012 18:37:01 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1328072 - /chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/main/java/org/apache/chemistry/opencmis/client/mapper/PropertyMapperTika.java Date: Thu, 19 Apr 2012 18:37:00 -0000 To: commits@chemistry.apache.org From: jens@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120419183701.062F7238897A@eris.apache.org> Author: jens Date: Thu Apr 19 18:37:00 2012 New Revision: 1328072 URL: http://svn.apache.org/viewvc?rev=1328072&view=rev Log: add a workaround for a tika bug when parsing MP3 tags Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/main/java/org/apache/chemistry/opencmis/client/mapper/PropertyMapperTika.java Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/main/java/org/apache/chemistry/opencmis/client/mapper/PropertyMapperTika.java URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/main/java/org/apache/chemistry/opencmis/client/mapper/PropertyMapperTika.java?rev=1328072&r1=1328071&r2=1328072&view=diff ============================================================================== --- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/main/java/org/apache/chemistry/opencmis/client/mapper/PropertyMapperTika.java (original) +++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/main/java/org/apache/chemistry/opencmis/client/mapper/PropertyMapperTika.java Thu Apr 19 18:37:00 2012 @@ -63,18 +63,30 @@ public class PropertyMapperTika extends return propId; } - public Object convertValue(String key, PropertyDefinition propDef, final String strValue) { + public Object convertValue(String key, PropertyDefinition propDef, String strValue) { Object value = null; PropertyType pt = propDef.getPropertyType(); if (null == pt) value = null; - else { + else if (null != strValue && strValue.length() > 0) { + // Tika has a bug and sometimes fails to parse MP3 tags, then generates '\0' in String + // see https://issues.apache.org/jira/browse/TIKA-887 + int lastIllegalPos = -1; + for (int i=0; i= 0) + strValue = strValue.substring(lastIllegalPos+1); // use remaining part after illegal char + switch (pt) { case STRING: case HTML: case URI: case ID: + if (propDef.getCardinality() == Cardinality.SINGLE) value = strValue; else {