velocity-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nbu...@apache.org
Subject svn commit: r662992 - /velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/ImportTool.java
Date Wed, 04 Jun 2008 06:10:44 GMT
Author: nbubna
Date: Tue Jun  3 23:10:44 2008
New Revision: 662992

URL: http://svn.apache.org/viewvc?rev=662992&view=rev
Log:
have ImportTool.read() take Object (so i can pass a LinkTool instance directly)

Modified:
    velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/ImportTool.java

Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/ImportTool.java
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/ImportTool.java?rev=662992&r1=662991&r2=662992&view=diff
==============================================================================
--- velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/ImportTool.java (original)
+++ velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/ImportTool.java Tue
Jun  3 23:10:44 2008
@@ -53,18 +53,25 @@
      * @param url the URL to import
      * @return the URL as a string
      */
-    public String read(String url) {
-        try {
-            // check the URL
-            if (url == null || url.equals("")) {
-                LOG.warn("ImportTool : Import URL is null or empty");
-                return null;
-            }
-
+    public String read(Object obj) {
+        if (obj == null)
+        {
+            LOG.warn("ImportTool.read(): url is null!");
+            return null;
+        }
+        String url = String.valueOf(obj).trim();
+        if (url.length() == 0)
+        {
+            LOG.warn("ImportTool.read(): url is empty string!");
+            return null;
+        }
+        try
+        {
             return acquireString(url);
         }
-        catch (Exception ex) {
-            LOG.error("ImportTool : Exception while importing URL", ex);
+        catch (Exception ex)
+        {
+            LOG.error("ImportTool.read(): Exception while aquiring '"+url+"'", ex);
             return null;
         }
     }



Mime
View raw message