o MAVEN-320: Make it handle slightly less conformant hrefs. Feels a bit dirty to me.
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@113096 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a1b8c11a2e
commit
ed1d38ef2e
@ -64,7 +64,7 @@ import org.dom4j.tree.DefaultElement;
|
||||
|
||||
/**
|
||||
* @author <a href="bwalding@jakarta.org">Ben Walding</a>
|
||||
* @version $Id: NavBean.java,v 1.3 2003/02/18 14:21:35 bwalding Exp $
|
||||
* @version $Id: NavBean.java,v 1.4 2003/03/10 14:18:41 bwalding Exp $
|
||||
*/
|
||||
public class NavBean
|
||||
{
|
||||
@ -128,8 +128,17 @@ public class NavBean
|
||||
return false;
|
||||
}
|
||||
|
||||
String xpath = ".//item[@href='" + location + "']";
|
||||
//System.out.println(elem.asXML());
|
||||
String xpath;
|
||||
if (location.startsWith("/") || location.startsWith(".")) {
|
||||
xpath = ".//item[@href='" + location + "']";
|
||||
|
||||
} else {
|
||||
xpath = ".//item[@href='/" + location + "']";
|
||||
|
||||
}
|
||||
|
||||
|
||||
List l = elem.selectNodes(xpath);
|
||||
|
||||
if (l.size() != 0)
|
||||
@ -167,6 +176,9 @@ public class NavBean
|
||||
*/
|
||||
public void setLocation(String location)
|
||||
{
|
||||
if (!location.startsWith("/"))
|
||||
location = "/" + location;
|
||||
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user