You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by vg...@apache.org on 2005/09/28 21:19:24 UTC

svn commit: r292265 - /cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/modules/input/RealPathModule.java

Author: vgritsenko
Date: Wed Sep 28 12:19:18 2005
New Revision: 292265

URL: http://svn.apache.org/viewcvs?rev=292265&view=rev
Log:
<quote>
If this mapping cannot be performed (e.g. Cocoon is
running in a .war file), <code>null</code> will be returned.
</quote>

Modified:
    cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/modules/input/RealPathModule.java

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/modules/input/RealPathModule.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/modules/input/RealPathModule.java?rev=292265&r1=292264&r2=292265&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/modules/input/RealPathModule.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/modules/input/RealPathModule.java Wed Sep 28 12:19:18 2005
@@ -1,12 +1,12 @@
 /*
- * Copyright 1999-2004 The Apache Software Foundation.
- * 
+ * Copyright 1999-2005 The Apache Software Foundation.
+ *
  * Licensed 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.
@@ -19,11 +19,10 @@
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
 import org.apache.avalon.framework.thread.ThreadSafe;
+
 import org.apache.cocoon.environment.ObjectModelHelper;
 
 import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
 import java.util.Map;
 import java.util.Vector;
 
@@ -33,7 +32,7 @@
  * running in a .war file), <code>null</code> will be returned.
  *
  * @author <a href="mailto:jefft@apache.org">Jeff Turner</a>
- * @version CVS $Id$
+ * @version $Id$
  */
 
 /*
@@ -66,9 +65,13 @@
         returnNames = tmp;
     }
 
-    public Object getAttribute( String name, Configuration modeConf, Map objectModel ) throws ConfigurationException {
-
+    public Object getAttribute(String name, Configuration modeConf, Map objectModel)
+    throws ConfigurationException {
         String uri = ObjectModelHelper.getContext(objectModel).getRealPath(name);
+        if (uri == null) {
+            return null;
+        }
+
         int lastCharPos = uri.length() - 1;
         if (uri.charAt(lastCharPos) == '\\') {
             uri = uri.substring(0, lastCharPos);
@@ -76,19 +79,13 @@
         return uri;
     }
 
-
-    public Iterator getAttributeNames( Configuration modeConf, Map objectModel ) throws ConfigurationException {
-
+    public Iterator getAttributeNames(Configuration modeConf, Map objectModel)
+    throws ConfigurationException {
         return RealPathModule.returnNames.iterator();
     }
 
-
     public Object[] getAttributeValues( String name, Configuration modeConf, Map objectModel )
-        throws ConfigurationException {
-
-            List values = new LinkedList();
-            values.add( this.getAttribute(name, modeConf, objectModel) );
-
-            return values.toArray();
+    throws ConfigurationException {
+        return new Object[] { getAttribute(name, modeConf, objectModel) };
     }
 }