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

how to detect failed login?



I seem to be unable to trap a failed login or open() of the
database

I am calling RemoteDatabase.open(...) with a username and as
a test I tried leaving the username blank.  The open() does
not throw an exception!  I get a exception when I try to use
an object later like this:

Exception occurred during event dispatching:
DE.softwarebuero.ozone.UnexpectedError:
DE.softwarebuero.ozone.PermissionDeniedExc:
DE.softwarebuero.ozone.core.PermissionError: No such user.
        at indexImpl_Proxy.getPoints(Compiled Code)
        at frmMapper.addMapPanel(Compiled Code)
        at frmMapper.btnConnectActionPerformed(Compiled
Code)
        at frmMapper.access$0(Compiled Code)
        at frmMapper$1.actionPerformed(Compiled Code)
        at
com.sun.java.swing.AbstractButton.fireActionPerformed(Compiled
Code)
        at
com.sun.java.swing.AbstractButton$ForwardActionEvents.actionPerformed(Compiled
Code)
        at
com.sun.java.swing.DefaultButtonModel.fireActionPerformed(Compiled
Code)
        at
com.sun.java.swing.DefaultButtonModel.setPressed(Compiled
Code)
        at
com.sun.java.swing.plaf.basic.BasicButtonListener.mouseReleased(Compiled
Code)
        at java.awt.Component.processMouseEvent(Compiled
Code)
        at java.awt.Component.processEvent(Compiled Code)
        at java.awt.Container.processEvent(Compiled Code)
        at java.awt.Component.dispatchEventImpl(Compiled
Code)
        at java.awt.Container.dispatchEventImpl(Compiled
Code)
        at java.awt.Component.dispatchEvent(Compiled Code)
        at
java.awt.LightweightDispatcher.retargetMouseEvent(Compiled
Code)
        at
java.awt.LightweightDispatcher.processMouseEvent(Compiled
Code)
        at
java.awt.LightweightDispatcher.dispatchEvent(Compiled Code)
        at java.awt.Container.dispatchEventImpl(Compiled
Code)
        at java.awt.Window.dispatchEventImpl(Compiled Code)
        at java.awt.Component.dispatchEvent(Compiled Code)
        at java.awt.EventDispatchThread.run(Compiled Code)

The open code looks like: (initDB() is what my app calls)

 private boolean initDB() {
 if(!openDB())
     return false;
 try {
     index = (indexImpl_Int)db.objectForName(indexDBName);
 } catch(Exception e) {
     JOptionPane.showMessageDialog(null
       ,"Error getting (for) index::" + e
       ,"Database Error"
       ,JOptionPane.ERROR_MESSAGE);
     closeDB();
     return false;
 }
 if(index == null)
     try {
  index = (indexImpl_Int)db.createObject("indexImpl",
             OzoneInterface.AllRead |
             OzoneInterface.AllLock,
             indexDBName);
     } catch(Exception e) {
  JOptionPane.showMessageDialog(null
           ,"Error getting (create) index::" + e
           ,"Database Error"
           ,JOptionPane.ERROR_MESSAGE);
  closeDB();
  return false;
     }
 return true;
    }

    private boolean openDB() {
        // open database
        db = new RemoteDatabase();
        try {
            //  open the connection on localhost at port
3333
            db.open (txtHost.getText(), 3334,
       txtUsername.getText(), "");

            // reload our database classes if changed them
            db.reloadClasses();
            return true;

        } catch(Exception e) {
            JOptionPane.showMessageDialog(null
       ,"Error opening database::" + e
       ,"Database Error"
       ,JOptionPane.ERROR_MESSAGE);
            try {
                closeDB();
            } catch (Exception ex) {
                return false;
            }
            return false;
        }

    }


--
Tim Brown
URL: http://www.incenter.org