RE: [JBoss-user] Throwing exception question....

2004-01-14 Thread Rod Macpherson
Correction. According to the specification, the JSP dumps everything in
a super-giant try-catch block so Exceptions and RuntimeException need
not be declared. 

The solution is therefore to apply best practices: limit the amount of
code in your JSPs to none or less if possible. I know that our
application contains hundreds of pages and there is no "code" at all. We
use tags and beans that you might define as a page-let: a bean whose
sole responsibility is to provide an API for a given JSP page. That way
everything is compiled and at most the JSP page calls inline methods on
its pagelet. 



-Original Message-
From: Pitre, Russell [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 14, 2004 2:07 PM
To: [EMAIL PROTECTED]
Subject: RE: [JBoss-user] Throwing exception question


Right!but doesn't...

Here's what the jsp looks like..
<%
InitialContext context = new InitialContext(); 

Object ref = context.lookup("ejb/FactoryBean");

FactoryHome factoryHome = (FactoryHome) PortableRemoteObject.narrow (
ref, FactoryHome.class);

Factory factory = factoryHome.create();

String ObjectString = "601645,601647,601649";

ArrayList list = new ArrayList();

list =  factory.getPersistableObjects("com.shawmut.model.Address",
ObjectString);
%>


This should not compile



The Factory interface and its corresponding bean implementation both
throw MaxRequestObjectsException...


Thanx-
Russ

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Rod
Macpherson
Sent: Wednesday, January 14, 2004 4:50 PM
To: [EMAIL PROTECTED]
Subject: RE: [JBoss-user] Throwing exception question

The JSP compile should fail in that case. 

-Original Message-
From: Pitre, Russell [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 14, 2004 12:38 PM
To: [EMAIL PROTECTED]
Subject: RE: [JBoss-user] Throwing exception question


Yah, I have my MaxNumberOfRequestsException class extending Exception
already..still not sure what it is

Still baffled!

Russ



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Adrian
Brock
Sent: Wednesday, January 14, 2004 2:46 PM
To: [EMAIL PROTECTED]
Subject: Re: [JBoss-user] Throwing exception question

You'll need:

public class MaxNumberOfRequestsException extends Exception rather than
extends RuntimeException 
or whatever you are using to avoid declaring it as being thrown.

RuntimeExceptions and Errors do not need to be handled.

Regards,
Adrian

On Wed, 2004-01-14 at 19:07, Pitre, Russell wrote:
> Hello All-
> 
>  
> 
> Using: jboss3.2.3-tomcat
> 
>  
> 
> I have a class that will throw a user defined exception.
> 
>  
> 
> My method:
> 
> public ArrayList getPersistableObjects (String className, String keys)

> {
> 
> if(cachelessKeyValues.length() > MAX_NUMBER_OF_REQUESTS) {
> 
> throw new MaxNumberOfRequestsException("Request exceeds maximum number

> of requests (" + MAX_NUMBER_OF_REQUESTS + ")");
> 
> }else{
> 
> do my stuff
> 
> }
> 
> }
> 
>  
> 
> I am wrapping this class with an ejb.  I want to force my front end
> developers to use a try catch statement to catch this exception in 
> their jsp's.  I have the remote interface and the bean class itself 
> throwing the exception up the line
> 
>  
> 
> BEAN CLASS:
> 
>  
> 
> public ArrayList getPersistableObjects(String className, String keys)
> throws MaxNumberOfRequestsException{
> 
> return Mule.getInstance().getPersistableObjects(className, keys);
> 
> }
> 
> INTERFACE:
> 
>  
> 
> public ArrayList getPersistableObjects (String className, String keys)

> throws MaxNumberOfRequestsException, java.rmi.RemoteException;
> 
>  
> 
>  
> 
> Everything compiles and works fine except that when the jsp compiles,
> it does not force you to catch MaxNumberOfRequestsException
> 
>  
> 
>  
> 
> Any ideas?  I've been banging my head all day with this.
> 
> Russ
-- 
 
Adrian Brock
Director of Support
Back Office
JBoss Group, LLC 
 



---
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user




---
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Config

RE: [JBoss-user] Throwing exception question....

2004-01-14 Thread Pitre, Russell
Right!but doesn't...

Here's what the jsp looks like..
<%
InitialContext context = new InitialContext(); 

Object ref = context.lookup("ejb/FactoryBean");

FactoryHome factoryHome = (FactoryHome) PortableRemoteObject.narrow (
ref, FactoryHome.class);

Factory factory = factoryHome.create();

String ObjectString = "601645,601647,601649";

ArrayList list = new ArrayList();

list =  factory.getPersistableObjects("com.shawmut.model.Address",
ObjectString);
%>


This should not compile



The Factory interface and its corresponding bean implementation both
throw MaxRequestObjectsException...


Thanx-
Russ

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Rod
Macpherson
Sent: Wednesday, January 14, 2004 4:50 PM
To: [EMAIL PROTECTED]
Subject: RE: [JBoss-user] Throwing exception question

The JSP compile should fail in that case. 

-Original Message-
From: Pitre, Russell [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 14, 2004 12:38 PM
To: [EMAIL PROTECTED]
Subject: RE: [JBoss-user] Throwing exception question


Yah, I have my MaxNumberOfRequestsException class extending Exception
already..still not sure what it is

Still baffled!

Russ



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Adrian
Brock
Sent: Wednesday, January 14, 2004 2:46 PM
To: [EMAIL PROTECTED]
Subject: Re: [JBoss-user] Throwing exception question

You'll need:

public class MaxNumberOfRequestsException extends Exception rather than
extends RuntimeException 
or whatever you are using to avoid declaring it as being thrown.

RuntimeExceptions and Errors do not need to be handled.

Regards,
Adrian

On Wed, 2004-01-14 at 19:07, Pitre, Russell wrote:
> Hello All-
> 
>  
> 
> Using: jboss3.2.3-tomcat
> 
>  
> 
> I have a class that will throw a user defined exception.
> 
>  
> 
> My method:
> 
> public ArrayList getPersistableObjects (String className, String keys)

> {
> 
> if(cachelessKeyValues.length() > MAX_NUMBER_OF_REQUESTS) {
> 
> throw new MaxNumberOfRequestsException("Request exceeds maximum number

> of requests (" + MAX_NUMBER_OF_REQUESTS + ")");
> 
> }else{
> 
> do my stuff
> 
> }
> 
> }
> 
>  
> 
> I am wrapping this class with an ejb.  I want to force my front end 
> developers to use a try catch statement to catch this exception in 
> their jsp's.  I have the remote interface and the bean class itself 
> throwing the exception up the line
> 
>  
> 
> BEAN CLASS:
> 
>  
> 
> public ArrayList getPersistableObjects(String className, String keys) 
> throws MaxNumberOfRequestsException{
> 
> return Mule.getInstance().getPersistableObjects(className, keys);
> 
> }
> 
> INTERFACE:
> 
>  
> 
> public ArrayList getPersistableObjects (String className, String keys)

> throws MaxNumberOfRequestsException, java.rmi.RemoteException;
> 
>  
> 
>  
> 
> Everything compiles and works fine except that when the jsp compiles, 
> it does not force you to catch MaxNumberOfRequestsException
> 
>  
> 
>  
> 
> Any ideas?  I've been banging my head all day with this.
> 
> Russ
-- 
 
Adrian Brock
Director of Support
Back Office
JBoss Group, LLC 
 



---
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user




---
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


---
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user




---
This SF.net e

RE: [JBoss-user] Throwing exception question....

2004-01-14 Thread Rod Macpherson
The JSP compile should fail in that case. 

-Original Message-
From: Pitre, Russell [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 14, 2004 12:38 PM
To: [EMAIL PROTECTED]
Subject: RE: [JBoss-user] Throwing exception question


Yah, I have my MaxNumberOfRequestsException class extending Exception
already..still not sure what it is

Still baffled!

Russ



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Adrian
Brock
Sent: Wednesday, January 14, 2004 2:46 PM
To: [EMAIL PROTECTED]
Subject: Re: [JBoss-user] Throwing exception question

You'll need:

public class MaxNumberOfRequestsException extends Exception rather than
extends RuntimeException 
or whatever you are using to avoid declaring it as being thrown.

RuntimeExceptions and Errors do not need to be handled.

Regards,
Adrian

On Wed, 2004-01-14 at 19:07, Pitre, Russell wrote:
> Hello All-
> 
>  
> 
> Using: jboss3.2.3-tomcat
> 
>  
> 
> I have a class that will throw a user defined exception.
> 
>  
> 
> My method:
> 
> public ArrayList getPersistableObjects (String className, String keys)

> {
> 
> if(cachelessKeyValues.length() > MAX_NUMBER_OF_REQUESTS) {
> 
> throw new MaxNumberOfRequestsException("Request exceeds maximum number

> of requests (" + MAX_NUMBER_OF_REQUESTS + ")");
> 
> }else{
> 
> do my stuff
> 
> }
> 
> }
> 
>  
> 
> I am wrapping this class with an ejb.  I want to force my front end 
> developers to use a try catch statement to catch this exception in 
> their jsp's.  I have the remote interface and the bean class itself 
> throwing the exception up the line
> 
>  
> 
> BEAN CLASS:
> 
>  
> 
> public ArrayList getPersistableObjects(String className, String keys) 
> throws MaxNumberOfRequestsException{
> 
> return Mule.getInstance().getPersistableObjects(className, keys);
> 
> }
> 
> INTERFACE:
> 
>  
> 
> public ArrayList getPersistableObjects (String className, String keys)

> throws MaxNumberOfRequestsException, java.rmi.RemoteException;
> 
>  
> 
>  
> 
> Everything compiles and works fine except that when the jsp compiles, 
> it does not force you to catch MaxNumberOfRequestsException
> 
>  
> 
>  
> 
> Any ideas?  I've been banging my head all day with this.
> 
> Russ
-- 
 
Adrian Brock
Director of Support
Back Office
JBoss Group, LLC 
 



---
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user




---
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


---
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


RE: [JBoss-user] Throwing exception question....

2004-01-14 Thread Pitre, Russell
Yah, I have my MaxNumberOfRequestsException class extending Exception
already..still not sure what it is

Still baffled!

Russ



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Adrian
Brock
Sent: Wednesday, January 14, 2004 2:46 PM
To: [EMAIL PROTECTED]
Subject: Re: [JBoss-user] Throwing exception question

You'll need:

public class MaxNumberOfRequestsException extends Exception
rather than
extends RuntimeException 
or whatever you are using to avoid declaring it as being thrown.

RuntimeExceptions and Errors do not need to be handled.

Regards,
Adrian

On Wed, 2004-01-14 at 19:07, Pitre, Russell wrote:
> Hello All-
> 
>  
> 
> Using: jboss3.2.3-tomcat
> 
>  
> 
> I have a class that will throw a user defined exception.
> 
>  
> 
> My method:
> 
> public ArrayList getPersistableObjects (String className, String keys)
> {
> 
> if(cachelessKeyValues.length() > MAX_NUMBER_OF_REQUESTS) {
> 
> throw new MaxNumberOfRequestsException("Request exceeds maximum number
> of requests (" + MAX_NUMBER_OF_REQUESTS + ")");
> 
> }else{
> 
> do my stuff 
> 
> }
> 
> }
> 
>  
> 
> I am wrapping this class with an ejb.  I want to force my front end
> developers to use a try catch statement to catch this exception in
> their jsp's.  I have the remote interface and the bean class itself
> throwing the exception up the line
> 
>  
> 
> BEAN CLASS:
> 
>  
> 
> public ArrayList getPersistableObjects(String className, String keys)
> throws MaxNumberOfRequestsException{
> 
> return Mule.getInstance().getPersistableObjects(className, keys);
> 
> }
> 
> INTERFACE:
> 
>  
> 
> public ArrayList getPersistableObjects (String className, String keys)
> throws MaxNumberOfRequestsException, java.rmi.RemoteException;
> 
>  
> 
>  
> 
> Everything compiles and works fine except that when the jsp compiles,
> it does not force you to catch MaxNumberOfRequestsException
> 
>  
> 
>  
> 
> Any ideas?  I've been banging my head all day with this.
> 
> Russ
-- 
 
Adrian Brock
Director of Support
Back Office
JBoss Group, LLC 
 



---
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user




---
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


Re: [JBoss-user] Throwing exception question....

2004-01-14 Thread Adrian Brock
You'll need:

public class MaxNumberOfRequestsException extends Exception
rather than
extends RuntimeException 
or whatever you are using to avoid declaring it as being thrown.

RuntimeExceptions and Errors do not need to be handled.

Regards,
Adrian

On Wed, 2004-01-14 at 19:07, Pitre, Russell wrote:
> Hello All-
> 
>  
> 
> Using: jboss3.2.3-tomcat
> 
>  
> 
> I have a class that will throw a user defined exception.
> 
>  
> 
> My method:
> 
> public ArrayList getPersistableObjects (String className, String keys)
> {
> 
> if(cachelessKeyValues.length() > MAX_NUMBER_OF_REQUESTS) {
> 
> throw new MaxNumberOfRequestsException("Request exceeds maximum number
> of requests (" + MAX_NUMBER_OF_REQUESTS + ")");
> 
> }else{
> 
> â.do my stuff 
> 
> }
> 
> }
> 
>  
> 
> I am wrapping this class with an ejb.  I want to force my front end
> developers to use a try catch statement to catch this exception in
> their jspâs.  I have the remote interface and the bean class itself
> throwing the exception up the lineâ.
> 
>  
> 
> BEAN CLASS:
> 
>  
> 
> public ArrayList getPersistableObjects(String className, String keys)
> throws MaxNumberOfRequestsException{
> 
> return Mule.getInstance().getPersistableObjects(className, keys);
> 
> }
> 
> INTERFACE:
> 
>  
> 
> public ArrayList getPersistableObjects (String className, String keys)
> throws MaxNumberOfRequestsException, java.rmi.RemoteException;
> 
>  
> 
>  
> 
> Everything compiles and works fine except that when the jsp compiles,
> it does not force you to catch MaxNumberOfRequestsException
> 
>  
> 
>  
> 
> Any ideas?  Iâve been banging my head all day with thisâ..
> 
> Russ
-- 
 
Adrian Brock
Director of Support
Back Office
JBoss Group, LLC 
 



---
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user