[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

OPP Bug?



As I mentioned in my Persistence Problem posts, I have been unable to get 
OPP to generate proxy classes with the correct write locks. Unless I am 
running OPP incorrectly, it appears that there may be a problem in the OPP 
process itself.

One of the responsibilities of the IfHelper class is to find the source file 
for interfaces. As I understand the code, it is not able to find the file if 
it is not in the current  or source destination directories. As a result all 
of the generated proxy methods for the interfaces that can't be found will 
have read locks.

If the above is true the following changes to IfHelper will fix the problem 
when running Windows NT if the interface classes are in the classpath when 
OPP is run. Note that the code throws and exception if the source file isn't 
found. I feel this is preferable to the current implementation which simply 
prints out the fact and goes on to generate incorrect proxies.

Add the following method to IfHelper:

    public static String classFileName(Class dbInterface) {
        // get the classpath of this virtual machine
        String jvmClassPath = System.getProperty( "java.class.path", "" );
        StringTokenizer t = new StringTokenizer(jvmClassPath, ";");
        String aPath;
        String classFileName;
        while (t.hasMoreTokens()) {
            aPath = (String)t.nextElement();
            classFileName = aPath + "\\" + 
dbInterface.getName().replace('.', '\\') + ".java";
           // System.out.println(classFileName);
            if (new File( classFileName).exists()) {
                return classFileName;
            }
        }
        throw new RuntimeException("Unable to find source file for " + 
dbInterface.getName());
    }


And in IfHelper.searchUpdateMethods2() replace the line

sourceName = outputDir + OPPHelper.rawClassName( dbInterface ) + ".java";

with

sourceName = classFileName(dbInterface);


Regards,

Don

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

----------------------------------------------------------------------
Post a message:         mailto:ozone-users@ozone-db.org
Unsubscribe:            mailto:ozone-users-request@ozone-db.org?body=unsubscribe
Contact administrator:  mailto:ozone-users-owner@ozone-db.org
Read archived messages: http://www.ozone-db.org/
----------------------------------------------------------------------