myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sc...@apache.org
Subject svn commit: r168205 - in /myfaces/trunk/src: components/org/apache/myfaces/custom/tree2/TreeModel.java share/org/apache/myfaces/util/ClassUtils.java
Date Wed, 04 May 2005 22:59:22 GMT
Author: schof
Date: Wed May  4 15:59:21 2005
New Revision: 168205

URL: http://svn.apache.org/viewcvs?rev=168205&view=rev
Log:
Added new method for determining class loader

Modified:
    myfaces/trunk/src/components/org/apache/myfaces/custom/tree2/TreeModel.java
    myfaces/trunk/src/share/org/apache/myfaces/util/ClassUtils.java

Modified: myfaces/trunk/src/components/org/apache/myfaces/custom/tree2/TreeModel.java
URL: http://svn.apache.org/viewcvs/myfaces/trunk/src/components/org/apache/myfaces/custom/tree2/TreeModel.java?rev=168205&r1=168204&r2=168205&view=diff
==============================================================================
--- myfaces/trunk/src/components/org/apache/myfaces/custom/tree2/TreeModel.java (original)
+++ myfaces/trunk/src/components/org/apache/myfaces/custom/tree2/TreeModel.java Wed May  4
15:59:21 2005
@@ -143,15 +143,8 @@
             int nodeIndex = Integer.parseInt(st.nextToken());
             sb.append(nodeIndex);
 
-            try
-            {
-                node = (TreeNode)node.getChildren().get(nodeIndex);
-            }
-            catch (IndexOutOfBoundsException e)
-            {
-                String msg = "Node with id " + sb.toString() + ". Failed to parse " + nodeId;
-                throw new IllegalArgumentException(msg);
-            }
+            // don't worry about invalid index, that exception will be caught later and dealt
with
+            node = (TreeNode)node.getChildren().get(nodeIndex);
             sb.append(SEPARATOR);
         }
 

Modified: myfaces/trunk/src/share/org/apache/myfaces/util/ClassUtils.java
URL: http://svn.apache.org/viewcvs/myfaces/trunk/src/share/org/apache/myfaces/util/ClassUtils.java?rev=168205&r1=168204&r2=168205&view=diff
==============================================================================
--- myfaces/trunk/src/share/org/apache/myfaces/util/ClassUtils.java (original)
+++ myfaces/trunk/src/share/org/apache/myfaces/util/ClassUtils.java Wed May  4 15:59:21 2005
@@ -321,4 +321,21 @@
             throw new FacesException(message, e);
         }
     }
+
+    /**
+     * Gets the ClassLoader associated with the current thread.  Returns the class loader
associated with 
+     * the specified default object if no context loader is associated with the current thread.
+     * 
+     * @param defaultObject The default object to use to determine the class loader (if none
associated with current thread.)
+     * @return ClassLoader
+     */    
+    protected static ClassLoader getCurrentLoader(Object defaultObject)
+    {
+        ClassLoader loader = Thread.currentThread().getContextClassLoader();
+        if(loader == null)
+        {
+            loader = defaultObject.getClass().getClassLoader();
+        }
+        return loader;
+    }
 }



Mime
View raw message