Package java.beans

Examples of java.beans.ExceptionListener


        MockPersistenceDelegate pd = new MockPersistenceDelegate(new String[] {
                "prop1", "non_existing" });
        MockBean b = new MockBean();
        b.setAll("bean1", 2);
        Encoder enc = new Encoder();
        ExceptionListener el = new ExceptionListener() {
            public void exceptionThrown(Exception e) {
                CallVerificationStack.getInstance().push(e);
            }
        };
        enc.setExceptionListener(el);
View Full Code Here


    public void testInstantiate_NoGetter() throws Exception {
        MockEncoder enc = new MockEncoder();
        MockPersistenceDelegate pd = new MockPersistenceDelegate(
                new String[] { "i" });
        MockNoGetterBean2 b = new MockNoGetterBean2(3);
        enc.setExceptionListener(new ExceptionListener() {
            public void exceptionThrown(Exception e) {
                CallVerificationStack.getInstance().push(e);
            }
        });
        Expression e = pd.instantiate(b, enc);
View Full Code Here

     */
    public void testInitialize_NoSetter() throws Exception {
        MockEncoder enc = new MockEncoder();
        MockPersistenceDelegate pd = new MockPersistenceDelegate();
        MockNoSetterBean b = new MockNoSetterBean();
        enc.setExceptionListener(new ExceptionListener() {
            public void exceptionThrown(Exception e) {
                CallVerificationStack.getInstance().push(e);
            }
        });
        b.setName("myName");
        pd.initialize(MockNoSetterBean.class, b, new MockNoSetterBean(), enc);
        assertTrue(CallVerificationStack.getInstance().empty());

        pd = new MockPersistenceDelegate(new String[] { "name" });
        enc.setExceptionListener(new ExceptionListener() {
            public void exceptionThrown(Exception e) {
                CallVerificationStack.getInstance().push(e);
            }
        });
        b.setName("myName");
View Full Code Here

        MockEncoder enc = new MockEncoder();
        MockPersistenceDelegate pd = new MockPersistenceDelegate();
        MockNoGetterBean b = new MockNoGetterBean();

        b.setName("myName");
        enc.setExceptionListener(new ExceptionListener() {
            public void exceptionThrown(Exception e) {
                CallVerificationStack.getInstance().push(e);
            }
        });
        enc.writeObject(b);
View Full Code Here

        Object o1 = new Object();
        Object o2 = new Object();
        // enc.setPersistenceDelegate(MockFooStop.class,
        // new MockPersistenceDelegate());
        try {
            enc.setExceptionListener(new ExceptionListener() {
                public void exceptionThrown(Exception e) {
                    CallVerificationStack.getInstance().push(e);
                }
            });
            pd.initialize(null, o1, o2, enc);
View Full Code Here

        Encoder enc = new Encoder();
        MockFoo b = new MockFoo();
        b.setName("myName");
        // enc.setPersistenceDelegate(MockFooStop.class,
        // new MockPersistenceDelegate());
        enc.setExceptionListener(new ExceptionListener() {
            public void exceptionThrown(Exception e) {
                CallVerificationStack.getInstance().push(e);
            }
        });
        try {
View Full Code Here

        ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
        Thread.currentThread().setContextClassLoader(settings.getClass().getClassLoader());
        try {
            ByteArrayOutputStream os = new ByteArrayOutputStream();
            XMLEncoder e = new XMLEncoder(new BufferedOutputStream(os));
            e.setExceptionListener(new ExceptionListener() {
                public void exceptionThrown(Exception e) {
                    throw new EmsException("Could not encode connection settings",e);
                }
            });
            e.setPersistenceDelegate(File.class,new PersistenceDelegate() {
View Full Code Here

  /**
   * Serialize the whole query plan.
   */
  public static void serializeQueryPlan(QueryPlan plan, OutputStream out) {
    XMLEncoder e = new XMLEncoder(out);
    e.setExceptionListener(new ExceptionListener() {
      public void exceptionThrown(Exception e) {
        LOG.warn(org.apache.hadoop.util.StringUtils.stringifyException(e));
        throw new RuntimeException("Cannot serialize the query plan", e);
      }
    });
View Full Code Here

  final void doComparison(final TestHarness harness)
  {
    // creates an ExceptionListener implementation that lets the test fail
    // if one occurs
    ExceptionListener exListener = new ExceptionListener()
      {
  public void exceptionThrown(Exception e)
  {
    harness.fail(name
                 + " - decode.readObject(): unexpected exception occured during decoding: "
View Full Code Here

    private static Painter loadPainter(final URL in, URL baseURL) throws FileNotFoundException, IOException {
        Thread.currentThread().setContextClassLoader(PainterUtil.class.getClassLoader());
        XMLDecoder dec = new XMLDecoder(in.openStream());
//        p("creating a persistence owner with the base url: " + baseURL);
        dec.setOwner(new PersistenceOwner(baseURL));
        dec.setExceptionListener(new ExceptionListener() {
            public void exceptionThrown(Exception ex) {
                System.out.println(ex.getMessage());
                ex.printStackTrace();
            }
        });
View Full Code Here

TOP

Related Classes of java.beans.ExceptionListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.