If you play with null values NullPointerException will be thrown. for instance, if some value is null in the database and if you got that null value to a string variable, after that if you trim it or substring it, then null pointer exception will be thrown. String str= null; str.trim() will throw NullPointerException.
A
checked exception is some subclass of Exception (or Exception itself),
excluding class RuntimeException and its subclasses.
Making an exception checked forces client programmers to deal with the
possibility that the exception will be thrown. eg, IOException thrown by
java.io.FileInputStream's read() method·
Spring comprises of seven modules. They are..
The core container:
The core container provides the essential functionality of the Spring
framework. A primary component of the core container is the BeanFactory, an
implementation of the Factory pattern. The BeanFactory applies the Inversion of
Control (IOC) pattern to separate an application's configuration and dependency
specification from the actual application code.
Spring context:
The Spring context is a configuration file that provides context information to
the Spring framework. The Spring context includes enterprise services such as
JNDI, EJB, e-mail, internalization, validation, and scheduling functionality.
Spring AOP:
The Spring AOP module integrates aspect-oriented programming functionality
directly into the Spring framework, through its configuration management
feature. As a result you can easily AOP-enable any object managed by the Spring
framework. The Spring AOP module provides transaction management services for
objects in any Spring-based application. With Spring AOP you can incorporate
declarative transaction management into your applications without relying on
EJB components.
Spring DAO:
The Spring JDBC DAO abstraction layer offers a meaningful exception hierarchy
for managing the exception handling and error messages thrown by different
database vendors. The exception hierarchy simplifies error handling and greatly
reduces the amount of exception code you need to write, such as opening and
closing connections. Spring DAO's JDBC-oriented exceptions comply to its
generic DAO exception hierarchy.
Spring ORM:
The Spring framework plugs into several ORM frameworks to provide its Object
Relational tool, including JDO, Hibernate, and iBatis SQL Maps. All of these
comply to Spring's generic transaction and DAO exception hierarchies.
Spring Web module:
The Web context module builds on top of the application context module,
providing contexts for Web-based applications. As a result, the Spring
framework supports integration with Jakarta Struts. The Web module also eases
the tasks of handling multi-part requests and binding request parameters to
domain objects.
Spring MVC framework:
The Model-View-Controller (MVC) framework is a full-featured MVC implementation
for building Web applications. The MVC framework is highly configurable via
strategy interfaces and accommodates numerous view technologies including JSP,
Velocity, Tiles, iText, and POI.
User defined Exceptions are the separate Exception classes defined
by the user for specific purpose. A User defined exception is created
by sub-classing Exception Class. This allows custom exceptions to be
generated (using throw) and caught in the same way as normal
exceptions.
Example:
class MyException extends Exception {
// The class simply has to exist to be an exception
}
There is no catch block that names either the class of exception that has been thrown or a class of exception that is a parent class of the one that has been thrown, then the exception is considered to be unhandled, in such condition the execution leaves the method directly as if no try has been executed
Types of advice:
Before advice: Advice that executes before a join point, but which does not
have the ability to prevent execution flow proceeding to the join point (unless
it throws an exception).
After returning advice: Advice to be executed after a join point completes
normally: for example, if a method returns without throwing an exception.
After throwing advice: Advice to be executed if a method exits by throwing an
exception.
After (finally) advice: Advice to be executed regardless of the means by which
a join point exits (normal or exceptional return).
Around advice: Advice that surrounds a join point such as a method invocation.
This is the most powerful kind of advice. Around advice can perform custom
behavior before and after the method invocation. It is also responsible for
choosing whether to proceed to the join point or to shortcut the advised method
execution by returning its own return value or throwing an exception
No, checked exceptions are just sub classes of Exception class excluding RuntimeException and its sub classes. We just informally call them as checked exception because java compiler will detect those exceptions at compile time. But there is no ecxeption like java.lang.CheckedException.
Not NullPointerException
When an exception is thrown in a try block and is caught by a matching catch block, the exception is considered to have been handled
Spring DAO classes throw exceptions which are subclasses of DataAccessException(org.springframework.dao.DataAccessException).Spring provides a convenient translation from technology-specific exceptions like SQLException to its own exception class hierarchy with the DataAccessException as the root exception. These exceptions wrap the original exception.
Ads By Google
© 2018 - JavaSpartans.com • All Rights Reserved