On Tue, Oct 26, 2010 at 4:13 PM, Amila Jayasekara <[email protected]> wrote:

> Hi All,
>
>
>
> Group C code reviews will be lead by Sameera for next few weeks. Please
> communicate with Sameera and arrange review sessions.
>
>
> Last week we reviewed some of the User core code. Mainly the
> DatabaseUserStoreManager.
>
>
> Some of the lessons we learn t are as follows,
>
>
> Use of database connections
>
> If a database connection is opened by a particular method, it should close
> the connection in a finally block.
>
> When closing a connection there is possibility that an exception might
> rise. In that case we should not through the exception. In other words we
> should not throw exceptions in finally block.
>
>
> try{
>
> }catch(SQLException) {
>
>                 //log
>
>                 //throw or handle
>
> }
>
> finally {
>
>                 Try {
>
>     Statement.close();
>
>                 Resultset.close();
>
>                 Connection.close()
>
>                 }catch(SQLException e){
>
>                 //log
>
>                 //do not throw exceptions here
>
> }
>
> }
>
>
> Class/method who created the connection must close the connection. If a
> reference is passed to another method, class, that class/method should not
> close the connection.
>
>
> When closing connections, it is better to close all database related
> objects, resultSet, statements and connections.
>
>
> OSGI,
>
> BundleActivator start method should not throw any exception. This leads
> OSGI to restart bundle over and over.  Therefore bundle activator start
> method should catch exceptions & errors and log them to a file.
>
> E.g: -try {
>
>                 }
>
> Catch (Throwable e) {
>
>                 //log
>
>                 //do not throw exceptions
>
> }
>
>
>
> Naming,
>
>                 Should  not have names like Statement sqlStmt1 etc …
> Should have a meaningful name.
>
> E.g :- Statement updateUserTableSQL
>
>
> Next reviews
>
>                 Rajike – ESB Endpoints
>
>                 Chathuri – Tooling related component
>
>                 Sameera – Carbon related component
>
>
>
> Thanks
>
> AmilaJ
>
Let's create a crucible project for the next reviews.

>
> _______________________________________________
> Carbon-dev mailing list
> [email protected]
> https://wso2.org/cgi-bin/mailman/listinfo/carbon-dev
>
>


-- 
Thanks,
Denis
----------------------------------------------------------
*Denis Weerasiri*
Software Engineer; WSO2 Inc.; http://wso2.com,
*email: denisw <http://goog_277208233/>*[email protected]*
<http://wso2.com/>*cell: +94 (71) 684-4450
blog: **http://ddweerasiri.blogspot.com* <http://ddweerasiri.blogspot.com/>*
twitter: **http://twitter.com/ddweerasiri* <http://twitter.com/ddweerasiri>*
linked-in: 
**http://lk.linkedin.com/in/ddweerasiri*<http://lk.linkedin.com/in/ddweerasiri>
_______________________________________________
Carbon-dev mailing list
[email protected]
https://wso2.org/cgi-bin/mailman/listinfo/carbon-dev

Reply via email to