On 11/11/2013 05:48 PM, Marius Dumitru Florea wrote: > Hi devs, > > I just reported http://jira.xwiki.org/browse/XCOMMONS-494 . It seems > the following generates a NPE: > > $escapetool.url({ > 'foo': $null, > 'bar': ['one', $null, 'three'], > $null: 'value' > }) > > I see 3 possible results: > > (1) Skip null parameter key and value > > bar=one&bar=three > > (2) Use 'null' for both the key and the value > > foo=null&bar=one&bar=null&bar=three&null=value > > (3) Use empty string for null value > > foo=&bar=one&bar=&bar=three&null=value > > I'm going to implement (1) if no one is against it.
It is legal to have parameters without values, like ?foo&bar=baz, and this signifies that a parameter is present, although it's exact value is irrelevant, it's just a marker for something. So I'd say that a null value should output just the key. If that null is part of a longer list of values, is it important to represent each null? Possibly, if the presence of nulls in the array of values is meaningful. But back on the server, reading such a parameter outputs an empty string instead of null, so it's not idempotent; we'd be replacing nulls with empty strings. Anyway, an empty string is better than a "null" string which could actually mean something. A null key, on the other hand, looks like an error. Without the proper key, the value is not that valuable (pun intended). What's it supposed to represent? So a null key should be skipped (right now it's included in the output, and it uses "null" as the key name). So, in conclusion, I vote for: (4) foo&bar=one&bar&bar=three -- Sergiu Dumitriu http://purl.org/net/sergiu _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs

