From 871f73d409d039cc32bd2b4c23c794547f8f7a9f Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Tue, 15 Jun 2010 04:34:49 +0000 Subject: [PATCH] 316597 Removed null check and fixed name in Resource#hrefEncodeURI git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2003 7e9141cc-0065-0410-87d8-b60c137991c4 --- VERSION.txt | 1 + .../eclipse/jetty/util/resource/Resource.java | 39 +++++++++---------- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index 1ed025e9910..25662c733ca 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -2,6 +2,7 @@ jetty-7.1.5-SNAPSHOT + 311550 The WebAppProvider should allow setTempDirectory + 316449 Websocket disconnect fix + 316584 Exception on startup if temp path has spaces and extractWAR=false + + 316597 Removed null check and fixed name in Resource#hrefEncodeURI jetty-7.1.4.v20100610 + 298551 SslSocketConnector does not need keystore stream diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/resource/Resource.java b/jetty-util/src/main/java/org/eclipse/jetty/util/resource/Resource.java index 16d66825b17..4d860a4fb94 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/resource/Resource.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/resource/Resource.java @@ -489,7 +489,7 @@ public abstract class Resource implements Serializable buf.append("\">Parent Directory\n"); } - String defangedBase = defangURI(base); + String encodedBase = hrefEncodeURI(base); DateFormat dfmt=DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM); @@ -498,7 +498,7 @@ public abstract class Resource implements Serializable Resource item = addPath(ls[i]); buf.append("\n">Link * * The above example would parse incorrectly on various browsers as the "<" or '"' characters * would end the href attribute value string prematurely. * - * @param raw the raw text to defang. + * @param raw the raw text to encode. * @return the defanged text. */ - private static String defangURI(String raw) + private static String hrefEncodeURI(String raw) { StringBuffer buf = null; - - if (buf==null) + + for (int i=0;i': - buf=new StringBuffer(raw.length()<<1); - break; - } + case '\'': + case '"': + case '<': + case '>': + buf=new StringBuffer(raw.length()<<1); + break; } - if (buf==null) - return raw; } - + if (buf==null) + return raw; + for (int i=0;i