Package org.springframework.beans

Examples of org.springframework.beans.FatalBeanException


        if (propertyObj != null) {
            try {
                pd.getWriteMethod().invoke(bean, new Object[] {propertyObj});
            } catch (Throwable e) {
                throw new FatalBeanException("Problem injecting property:  " + e.getMessage(), e);
            }
        }
    }
View Full Code Here


                        Object nameObj = componentName;
                        if (nameObj != null) {
                            try {
                                pd.getWriteMethod().invoke(bean, new Object[] {nameObj});
                            } catch (Throwable e) {
                                throw new FatalBeanException("Problem injecting reference:  " + e.getMessage(), e);
                            }
                        }
                    } else {
                        throw new IllegalStateException(
                                                        "ComponentName annotation is supported only on java.lang.String field type.");
View Full Code Here

                Constructor con = wrappedConcreteType.getConstructor(new Class[] {Comparator.class});
                newCollection = BeanUtils.instantiateClass(con,
                        new Object[] {((SortedSet)wrappedCollection).comparator()});
            }
            catch (NoSuchMethodException e) {
                throw new FatalBeanException("Could not instantiate SortedSet class ["
                        + wrappedConcreteType.getName() + "]: no constructor taking Comparator found", e);
            }
        }
        else {
            newCollection = BeanUtils.instantiateClass(wrappedConcreteType);
View Full Code Here

        }
        else {
            Class beanClass = bean.getClass();
            Method namedPCLAdder = getNamedPCLAdder(beanClass);
            if (namedPCLAdder == null)
                throw new FatalBeanException("Could not find the bean method"
                        + "/npublic void addPropertyChangeListener(String, PropertyChangeListener);/nin bean '" + bean
                        + "'");
            try {
                namedPCLAdder.invoke(bean, new Object[] {propertyName, listener});
            }
            catch (InvocationTargetException e) {
                throw new FatalBeanException("Due to an InvocationTargetException we failed to add "
                        + "a named PropertyChangeListener to bean '" + bean + "'", e);
            }
            catch (IllegalAccessException e) {
                throw new FatalBeanException("Due to an IllegalAccessException we failed to add "
                        + "a named PropertyChangeListener to bean '" + bean + "'", e);
            }
        }
    }
View Full Code Here

        }
        else {
            Class beanClass = bean.getClass();
            Method namedPCLRemover = getNamedPCLRemover(beanClass);
            if (namedPCLRemover == null)
                throw new FatalBeanException("Could not find the bean method"
                        + "/npublic void removePropertyChangeListener(String, PropertyChangeListener);/nin bean '"
                        + bean + "'");
            try {
                namedPCLRemover.invoke(bean, new Object[] {propertyName, listener});
            }
            catch (InvocationTargetException e) {
                throw new FatalBeanException("Due to an InvocationTargetException we failed to remove "
                        + "a named PropertyChangeListener from bean '" + bean + "'", e);
            }
            catch (IllegalAccessException e) {
                throw new FatalBeanException("Due to an IllegalAccessException we failed to remove "
                        + "a named PropertyChangeListener from bean '" + bean + "'", e);
            }
        }
    }
View Full Code Here

  public void testIsCheckedException() {
    assertTrue(ObjectUtils.isCheckedException(new Exception()));
    assertTrue(ObjectUtils.isCheckedException(new ServletException()));

    assertFalse(ObjectUtils.isCheckedException(new RuntimeException()));
    assertFalse(ObjectUtils.isCheckedException(new FatalBeanException("")));

    // Any Throwable other than RuntimeException and Error
    // has to be considered checked according to the JLS.
    assertTrue(ObjectUtils.isCheckedException(new Throwable()));
  }
View Full Code Here

    mc = new TestRuntimeExceptionHandler();
    mv = testHandlerCaughtException(mc, new RuntimeException());
    assertTrue(mv.getViewName().equals("handle(RTE)"));
    assertTrue("Invoke correct method", mc.wasInvoked("handle(RTE)"));
    mv = testHandlerCaughtException(mc, new FatalBeanException(null, null));
    assertTrue(mv.getViewName().equals("handle(RTE)"));
    assertTrue("Invoke correct method", mc.wasInvoked("handle(RTE)"));

    testExceptionNoHandler(mc, new SQLException());
    testExceptionNoHandler(mc, new Exception());
View Full Code Here

  public void testAlwaysTrueForThrowable() {
    RollbackRuleAttribute rr = new RollbackRuleAttribute("java.lang.Throwable");
    assertTrue(rr.getDepth(new MailSendException("")) > 0);
    assertTrue(rr.getDepth(new ServletException()) > 0);
    assertTrue(rr.getDepth(new FatalBeanException(null,null)) > 0);
    assertTrue(rr.getDepth(new RuntimeException()) > 0);
  }
View Full Code Here

    this.serviceMappings = serviceMappings;
  }

  public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
    if (!(beanFactory instanceof ListableBeanFactory)) {
      throw new FatalBeanException(
          "ServiceLocatorFactoryBean needs to run in a BeanFactory that is a ListableBeanFactory");
    }
    this.beanFactory = (ListableBeanFactory) beanFactory;
  }
View Full Code Here

      else {
        throw new IllegalArgumentException("Unsupported filter type: " + filterType);
      }
    }
    catch (ClassNotFoundException ex) {
      throw new FatalBeanException("Type filter class not found: " + expression, ex);
    }
  }
View Full Code Here

TOP

Related Classes of org.springframework.beans.FatalBeanException

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.