private Authenticator lookupAuthenticatorWithDefaultConstructor(final Class<?> pAuthClass, final NoSuchMethodException ignore) throws InstantiationException, IllegalAccessException { // fallback to default constructor try { final Constructor<?> defaultConstructor = pAuthClass.getConstructor(); return (Authenticator) defaultConstructor.newInstance(); } catch (NoSuchMethodException e) { e.initCause(ignore); throw new IllegalArgumentException("Cannot create an instance of custom authenticator class, no default constructor to use", e); } catch (InvocationTargetException e) { e.initCause(ignore); throw new IllegalArgumentException("Cannot create an instance of custom authenticator using default constructor", e); } }
private Authenticator lookupAuthenticatorWithDefaultConstructor(Class pAuthClass, NoSuchMethodException ignore) throws InstantiationException, IllegalAccessException { // fallback to default constructor try { Constructor defaultConstructor = pAuthClass.getConstructor(); return (Authenticator) defaultConstructor.newInstance(); } catch (NoSuchMethodException e) { e.initCause(ignore); throw new IllegalArgumentException("Cannot create an instance of custom authenticator class, no default constructor to use", e); } catch (InvocationTargetException e) { e.initCause(ignore); throw new IllegalArgumentException("Cannot create an instance of custom authenticator using default constructor", e); } }
private Authenticator lookupAuthenticatorWithDefaultConstructor(final Class<?> pAuthClass, final NoSuchMethodException ignore) throws InstantiationException, IllegalAccessException { // fallback to default constructor try { final Constructor<?> defaultConstructor = pAuthClass.getConstructor(); return (Authenticator) defaultConstructor.newInstance(); } catch (NoSuchMethodException e) { e.initCause(ignore); throw new IllegalArgumentException("Cannot create an instance of custom authenticator class, no default constructor to use", e); } catch (InvocationTargetException e) { e.initCause(ignore); throw new IllegalArgumentException("Cannot create an instance of custom authenticator using default constructor", e); } }
private Authenticator lookupAuthenticatorWithDefaultConstructor(final Class<?> pAuthClass, final NoSuchMethodException ignore) throws InstantiationException, IllegalAccessException { // fallback to default constructor try { final Constructor<?> defaultConstructor = pAuthClass.getConstructor(); return (Authenticator) defaultConstructor.newInstance(); } catch (NoSuchMethodException e) { e.initCause(ignore); throw new IllegalArgumentException("Cannot create an instance of custom authenticator class, no default constructor to use", e); } catch (InvocationTargetException e) { e.initCause(ignore); throw new IllegalArgumentException("Cannot create an instance of custom authenticator using default constructor", e); } }
/** * Reads the view from the specified uri. */ @Override public void read(URI f, URIChooser chooser) throws IOException { try { final Drawing drawing = createDrawing(); InputFormat inputFormat = drawing.getInputFormats().get(0); inputFormat.read(f, drawing, true); SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { view.getDrawing().removeUndoableEditListener(undo); view.setDrawing(drawing); view.getDrawing().addUndoableEditListener(undo); undo.discardAllEdits(); } }); } catch (InterruptedException e) { InternalError error = new InternalError(); e.initCause(e); throw error; } catch (InvocationTargetException e) { InternalError error = new InternalError(); e.initCause(e); throw error; } }
/** * Reads the view from the specified uri. */ @Override public void read(URI f, URIChooser chooser) throws IOException { try { final Drawing drawing = createDrawing(); InputFormat inputFormat = drawing.getInputFormats().get(0); inputFormat.read(f, drawing, true); SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { view.getDrawing().removeUndoableEditListener(undo); view.setDrawing(drawing); view.getDrawing().addUndoableEditListener(undo); undo.discardAllEdits(); } }); } catch (InterruptedException e) { InternalError error = new InternalError(); e.initCause(e); throw error; } catch (InvocationTargetException e) { InternalError error = new InternalError(); e.initCause(e); throw error; } }