Thanks for this excellent suggestion Paolo. I will add it to my code. The Sunburned Surveyor
On 5/17/07, P.Rizzi Ag.Mobilità Ambiente <[EMAIL PROTECTED]> wrote: > > Before casting you should always check that the instance is indeed what you > think, like this: > if( needToCast instanceof IRendererFactoryTool ) > IRendererFactoryTool casted = (IRendererFactoryTool) needToCast > > and this saves you from nulls too, because the instanceof will be false if > needToCast is null. > > > Bye > Paolo Rizzi > > ________________________________ > Da: [EMAIL PROTECTED] per > conto di Sunburned Surveyor > Inviato: mer 16/05/2007 20.46 > A: List for discussion of JPP development and use. > Oggetto: [JPP-Devel] A question about null values... > > > > Are you allowed to cast an object with a value of null, or does this > throw an exception? > > For example, would the following statement throw an exception if the > needToCast reference was null? > > IRendererFactoryTool casted = (IRendererFactoryTool) needToCast; > > Thanks, > > The Sunburned Surveyor > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Jump-pilot-devel mailing list > Jump-pilot-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Jump-pilot-devel mailing list > Jump-pilot-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel > > ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel