|
|
|
Created:
15 years, 9 months ago by janluehe Modified:
15 years, 9 months ago Reviewers:
gagan.goku, dev-remailer Base URL:
http://svn.apache.org/repos/asf/shindig/trunk/ Visibility:
Public. |
DescriptionThis patch changes the declaration of ProxyBase#setRequestHeaders to throw a GadgetException, which makes it easier to override this method and is also consistent with ProxyBase#setResponseHeaders, which already declares to throw this kind of exception.
Patch Set 1 #
MessagesTotal messages: 7
On 2010/06/23 16:05:22, janluehe wrote: > Do you want to wrap an inner exception into GadgetException? Currently there doesn't seem to be anything in setRequestHeaders that can throw an exception. If you have a case where some null pointer exception etc is returned, then this change makes sense.
Sign in to reply to this message.
We override setRequestHeaders to add some product-specific headers, and when determining their values, checked exceptions may be thrown. Currently, we have to log them as severe errors, but we'd really like to be able to wrap them inside GadgetException and have ProxyBase#outputError take care of producing an error response. On 2010/06/23 16:36:35, gagan.goku wrote: > On 2010/06/23 16:05:22, janluehe wrote: > > > > Do you want to wrap an inner exception into GadgetException? > Currently there doesn't seem to be anything in setRequestHeaders that can throw > an exception. If you have a case where some null pointer exception etc is > returned, then this change makes sense.
Sign in to reply to this message.
On 2010/06/23 16:55:47, janluehe wrote:
> We override setRequestHeaders to add some product-specific headers, and when
> determining their values, checked exceptions may be thrown. Currently, we have
> to log them as severe errors, but we'd really like to be able to wrap them
> inside GadgetException and have ProxyBase#outputError take care of producing
an
> error response.
>
>
> On 2010/06/23 16:36:35, gagan.goku wrote:
> > On 2010/06/23 16:05:22, janluehe wrote:
> > >
> >
> > Do you want to wrap an inner exception into GadgetException?
> > Currently there doesn't seem to be anything in setRequestHeaders that can
> throw
> > an exception. If you have a case where some null pointer exception etc is
> > returned, then this change makes sense.
Your use case sounds good to me.
But you can also do this:
static class A {
protected void hello() {
throw new NullPointerException("hello");
}
}
static class B extends A {
public void hello1() throws GadgetException {
try {
super.hello();
} catch (Exception e) {
e.printStackTrace();
throw new GadgetException(e);
}
}
}
Sign in to reply to this message.
What we are trying is different from your example. This is our use case in terms
of your example:
static class A {
protected void hello() {
// do something
}
}
static class B extends A {
protected void hello() {
super.hello();
customHello();
}
private void customHello() /*throws GadgetException*/ {
// do something that may throw GadgetException
}
}
We would like to be able to propagate the GadgetException from customHello(),
and have customHello() declare to throw a GadgetException, but for this to
happen, hello() also must declare to throw a GadgetException.
On 2010/06/23 17:31:43, gagan.goku wrote:
> On 2010/06/23 16:55:47, janluehe wrote:
> > We override setRequestHeaders to add some product-specific headers, and when
> > determining their values, checked exceptions may be thrown. Currently, we
have
> > to log them as severe errors, but we'd really like to be able to wrap them
> > inside GadgetException and have ProxyBase#outputError take care of producing
> an
> > error response.
> >
> >
> > On 2010/06/23 16:36:35, gagan.goku wrote:
> > > On 2010/06/23 16:05:22, janluehe wrote:
> > > >
> > >
> > > Do you want to wrap an inner exception into GadgetException?
> > > Currently there doesn't seem to be anything in setRequestHeaders that can
> > throw
> > > an exception. If you have a case where some null pointer exception etc is
> > > returned, then this change makes sense.
>
> Your use case sounds good to me.
>
> But you can also do this:
> static class A {
> protected void hello() {
> throw new NullPointerException("hello");
> }
> }
>
> static class B extends A {
> public void hello1() throws GadgetException {
> try {
> super.hello();
> } catch (Exception e) {
> e.printStackTrace();
> throw new GadgetException(e);
> }
> }
> }
Sign in to reply to this message.
Thanks Gagan for commenting esp. from the accel side. @Jan, I just committed this patch -- seems quite reasonable to me. Thanks! On Wed, Jun 23, 2010 at 11:09 AM, <janluehe@gmail.com> wrote: > What we are trying is different from your example. This is our use case > in terms of your example: > > > static class A { > protected void hello() { > // do something > > } > } > > static class B extends A { > protected void hello() { > super.hello(); > customHello(); > } > > private void customHello() /*throws GadgetException*/ { > // do something that may throw GadgetException > } > } > > We would like to be able to propagate the GadgetException from > customHello(), and have customHello() declare to throw a > GadgetException, but for this to happen, hello() also must declare to > throw a GadgetException. > > > > On 2010/06/23 17:31:43, gagan.goku wrote: > >> On 2010/06/23 16:55:47, janluehe wrote: >> > We override setRequestHeaders to add some product-specific headers, >> > and when > >> > determining their values, checked exceptions may be thrown. >> > Currently, we have > >> > to log them as severe errors, but we'd really like to be able to >> > wrap them > >> > inside GadgetException and have ProxyBase#outputError take care of >> > producing > >> an >> > error response. >> > >> > >> > On 2010/06/23 16:36:35, gagan.goku wrote: >> > > On 2010/06/23 16:05:22, janluehe wrote: >> > > > >> > > >> > > Do you want to wrap an inner exception into GadgetException? >> > > Currently there doesn't seem to be anything in setRequestHeaders >> > that can > >> > throw >> > > an exception. If you have a case where some null pointer exception >> > etc is > >> > > returned, then this change makes sense. >> > > Your use case sounds good to me. >> > > But you can also do this: >> static class A { >> protected void hello() { >> throw new NullPointerException("hello"); >> } >> } >> > > static class B extends A { >> public void hello1() throws GadgetException { >> try { >> super.hello(); >> } catch (Exception e) { >> e.printStackTrace(); >> throw new GadgetException(e); >> } >> } >> } >> > > > > http://codereview.appspot.com/1683050/show >
Sign in to reply to this message.
Happy to chime in. Thanks Gagan -- The only thing missing in life is background music. -- Gagandeep Singh On Wed, Jun 23, 2010 at 11:57 PM, John Hjelmstad <fargo@google.com> wrote: > Thanks Gagan for commenting esp. from the accel side. @Jan, I just > committed > this patch -- seems quite reasonable to me. Thanks! > > On Wed, Jun 23, 2010 at 11:09 AM, <janluehe@gmail.com> wrote: > > > What we are trying is different from your example. This is our use case > > in terms of your example: > > > > > > static class A { > > protected void hello() { > > // do something > > > > } > > } > > > > static class B extends A { > > protected void hello() { > > super.hello(); > > customHello(); > > } > > > > private void customHello() /*throws GadgetException*/ { > > // do something that may throw GadgetException > > } > > } > > > > We would like to be able to propagate the GadgetException from > > customHello(), and have customHello() declare to throw a > > GadgetException, but for this to happen, hello() also must declare to > > throw a GadgetException. > > > > > > > > On 2010/06/23 17:31:43, gagan.goku wrote: > > > >> On 2010/06/23 16:55:47, janluehe wrote: > >> > We override setRequestHeaders to add some product-specific headers, > >> > > and when > > > >> > determining their values, checked exceptions may be thrown. > >> > > Currently, we have > > > >> > to log them as severe errors, but we'd really like to be able to > >> > > wrap them > > > >> > inside GadgetException and have ProxyBase#outputError take care of > >> > > producing > > > >> an > >> > error response. > >> > > >> > > >> > On 2010/06/23 16:36:35, gagan.goku wrote: > >> > > On 2010/06/23 16:05:22, janluehe wrote: > >> > > > > >> > > > >> > > Do you want to wrap an inner exception into GadgetException? > >> > > Currently there doesn't seem to be anything in setRequestHeaders > >> > > that can > > > >> > throw > >> > > an exception. If you have a case where some null pointer exception > >> > > etc is > > > >> > > returned, then this change makes sense. > >> > > > > Your use case sounds good to me. > >> > > > > But you can also do this: > >> static class A { > >> protected void hello() { > >> throw new NullPointerException("hello"); > >> } > >> } > >> > > > > static class B extends A { > >> public void hello1() throws GadgetException { > >> try { > >> super.hello(); > >> } catch (Exception e) { > >> e.printStackTrace(); > >> throw new GadgetException(e); > >> } > >> } > >> } > >> > > > > > > > > http://codereview.appspot.com/1683050/show > > >
Sign in to reply to this message.
|
||||||||||||||||||||||||||||||||||||||||||
