]> source.dussan.org Git - archiva.git/commitdiff
o fixed npe in dependency tree on artifact browse by adding the nodevar attribute...
authorMaria Odea B. Ching <oching@apache.org>
Tue, 21 Jun 2011 09:21:10 +0000 (09:21 +0000)
committerMaria Odea B. Ching <oching@apache.org>
Tue, 21 Jun 2011 09:21:10 +0000 (09:21 +0000)
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

archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DependencyTree.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DependencyTreeTag.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/PlexusTagUtil.java [deleted file]
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/dependencyTree.jspf

index fadd061a474701ef03653f1c3628c32b858051a8..0c8c7aa749fd6ed1bac43fa98d6e35bba365a3d8 100644 (file)
@@ -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 );
index bb29ba0aa8ae25addf5df9ec201609f03c142ccd..d60d3b5b5cf926cc353517b778b66ec01c685c6e 100644 (file)
@@ -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 (file)
index 0eaf6b5..0000000
+++ /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 );
-
-
-    }
-}
index 54b4b1e197df8670d532c007d84b0a4387acb33d..9e82dd5b43efd6c959a6aa3d71a560536428521f 100644 (file)
@@ -22,7 +22,7 @@
 <%@ taglib prefix="archiva" uri="/WEB-INF/taglib.tld" %>
 
 <archiva:dependency-tree groupId="${groupId}" artifactId="${artifactId}" version="${version}"
-                         modelVersion="${model.version}">
+                         modelVersion="${model.version}" nodevar="node">
   <my:showArtifactLink groupId="${node.groupId}" artifactId="${node.artifactId}"
                        version="${node.version}"/>
 </archiva:dependency-tree>