Return-Path: X-Original-To: apmail-camel-issues-archive@minotaur.apache.org Delivered-To: apmail-camel-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0D89911F20 for ; Wed, 27 Aug 2014 07:46:58 +0000 (UTC) Received: (qmail 89534 invoked by uid 500); 27 Aug 2014 07:46:57 -0000 Delivered-To: apmail-camel-issues-archive@camel.apache.org Received: (qmail 89498 invoked by uid 500); 27 Aug 2014 07:46:57 -0000 Mailing-List: contact issues-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list issues@camel.apache.org Received: (qmail 89489 invoked by uid 99); 27 Aug 2014 07:46:57 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Aug 2014 07:46:57 +0000 Date: Wed, 27 Aug 2014 07:46:57 +0000 (UTC) From: "Raghavan (JIRA)" To: issues@camel.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CAMEL-7752) filter with camel sftp is returnin NullPointerException 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/CAMEL-7752?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14111996#comment-14111996 ] Raghavan commented on CAMEL-7752: --------------------------------- Thanks Claus. Using getFileNameOnly() fixed the issue related to files However with filter in place, even with recursive=true, the files under subDirectories are not read in the filter. For e.g. /home/user1 > a.xml [processed successfully] > b.txt [ignored as expected] > folder1/c.xml [not read] > folder2/d.xml [not read] > filter with camel sftp is returnin NullPointerException > ------------------------------------------------------- > > Key: CAMEL-7752 > URL: https://issues.apache.org/jira/browse/CAMEL-7752 > Project: Camel > Issue Type: Bug > Components: camel-ftp > Affects Versions: 2.10.0 > Environment: Windows 7, RedHat Linux 5.x > Reporter: Raghavan > Labels: GenericFile, camel-ftp, filter, ftp > > We are testing camel sftp with filter options to restrict the source files using a pattern. > We get a NullPointerException when try to use a filter (CustomFilter) > Attached herewith the code snippet > [[CodeSnippet]] > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camel="http://camel.apache.org/schema/spring" > xsi:schemaLocation=" > http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd > http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> > > > > > > > > > > > > > > > FileFilter src: > public class FileFilter implements GenericFileFilter { > private static Logger logger = LoggerFactory.getLogger(FileFilter.class); > > /* The purpose of this method is to apply a custom filter based on file pattern > * This enables the ftp adapter to filter files based on the criteria implemented here > * (non-Javadoc) > * @see org.apache.camel.component.file.GenericFileFilter#accept(org.apache.camel.component.file.GenericFile) > */ > public boolean accept(GenericFile file) { > > if(logger.isDebugEnabled()) { > logger.debug("IsDirectory=" + file.isDirectory()); > logger.debug("FileName="+file.getFileName()); > } > > if(file !=null && file.getFileName() != null) { > return file.getFileName().endsWith(".xml"); > } > else { > return false; > } > } > } > [[/CodeSnippet]] -- This message was sent by Atlassian JIRA (v6.2#6252)