Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import openeye.oechem.*;
- public class CustomErrorHandler {
- private class MyErrorHandler extends OEErrorHandlerImplBase {
- @Override
- public void Msg(int level, String msg) {
- System.err.println("thread:" + Thread.currentThread().getId() +
- " level:" + level +
- " msg:" + msg);
- }
- @Override
- public OEErrorHandlerImplBase CreateCopy() {
- OEErrorHandlerImplBase copy = new MyErrorHandler();
- copy.swigReleaseOwnership();
- return copy;
- }
- }
- public void run() {
- // use the default error handler
- oechem.OEThrow.Warning("message 0");
- // create a new one
- oechem.OEThrow.SetHandlerImpl(new MyErrorHandler(), true);
- oechem.OEThrow.Warning("message 1");
- // create a local one
- MyErrorHandler hand = new MyErrorHandler();
- oechem.OEThrow.SetHandlerImpl(hand, false);
- oechem.OEThrow.Info("message 2");
- }
- public static void main(String argv[]) {
- CustomErrorHandler app = new CustomErrorHandler();
- app.run();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement