From: Maria Odea B. Ching Date: Tue, 21 Jun 2011 09:21:10 +0000 (+0000) Subject: o fixed npe in dependency tree on artifact browse by adding the nodevar attribute... X-Git-Tag: archiva-1.4-M1~591 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c8617ac77e8f4fae9f9682feaa3a7c14edddd053;p=archiva.git o fixed npe in dependency tree on artifact browse by adding the nodevar attribute dependencytree page o removed PlexusTagUtil and lookup the dependency tree component in the tag using the webappcontext git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1137917 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DependencyTree.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DependencyTree.java index fadd061a4..0c8c7aa74 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DependencyTree.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DependencyTree.java @@ -44,7 +44,7 @@ import java.util.List; * @version $Id$ * plexus.component role="org.apache.maven.archiva.web.tags.DependencyTree" */ -@Service +@Service( "dependencyTree" ) public class DependencyTree { private Logger log = LoggerFactory.getLogger( DependencyTree.class ); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DependencyTreeTag.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DependencyTreeTag.java index bb29ba0aa..d60d3b5b5 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DependencyTreeTag.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DependencyTreeTag.java @@ -19,13 +19,14 @@ package org.apache.maven.archiva.web.tags; * under the License. */ -import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.IteratorUtils; import org.apache.commons.lang.StringUtils; import org.apache.maven.archiva.common.ArchivaException; import org.apache.maven.archiva.web.tags.DependencyTree.TreeEntry; -import org.codehaus.plexus.component.repository.exception.ComponentLookupException; +import org.springframework.beans.BeansException; +import org.springframework.web.context.WebApplicationContext; +import org.springframework.web.context.support.WebApplicationContextUtils; import java.io.IOException; import java.io.PrintWriter; @@ -113,9 +114,12 @@ public class DependencyTreeTag DependencyTree deptree; try { - deptree = (DependencyTree) PlexusTagUtil.lookup( pageContext, DependencyTree.class ); + WebApplicationContext webApplicationContext = + WebApplicationContextUtils.getRequiredWebApplicationContext( pageContext.getServletContext() ); + + deptree = ( DependencyTree ) webApplicationContext.getBean( "dependencyTree" ); } - catch ( PlexusSisuBridgeException e ) + catch ( BeansException e ) { throw new JspException( "Unable to lookup DependencyTree: " + e.getMessage(), e ); } diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/PlexusTagUtil.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/PlexusTagUtil.java deleted file mode 100644 index 0eaf6b5df..000000000 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/PlexusTagUtil.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.apache.maven.archiva.web.tags; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; -import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException; -import org.springframework.web.context.WebApplicationContext; -import org.springframework.web.context.support.WebApplicationContextUtils; - -import javax.servlet.ServletContext; -import javax.servlet.jsp.PageContext; - -/** - * PlexusTagUtil - * - * @version $Id$ - */ -public class PlexusTagUtil -{ - public static Object lookup( PageContext pageContext, Class clazz ) - throws PlexusSisuBridgeException - { - return getContainer( pageContext ).lookup( clazz ); - } - - private static PlexusSisuBridge getContainer( PageContext pageContext ) - { - ServletContext servletContext = pageContext.getServletContext(); - - WebApplicationContext webApplicationContext = - WebApplicationContextUtils.getRequiredWebApplicationContext( pageContext.getServletContext() ); - - return webApplicationContext.getBean( PlexusSisuBridge.class ); - - - } -} diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/dependencyTree.jspf b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/dependencyTree.jspf index 54b4b1e19..9e82dd5b4 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/dependencyTree.jspf +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/dependencyTree.jspf @@ -22,7 +22,7 @@ <%@ taglib prefix="archiva" uri="/WEB-INF/taglib.tld" %> + modelVersion="${model.version}" nodevar="node">