/*
 * ExceptionAction.java
 *
 * Created on 2006/12/12, 16:24
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package sample.org.itscool.exception;

import java.io.IOException;
import javax.servlet.ServletException;
import org.itscool.weber.action.Action;
import org.itscool.weber.action.ActionBucket;

/**
 *
 * @author kanou
 */
public class ExceptionAction extends Action{
    public String doExecute(ActionBucket bucket) throws Exception{
        String kind = (String)this.getParameter("kind");
        if(kind == null){
            throw new Exception("kind is null");
        }else if(kind.equals("ioexception")){
            throw new IOException("IOException をスローします ");
        }else if(kind.equals("servletexception")){
            throw new ServletException("ServletException をスローします ");
        }else if(kind.equals("numberformatexception")){
            Integer.parseInt(kind);
            return "success";
        }else{
            throw new Exception("一般的なシステムエラー");
        }
    }
    
}
