Return-Path: Mailing-List: contact ibatis-user-java-help@incubator.apache.org; run by ezmlm Delivered-To: mailing list ibatis-user-java@incubator.apache.org Received: (qmail 63115 invoked by uid 99); 11 Feb 2005 18:36:54 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=RCVD_BY_IP,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: domain of clinton.begin@gmail.com designates 64.233.184.196 as permitted sender) Received: from wproxy.gmail.com (HELO wproxy.gmail.com) (64.233.184.196) by apache.org (qpsmtpd/0.28) with ESMTP; Fri, 11 Feb 2005 10:36:53 -0800 Received: by wproxy.gmail.com with SMTP id 69so339401wra for ; Fri, 11 Feb 2005 10:36:51 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=o1Gsz6iVOX8PqvsjapXXzfPygngms3mTlLU8ewQpQMCZ37rKPcm3IAunxsaiN+suio7MwCXVbf6xHK1Ej/i79BT5Ebg4vEdUevrQb1dxigUdUThcymMrk+8YOjD2yF3xffkcMeDt1Qo43t749gIachltYoDaN+Wrjq2eWsLa+Ds= Received: by 10.54.26.20 with SMTP id 20mr50320wrz; Fri, 11 Feb 2005 10:36:51 -0800 (PST) Received: by 10.54.33.78 with HTTP; Fri, 11 Feb 2005 10:36:50 -0800 (PST) Message-ID: <16178eb1050211103639b53d15@mail.gmail.com> Date: Fri, 11 Feb 2005 11:36:50 -0700 From: Clinton Begin Reply-To: cbegin@ibatis.com To: ibatis-user-java@incubator.apache.org Subject: Re: Problem using a "url" based properties file In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: X-Virus-Checked: Checked Can you put this in JIRA please? That way it will be tracked and fixed. Cheers, Clinton On Fri, 11 Feb 2005 14:59:43 +0100, thijs.van.nieuwkerk@nl.abnamro.com wrote: > > > Hi, > > Instead of using a resource properties file I want to use a url based > properties file. I always get a MalFormedURLException when I use the url > properties files. I tested my url's in a simple java program and they are > fine. > > I think that there probably is a bug in the SqlMapConfigParser class. When > using a url for retrieving a properties file I get a > null pointer exception (in debug session). I looked into the ibatis code > and found following bug: > > if (resource != null) { > vars.errorCtx.setResource(resource); > props = Resources.getResourceAsProperties(resource); > } else if (url != null) { > vars.errorCtx.setResource(url); > =>> props = Resources.getUrlAsProperties(resource); <<== > > This can't be OK. resource is null when the code for the url is executed. > Maybe a copy paste error! > > I used both iBatis 2.0.8 and 2.0.9. In both version the same error occurrs. > > regards > Thijs van Nieuwkerk > > private void addGlobalPropNodelets() { > parser.addNodelet("/sqlMapConfig/properties", new Nodelet() { > public void process(Node node) throws Exception { > vars.errorCtx.setActivity("loading global properties"); > > Properties attributes = NodeletUtils.parseAttributes(node); > String resource = attributes.getProperty("resource"); > String url = attributes.getProperty("url"); > > try { > Properties props = null; > if (resource != null) { > vars.errorCtx.setResource(resource); > props = Resources.getResourceAsProperties(resource); > } else if (url != null) { > vars.errorCtx.setResource(url); > ==>> props = Resources.getUrlAsProperties(resource); <<== > } else { > throw new RuntimeException("The " + "properties" + " element > requires either a resource or a url attribute."); > } > > if (vars.properties == null) { > vars.properties = props; > } else { > props.putAll(vars.properties); > vars.properties = props; > } > } catch (Exception e) { > throw new RuntimeException("Error loading properties. Cause: " + > e); > } > } > }); > } > --------------------------------------------------------------------------- > This message (including any attachments) is confidential and may be > privileged. If you have received it by mistake please notify the sender by > return e-mail and delete this message from your system. Any unauthorised > use or dissemination of this message in whole or in part is strictly > prohibited. Please note that e-mails are susceptible to change. > ABN AMRO Bank N.V. (including its group companies) shall not be liable for > the improper or incomplete transmission of the information contained in > this communication nor for any delay in its receipt or damage to your > system. ABN AMRO Bank N.V. (or its group companies) does not guarantee that > the integrity of this communication has been maintained nor that this > communication is free of viruses, interceptions or interference. > --------------------------------------------------------------------------- > >