Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 316597

Summary: Useless null check in org.eclipse.jetty.util.resource.Resource.defangURI()
Product: [RT] Jetty Reporter: Richard Hash <richard.hash>
Component: serverAssignee: Greg Wilkins <gregw>
Status: RESOLVED FIXED QA Contact:
Severity: trivial    
Priority: P3 CC: jetty-inbox, mgorovoy
Version: 7.1.3   
Target Milestone: 7.2.0.RC0   
Hardware: All   
OS: All   
Whiteboard:

Description Richard Hash CLA 2010-06-11 08:38:49 EDT
Build Identifier: Build id: M20090917-0800

In org.eclipse.jetty.util.resource.Resource(), the following code might want to be a little less certain about buf being null:

    private static String defangURI(String raw) 
    {
        StringBuffer buf = null;
        
        if (buf==null)
        {

Reproducible: Always

Steps to Reproduce:
1. Open org.eclipse.jetty.util.resource.Resource.defangURI()
2. Look at code.
3. Slap head and say doh!
Comment 1 Greg Wilkins CLA 2010-06-15 00:20:56 EDT
defang URI!   who even wrote that method!!!!  (will probably turn out to be me!)
Comment 2 Greg Wilkins CLA 2010-06-15 00:35:21 EDT
DOH!
it was me.  Fixed and given a better method name: hrefEncodeURI
r2003
Comment 3 Michael Gorovoy CLA 2010-06-17 13:36:36 EDT
Marking as resolved.