Java Patches not being discovered

35 views
Skip to first unread message

Craig Jones

unread,
Jun 15, 2012, 9:24:37 PM6/15/12
to autopat...@googlegroups.com
I have AutoPatch 1.4.1 running with SQL patches and XML patches.  I tried to add a Java patch, but it's not being discovered.  What am I doing wrong?  Thanks in advance.

// Craig

package com.mydomain.autopatches;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.tacitknowledge.util.migration.MigrationContext;
import com.tacitknowledge.util.migration.MigrationException;
import com.tacitknowledge.util.migration.MigrationTaskSupport;

public class Patch_00020 extends MigrationTaskSupport {
    final static Logger logger = LoggerFactory.getLogger(Patch_00020.class);

    @Override
    public Integer getLevel() {
        return new Integer(00020);
    }
    @Override
    public void up(MigrationContext context) throws MigrationException {
        logger.trace("Entered Patch_00020.up()");
        logger.info("Some actual patch code would go here.");
    }
}



Scott Askew

unread,
Jun 16, 2012, 11:21:21 PM6/16/12
to autopat...@googlegroups.com
Hi Craig,

It'd difficult to tell you exactly why your patch isn't being discovered as there may be significant complexity depending on your environment. One thing that stands out here is that getName() is going to return null which isn't legal. You might see something like "MigrationTask com.mydomain.autopatches.Patch_00020 had no migration name. Is that intentional? Skipping task." in your logs. If so, the easiest fix is to either call setName in your constructor or override getName.

I'll create a GitHub issue for this as it illustrates a design flaw in MigrationTaskSupport at a minimum and possibly the entire concept of MigrationTask.getName.

Please let me know if that fixes the issue. If not then please let me know what your environment looks like (e.g. a Spring app on JBoss, etc) and I'll help you troubleshoot.

-scott
Reply all
Reply to author
Forward
0 new messages