Return-Path: Delivered-To: apmail-excalibur-user-archive@www.apache.org Received: (qmail 60529 invoked from network); 28 Jan 2008 18:36:11 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 28 Jan 2008 18:36:11 -0000 Received: (qmail 56506 invoked by uid 500); 28 Jan 2008 18:36:00 -0000 Delivered-To: apmail-excalibur-user-archive@excalibur.apache.org Received: (qmail 56460 invoked by uid 500); 28 Jan 2008 18:36:00 -0000 Mailing-List: contact user-help@excalibur.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: "Excalibur Users List" Reply-To: "Excalibur Users List" Delivered-To: mailing list user@excalibur.apache.org Received: (qmail 56449 invoked by uid 99); 28 Jan 2008 18:36:00 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Jan 2008 10:36:00 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of solprovider@gmail.com designates 72.14.214.239 as permitted sender) Received: from [72.14.214.239] (HELO hu-out-0506.google.com) (72.14.214.239) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Jan 2008 18:35:33 +0000 Received: by hu-out-0506.google.com with SMTP id 31so1065043huc.14 for ; Mon, 28 Jan 2008 10:35:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; bh=h0onQG++1WLR97jSIhjFIXX5v6kZfRWorx+RQNE2BR0=; b=QoWZp6bhcKUtctTlgU0jdzSwOL429quxdRZruaBd/E/L+jzE6n2YJ/67BqqDLFD31V3wgoyUobfZeG3aV08OA71kkR/C2tUNqVDGJ0kumGZRQoEuBax/6LfDzsFzoT2ScHJftNTKouK9KDZAvZRoCUw0Mr+kl7w32D8PF3C5mL4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=N2p5dTrjLY9SGArOFSQg5iBJr2up/MKXorH5/V+bnTDeZf48PfY8l3vfAR0r8Z62ZdIR3RAj6Ff5zRDQcsCE9/hp78i/ziEqsdLswh6PVZIn78lR/lU3Ld4VdXdmEX2rS+oFeLJl6RYLZZGsPuDD8PVTHYpe+KoE6yjZWIvM+o8= Received: by 10.86.99.9 with SMTP id w9mr5492724fgb.58.1201545338008; Mon, 28 Jan 2008 10:35:38 -0800 (PST) Received: by 10.86.31.7 with HTTP; Mon, 28 Jan 2008 10:35:37 -0800 (PST) Message-ID: Date: Mon, 28 Jan 2008 13:35:37 -0500 From: solprovider@apache.org Sender: solprovider@gmail.com To: "Excalibur Users List" Subject: Re: Bug in FileSource? In-Reply-To: <479DA84F.9070609@apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <479DA84F.9070609@apache.org> X-Google-Sender-Auth: d3e8006f0fd33c56 X-Virus-Checked: Checked by ClamAV on apache.org [Using a friend's computer.] Bug is obvious: public FileSource(String uri) throws SourceException, MalformedURLException { int pos = SourceUtil.indexOfSchemeColon(uri); if (pos == -1) { throw new MalformedURLException("Invalid URI : " + uri); } String scheme = uri.substring(0, pos); String fileName = uri.substring(pos + 1); fileName = SourceUtil.decodePath(fileName); this.init(scheme, new File(fileName)); } Anything before the first colon is treated as the protocol. Are single letter schemes illegal? Or is there a "not a real OS" flag to check for a "drive letter"? This code will also fail for real operating systems because it assumes the String is a URI. new FileSource("/var/myfile") will throw an Exception. I misunderstood the API doc: Builds a FileSource given an URI, which doesn't necessarily have to start with "file:" That seems to imply a FileSource can be created from a filepath string. Guess it means a FileSource can be created from other protocols. The API doc needs to explicitly exclude filepaths. I am surprised a FileSource cannot be created from a filepath String. That seems like the most common operation. I can fix my code with a simple "file://" prefix. solprovider On Jan 28, 2008 5:02 AM, Carsten Ziegeler wrote: > this seems to be a bug - can you file a bug please? > > Thanks > Carsten > > > solprovider@apache.org wrote: > > FileSource incorrectly repeats the drive specification on Windows. > > This causes errors retrieving files relative to the FileSource. > > > > We are receiving this error using excalibur-sourceresolve-2.2.3.jar > > (from Cocoon-2.1.11) > > cause: java.io.FileNotFoundException: F:\F:\mydirectory\page2xhtml.xsl > > (The filename, directory name, or volume label syntax is incorrect) > > org.apache.cocoon.ProcessingException: Unable to get transformer > > handler for F:///F:/myDirectory/page2xhtml-homepage.xsl > > > > FILE: page2xhtml-homepage.xsl (relatively imports page2xhtml.xsl.) > > > > > > > > > > > > JAVA TEST: > > import java.io.File; > > import org.apache.excalibur.source.Source; > > import org.apache.excalibur.source.impl.FileSource; > > public class mySourceFactory implements SourceFactory{ > > public Source getSource(String location, Map parameters) throws > > IOException, MalformedURLException { > > File file = new File(myDirectory, location); > > if(!file.exists()) throw new IOException("Bad file."); > > filepath = file.getAbsolutePath(); //Original assignment is > > print(filepath); \\ "F:\myDirectory\myfile.xsl" > > FileSource source = new FileSource(filepath); > > print(source.getURI()); \\"F:///F:/myDirectory/myfile.xslt" > > return source; > > } > > } > > > > Are we doing something wrong? Does FileSource.getURI() contain a bug? > > What is the workaround? > > > > TIA, > > solprovider > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: user-unsubscribe@excalibur.apache.org > > For additional commands, e-mail: user-help@excalibur.apache.org > > > > > > > -- > Carsten Ziegeler > cziegeler@apache.org > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@excalibur.apache.org > For additional commands, e-mail: user-help@excalibur.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@excalibur.apache.org For additional commands, e-mail: user-help@excalibur.apache.org