You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltaspike.apache.org by jo...@apache.org on 2013/05/27 02:56:50 UTC

git commit: DELTASPIKE-339 JNDI config source should not be scannable at this time. Also cleaned up exception handling.

Updated Branches:
  refs/heads/master 007474b2d -> b2394cb03


DELTASPIKE-339 JNDI config source should not be scannable at this time.  Also cleaned up exception handling.


Project: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/commit/b2394cb0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/tree/b2394cb0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/diff/b2394cb0

Branch: refs/heads/master
Commit: b2394cb03e390075aa92b65f8b0f4247b27ecd32
Parents: 007474b
Author: John D. Ament <jo...@gmail.com>
Authored: Sun May 26 20:55:59 2013 -0400
Committer: John D. Ament <jo...@gmail.com>
Committed: Sun May 26 20:55:59 2013 -0400

----------------------------------------------------------------------
 .../core/impl/config/LocalJndiConfigSource.java    |    2 +-
 .../deltaspike/core/impl/util/JndiUtils.java       |   22 ++++++++++++---
 2 files changed, 19 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/b2394cb0/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/config/LocalJndiConfigSource.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/config/LocalJndiConfigSource.java b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/config/LocalJndiConfigSource.java
index c847d6b..bcc4b20 100644
--- a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/config/LocalJndiConfigSource.java
+++ b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/config/LocalJndiConfigSource.java
@@ -89,6 +89,6 @@ class LocalJndiConfigSource extends BaseConfigSource
     @Override
     public boolean isScannable()
     {
-        return true;
+        return false;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/b2394cb0/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/util/JndiUtils.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/util/JndiUtils.java b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/util/JndiUtils.java
index 9301da5..968e979 100644
--- a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/util/JndiUtils.java
+++ b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/util/JndiUtils.java
@@ -183,14 +183,28 @@ public abstract class JndiUtils
             NamingEnumeration<NameClassPair> enumeration = initialContext.list(name);
             while (enumeration.hasMoreElements())
             {
-                NameClassPair binding = enumeration.nextElement();
-                Name bindingName = nameParser.parse(name).add(binding.getName());
-                result.put(binding.getName(), lookup(bindingName, type));
+                try
+                {
+                    NameClassPair binding = enumeration.nextElement();
+                    Name bindingName = nameParser.parse(name).add(binding.getName());                
+                    result.put(binding.getName(), lookup(bindingName, type));
+                }
+                catch (NamingException e)
+                {
+                    if (LOG.isLoggable(Level.FINEST))
+                    {
+                        // this is expected if there is no entry in JNDI for the requested name or type
+                        // so finest level is ok, if devs want to see it they can enable this logger level.
+                        LOG.log(Level.FINEST, "InitialContext#list failed!", e);
+                    }
+                }
             }
         }
         catch (NamingException e)
         {
-            // this is expected if there is no entry in JNDI for the requested name or type
+            // this is fine at this point, since the individual lines will be caught currently.
+            LOG.log(Level.WARNING,"Problem reading the name of the JNDI location " + name
+                + " or failuring listing pairs.",e);
         }
         return result;
     }