You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@excalibur.apache.org by le...@apache.org on 2004/08/06 07:33:58 UTC
svn commit: rev 36018 - excalibur/trunk/containerkit/instrument/mgr-http/src/java/org/apache/excalibur/instrument/manager/http
Author: leif
Date: Thu Aug 5 22:33:57 2004
New Revision: 36018
Modified:
excalibur/trunk/containerkit/instrument/mgr-http/src/java/org/apache/excalibur/instrument/manager/http/HTMLCreateSampleHandler.java
excalibur/trunk/containerkit/instrument/mgr-http/src/java/org/apache/excalibur/instrument/manager/http/XMLCreateSampleHandler.java
excalibur/trunk/containerkit/instrument/mgr-http/src/java/org/apache/excalibur/instrument/manager/http/XMLCreateSamplesHandler.java
Log:
Fix a problem where the create handlers were dumping a stack trace if the user made a request with an invalid sample type.
Modified: excalibur/trunk/containerkit/instrument/mgr-http/src/java/org/apache/excalibur/instrument/manager/http/HTMLCreateSampleHandler.java
==============================================================================
--- excalibur/trunk/containerkit/instrument/mgr-http/src/java/org/apache/excalibur/instrument/manager/http/HTMLCreateSampleHandler.java (original)
+++ excalibur/trunk/containerkit/instrument/mgr-http/src/java/org/apache/excalibur/instrument/manager/http/HTMLCreateSampleHandler.java Thu Aug 5 22:33:57 2004
@@ -17,6 +17,7 @@
package org.apache.excalibur.instrument.manager.http;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Map;
@@ -108,8 +109,21 @@
}
// Register the new lease
- InstrumentSampleDescriptor sample =
- desc.createInstrumentSample( description, interval, size, lease, type );
+ InstrumentSampleDescriptor sample;
+ try
+ {
+ sample = desc.createInstrumentSample( description, interval, size, lease, type );
+ }
+ catch ( IllegalArgumentException e )
+ {
+ // The sample type is not valid.
+ throw new FileNotFoundException( e.getMessage() );
+ }
+ catch ( IllegalStateException e )
+ {
+ // The sample type was incompatible with the instrument.
+ throw new FileNotFoundException( e.getMessage() );
+ }
// Redirect to the new sample page.
throw new HTTPRedirect( "sample.html?name=" + urlEncode( sample.getName() ) );
Modified: excalibur/trunk/containerkit/instrument/mgr-http/src/java/org/apache/excalibur/instrument/manager/http/XMLCreateSampleHandler.java
==============================================================================
--- excalibur/trunk/containerkit/instrument/mgr-http/src/java/org/apache/excalibur/instrument/manager/http/XMLCreateSampleHandler.java (original)
+++ excalibur/trunk/containerkit/instrument/mgr-http/src/java/org/apache/excalibur/instrument/manager/http/XMLCreateSampleHandler.java Thu Aug 5 22:33:57 2004
@@ -101,8 +101,21 @@
}
// Register the new lease
- InstrumentSampleDescriptor sample =
- desc.createInstrumentSample( description, interval, size, lease, type );
+ InstrumentSampleDescriptor sample;
+ try
+ {
+ sample = desc.createInstrumentSample( description, interval, size, lease, type );
+ }
+ catch ( IllegalArgumentException e )
+ {
+ // The sample type is not valid.
+ throw new FileNotFoundException( e.getMessage() );
+ }
+ catch ( IllegalStateException e )
+ {
+ // The sample type was incompatible with the instrument.
+ throw new FileNotFoundException( e.getMessage() );
+ }
out.println( InstrumentManagerHTTPConnector.XML_BANNER );
outputSample( out, sample, "", packed );
Modified: excalibur/trunk/containerkit/instrument/mgr-http/src/java/org/apache/excalibur/instrument/manager/http/XMLCreateSamplesHandler.java
==============================================================================
--- excalibur/trunk/containerkit/instrument/mgr-http/src/java/org/apache/excalibur/instrument/manager/http/XMLCreateSamplesHandler.java (original)
+++ excalibur/trunk/containerkit/instrument/mgr-http/src/java/org/apache/excalibur/instrument/manager/http/XMLCreateSamplesHandler.java Thu Aug 5 22:33:57 2004
@@ -144,8 +144,22 @@
}
// Register the new lease
- InstrumentSampleDescriptor sample =
- desc.createInstrumentSample( description, interval, size, lease, type );
+ InstrumentSampleDescriptor sample;
+ try
+ {
+ sample =
+ desc.createInstrumentSample( description, interval, size, lease, type );
+ }
+ catch ( IllegalArgumentException e )
+ {
+ // The sample type is not valid.
+ throw new FileNotFoundException( e.getMessage() );
+ }
+ catch ( IllegalStateException e )
+ {
+ // The sample type was incompatible with the instrument.
+ throw new FileNotFoundException( e.getMessage() );
+ }
outputSample( out, sample, " ", packed );
}
---------------------------------------------------------------------
To unsubscribe, e-mail: scm-unsubscribe@excalibur.apache.org
For additional commands, e-mail: scm-help@excalibur.apache.org