Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Tomcat - JSP/Servlet container
Struts - A MVC web framework
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
JSP - A mailing list about Java Server Pages specification and reference
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Subject: Servlet : Session invalidate
Oracle Connection Pooling in 3 2 2
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Subject: Running a Simple JMS Example
Tomcat and webapplication specific java library path
Mapping in workers2 properties
org apache jasper JasperException
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action
   MESSAGE
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
Value attribute of <html:checkbox
url string for connecting jboss to oracle
javax servlet ServletException: BeanUtils populate
5 0 18: Windows XP Pro vs Windows 2000
HTTP Status 404 The requested resource is not available
 
Design paterns for null arguments

Design paterns for null arguments

2004-05-28       - By Laxmish R. Hegde

 Back
Reply:     1     2     3     4     5     6     7     8  

I think sub class'ing  the java.lang.exception and throwing that exception
should work fine for you.
Yes you can have a factory pattern to get the exception you would like to
throw back to the client.

Cheers,
Laxmish Hegde


-- --Original Message-- --
From: Sandeep Kachalia [mailto:skachalia@(protected)]
Sent: Friday, May 28, 2004 2:26 PM
To: J2EEPATTERNS-INTEREST@(protected)
Subject: Re: Design paterns for null arguments



Thanks Ben,
I wanted to open APIs for my client. The API users may pass null values as
arguments.
I have n number of  parameters against I need to do null verification.
Can we apply some pattern here through which we check the nullability and
give customerized messages to user.

e.g.
public void myFunction(String a,String b,String c)
{     Object  arguments[] ; // List of argument objects;
   // patternApplied(Object arguments[]) throws Exception
}

I hope I am able to make it clear.

Thanks,
Sandeep


Ben Hill wrote:


On Fri, 2004-05-28 at 07:10, Sandeep Kachalia wrote:



Does exist a pattern for handling null arguments in a method.

any pointers??





Not a method per se. If you have some sort of idea what the null

handling should do, there may be a pattern to help.



Cheers,



Ben



====================================================================

Companion Site:  http://www.corej2eepatterns.com
<http://www.corej2eepatterns.com>

J2EE BluePrints:  http://java.sun.com/blueprints/corej2eepatterns
<http://java.sun.com/blueprints/corej2eepatterns>

List Archive:
http://archives.java.sun.com/archives/j2eepatterns-interest.html
<http://archives.java.sun.com/archives/j2eepatterns-interest.html>

Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to
listserv@(protected) <mailto:listserv@(protected)>



====================================================================
Companion Site: http://www.corej2eepatterns.com J2EE BluePrints:
http://java.sun.com/blueprints/corej2eepatterns List Archive:
http://archives.java.sun.com/archives/j2eepatterns-interest.html
Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to
listserv@(protected)

*********************************************************************
Disclaimer: The information in this e-mail and any attachments is
confidential / privileged. It is intended solely for the addressee or
addressees. If you are not the addressee indicated in this message, you may
not copy or deliver this message to anyone. In such case, you should destroy
this message and kindly notify the sender by reply email. Please advise
immediately if you or your employer does not consent to Internet email for
messages of this kind.
*********************************************************************

====================================================================
Companion Site: http://www.corej2eepatterns.com
J2EE BluePrints: http://java.sun.com/blueprints/corej2eepatterns
List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html
Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected)

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859 (See http://iso-8859.ora-code.com)-1">
<TITLE></TITLE>

<META content="MSHTML 5.50.4937.800" name=GENERATOR></HEAD>
<BODY text=#330099 bgColor=#ffffff>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=424140810-28052004>I
think sub&nbsp;class'ing&nbsp; the java.lang.exception and throwing that
exception should work fine <FONT face=Tahoma color=#330099>for
you.</FONT></SPAN></FONT></DIV>
<DIV><FONT face=Tahoma size=2><SPAN class=424140810-28052004>Yes you can have a
factory pattern to get the&nbsp;exception&nbsp;you would like to throw back to
the client.</SPAN></FONT></DIV>
<DIV><FONT face=Tahoma size=2><SPAN class=424140810-28052004></SPAN></FONT>
<FONT
face=Tahoma size=2><SPAN class=424140810-28052004></SPAN></FONT><FONT
face=Tahoma size=2><SPAN class=424140810-28052004></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Tahoma size=2><SPAN
class=424140810-28052004>Cheers,</SPAN></FONT></DIV>
<DIV><FONT face=Tahoma size=2><SPAN class=424140810-28052004>Laxmish
Hegde</SPAN></FONT></DIV>
<DIV><FONT face=Tahoma size=2><SPAN
class=424140810-28052004></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Tahoma size=2><SPAN
class=424140810-28052004></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=424140810-28052004></SPAN></FONT><FONT face=Tahoma size=2>-- --Original
Message-- --<BR><B>From:</B> Sandeep Kachalia
[mailto:skachalia@(protected)]<BR><B>Sent:</B> Friday, May 28, 2004 2:26
PM<BR><B>To:</B> J2EEPATTERNS-INTEREST@(protected)<BR><B>Subject:</B> Re:
Design paterns for null arguments<BR><BR></DIV></FONT>
<BLOCKQUOTE><FONT size=-1><FONT face="Lucida Sans Unicode">Thanks Ben,<BR>I
 wanted to open APIs for my client. The API users may pass null values as
 arguments.<BR>I have n number of&nbsp; parameters against I need to do null
 verification.<BR>Can we apply some pattern here through which we check the
 nullability and give customerized messages to user.<BR><BR>e.g. <BR>public
 void myFunction(String a,String b,String c)<BR>{&nbsp;&nbsp; &nbsp;
 Object&nbsp; arguments[] ; // List of argument objects; &nbsp;
 <BR>&nbsp;&nbsp;&nbsp; // patternApplied(Object arguments[]) throws
 Exception<BR>}<BR><BR>I hope I am able to make it
 clear.<BR><BR>Thanks,<BR>Sandeep<BR><BR></FONT></FONT><BR>Ben Hill wrote:<BR>
 <BLOCKQUOTE cite="mid1085735389.476.36.camel@(protected)" type="cite"><PRE wrap=
"">On Fri, 2004-05-28 at 07:10, Sandeep Kachalia wrote:
 </PRE>
   <BLOCKQUOTE type="cite"><PRE wrap="">Does exist a pattern for handling null
arguments in a method.
any pointers??
   </PRE></BLOCKQUOTE><PRE wrap=""><!---->
Not a method per se. If you have some sort of idea what the null
handling should do, there may be a pattern to help.

Cheers,

Ben

====================================================================
Companion Site: <A class=moz-txt-link-freetext href="http://www
.corej2eepatterns.com">http://www.corej2eepatterns.com</A>
J2EE BluePrints: <A class=moz-txt-link-freetext href="http://java.sun.com
/blueprints/corej2eepatterns">http://java.sun.com/blueprints/corej2eepatterns</A
>
List Archive: <A class=moz-txt-link-freetext href="http://archives.java.sun.com
/archives/j2eepatterns-interest.html">http://archives.java.sun.com/archives
/j2eepatterns-interest.html</A>
Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to <A class=moz-txt-link
-abbreviated href="mailto:listserv@(protected)">listserv@(protected)</A>
 </PRE></BLOCKQUOTE>==========================================================
==========
 Companion Site: http://www.corej2eepatterns.com J2EE BluePrints:
 http://java.sun.com/blueprints/corej2eepatterns List Archive:
 http://archives.java.sun.com/archives/j2eepatterns-interest.html
 Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected)
</BLOCKQUOTE></BODY></HTML>

<P><FONT SIZE=2 FACE="Arial">**************************************************
******************* Disclaimer: The information in this e-mail and any
attachments is confidential / privileged. It is intended solely for the
addressee or addressees. If you are not the addressee indicated in this message
, you may not copy or deliver this message to anyone. In such case, you should
destroy this message and kindly notify the sender by reply email. Please advise
immediately if you or your employer does not consent to Internet email for
messages of this kind. ********************************************************
*************</FONT></P>
====================================================================
Companion Site: http://www.corej2eepatterns.com
J2EE BluePrints: http://java.sun.com/blueprints/corej2eepatterns
List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html
Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.