This is an exported version of the JIRA issue tracker. Please use the Google Code site to open new tickets or report updates to these existing tickets. Feel free to contact the mailing list with any questions.

[SJN-56] If JNDI name begins with java:/ and if using a PropertiesContext, search will fail
Created: Wed, 20 Oct 2004 12:23:40 -0700 (PDT)  Updated: Sun, 6 Apr 2008 01:13:09 -0700 (PDT)

Status:Closed
Project:Simple-JNDI
Component/s:
Affects Version/s:0.9.1
Fix Version/s:

Type:BugPriority: Major
Reporter:NoneAssignee:Henri Yandell
Resolution:Obsolete 
Environment:


 Description   
When a JNDI name begins with "java:/" rather than "java:", JNDI will not find the corresponding properties file. There is a simple fix, appended here:



Index: c:/greening/dev/eclipse/simple-jndi/src/java/org/osjava/jndi/PropertiesContext.java
===================================================================
--- c:/greening/dev/eclipse/simple-jndi/src/java/org/osjava/jndi/PropertiesContext.java (revision 1286)
+++ c:/greening/dev/eclipse/simple-jndi/src/java/org/osjava/jndi/PropertiesContext.java (working copy)
@@ -210,17 +210,14 @@
      * java:/ is impossible to deal with on a Windows box.
      * Complete utter pain. Solution is to remove the :
      */
- private String handleJavaStandard(String key) {
+ private String handleJNDIPrefix(String key) {
         if(key != null) {
- if(key.equals("java:")) {
- return "java";
- }
- if(key.equals("java:/")) {
- return "java/";
- }
             if(key.startsWith("java:/")) {
                 return "java/"+key.substring("java:/".length());
             }
+ if(key.startsWith("java:")) {
+ return "java/"+key.substring("java:".length());
+ }
         }
         return key;
     }
@@ -424,7 +421,7 @@
             return getSpecial(name);
         }
 
- name = handleJavaStandard(name);
+ name = handleJNDIPrefix(name);
 
// name is a delimited notation, each element is either a
         // directory, file or part of a key.


Comment by greening [ Wed, 20 Oct 2004 12:25:36 -0700 (PDT) ]
Uh obviously the submitter/patcher was me (if you look at the file names).
Comment by bayard [ Tue, 23 Aug 2005 19:38:01 -0700 (PDT) ]
Not applicable anymore, but could be when we move back to a lookup strategy that looks for a file when it's asked for.
Comment by bayard [ Sun, 6 Apr 2008 01:13:09 -0700 (PDT) ]
Closing as simple-jndi never looks for files on demand. Instead you use the PropertiesLoader or SimpleContext and it loads into memory only at the initial opening.