Changeset 4016

Show
Ignore:
Timestamp:
09/11/08 22:32:19 (3 years ago)
Author:
michael
Message:

Fix use of Thread Locals? and other issues from Find Bugs?

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/main/java/org/sarugo/xtc/compiler/Compiler.java

    r3966 r4016  
    4949public abstract class Compiler { 
    5050 
    51         private static ThreadLocal<Compiler> instance = new ThreadLocal<Compiler>(); 
    52  
    5351        private static final String PROVIDER_RESOURCE = "META-INF/services/org.sarugo.xtc.compiler.Compiler"; 
    5452 
     
    203201 
    204202        public static Compiler getInstance() { 
    205  
    206                 Compiler result = instance.get(); 
    207                 if (result == null) { 
    208                         try { 
    209                                 instance.set((Compiler) Classpath 
    210                                                 .instanceFromConfig(PROVIDER_RESOURCE)); 
    211                         } catch (Exception e) { 
    212                                 throw new RuntimeException( 
    213                                                 "Unable to register the Compiler implementation", e); 
    214                         } 
    215                         result = instance.get(); 
    216                 } 
    217                 if (result == null) { 
     203                try { 
     204                        return (Compiler) Classpath.instanceFromConfig(PROVIDER_RESOURCE); 
     205                } catch (Exception e) { 
    218206                        throw new RuntimeException( 
    219                                         "Unable to register the Compiler implementation"); 
    220                 } 
    221                 return result; 
     207                                        "Unable to register the Compiler implementation", e); 
     208                } 
    222209        } 
    223210} 
  • trunk/src/main/java/org/sarugo/xtc/compiler/TagLibraryConfig.java

    r3966 r4016  
    3131import org.sarugo.xtc.tag.TagHandler; 
    3232import org.sarugo.xtc.tag.TagLibrary; 
    33 import org.sarugo.xtc.util.Classpath; 
    3433import org.sarugo.xtc.util.ParameterCheck; 
    3534import org.xml.sax.Attributes; 
     
    199198                throw new Exception("Must Provide Return Type: "+s); 
    200199            } else { 
    201                 String rt = s.substring(0, pos).trim(); 
    202200                int pos2 = s.indexOf('(', pos+1); 
    203201                if (pos2 == -1) { 
  • trunk/src/main/java/org/sarugo/xtc/tag/ui/InsertHandler.java

    r2915 r4016  
    6969        public boolean render(TemplateContext ctx, String name) throws IOException, 
    7070                        TemplateException, ELException { 
    71                 if (this.name == name || this.name != null && this.name.equals(name)) { 
     71                if (this.name != null && this.name.equals(name)) { 
    7272                        this.nextHandler.render(ctx); 
    7373                        return true; 
  • trunk/src/main/java/org/sarugo/xtc/util/Classpath.java

    r3966 r4016  
    1616 
    1717import java.io.BufferedReader; 
    18 import java.io.File; 
    1918import java.io.IOException; 
    2019import java.io.InputStreamReader; 
    21 import java.net.JarURLConnection; 
    2220import java.net.URL; 
    23 import java.net.URLConnection; 
    24 import java.util.Enumeration; 
    25 import java.util.HashSet; 
    26 import java.util.Set; 
    27 import java.util.jar.JarEntry; 
    28 import java.util.jar.JarFile; 
    2921 
    3022import org.sarugo.xtc.TemplateFactory; 
     
    5749                                        providerClassName = providerName.substring(0, 
    5850                                                        providerName.indexOf('#')).trim(); 
    59                                 } else
     51                                } else if (providerName != null)
    6052                                        providerClassName = providerName.trim(); 
    6153                                }