ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clinton Begin <clinton.be...@gmail.com>
Subject Re: Problem using a "url" based properties file
Date Fri, 11 Feb 2005 18:36:50 GMT
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
<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.
> ---------------------------------------------------------------------------
> 
>

Mime
View raw message