seems fine for me. I've applied the patch and added a test to ensure works properly in revision 955502.
On Thu, Jun 17, 2010 at 2:19 AM, Josh Gordineer <[email protected]> wrote: > Thanks for the quick response, for the moment we'll just have a local > version of the 1.0-SNAPSHOT so we can apply our patch that was on a class > that ended up going away (Operation.java). > > The original issue is in the message below, let me know if this looks like > something that can make it into 1.1. > > --Josh > > > ----- Forwarded Message ---- > *From:* Nagesh Susarla <*[email protected]*> > *To:* *[email protected] > **Sent:* Thu, March 26, 2009 12:23:06 PM > *Subject:* i18n Template Neg operator impl > > > Hi, > > Firstly let me say that the URITemplate impl is great and works great for > us. > Recently I came across an issue with the -neg operator which seems to > deviates from the spec. The spec states the following: > > * > > http://bitworking.org/projects/URI-Templates/spec/draft-gregorio-uritemplate-02.txt > * > 3.3.2. The 'neg' operator > > If all of the variables are un-defined or empty then substitute the > value of arg, otherwise substitute the empty string. > > > Template t = new > Template("*http://cnn.com/{-neg|all|foo,bar}<http://cnn.com/%7B-neg%7Call%7Cfoo,bar%7D> > ";*); > Map m = new HashMap(); > m.put("foo", "value"); > String out = t.expand(m); > > out => *http://cnn.com/all > * > Note that the output returns "all" inspite of one of the variables being > declared. If I read correctly, it should return "*http://cnn.com*" instead > of "*http://cnn.com/all*" > Can you please confirm that this is a bug or point me to the correct spec? > > After debugging this a bit, it looks like this can be fixed with the > following diff (I'm looking at the sources from > abdera-i18n-1.0-20090105.215721-1-sources.jar) > > --- ./org/apache/abdera/i18n/templates/Operation.java 2008-12-19 > 12:54:26.000000000 -0800 > +++ ./patch/Operation.java 2009-03-25 17:39:18.000000000 -0700 > @@ -528,9 +528,9 @@ > public String evaluate(String var, String arg, Context context) { > String[] vardefs = var.split("\\s*,\\s*"); > for (String v : vardefs) { > - if (!isdefined(v,context)) return arg; > + if (isdefined(v,context)) return null; > } > - return null; > + return arg; > } > public void explain(String var, String arg, Appendable buf) throws > IOException { > buf.append("If ["); > > Let me know if you'd like me to file a bug. > > thanks, > Nagesh > > > ------ End of Forwarded Message > > On Wed, Jun 16, 2010 at 2:21 PM, ant elder <[email protected]> wrote: > > > On Wed, Jun 16, 2010 at 9:55 PM, Josh Gordineer <[email protected]> > > wrote: > > > Our project used to depend on the following location but I see that it > > has > > > been removed: > > > > > > > > > http://repository.apache.org/snapshots/org/apache/abdera/abdera-i18n/1.0-SNAPSHOT/abdera-i18n-1.0-SNAPSHOT.pom > > > > > > We had a patch for a piece of functionality that was not working as > > defined > > > by the URI templates (We've previously submitted a bug for this to be > > fixed > > > but doesn't look like it has been in 1.1 We had also asked for that to > be > > > fixed in the next release which does not look like it is fixed either - > I > > > can forward that info if you are interested). > > > > > > My question is why would the 1.0 snapshot be deleted which would force > > > people to upgrade to the latest (1.1) even though (such as in our case) > > > there are reasons why you would not want to upgrade. > > > > > > Thanks.. > > > Josh > > > > > > > I don't know for sure what happened but i do know that "they" do > > delete old snapshots sometimes, otherwise the snapshot repo would > > become enormous. So perhaps that one was just deleted as 1.0 has been > > release and the snapshot repo now has 1.1 snapshots. > > > > We're about to do a 1.1 release, i'd be very happy to try to get > > whatever fix or patch you have into that so you can depend on a > > reliable non-snapshot release - what is the JIRA for the bug you have > > reported? > > > > ...ant > > >
