Michael Farouk

The main issue every programmer find is the exception handling. Let us together by the means of this article try to see what the best ways available for exception handling are. The idea of the all the programmers like us is to come up with a quality code that  instead of making the problems worst, resolves the same at the earliest.

What is an Exception?

Exception is an error which occurs during the execution of a program.

There are mainly two types of exceptions:

1-Checked exception

2-Unchecked exception

Checked exception is considered at compile time so it greatly reduces the occurrence of unhandled exceptions during runtime. They extend Exception and are intended to be handled at compile time. A checked exception indicates an expected problem which might occur during normal application execution.

Following is the list of checked exceptions:

  • ClassNotFoundException
  • NoSuchMethodException
  • NoSuchFieldException
  • InstantiationException
  • CloneNotSupportedException
  • InterruptedException
  • IllegalAccessException

Unchecked exceptions extend RuntimeException. An unchecked exception indicates an unexpected problem which occurs due to coding bug. These are exceptions introduced by the application developer during coding. These exceptions are not checked during compile time but they are checked during runtime.

Following is the list of unchecked exceptions

  • NullPointerException
  • IndexOutOfBoundsException
  • ArrayIndexOutOfBoundsException
  • ClassCastException
  • IllegalStateException
  • ArithmeticException
  • SecurityException

Description: JavaExceptionHandling.jpg

The Hierarchy of Exception

Handling Exceptions

1-Using try and catch

Exception handling works by transferring the execution of a program to an appropriate exception handler when an exception occurs. For example, if you call a method that opens a file but the file cannot be opened, execution of that method will stop, and code that you wrote to deal with this situation will be run. Therefore, we need a way to tell the JVM what code to execute when a certain exception happens. To do this, we use the try and catch keywords. The try is used to define a block of code in which exceptions may occur. This block of code is called a guarded region (which really means "risky code goes here").

Example:

try{

The risky code goes here which is may causes some kind of exceptions. }catch(HandeledException){

Handling of exception goes here

}

2-Using finally

A finally block encloses code that is always executed at some point after the try block, whether an exception was thrown or not. Even if there is a return statement in the try block. The finally block executes right after the return statement, and before the return executes! This is the right place to close your files, release your network sockets, and perform any other cleanup your code requires. If the try block executes with no exceptions, the finally block is executed immediately after the try block completes. If there was an exception thrown, the finally block executes immediately after the proper catch block completes.

Example:

try{

The risky code goes here which is may causes some kind of exceptions.

}catch(Handeled Exception){

Handling of exception goes here

}

finally{

The code goes Here is always excute after the try or the catch blocks.

// Put code here to release any resource we

// allocated in the try clause.

}

Custom Exception Handling

Custom exception handler is designed to meet the application requirement. The normal exception APIs provided by the java are basic building blocks. Now the developer is expected to use these building blocks to make their own custom exception handler.

To define their own custom exception class, developer needs to extend the Exception class. All custom exceptions are considered to be checked exceptions. The custom exception class is like any other normal class but they provide useful methods and directs customized execution path

Following rules needs to be followed to define custom exception class:

  • All exceptions must be a child of Throwable.
  • Must extend the Exception class for checked exception.
  • For runtime exception, extend the RuntimeException class.

Example:

class MyCustomException extends Exception{

// Write useful methods and execution path

}

Conclusion

 A program can catch exceptions by using a combination of the try, catch, and finally blocks.

  • The try block identifies a block of code in which an exception can occur.
  • The catch block identifies a block of code, known as an exception handler that can handle a particular type of exception.
  • The finally block identifies a block of code that is guaranteed to execute, and is the right place to close files, recover resources, and otherwise clean up after the code enclosed in the try block.

The try statement should contain at least one catch block or a finally block and may have multiple catch blocks.

 The class of the exception object indicates the type of exception thrown. The exception object can contain further information about the error, including an error message. With exception chaining, an exception can point to the exception that caused it, which can in turn point to the exception that caused it, and so on.

Michael

A financial statement (or financial report) is a formal record of the financial activities of a business, person, or other entity. Relevant financial information is presented in a structured manner and in an easy to understand form, through this post we will go through some of the financial statements and the usage of each one.

1-Balance sheet

Balance sheet (also called the statement of financial position), and it describes where the enterprise stands at a specific point of time. The balance sheet list all the enterprise assets, liabilities and owners’ equity.

  • Assets are economic resources that are owned by the business and are expected to benefit future operations.
  • Liabilities are debts that represent negative future cash flows for the enterprise.
  • Owners’ equity represents the owners’ claims on the assets of the business.

At any point the assets should equal to the sum of the liabilities and owners’ equity, and we call this the accounting equation.

2-Income statement

The income statement provides the user with data about the profitability of the enterprise, detailing sources of revenue and the expenses which reduce profit, by analyzing the income statement you can determine the actions required to increase the profit and to reduce the expenses.

The bottom line of the income statement is called net income or profit. Net income is either retained by the firm for growth or paid out as dividends to the firm's owners (investors) depending on the company's dividend policy.

3- Cash Flow Statement

Cash flow statement (also called Statement of Cash flow), it is concerned with the flow of cash in and out of the business, and it breaks the analysis down to operating, investing, and financing activities.

  • Operating activities include the cash effects of revenue and expense transactions.
  • Investing activities include the cash effects of purchasing and selling assets.
  • Financing activities include the cash effects of transactions with the owners and creditors.

It is very important for:

The Accounting personnel who need to know whether the organization will be able to cover payroll and other immediate expenses.

For Potential lenders or creditors who want a clear picture about a company's ability to repay depts.

And for Potential investors, who need to judge whether the company is financially sound or not.

First, what is SharePoint?

It’s a Web application platform developed by Microsoft, Organizations use it to create websites. You can use it as a secure place to store, organize, share, and access information from almost any device.

Description: C:\Documents and Settings\Administrator\Desktop\blog\SharepointServices1.gif

Why we should use it?

Here are the Top Features of Microsoft SharePoint:

  1.  Document Management :

-Store, organize, and locate documents.

-Ensure the consistency of documents.

-Manage metadata for documents.

-Help protect documents from unauthorized access or use.

-Ensure consistent business processes (workflows) for how documents are handled.
 

  1. Social
    Facebook and Twitter are the most popular social networking websites, and with the release of SharePoint 2013, users can like posts or documents and they have ability to post short status updates and replies that may include text, links, images, videos, hashtags (#) for categorization/tagging and they can use the “@” symbol to search for people to reference in social activity updates and you’re able to follow people, documents, sites, tags and activities.
    Also users can share pages, posts and documents with other users.
     
  2. Search
    SharePoint 2013 Search enables users to discover important information quickly, with fast document previews in the web browser, and much better search refiners on the left-hand side. In 2013 release, every search box in every team site will offer full access to enterprise-wide search, people search, and other specialized search experiences.

Users can access the desired scope from the drop-down list inside the search box. SharePoint 2013 allows users to have the power of enterprise-level search experiences.

  1. Web Content Management
    The web content management improvements in SharePoint 2013 simplify how users can design publishing sites, and enhance the authoring and publishing processes within an organization. With improvements in the process of embedding video directly into pages, shorter URLs, and better multi-lingual and multi-device support, Intranets and Extranets will be more efficient.
     
  2. Apps and the Marketplace
    SharePoint App model allows for much more flexibility and personalization, SharePoint App is a stand-alone, self-contained piece of functionality that extends the features and capabilities of a SharePoint site. There is a 'public store,' which is the main app store that Microsoft has been marketing heavily. Users connect to it from within SharePoint, and it adheres to the now standard rules of a typical store. There is a search function, and users can also browse by genre. Once selected an app is downloaded and installed directly onto the SharePoint environment.

The marketplace is expected to grow substantially in order to benefit users. SharePoint 2013 has been redesigned to allow independent third-party developers provide apps that extend the functionality of SharePoint.

We will continue SharePoint Features in future articles….