Return-Path: X-Original-To: apmail-chemistry-dev-archive@www.apache.org Delivered-To: apmail-chemistry-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id ED78518DF6 for ; Thu, 19 Nov 2015 08:07:11 +0000 (UTC) Received: (qmail 65769 invoked by uid 500); 19 Nov 2015 08:07:11 -0000 Delivered-To: apmail-chemistry-dev-archive@chemistry.apache.org Received: (qmail 65676 invoked by uid 500); 19 Nov 2015 08:07:11 -0000 Mailing-List: contact dev-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 dev@chemistry.apache.org Received: (qmail 65288 invoked by uid 99); 19 Nov 2015 08:07:11 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Nov 2015 08:07:11 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 025C52C0450 for ; Thu, 19 Nov 2015 08:07:11 +0000 (UTC) Date: Thu, 19 Nov 2015 08:07:11 +0000 (UTC) From: "Steven Li (JIRA)" To: dev@chemistry.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (CMIS-958) InMemory server failing CmisJS tests, cause found, patch suggested MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CMIS-958?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Steven Li updated CMIS-958: --------------------------- Description: The InMemory server is failing the test suites from the CmisJS project (https://github.com/agea/CmisJS), I traced it down to a somewhat straightforward bug in ObjectService.java (in package org.apache.chemistry.opencmis.server.impl.browser), around line 494, see below: {code} String changeToken = (changeTokens != null && changeTokens.size() > i ? changeTokens.get(i) : null); if (changeToken.length() == 0) { changeToken = null; } {code} The first statement would sometimes yields a "null" value, which is then used immediately as a valid object, resulting in NullPointerException when executing the test cases. A reasonable patch would be to change the 2nd line to: {code} if ( (changeToken!=null) && (changeToken.length()==0) ) { {code} Wondering if this makes sense to you all... was: The InMemory server is failing the test suites from the CmisJS project (https://github.com/agea/CmisJS), I traced it down to a somewhat straightforward bug in ObjectService.java (in package org.apache.chemistry.opencmis.server.impl.browser), around line 494, see below: {code} String changeToken = (changeTokens != null && changeTokens.size() > i ? changeTokens.get(i) : null); if (changeToken.length() == 0) { changeToken = null; } {code} The first statement would sometimes yields a "null" value, which is then used immediately always as valid object, resulting in NullPointerException. A reasonable patch would be to change the 2nd line to: {code} if ( (changeToken!=null) && (changeToken.length()==0) ) { {code} Wondering if this makes sense to you all... Summary: InMemory server failing CmisJS tests, cause found, patch suggested (was: InMemory failing CmisJS tests, cause found, patch suggested) > InMemory server failing CmisJS tests, cause found, patch suggested > ------------------------------------------------------------------ > > Key: CMIS-958 > URL: https://issues.apache.org/jira/browse/CMIS-958 > Project: Chemistry > Issue Type: Bug > Components: opencmis-server > Affects Versions: OpenCMIS 0.14.0 > Environment: CentOS 7.1 > Reporter: Steven Li > Original Estimate: 1h > Remaining Estimate: 1h > > The InMemory server is failing the test suites from the CmisJS project (https://github.com/agea/CmisJS), I traced it down to a somewhat straightforward bug in ObjectService.java (in package org.apache.chemistry.opencmis.server.impl.browser), around line 494, see below: > {code} > String changeToken = (changeTokens != null && changeTokens.size() > i ? changeTokens.get(i) : null); > if (changeToken.length() == 0) { > changeToken = null; > } > {code} > The first statement would sometimes yields a "null" value, which is then used immediately as a valid object, resulting in NullPointerException when executing the test cases. A reasonable patch would be to change the 2nd line to: > {code} > if ( (changeToken!=null) && (changeToken.length()==0) ) { > {code} > Wondering if this makes sense to you all... -- This message was sent by Atlassian JIRA (v6.3.4#6332)