Permalink
Browse files

RESTEASY-1019: fixed parsing of a weak EntityTag

  • Loading branch information...
1 parent 3ddbc5b commit a1f44f0fb0e496030f1e41a72ac558cd90994a4c @ja-fra committed Feb 19, 2014
@@ -12,6 +12,12 @@
public EntityTag fromString(String value) throws IllegalArgumentException
{
if (value == null) throw new IllegalArgumentException("value of EntityTag is null");
+ boolean weakTag = false;
+ if (value.startsWith("W/"))
+ {
+ weakTag = true;
+ value = value.substring(2);
+ }
if (value.startsWith("\""))
{
value = value.substring(1);
@@ -20,11 +26,7 @@ public EntityTag fromString(String value) throws IllegalArgumentException
{
value = value.substring(0, value.length() - 1);
}
- if (value.startsWith("W/"))
- {
- return new EntityTag(value.substring(2), true);
- }
- return new EntityTag(value);
+ return new EntityTag(value, weakTag);
}
public String toString(EntityTag value)

0 comments on commit a1f44f0

Please sign in to comment.