sonatype/nexus — pull request #858 by cstamas (2013-05-14 08:54:14+00:00)
Title: [2.6] NEXUS-5704: 500 Internal Server Error when "If-None-Match" in header

Restlet 1.1 is very picky (and have a bug) how it handles ETags: it requires "by the book" how HTTP request formats ETags, they must be quoted. In other case, the header presence is detected, but unexpected `null` value is returned for tag value. This causes NPE in Nexus code too.

"Vanilla" Nexus (even without this change) _works properly_ for HTTP conditional GETs using `if-modified-since` headers, as shown in the linked issue. Still, NPE does happens in Nexus codebase, and this pull fixes it.

This pull merely fixes that single point of NPE by adding nullcheck, and also simplifies the `renderStorageFileItem()` method, but DOES NOT fix the Restlet library in this manner. Nexus will still NPE if HTTP request carries badly formatted ETag. After this change, badly formatted ETags will continue to cause 500 Internal Server Error responses, but this time deeply in Restlet code (where also Tag inspection is tried, without nullchecks around it).

Relates to issue
https://issues.sonatype.org/browse/NEXUS-5704