[jboss-svn-commits] JBL Code SVN: r9850 - in labs/jbossrules/trunk/drools-compiler/src/main/java/org: apache/commons/jci/stores and 3 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Feb 28 14:10:14 EST 2007


Author: mark.proctor at jboss.com
Date: 2007-02-28 14:10:14 -0500 (Wed, 28 Feb 2007)
New Revision: 9850

Removed:
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/stores/MemoryResourceStore.java
Modified:
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/EclipseJavaCompiler.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/EclipseJavaCompilerSettings.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/JaninoJavaCompiler.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/utils/ClassUtils.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/PackageBuilder.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/ColumnBuilder.java
Log:
JBRULES-277 mport package name that has 2 sets of CAPS packages does not work
-Updated to the latest version of JCI, so this should now be fixed

Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/EclipseJavaCompiler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/EclipseJavaCompiler.java	2007-02-28 17:27:14 UTC (rev 9849)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/EclipseJavaCompiler.java	2007-02-28 19:10:14 UTC (rev 9850)
@@ -19,18 +19,16 @@
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.HashSet;
 import java.util.Locale;
 import java.util.Map;
-import java.util.Set;
 import java.util.StringTokenizer;
 
 import org.apache.commons.jci.problems.CompilationProblem;
 import org.apache.commons.jci.readers.ResourceReader;
 import org.apache.commons.jci.stores.ResourceStore;
+import org.apache.commons.jci.utils.ClassUtils;
 import org.eclipse.jdt.core.compiler.IProblem;
 import org.eclipse.jdt.internal.compiler.ClassFile;
 import org.eclipse.jdt.internal.compiler.CompilationResult;
@@ -48,6 +46,7 @@
 
 public final class EclipseJavaCompiler extends AbstractJavaCompiler {
 
+    //private final Log log = LogFactory.getLog(EclipseJavaCompiler.class);
     private final Map settings;
 
     public EclipseJavaCompiler() {
@@ -70,21 +69,26 @@
         final private char[][] packageName;
         final private ResourceReader reader;
 
-        CompilationUnit(final ResourceReader pReader, final String pClazzName) {
+        CompilationUnit( final ResourceReader pReader, final String pSourceFile ) {
             reader = pReader;
-            clazzName = pClazzName;
-            clazzName.replace('.', '/');
-            fileName = clazzName.replace('.', '/') + ".java";
+            clazzName = ClassUtils.convertResourceToClassName(pSourceFile);
+            fileName = pSourceFile;
             int dot = clazzName.lastIndexOf('.');
             if (dot > 0) {
                 typeName = clazzName.substring(dot + 1).toCharArray();
             } else {
                 typeName = clazzName.toCharArray();
             }
+            
+//            log.debug("className=" + clazzName);
+//            log.debug("fileName=" + fileName);
+//            log.debug("typeName=" + new String(typeName)); 
+            
             final StringTokenizer izer = new StringTokenizer(clazzName, ".");
             packageName = new char[izer.countTokens() - 1][];
             for (int i = 0; i < packageName.length; i++) {
                 packageName[i] = izer.nextToken().toCharArray();
+//                log.debug("package[" + i + "]=" + new String(packageName[i]));
             }
         }
 
@@ -106,117 +110,144 @@
     }
 
     public org.apache.commons.jci.compilers.CompilationResult compile(
-            final String[] pClazzNames,
+            final String[] pSourceFiles,
             final ResourceReader pReader,
             final ResourceStore pStore,
-            final ClassLoader classLoader
+            final ClassLoader pClassLoader
             ) {
-        
+
         final Map settingsMap = settings;
-        final Set clazzIndex = new HashSet();
-        ICompilationUnit[] compilationUnits = new ICompilationUnit[pClazzNames.length];
+//        final Set sourceFileIndex = new HashSet();
+        final ICompilationUnit[] compilationUnits = new ICompilationUnit[pSourceFiles.length];
         for (int i = 0; i < compilationUnits.length; i++) {
-            final String clazzName = pClazzNames[i];
-            compilationUnits[i] = new CompilationUnit(pReader, clazzName);
-            clazzIndex.add(clazzName);
+            final String sourceFile = pSourceFiles[i];
+            compilationUnits[i] = new CompilationUnit(pReader, sourceFile);
+//            sourceFileIndex.add(sourceFile);
+//            log.debug("compiling " + sourceFile);
         }
 
         final IErrorHandlingPolicy policy = DefaultErrorHandlingPolicies.proceedWithAllProblems();
         final IProblemFactory problemFactory = new DefaultProblemFactory(Locale.getDefault());
         final INameEnvironment nameEnvironment = new INameEnvironment() {
 
-            public NameEnvironmentAnswer findType( final char[][] compoundTypeName ) {
+            public NameEnvironmentAnswer findType( final char[][] pCompoundTypeName ) {
                 final StringBuffer result = new StringBuffer();
-                for (int i = 0; i < compoundTypeName.length; i++) {
+                for (int i = 0; i < pCompoundTypeName.length; i++) {
                     if (i != 0) {
                         result.append('.');
                     }
-                    result.append(compoundTypeName[i]);
+                    result.append(pCompoundTypeName[i]);
                 }
-                return findType(result.toString());
+
+                //log.debug("finding compoundTypeName=" + result.toString());
+
+            	return findType(result.toString());
             }
 
-            public NameEnvironmentAnswer findType( final char[] typeName, final char[][] packageName ) {
+            public NameEnvironmentAnswer findType( final char[] pTypeName, final char[][] pPackageName ) {
                 final StringBuffer result = new StringBuffer();
-                for (int i = 0; i < packageName.length; i++) {
-                    result.append(packageName[i]);
+                for (int i = 0; i < pPackageName.length; i++) {
+                    result.append(pPackageName[i]);
                     result.append('.');
                 }
-                result.append(typeName);
+                
+//            	log.debug("finding typeName=" + new String(typeName) + " packageName=" + result.toString());
+
+            	result.append(pTypeName);
                 return findType(result.toString());
             }
 
-            private NameEnvironmentAnswer findType( final String clazzName ) {
-                byte[] clazzBytes = pStore.read(clazzName);
+            private NameEnvironmentAnswer findType( final String pClazzName ) {
+            	
+            	if (isPackage(pClazzName)) {
+            		return null;
+            	}
+            	
+//            	log.debug("finding " + pClazzName);
+            	
+            	final String resourceName = ClassUtils.convertClassToResourcePath(pClazzName);
+            	
+                final byte[] clazzBytes = pStore.read(pClazzName);
                 if (clazzBytes != null) {
-                    // log.debug("loading from store " + clazzName);
-                    final char[] fileName = clazzName.toCharArray();
+//                    log.debug("loading from store " + pClazzName);
+
+                    final char[] fileName = pClazzName.toCharArray();
                     try {
                         final ClassFileReader classFileReader = new ClassFileReader(clazzBytes, fileName, true);
                         return new NameEnvironmentAnswer(classFileReader, null);
                     } catch (final ClassFormatException e) {
-                    	// @TODO: we need to handle this better, maybe a runtime exception?
-                    	e.printStackTrace();                    	
-                        //log.error("wrong class format", e);
+//                        log.error("wrong class format", e);
+                        return null;
                     }
-                } else {
-                    if (pReader.isAvailable(clazzName.replace('.', '/') + ".java")) {
-                        ICompilationUnit compilationUnit = new CompilationUnit(pReader, clazzName);
-                        return new NameEnvironmentAnswer(compilationUnit, null);
-                    }
+                }
+                
+//            	log.debug("not in store " + pClazzName);
+            	
+//                if (pReader.isAvailable(clazzName.replace('.', '/') + ".java")) {
+//                    log.debug("compile " + clazzName);
+//                    ICompilationUnit compilationUnit = new CompilationUnit(pReader, clazzName);
+//                    return new NameEnvironmentAnswer(compilationUnit, null);
+//                }
 
-                    final String resourceName = clazzName.replace('.', '/') + ".class";
-                    final InputStream is = classLoader.getResourceAsStream(resourceName);
-                    if (is != null) {
-                        final byte[] buffer = new byte[8192];
-                        final ByteArrayOutputStream baos = new ByteArrayOutputStream(buffer.length);
-                        int count;
-                        try {
-                            while ((count = is.read(buffer, 0, buffer.length)) > 0) {
-                                baos.write(buffer, 0, count);
-                            }
-                            baos.flush();
-                            clazzBytes = baos.toByteArray();
-                            final char[] fileName = clazzName.toCharArray();
-                            ClassFileReader classFileReader =
-                                new ClassFileReader(clazzBytes, fileName, true);
-                            return new NameEnvironmentAnswer(classFileReader, null);
-                        } catch (final IOException e) {
-                        	// @TODO: we need to handle this better, maybe a runtime exception?
-                        	e.printStackTrace();                        	
-                            // log.error("could not read class", e);
-                        } catch (final ClassFormatException e) {
-                        	// @TODO: we need to handle this better, maybe a runtime exception?
-                        	e.printStackTrace();                        	
-                            // log.error("wrong class format", e);
-                        } finally {
-                            try {
-                                baos.close();
-                            } catch (final IOException oe) {
-                            	// @TODO: we need to handle this better, maybe a runtime exception?
-                            	oe.printStackTrace();                            	
-                                //log.error("could not close output stream", oe);
-                            }
-                            try {
-                                is.close();
-                            } catch (final IOException ie) {
-                            	// @TODO: we need to handle this better, maybe a runtime exception?
-                            	ie.printStackTrace();                            	
-                                //log.error("could not close input stream", ie);
-                            }
-                        }
+                final InputStream is = pClassLoader.getResourceAsStream(resourceName);
+                if (is == null) {
+//                	log.debug("class " + pClazzName + " not found");
+                	return null;
+                }
+
+                final byte[] buffer = new byte[8192];
+                final ByteArrayOutputStream baos = new ByteArrayOutputStream(buffer.length);
+                int count;
+                try {
+                    while ((count = is.read(buffer, 0, buffer.length)) > 0) {
+                        baos.write(buffer, 0, count);
                     }
+                    baos.flush();
+                    final char[] fileName = pClazzName.toCharArray();
+                    final ClassFileReader classFileReader = new ClassFileReader(baos.toByteArray(), fileName, true);
+                    return new NameEnvironmentAnswer(classFileReader, null);
+                } catch (final IOException e) {
+                    e.printStackTrace();
+//                    log.error("could not read class", e);
+                    return null;
+                } catch (final ClassFormatException e) {
+                    e.printStackTrace();
+//                    log.error("wrong class format", e);
+                    return null;
+                } finally {
+                    try {
+                        baos.close();
+                    } catch (final IOException oe) {
+                        oe.printStackTrace();
+//                        log.error("could not close output stream", oe);
+                    }
+                    try {
+                        is.close();
+                    } catch (final IOException ie) {
+                        ie.printStackTrace();
+//                        log.error("could not close input stream", ie);
+                    }
                 }
-                return null;
             }
 
-            private boolean isPackage( final String clazzName ) {
-                final String resourceName = clazzName.replace('.', '/') + ".class";
-                final URL resource = classLoader.getResource(resourceName);
-                return resource == null;
+            private boolean isPackage( final String pClazzName ) {
+            	
+            	final InputStream is = pClassLoader.getResourceAsStream(ClassUtils.convertClassToResourcePath(pClazzName));
+            	if (is != null) {                    
+//                	log.debug("found the class for " + pClazzName + "- no package");
+            		return false;
+            	}
+            	
+            	final String source = pClazzName.replace('.', '/') + ".java";
+            	if (pReader.isAvailable(source)) {
+//                	log.debug("found the source " + source + " for " + pClazzName + " - no package ");
+            		return false;
+            	}
+            	
+            	return true;
             }
 
-            public boolean isPackage( char[][] parentPackageName, char[] packageName ) {
+            public boolean isPackage( char[][] parentPackageName, char[] pPackageName ) {
                 final StringBuffer result = new StringBuffer();
                 if (parentPackageName != null) {
                     for (int i = 0; i < parentPackageName.length; i++) {
@@ -226,25 +257,26 @@
                         result.append(parentPackageName[i]);
                     }
                 }
-                if (Character.isUpperCase(packageName[0])) {
-                    return false;
-                }
+                
+//                log.debug("isPackage parentPackageName=" + result.toString() + " packageName=" + new String(packageName));
+                
                 if (parentPackageName != null && parentPackageName.length > 0) {
                     result.append('.');
                 }
-                result.append(packageName);
+                result.append(pPackageName);
                 return isPackage(result.toString());
             }
 
             public void cleanup() {
+//            	log.debug("cleanup");
             }
         };
 
         final Collection problems = new ArrayList();
         final ICompilerRequestor compilerRequestor = new ICompilerRequestor() {
-            public void acceptResult( CompilationResult result ) {
-                if (result.hasProblems()) {
-                    final IProblem[] iproblems = result.getProblems();
+            public void acceptResult( final CompilationResult pResult ) {
+                if (pResult.hasProblems()) {
+                    final IProblem[] iproblems = pResult.getProblems();
                     for (int i = 0; i < iproblems.length; i++) {
                         final IProblem iproblem = iproblems[i];
                         final CompilationProblem problem = new EclipseCompilationProblem(iproblem); 
@@ -254,8 +286,8 @@
                         problems.add(problem);
                     }
                 }
-                if (!result.hasErrors()) {
-                    final ClassFile[] clazzFiles = result.getClassFiles();
+                if (!pResult.hasErrors()) {
+                    final ClassFile[] clazzFiles = pResult.getClassFiles();
                     for (int i = 0; i < clazzFiles.length; i++) {
                         final ClassFile clazzFile = clazzFiles[i];
                         final char[][] compoundName = clazzFile.getCompoundName();
@@ -266,14 +298,13 @@
                             }
                             clazzName.append(compoundName[j]);
                         }
-                        pStore.write(clazzName.toString(), clazzFile.getBytes());
+                        pStore.write(clazzName.toString().replace('.', '/') + ".class", clazzFile.getBytes());
                     }
                 }
             }
         };
 
-        final Compiler compiler =
-            new Compiler(nameEnvironment, policy, settingsMap, compilerRequestor, problemFactory, false);
+        final Compiler compiler = new Compiler(nameEnvironment, policy, settingsMap, compilerRequestor, problemFactory, false);
 
         compiler.compile(compilationUnits);
 

Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/EclipseJavaCompilerSettings.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/EclipseJavaCompilerSettings.java	2007-02-28 17:27:14 UTC (rev 9849)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/EclipseJavaCompilerSettings.java	2007-02-28 19:10:14 UTC (rev 9850)
@@ -15,7 +15,7 @@
     	defaultEclipseSettings.put(CompilerOptions.OPTION_SourceFileAttribute, CompilerOptions.GENERATE);
     	defaultEclipseSettings.put(CompilerOptions.OPTION_ReportUnusedImport, CompilerOptions.IGNORE);
         defaultEclipseSettings.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.GENERATE);
-    }         
+    }
     
     public Map getMap() {
         final Map map = new HashMap(defaultEclipseSettings);

Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/JaninoJavaCompiler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/JaninoJavaCompiler.java	2007-02-28 17:27:14 UTC (rev 9849)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/JaninoJavaCompiler.java	2007-02-28 19:10:14 UTC (rev 9850)
@@ -29,6 +29,7 @@
 import org.apache.commons.jci.problems.CompilationProblem;
 import org.apache.commons.jci.readers.ResourceReader;
 import org.apache.commons.jci.stores.ResourceStore;
+import org.apache.commons.jci.utils.ClassUtils;
 import org.codehaus.janino.ClassLoaderIClassLoader;
 import org.codehaus.janino.CompileException;
 import org.codehaus.janino.DebuggingInformation;
@@ -50,6 +51,8 @@
  */
 public final class JaninoJavaCompiler extends AbstractJavaCompiler {
 
+//    private final Log log = LogFactory.getLog(JaninoJavaCompiler.class);
+
     private class CompilingIClassLoader extends IClassLoader {
 
         private final Map types = new HashMap();
@@ -103,8 +106,10 @@
                         problems.add(problem);
                     }
                 });
+//                log.debug("compile " + className);
                 final ClassFile[] classFiles = uc.compileUnit(DebuggingInformation.ALL);
                 for (int i = 0; i < classFiles.length; i++) {
+//                    log.debug("compiled " + classFiles[i].getThisClassName());
                     classes.put(classFiles[i].getThisClassName(), classFiles[i].toByteArray());
                 }
                 final IClass ic = uc.findClass(className);
@@ -123,9 +128,7 @@
                     try {
                         scanner.close();
                     } catch (IOException e) {
-                    	// @TODO: we need to handle this better, maybe a runtime exception?
-                    	e.printStackTrace();
-                        //log.error("IOException occured while compiling " + className, e);
+//                        log.error("IOException occured while compiling " + className, e);
                     }
                 }
             }
@@ -141,21 +144,20 @@
             ) {
         final Map classFilesByName = new HashMap();       
         
-        final CompilingIClassLoader icl = new CompilingIClassLoader(pResourceReader, classFilesByName, classLoader);                
-        
-        try {
-            for (int i = 0; i < pClasses.length; i++) {
-                icl.loadIClass(Descriptor.fromClassName(pClasses[i]));
-            }
-        } catch ( ClassNotFoundException e ) {
-            // @TODO: if an exception is thrown here, how do we handle it?
-            e.printStackTrace();
+        final CompilingIClassLoader icl = new CompilingIClassLoader(pResourceReader, classFilesByName, classLoader);
+        for (int i = 0; i < pClasses.length; i++) {
+            try {
+				icl.loadIClass(Descriptor.fromClassName(ClassUtils.convertResourceToClassName(pClasses[i])));
+			} catch (ClassNotFoundException e) {
+				// @TODO: if an exception is thrown here, how do we handle it?
+				e.printStackTrace();
+			}
         }
-        
         // Store all fully compiled classes
         for (Iterator i = classFilesByName.entrySet().iterator(); i.hasNext();) {
             final Map.Entry entry = (Map.Entry)i.next();
-            pStore.write((String)entry.getKey(), (byte[])entry.getValue());
+            final String clazzName = (String)entry.getKey(); 
+            pStore.write(ClassUtils.convertClassToResourcePath(clazzName), (byte[])entry.getValue());
         }
         
         final Collection problems = icl.getProblems();

Deleted: labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/stores/MemoryResourceStore.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/stores/MemoryResourceStore.java	2007-02-28 17:27:14 UTC (rev 9849)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/stores/MemoryResourceStore.java	2007-02-28 19:10:14 UTC (rev 9850)
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.jci.stores;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-
-/**
- * @author tcurdt
- */
-public final class MemoryResourceStore implements ResourceStore {
-
-	private final Map store = new HashMap();
-	
-	public byte[] read( final String pResourceName ) {
-		return (byte[]) store.get(pResourceName);
-	}
-
-	public void write( final String pResourceName, final byte[] pData ) {
-		store.put(pResourceName, pData);
-	}
-	
-    public void remove( final String pResourceName ) {
-        store.remove(pResourceName);
-    }
-
-    /**
-     * @deprecated
-     */
-    public String[] list() {
-        if (store == null) {
-            return new String[0];
-        }
-        final List names = new ArrayList();
-        
-        for (final Iterator it = store.keySet().iterator(); it.hasNext();) {
-            final String name = (String) it.next();
-            names.add(name);
-        }
-
-        return (String[]) names.toArray(new String[store.size()]);
-    }
-    
-    public String toString() {
-        return this.getClass().getName() + store.toString();
-    }
-}

Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/utils/ClassUtils.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/utils/ClassUtils.java	2007-02-28 17:27:14 UTC (rev 9849)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/utils/ClassUtils.java	2007-02-28 19:10:14 UTC (rev 9850)
@@ -9,12 +9,20 @@
 	 * Please do not use - internal
 	 * org/my/Class.xxx -> org.my.Class
 	 */
-	public static String convertResourceNameToClassName( final String pResourceName ) {
+	public static String convertResourceToClassName( final String pResourceName ) {
 		return ClassUtils.stripExtension(pResourceName).replace('/', '.');
 	}
 
 	/**
 	 * Please do not use - internal
+	 * org.my.Class -> org/my/Class.class
+	 */
+	public static String convertClassToResourcePath( final String pName ) {
+		return pName.replace('.', '/') + ".class";
+	}
+
+	/**
+	 * Please do not use - internal
 	 * org/my/Class.xxx -> org/my/Class
 	 */
 	public static String stripExtension( final String pResourceName ) {
@@ -38,4 +46,11 @@
 	    return clazzName;
 	}
 
+	public static String relative( final File base, final File file ) {
+	    final int rootLength = base.getAbsolutePath().length();
+	    final String absFileName = file.getAbsolutePath();
+	    final String relFileName = absFileName.substring(rootLength + 1);
+		return relFileName;
+	}
+	
 }

Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/PackageBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/PackageBuilder.java	2007-02-28 17:27:14 UTC (rev 9849)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/PackageBuilder.java	2007-02-28 19:10:14 UTC (rev 9850)
@@ -81,7 +81,6 @@
     private Map                         errorHandlers;
     private List                        generatedClassList;
     private TypeResolver                typeResolver;
-    private FunctionResolver            functionResolver;
     private ClassFieldExtractorCache    classFieldExtractorCache;
     private Map                         lineMappings;
 
@@ -315,7 +314,7 @@
 
         this.errorHandlers.put( fileName,
                                 handler );
-        this.generatedClassList.add( className );
+        this.generatedClassList.add( fileName );
     }
 
     private void addFunction(final FunctionDescr functionDescr) {

Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/ColumnBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/ColumnBuilder.java	2007-02-28 17:27:14 UTC (rev 9849)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/ColumnBuilder.java	2007-02-28 19:10:14 UTC (rev 9850)
@@ -21,6 +21,7 @@
 import java.util.List;
 
 import org.antlr.stringtemplate.StringTemplate;
+import org.apache.commons.jci.utils.ClassUtils;
 import org.drools.RuntimeDroolsException;
 import org.drools.base.ClassObjectType;
 import org.drools.base.FieldFactory;
@@ -108,7 +109,7 @@
                     // otherwise, create and load
                     byte[] proxyBytes = ShadowProxyFactory.getProxyBytes( userProvidedClass );
                     if ( proxyBytes != null ) {
-                        context.getPkg().getPackageCompilationData().write( shadowProxyName,
+                        context.getPkg().getPackageCompilationData().write( ClassUtils.convertClassToResourcePath( shadowProxyName ),
                                                                             proxyBytes );
                         shadowClass = context.getPkg().getPackageCompilationData().getClassLoader().loadClass( shadowProxyName );
                     }




More information about the jboss-svn-commits mailing list