Java Rumblings

Pages

  • Home
  • TOC
  • Spring
  • Core Java
  • Design Pattern
  • Concurrency
  • Hibernate
  • Garbage Collection
  • Exception
  • Books
  • Java API
  • Collections
  • Reflection
  • Class Loader
  • Annotation
  • Generics

Saturday, 12 March 2011

Exceptions (TOC)

Introduction to exception
How java implements Exception handling?
Types of Exceptions in java
            Checked vs unchecked vs Error type exceptions

Java's catching or throwing exception

This section discusses the reasoning behind this requirement and what it means to you and your Java programs.

Dealing with Exceptions

  • Example of class which has to deal with example
  • Catching and handling exception with try-catch-finally
  • Specifying the exceptions thrown by method using throws clause

How to throw Exceptions

  • The throw statement
  • Creating custom exception

Custom Exceptions

  • Adding custom exceptions to the project design
  • Creating the custom exception example
  • Naming convention for exceptions in java

Nested Exceptions

Runtime Exceptions--The Controversy

Exceptions and control flow

Finally and catch

Some practices related to exception:

    • Avoid @throws in javadoc

    • Javadoc all exceptions

    • Be specific in throws clause

    • Stack trace as String

    • Use template for repeated try-catch

    • Pass all pertinent data to exceptions

    Posted by Rekha Kumari at 02:35
    Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
    Labels: exception, java, toc2

    No comments:

    Post a Comment

    Newer Post Older Post Home
    Subscribe to: Post Comments (Atom)

    Related Posts

    Search This Blog

    Followers

    Blog Archive

    • ►  2012 (40)
      • ►  January (40)
    • ▼  2011 (854)
      • ►  December (7)
      • ►  October (5)
      • ►  September (4)
      • ►  July (43)
      • ►  June (157)
      • ►  May (221)
      • ►  April (231)
      • ▼  March (119)
        • Creating read-only or unmodifiable collection in java
        • HashMap vs HashTable
        • Get Synchronized Map
        • Getting Synchronized set
        • Difference between String StringBuffer and StringB...
        • Abstract classes vs interfaces
        • Tools for converting c to java source
        • Conversion from decimal to binary
        • Conversion from integer to hexadecimal and vice-versa
        • Conversion from primitive types to String and vice...
        • Covariant Parameter Types
        • Getting the limits of primitive types
        • JPA : Persistence unit
        • JPA 2.0 with EclipseLink
        • JPA resoures for eclipse link
        • JPA : Relationship Example using eclipse link
        • Simple example on JPA with eclipse link
        • Installation - Eclipse link and derby for JPA
        • Relationship Mapping
        • Persistence of fields
        • Entities and Transactions in JPA
        • EntityManager in JPA
        • Customizing the Entity object in JPA
        • JPA Architecture
        • JDBC vs ORM
        • JPA : Overview
        • Initialling to zero rather than null
        • Equivalent of function pointers of C in java
        • Get file size in java
        • Extending size of array in java
        • JAX-WS quick tutorial
        • Create XSD file with JAXB
        • More on XML serialization with JAXB
        • Jaxb : Shortcomings of API
        • Marshalling : Jaxb
        • Jaxb : Validation
        • UnMarshalling : Jaxb
        • Jaxb : TABLE OF CONTENTS
        • Jaxb : Binding XML Schemas
        • Prerequisites for jaxb
        • JAXB : Generating java classes from xsd
        • How to create a zip file with java.util.zip package
        • Retrieve a compressed file from a ZIP file
        • Retrieve the contents of a ZIP file
        • Uncompress a file in the GZIP format
        • Writing zip file in java
        • Convert String to boolean
        • Convert String to byte array
        • Convert from byte array to string
        • Jaxb - Example to generate xml from java class
        • java.lang.NoClassDefFoundError: org/apache/commons...
        • JAXB Architecture
        • JAXB Introduction
        • Compression and DeCompression in Java using java.u...
        • Compressing java string
        • WSDL Document Example
        • WSDL Elements
        • WSDL introduction
        • Write XML File using STAX
        • JAXP introduction
        • Servlets (index)
        • JSP (index)
        • Working with Arrays using reflections in java
        • Type Descriptors in reflections
        • Reflections (toc or index)
        • Example on Format of a Serialized Object
        • Versioning in Serialization
        • Java Serialization in gist
        • How to return the content in the correct encoding ...
        • How to validate URL in Java?
        • How to schedule a job in Java?
        • How to Convert an ArrayList to a HashSet?
        • API Design for collections
        • Interoperability in collections
        • Compatibility in collections
        • Custom Implementations in collections
        • Convenience Implementations
        • General Purpose Implementations
        • Wrapper Implementations
        • The SortedMap Interface
        • The SortedSet interface
        • The Map Interface in java
        • Fancy Uses of Collection-Views: Map Algebra
        • Multimaps
        • Bulk operations on map
        • Basic Operations in map
        • Comparison of map and hashtable
        • Implementations in collections
        • Interfaces in collections
        • Introduction to collection
        • Putting It All Together
        • The finally Block in java
        • The catch Block(s)
        • The try Block in java
        • A simple class which has to deal with exception - ...
        • try - catch - finally : Catching the exception in ...
        • throws : Throwing the Exceptions from a method in ...
        • Exceptions (TOC)
        • Java's catching or throwing exception
        • Runtime Exceptions--The Controversy
      • ►  February (64)
      • ►  January (3)
    • ►  2010 (208)
      • ►  December (1)
      • ►  November (3)
      • ►  October (57)
      • ►  September (120)
      • ►  August (10)
      • ►  July (10)
      • ►  May (4)
      • ►  April (3)
    • ►  2009 (8)
      • ►  December (8)

    Labels

    .net (3) abstract (5) access (1) Access Control (3) accessor (1) address (1) address of (1) advantage (3) ajax (2) Algorithms (1) Annotation (16) anonymous (1) Apache (6) apache commons (1) Apache POI (1) API (1) application-server (2) array/1DArray (12) array/2DArray (5) ArrayDeque (1) ArrayList (18) Arrays (33) Arrays-tutorial (18) assert (1) atom (1) atomic operation (2) AtomicInteger (4) atomicity (1) Autoboxing / Unboxing (2) avoid null (1) awt / abstract window toolkit (1) batch processing (2) Bean (2) benchmark (1) bigdecimal (2) BigInteger (1) binarysearch (1) binarystream (1) binding (1) bits (4) Bitwise (5) bitwise operators (3) blob (2) blocking concurrent ds (7) blocking queue (7) blocks (1) books (5) boolean (1) boundedness (4) BufferedInputStream (1) BufferedOutputStream (2) BufferedReader (1) BufferedWriter (2) bulk operations (3) byte array (7) byte IO (5) ByteArrayInputStream (3) c cpp (1) c++ / cpp (6) cache (3) Calendar (4) cascade (1) casting (2) catalyst (1) char (2) character IO (1) charting (1) checked exception (1) Class (11) class file (1) classloader (13) classname (1) classpath (7) clob (2) clone (5) cloud computing (1) coding style (7) collection-diagrams (2) collection-implementation (7) collection-interface (15) collection-interoperability (3) collection-iteration (2) collection-operation (9) collection-view (3) Collections (168) Collections static methods (1) Collections-base (6) Collections-methods (2) coltoc (5) command line arguments (3) command prompt (1) commons-lang (3) commons-logging (1) commons.beanutils (1) Comparable (6) Comparator (5) compare() (2) compareTo() (7) comparing languages (1) Comparison (10) compilers (7) composition (7) compression (5) concatenate (1) concurrency (83) concurrent datastructures (11) concurrent hashmap (2) concurrent hashset (1) concurrent interfaces (7) conditions (2) Console (1) console input (1) const (1) constant / literal pool (6) Constructor (15) content (1) contoc (4) contravariance (3) control flow (6) controversy (1) conversion (17) Copy Constructor (1) Copying (4) core-java (79) covariance (7) cpp vs java (19) csv (1) custom exception (3) cxf (3) cyclic dependency (1) daemon threads (1) data types (2) database key (2) databases (1) datastructures (1) Date (9) DateFormat (1) dbutils (1) DDD / Domain Driven Design (1) decompile (2) decompiler (1) deep copy (5) deeptoString (1) delete (1) deque / double ended queue (2) design (4) design principle (1) destructor (2) deterministic (1) development tools (7) difference (24) directory (16) disadvantage (2) divide-by-zero-exception (1) do-while (1) document (2) double (3) download-source-code (12) dynamic (1) dynamic / weak typing (1) ear (1) early binding (1) effective java (5) email (1) empty (1) encapsulation (2) encapsulation_classes (6) encoding (1) Enum (16) Enumeration (1) EnumMap (1) EnumSet (2) environment variables (1) equality (9) equality operator (1) equals() (14) event (2) evil constructor (1) example-code (17) excel (1) exception (50) exe (1) executable (1) Execution time (1) executor (6) executor service (1) expand (1) externalization (6) failsafe (1) FAQ (1) feed (1) field (2) File (4) File handling (39) file IO (4) file reading (1) fileFilter (2) FileFiltername (1) filter (2) Filtered Stream (2) final (8) final classes (1) finalize (2) finally (3) firstProgram / helloworld (10) fizz (1) float (1) for (1) formatting output (1) frame (3) Function parameter (1) function pointers (1) functions (1) Fundamental Prog. Structure (5) funny (1) future (1) gc / garbage collection (12) generator (1) generic-method (4) Generics (35) generics faciliy (3) getopt (1) Getter (1) google (2) GUI (1) guice (1) gwt (1) gzip (2) h2 database (2) hashcode (4) hashMap (10) HashSet (7) HashTable (7) heap-memory (4) hell (1) helper (1) hibernate (29) hibernate fetching strategies (1) hibernate object (1) hibernate-annotation (1) hibernate-inheritance (4) hibernate-xml (1) hiding (1) hotspot (1) how to (1) how-to (1) hsqldb (1) http (2) http client (1) httpconnection (2) if-else (2) image (3) immutable objects (3) implementing datastructure using array (1) import (2) in-memory (1) incomplete (2) index access (1) inheritance (29) inheritance type (1) ini file (1) init block (3) initialization (16) Inner Class (9) Input (2) inputstream (1) instanceof (4) integer (6) Interface (11) intern (3) internalization (1) interrupt (1) interview questions (8) introduction (3) invariance (1) IO / Input Output (27) ipaddress (1) ireport (1) isEmpty (1) iterable (2) iterate (4) iterator (7) itext (6) j2ee (1) jar (6) jasper (1) java (1069) Java API (1) java console (1) java secret (1) java-practises (7) java-secrets (1) java-tip (1) java.io (36) java.io.File (21) java.lang (6) java.lang.Annotations (14) java.math (1) java.net (4) java.nio (3) java.text (2) java.util.concurrent (1) java.util.logging (2) java.util.zip (6) java4 (1) Java5 / tiger (5) java5Concurrency (19) java6 (5) java7 / jdk7 (10) javac (1) javac options (2) javadoc (2) javamail (2) javax (1) javax.tools (1) jax-ws (1) jaxb (13) jaxp (1) jdbc (14) jdbc drivers (1) jetty (1) jexcelapi (2) jfreechart (1) jms (1) jpa / java persistence api (16) jsf (1) jsp (7) jsp compiler (1) junit (2) just-in-time (JIT) compilers (1) jvm (12) jvm options (1) jython (1) keyset (1) keyword (3) Latches (2) late binding (1) lazy initialization (1) lexical structure (1) libraries (1) lifecycle (2) limitations (2) link list (3) LinkedHashMap (4) linkedHashSet (3) LinkedList (5) list (39) list-implementation (4) list-interface (1) list-operation (4) ListIterator (1) literals (1) local variable (1) locale (2) locking (8) logging (8) logical (1) loops (1) lucene (1) macaddress (1) main-method (2) map (41) map-implementation (12) map-interface (2) Marker Interfaces (2) memory (7) memory frame (1) memory leak (2) memory model (3) message-format (1) metadata (1) Method (computer science) (7) method overriding / hiding (2) microbechmark (1) Microsoft Office (1) mixin (1) mock test (1) modifier (4) monitor (1) mq / message queue (1) multiple inheritance (1) Mutable objects (1) mutator (1) named exception (3) naming convention (12) nanotime (1) native method (7) natural key (1) natural langauge (1) natural ordering (1) Navigable Map (1) Navigable Set (1) need (1) Nested Class (10) networking (1) new (2) newInstance (1) non-static (2) notifyAll (1) NPE / Null Pointer Exception (3) null (5) number (1) NumberFormat (1) numbers (1) object (3) Object class (3) Observable (1) online (1) OOP / Object Oriented Programming (52) openjdk (2) operators (20) optimization (3) orm (38) os / operating system (2) output (4) overloading (3) overriding (4) package (3) paradigm (1) parallel programming (1) parametric type (2) parsing (5) Pass by value (1) password breaking (1) path (2) pdf (4) pdf-generation (5) performance (3) pointer (1) polymorphism (5) precompilation (1) prerequisite (1) preventing inheritance (1) Primary / primitive data types (15) primary key (1) printf (2) priority (1) private constructor (1) privilege (1) process (2) producer consumer (1) programmatic / runtime compilation (1) programming (1) programming language / PL (4) programs (14) properties (6) Property (map) (1) Pros and cos (1) quartz (1) queue (2) random (3) random stuff (1) range (1) raw types (1) read (1) read byte (1) read file (2) read-only (1) read/write (3) recursion (3) reference (5) Reflection (30) regex / regular expression (16) resource (1) rest (4) restful-webservice (3) restrictions (3) return (1) rmi (4) rss (1) rtf (1) rtti (1) ruby (2) Run time (computing) (1) runnable (3) runtime (4) saaj (1) sample code (8) scheduler (2) scjp (9) scope (1) scoping (2) screenshot (1) scripting (1) search (1) security manager (2) semaphore (4) sequence diagram (1) serialization (16) server (4) servlet (15) servlet mapping (1) set (28) set-implementation (7) Setter (1) shallow copy (6) SimpleDateFormat (1) sleep (1) slf4j (1) SOA / service oriented architecture (3) soap (3) soft-reference (1) sort (5) sorted map (1) sorted set (7) sorting (10) source code (6) split (1) spring-mvc (1) sql date (1) stack (3) stack memory (2) standard IO (2) static (20) static / strong typing (1) static block (1) static initialization (6) static methods (1) stax (1) Stream (14) String (46) string abnormal (1) string equality (1) String functions (2) string IO (2) string tokenizer (3) String utility (1) stringBuffer (4) stringBuilder (4) StringUtils (1) stripes (1) strong-reference (2) subscript (1) substring (3) subtyping (1) sun.misc (1) super (4) surrogate key (1) swap (4) swing (9) Switch-Case (3) synchronized (8) synchronizer (9) synchronous queue (1) syntax and grammar (34) system properties (2) tdd / test driven development (2) templates (1) testing (1) this (2) thread factory (1) thread local (1) thread pool (4) ThreadGroup / thread group (5) ThreadModel (1) Threads (30) throw (4) throws (4) Time (2) timer (2) TimerTask (1) toc/index (8) toc2 (24) today (6) tomcat (1) TOPLink (1) toString (5) transient (1) traversing (1) treeMap (6) treeSet (4) try-catch (5) tutorial (1) tutorial-References (1) twitter (1) type (1) type parameter (1) type safety (2) type substitution (1) typecast (1) types (3) udf (6) UML (9) underscore (1) unicode (1) unique (1) unit test (1) unit testing (1) unix / linux (1) URL (3) url shortener (1) Usage (1) use cases (1) using reflection (2) utf-8 (1) utility class (2) validation (1) value classes (5) varargs (3) variables (6) variance (1) Vector (9) version (1) vm / virtual memory (1) volatile (3) wait (1) war (1) weak-reference (5) WeakHashMap (3) web container (1) web development (18) web frameworks (1) web-server (2) web-service (13) while (1) wicket (1) wildcard (11) windows os (1) wink (1) without Main (1) wrapper (4) write file (1) writing xml (1) wsdl (4) xml-encoder (1) xsd (1) yield (1)
    Powered by Blogger.