Search in sources :

Example 1 with InvalidObjectIdException

use of org.kse.utilities.oid.InvalidObjectIdException in project keystore-explorer by kaikramer.

the class DObjectIdChooser method okPressed.

private void okPressed() {
    String firstArc = "" + jcbFirstArc.getSelectedItem();
    String secondArc = "" + jcbSecondArc.getSelectedItem();
    String remainingArcs = jtfRemainingArcs.getText().trim();
    ASN1ObjectIdentifier newObjectId = new ASN1ObjectIdentifier(firstArc + "." + secondArc + "." + remainingArcs);
    try {
        ObjectIdUtil.validate(newObjectId);
    } catch (InvalidObjectIdException e) {
        JOptionPane.showMessageDialog(this, e.getMessage(), getTitle(), JOptionPane.WARNING_MESSAGE);
        return;
    }
    objectId = newObjectId;
    closeDialog();
}
Also used : ASN1ObjectIdentifier(org.bouncycastle.asn1.ASN1ObjectIdentifier) InvalidObjectIdException(org.kse.utilities.oid.InvalidObjectIdException)

Example 2 with InvalidObjectIdException

use of org.kse.utilities.oid.InvalidObjectIdException in project keystore-explorer by kaikramer.

the class JObjectId method editObjectId.

private void editObjectId() {
    Container container = getTopLevelAncestor();
    try {
        DObjectIdChooser dObjectIdChooser = null;
        if (container instanceof JDialog) {
            dObjectIdChooser = new DObjectIdChooser((JDialog) container, title, objectId);
            dObjectIdChooser.setLocationRelativeTo(container);
            dObjectIdChooser.setVisible(true);
        } else if (container instanceof JFrame) {
            dObjectIdChooser = new DObjectIdChooser((JFrame) container, title, objectId);
            dObjectIdChooser.setLocationRelativeTo(container);
            dObjectIdChooser.setVisible(true);
        }
        ASN1ObjectIdentifier newObjectId = dObjectIdChooser.getObjectId();
        if (newObjectId == null) {
            return;
        }
        setObjectId(newObjectId);
    } catch (InvalidObjectIdException ex) {
        DError dError = null;
        if (container instanceof JDialog) {
            dError = new DError((JDialog) container, ex);
        } else {
            dError = new DError((JFrame) container, ex);
        }
        dError.setLocationRelativeTo(container);
        dError.setVisible(true);
    }
}
Also used : Container(java.awt.Container) JFrame(javax.swing.JFrame) JDialog(javax.swing.JDialog) ASN1ObjectIdentifier(org.bouncycastle.asn1.ASN1ObjectIdentifier) InvalidObjectIdException(org.kse.utilities.oid.InvalidObjectIdException) DError(org.kse.gui.error.DError)

Aggregations

ASN1ObjectIdentifier (org.bouncycastle.asn1.ASN1ObjectIdentifier)2 InvalidObjectIdException (org.kse.utilities.oid.InvalidObjectIdException)2 Container (java.awt.Container)1 JDialog (javax.swing.JDialog)1 JFrame (javax.swing.JFrame)1 DError (org.kse.gui.error.DError)1