Exception again???help

Hi guyz ,
I have something till now also not clear.
What is the benefit of exception ,refer to this 2 codes.
By looking at the code ,second code is much more shorter and easy to understand but doing the same thing as the first code where using exception.So ,what are the benefits.
Refer to the first code ,is defining like this can code reuse of the exception class(DivisionByZeroException) or exception grouping for the "code reuse and data abstraction purpose"?
First Code
==========
class DivisionByZeroException extends Exception {                      // (1)
public DivisionByZeroException(String msg) { super(msg); }
public class DivisionByZero6 {
public void division() throws DivisionByZeroException {            // (2)
int num1 = 10;
int num2 = 0;
if (num2 == 0) throw new DivisionByZeroException("/ by 0"); // (3)
System.out.println(num1 + " / " + num2 + " = " + (num1 / num2));
System.out.println("Returning from division.");
public static void main(String args[]) {
try {                                                         // (4)
new DivisionByZero6().division();
} catch (DivisionByZeroException e) {                         // (5)
System.out.println("In main, dealt with " + e);
} finally {                                                   // (6)
System.out.println("Finally done in main.");
System.out.println("Returning from main."); // (7)
Second Code
===========
public class DivisionByZero6 {
public void division(){            // (2)
int num1 = 10;
int num2 = 0;
if ( num2 != 0)
System.out.println(num1 + " / " + num2 + " = " + (num1 / num2));
System.out.println("Returning from division.");
else
{System.out.println("Deal with division by / by 0");} // (3)
public static void main(String args[])
new DivisionByZero6().division();
System.out.println("Returning from main."); // (7)

Hi ,
I understand the purpose of exception is for the robustness of data valitidy especially critical application .What i do not understand is why handling run time error must use java rules which is exception and run time error able to handle others simpler ways like some comparison syntax ..
Hope you understand my question....

Similar Messages

  • My I Pad is not charging, it started after the battery went dead while i was playing a game, when i tried charging it all it does is flash the apple icon and it switches off again, help Pliiz

    my Ipad is not charging, it started after the battery died while i was playing a game, when i tried charging its only flashing the apple icon and it switches off again, help PLIIZ

    Not charging
    1. Reset iPad
    2. Try another wall socket
    3. Try another cable (make sure it's an original Apple cable)
    4. Try another charger (make sure it's an original Apple charger)
    5. Clean Lightning port with compress air or new paint brush

  • Hii,,, i am using iphone 3g, i am trying to install apps from apple store,, installation stop in middle,and say u have to do install through itunes from your laptop. when i am trying to install it from my laptop,, its failed again n again,, help me out ,,

    hii,,, i am using iphone 3g, i am trying to install apps from apple store,, installation stop in middle,and say,, u have to do install through itunes from your laptop. when i am trying to install it from my laptop,, its failed again n again,, help me out ,

    Many thanks.
    With those symptoms, I'd try the following document:
    Apple software on Windows: May see performance issues and blank iTunes Store
    (If there's a SpeedBit LSP showing up in Autoruns, it's usually best to just uninstall your SpeedBit Video Accelerator.)

  • BeanUtils.populate exception (Need Help)

    Dear All,
    Am getting a strange exception when try to do a action in struts, below is my exception, please help me in solving this issue.
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: BeanUtils.populate
         org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1190)
         org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)
         org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
         org.apache.struts.action.ActionServlet.process(ActionServlet.java:1480)
         org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:524)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         sun.reflect.GeneratedMethodAccessor67.invoke(Unknown Source)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:585)
         org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:239)
         java.security.AccessController.doPrivileged(Native Method)
         javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
         org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:266)
         org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:157)
         java.security.AccessController.doPrivileged(Native Method)
         java.security.AccessController.doPrivileged(Native Method)
         org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
         org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
         org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
         org.apache.struts.action.ActionServlet.process(ActionServlet.java:1480)
         org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:524)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         sun.reflect.GeneratedMethodAccessor67.invoke(Unknown Source)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:585)
         org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:239)
         java.security.AccessController.doPrivileged(Native Method)
         javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
         org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:266)
         org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:157)
    root cause
    java.security.AccessControlException: access denied (java.lang.RuntimePermission accessDeclaredMembers)
         java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
         java.security.AccessController.checkPermission(AccessController.java:427)
         java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
         java.lang.SecurityManager.checkMemberAccess(SecurityManager.java:1662)
         java.lang.Class.checkMemberAccess(Class.java:2125)
         java.lang.Class.getDeclaredMethods(Class.java:1762)
         org.apache.commons.beanutils.MappedPropertyDescriptor$1.run(MappedPropertyDescriptor.java:386)
         java.security.AccessController.doPrivileged(Native Method)
         org.apache.commons.beanutils.MappedPropertyDescriptor.getPublicDeclaredMethods(MappedPropertyDescriptor.java:383)
         org.apache.commons.beanutils.MappedPropertyDescriptor.internalFindMethod(MappedPropertyDescriptor.java:453)
         org.apache.commons.beanutils.MappedPropertyDescriptor.findMethod(MappedPropertyDescriptor.java:527)
         org.apache.commons.beanutils.MappedPropertyDescriptor.<init>(MappedPropertyDescriptor.java:149)
         org.apache.commons.beanutils.PropertyUtilsBean.getPropertyDescriptor(PropertyUtilsBean.java:865)
         org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:991)
         org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:865)
         org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:343)
         org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1188)
         org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)
         org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
         org.apache.struts.action.ActionServlet.process(ActionServlet.java:1480)
         org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:524)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         sun.reflect.GeneratedMethodAccessor67.invoke(Unknown Source)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:585)
         org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:239)
         java.security.AccessController.doPrivileged(Native Method)
         javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
         org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:266)
         org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:157)
         java.security.AccessController.doPrivileged(Native Method)
         java.security.AccessController.doPrivileged(Native Method)
         org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
         org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
         org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
         org.apache.struts.action.ActionServlet.process(ActionServlet.java:1480)
         org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:524)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         sun.reflect.GeneratedMethodAccessor67.invoke(Unknown Source)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:585)
         org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:239)
         java.security.AccessController.doPrivileged(Native Method)
         javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
         org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:266)
         org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:157)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.0.27 logs.Thanks in advance,
    vyrav.

    Thanks for ur reply Ganesh.
    This is my JSP
    <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
    <%@ taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html" %>
    <%@ taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="bean" %>
    <%@ taglib uri="/WEB-INF/tld/struts-logic.tld" prefix="logic" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html:html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Uploaded File Details</title>
         <script>
              function logOut()
                        document.adminForm.action="upload.do?parameter=logout";
                        document.adminForm.submit();
              function download(temp)
                        document.adminForm.fileId.value = temp;
                        document.adminForm.action="download.do";
                        document.adminForm.submit();
         </script>
    <link rel="stylesheet" type="text/css" href="style.css" />
    </head>
    <body>
         <table align="right">
                        <tr>
                             <td>
                                  <a href="javascript:logOut();">Logout</a>
                             </td>
                        </tr>
         </table>
         <%
                        if(session.getAttribute("name")!=null)
                                    String userName= (String) session.getAttribute("name");
         %>
                   <br /><br /><b>Welcome <%=userName%></b><br />
         <%
         %>
         <center>
              <html:form action="/download.do" name="adminForm" type="com.roots.AdminForm">
                   <br /><br />
                   <html:hidden property="fileId"/>
                   <table align="center" border="1">
                        <tr bgcolor="#FFCC66">
                             <td align="center">
                                  No
                             </td>
                             <td align="center">
                                  Name
                             </td>
                             <td align="center">
                                  Uploaded Date
                             </td>
                             <td align="center">
                                  File Name
                             </td>
                        </tr>
                        <logic:iterate name="adminForm" property="displayList" id="displayDto">
                             <tr>
                                  <td align="center">
                                       <bean:write name="displayDto" property="serialNo"/>
                                  </td>
                                  <td align="left">
                                       <bean:write name="displayDto" property="empName"/>
                                  </td>
                                  <td align="left">
                                       <bean:write name="displayDto" property="uploadedDate"/>
                                  </td>
                                  <td align="left">
                                       <a href="javascript:download('<bean:write name="displayDto" property="serialNo"/>');"><bean:write name="displayDto" property="fileName"/></a>
                                  </td>
                             </tr>
                        </logic:iterate>
                   </table>
              </html:form>          
         </center>
    </body>
    </html:html>This is my struts config
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE struts-config PUBLIC
             "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
             "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
         <struts-config>
               <data-sources>
               </data-sources>
              <form-beans>
                   <form-bean name="loginForm" type="com.roots.LoginForm" />
                   <form-bean name="uploadForm" type="com.roots.UploadForm" />
                   <form-bean name="adminForm" type="com.roots.AdminForm" />
              </form-beans>
              <global-forwards></global-forwards>
              <action-mappings>
                   <action path="/login"
                        name="loginForm"
                        scope="request"
                        validate="true"
                        input="/login.jsp"
                        type="com.roots.LoginAction" >
                             <forward name="SUCCESS" path="/upload.jsp" />
                             <forward name="FAILURE" path="/login.jsp" />
                             <forward name="ADMIN" path="/admin.do" />
                   </action>
                   <action path="/upload"
                        name="uploadForm"
                        scope="request"
                        parameter="parameter"
                        input="/upload.jsp"
                        type="com.roots.UploadAction" >
                             <forward name="SUCCESS" path="/upload.jsp" />
                             <forward name="FAILURE" path="/login.jsp" />
                   </action>
                   <action path="/download"
                             type="com.roots.FileDownloadAction">
                   </action>
                   <action path="/admin"
                        name="adminForm"
                        scope="request"
                        validate="false"
                        type="com.roots.AdminAction" >
                        <forward name="DISPLAY" path="/admin.jsp" />
                        <forward name="FAILURE" path="/login.jsp" />
                   </action>
              </action-mappings>
              <message-resources parameter="application_fr"/>
            <message-resources parameter="application_es"/>
            <message-resources parameter="application_en"/>
            <message-resources parameter="application_de"/>
            <message-resources parameter="application" />
         </struts-config>this is my form package com.roots;
    import java.util.List;
    import org.apache.struts.action.ActionForm;
    public class AdminForm extends ActionForm {
         private List displayList = null;
         public String fileId;
         public String getFileId() {
              return fileId;
         public void setFileId(String fileId) {
              this.fileId = fileId;
         public List getDisplayList() {
              return displayList;
         public void setDisplayList(List displayList) {
              this.displayList = displayList;
    }Please let me know wat am doing wrong, this is killing me for the last two days.
    Thanks,
    vyrav.

  • Unable to install the GEAR driver set at this time.The GEARAspiWDM service used bz the GEAR driver set is scheduled to be deleted during the next system reboot.Please reboot the system and run iTunes again.help me..I understand this problem..thanks

    Unable to install the GEAR driver set at this time.The GEARAspiWDM service used bz the GEAR driver set is scheduled to be deleted during the next system reboot.Please reboot the system and run iTunes again.help me..I understand this problem..thanks

    Hi there, i had the exact same problem and posted a thread a few above yours, and these forums wasnt much help nobody replied, so i did a bit of research and followed all the intructions on this site: http://www.gearsoftware.com/cfknowledgebase/articledisplay.cfm?articleid=296
    If you follow the steps very carefully and do as each says, this will solve your problem.. Now i am very happy i can actually install iTunes and use it for my iPod.
    Remember to be carefully with the steps as the things you will be deleting are very important to your comp.
    Hope this helps.
      Windows XP  

  • How do I permanently set a popup exception. I can set an exception, but everytime I leave FF and connect again, I have to set the exception again.

    How do I permanently set a popup exception. I can set an exception, but every time I leave FF and connect again, I have to set the exception again. Can I set it once on a permanent basis?

    In case you are using "Clear history when Firefox closes":
    *do not clear Site Preferences
    *Tools > Options > Privacy: History: [X] Clear history when Firefox closes > Settings
    *https://support.mozilla.org/kb/Clear+Recent+History
    Note that clearing "Site Preferences" clears all exceptions for cookies, images, pop-up windows, software installation, and passwords.

  • I have a bose speakers and error on my iphone bluetooth device gave the skip and not as now bring up the device again, help please!

    I have a bose speakers and error on my iphone bluetooth device gave the skip and not as now bring up the device again, help please!

    Try toggle Bluetooth off and on. You can also try a reset all settings (your content won't be deleted).

  • I bought gta3 on AppStore and when I restored my iPad I have to pay for gta3 again help me

    I bought gta3 on AppStore and when I restored my iPad I have to pay for gta3 again help me

    Did you buy it directly on your iPad? Did you ever transfer the app to the iTunes content library on your computer? If so, sync it back onto your iPad. If not, then I encourage you to do so regularly for occasions just such as this.
    Does the previous purchase of the app appear in your iTunes Purchase History? Usually you just think that you are going to be charged but at the last step the App store sees that you previously bough the app and informs you that it will be free.
    Also, is this the same version that you previously bought? Or is this the next major paid version?

  • Hello , my previous purchased app do not occur again ,help me plz ?

    Hello , my previous purchased app do not occur again ,help me plz ?

    Have you changed countries since buying it, and is the app still available in your country's store ? If you've changed countries or it's been removed then you won't be able to redownload it - in which case do you have a copy of it in the Apps part of your computer's iTunes library, or on your backup of your downloads/library, so that you can sync it back to your iPad ?
    If it is still in the store and it's not showing in the Purchased tab in the App Store app for redownloading then check to see if it's hidden : iTunes Store: Hiding and unhiding purchases.

  • My iphone 4 turn of i left it for a while and tried to turn it back on the load up screen with the apple icon came up and after a few seconds went of again and the iphone turned back of again, HELP?

    my iphone turned of i didnt think nothing of it so i left it for abit as i didnt need it i then after i while turned it back on and the start up screen came on and the apple icon but after a few minutes of showing the apple icon it turned of again HELP?

    Try this  - Reset the iPad by holding down on the Sleep and Home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons. (This is equivalent to rebooting your computer.) No data/files will be erased. http://support.apple.com/kb/ht1430
    Frozen or unresponsive iPad
    Resolve these most common issues:
        •    Display remains black or blank
        •    Touch screen not responding
        •    Application unexpectedly closes or freezes
    http://www.apple.com/support/ipad/assistant/ipad/
    iPad Frozen, not responding, how to fix
    http://appletoolbox.com/2012/07/ipad-frozen-not-responding-how-to-fix/
    iPad Frozen? How to Force Quit an App, Reset or Restart Your iPad
    http://ipadacademy.com/2010/11/ipad-frozen-how-to-force-quit-an-app-reset-or-res tart-your-ipad
    Black or Blank Screen on iPad or iPhone
    http://appletoolbox.com/2012/10/black-or-blank-screen-on-ipad-or-iphone/
    What to Do When Your iPad Won't Turn On
    http://ipad.about.com/od/iPad_Troubleshooting/ss/What-To-Do-When-Your-Ipad-Wo-No t-Turn-On.htm
    iOS: Not responding or does not turn on
    http://support.apple.com/kb/TS3281
    iOS: Device unexpectedly restarts, displays Apple logo, or powers off
    http://support.apple.com/kb/TS5356
    iPad: Basic troubleshooting
    http://support.apple.com/kb/TS3274
     Cheers, Tom

  • Struts Exception Again!!!! Help plz.........

    Hello again,
    Hope this time i'll get some response regarding my error in a simple struts exception.........i've an application in which i've main page i.e "index.jsp", frm this page i've a html link tag fwdin to another jsp page i.e "search.jsp".Now when i click on the link at my index.jsp page i'm getting the following exception:-
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented
    it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: /search.jsp(44,26) equal symbol
    expected
    org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHan
    dler.java:39)
    org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.jav
    a:407)
    org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.jav
    a:90)
    org.apache.jasper.compiler.Parser.parseAttribute(Parser.java:193)
    org.apache.jasper.compiler.Parser.parseAttributes(Parser.java:143)
    org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1328)
    org.apache.jasper.compiler.Parser.parseElements(Parser.java:1560)
         org.apache.jasper.compiler.Parser.parseBody(Parser.java:1789)
    org.apache.jasper.compiler.Parser.parseOptionalBody(Parser.java:1060)
    org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1367)
    org.apache.jasper.compiler.Parser.parseElements(Parser.java:1560)
         org.apache.jasper.compiler.Parser.parse(Parser.java:126)
    org.apache.jasper.compiler.ParserController.doParse(ParserController.ja
    va:220)
    org.apache.jasper.compiler.ParserController.parse(ParserController.java
    :101)
    org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:203)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:470)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.j
    ava:511)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.j
    ava:295)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.ja
    va:1069)
    org.apache.struts.action.RequestProcessor.internalModuleRelativeForward
    (RequestProcessor.java:1012)
    org.apache.struts.action.RequestProcessor.processValidate(RequestProces
    sor.java:980)
    org.apache.struts.action.RequestProcessor.process(RequestProcessor.java
    :255)
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    note The full stack trace of the root cause is available in the Apache
    Tomcat/5.0.27 logs.
    Apache Tomcat/5.0.27
    Plz help me by telling what kind of equal symbol is expected by the application and where possibly it can be????????i've only 2 reference for "search.jsp" tht too in struts-config.xml file...........

    here's the search.jsp file:-
    <%@ page language="java" %>
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
    <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
    <html>
    <head>
    <title>Gaurav, Human Resource Portal</title>
    </head>
    <body>
    <font size="+1"><b>Gaurav, Human Resource Portal - search.jsp</b></font>
    <hr width="100%" noshade="true">
    <html:errors/>
    <html:form action="/search">
         <table>
              <tr>
                   <td align="right"><bean:message key="label.search.name"/>:</td>
                   <td><html:text property="name"/></td>
              </tr>
              <tr>
                   <td></td>
                   <td>--- or ---</td>
              </tr>
              <tr>
                   <td align="right"><bean:message key="label.search.ssNum"/>:</td>
                   <td><html:text property="ssNum"/> (xxx-xx-xxxx)</td>
              </tr>
              <tr>
                   <td></td>
                   <td><html:submit/></td>
              </tr>
         </table>
    </html:form>
    <logic:present name="searchForm" property="results">
         <hr width="100%" size="1" noshade="true">
         <bean:size id="size" name"searchForm" property="results"/>
              <logic:equal name="size" value="0">
                   <center><font color="red"><b>No Employees Found</b></font></center>
              </logic:equal>
              <logic:greaterThan name="size" value="0">
                   <table border="1">
                        <tr>
                             <th>Name</th>
                             <th>Social Security number</th>
                        </tr>
                        <logic:iterate id="result" name="searchForm" property="results">
                        <tr>
                             <td><bean:write name="result" property="name"/></td>
                             <td><bean:write name="result" property="ssNum"/></td>
                        </tr>
                        </logic:iterate>
                   </table>
              </logic:greaterThan>
    </logic:present>
    </body>
    </html>

  • Out OF Bounds Exception need help

    I am trying to learn how to catch exceptions. I can not see what I am doing wrong. Can someone show me and explain what I am doing wrong. I am taking in Military Time and will convert it to a 12 hour clock. I am testing it as I go so I have not finished adding code. The bad code is marked with // <== StringIndexOutOfBoundsException. Thank You in advance for the help.
    public class TimeFormat
    public TimeFormat()
    public static void main(String[] args)
    double amtt;
    char ans = 'n';
    String time1 = "00:00";
    String min1 = " ";
    int hh = 0;
    int mm = 0;
    String dd = " ";
    System.out.println("This program will convert 24 hour time into 12 hour time");
    do
    try
    System.out.println("Enter a time in military format: (ex. 14:00)");
    time1 = SavitchIn.readLine();
    hh = Integer.parseInt(time1.substring( 0, 2));
    String amPm = "PM";
    if (hh <= 12)
    amPm = "AM";
    dd = time1.substring( 2, 1); // <== StringIndexOutOfBoundsException
    mm = Integer.parseInt(time1.substring( 3, 2));
    int t1 = Integer.parseInt(time1);
    min1 = time1.substring(3, 3);
    if (t1 < 0 || t1 > 2459)
    throw new Exception ("Exception: Bad Input, must be between 0 and 2459");
    catch(Exception e)
    System.out.println("e.getMessage()");
    System.out.println("Time must be between 0 and 2499");
    System.out.println("\n\nWould you like to do it again? (y/n) : ");
    ans= SavitchIn.readLineNonwhiteChar();
    }while ((ans == 'y') || (ans == 'y'));

    import java.awt.*;
    import java.io.*;
    import java.text.*;
    public class texas {
      int hours, minutes;
      String AM_PM = " am";
      public texas() {
        try {
          BufferedReader br = new BufferedReader(
                              new InputStreamReader( System.in ));
          System.out.print("\nEnter a 24-hour time (\"##:##\"): ");
          System.out.flush();
          String s = br.readLine();
          if(s.indexOf(":") == -1) {
            System.out.println("Invalid entry - separate hours " +
                               "and minutes with \":\"");
            return;
          String[] sarray = s.split(":");
          hours   = Integer.parseInt(sarray[0]);
          minutes = Integer.parseInt(sarray[1]);
        } catch(IOException ioe) {
          System.out.println(ioe.toString());
          return;
        } catch(NumberFormatException nfe) {
          System.out.println(nfe.toString());
          return;
        } catch(ArrayIndexOutOfBoundsException aioobe) {
          System.out.println(aioobe.toString());
          return;
        if(hours < 0 || hours > 24) {
          System.out.println("Invalid input - hours must be between 0 and 24");
          return;
        if(minutes < 0 || minutes > 59) {
          System.out.println("Invalid input - minutes must be between 0 and 59");
          return;
        if(hours > 12) {
          hours -= 12;
          AM_PM = " pm";
        if(hours == 12 && minutes >= 0)
          AM_PM = " pm";
        String minutes12 = String.valueOf(minutes);
        if(minutes12.length() < 2)
          minutes12 = "0" + minutes12;
        String time = String.valueOf(hours) + ":" + minutes12 + AM_PM;
        System.out.println("12-hour time is: " + time);
      public static void main(String[] args) {
        new texas();
    }

  • Exception occurred - help me please

    Hi,
    I am compiling some applets from Eclipse, I arrived to my last applet and I tested it in another PC with a MSVM ver 1.1.4 after sign it with my security certificate. These applets work with Sun VM but when I open just my last applet with the version 1.1.4 de MS the follow message appears:
    Exception occurred during event dispatching:
    java.lang.NullPointerException
         at com/ms/awt/WToolkit.checkScrImage
         at com/ms/awt/WToolkit.checkImage
         at java/awt/Component.checkImage
         at java/awt/ImageMediaEntry.getStatus
         at java/awt/MediaTracker.statusAll
         at java/awt/MediaTracker.waitForAll
         at java/awt/MediaTracker.waitForAll
         at ImageEditor/bo.<init>
         at ImageEditor/cw.L
         at ImageEditor/cw.m
         at ImageEditor/bh.a
         at ImageEditor/bh.mouseReleased
         at java/awt/Component.processMouseEvent
         at java/awt/Component.processEvent
         at java/awt/Component.dispatchEventImpl
         at java/awt/Component.dispatchEvent
         at com/ms/awt/ZComponentPeer.processEvent
         at java/awt/Component.dispatchEventImpl
         at java/awt/Container.dispatchEventImpl
         at java/awt/Component.dispatchEvent
         at java/awt/EventDispatchThread.run
    And the error comes when I try to pass to my 2nd window applet.
    Anybody could give me an idea why it is happening please?
    Thank you
    Panchitopro

    Dear, turingcomplete :
    Thanks for your help, I was changed the thread in my code, my problem was moved.
    thank you again
    sincerely
    yours Urey

  • My iphone 4s has been reporting invalid sim/sim card failure intermittently for a week. tried to solve problem permanently - in mid of reset all settings my sim card failed again. help! not backed up on icloud, just itunes.  don't ask. thanks!

    my iphone 4s has been reporting invalid sim/sim card failure intermittently for a week. I thought it was a one/two-time thing, so had to manually eject SIM card and put back in.  Today, after it happened twice in 12 hours, someone told me to reset - i thought they meant reset all settings, not network settings.  while in the middle of resetting, there was an invalid SIM card again.  so a few questions - which should i do first?  try to manually back up from itunes (not connected to cloud - will be after tonight!), or eject SIM card?  don't know if one will jeopardize the other.  also, the last time i backed up was 6 days ago - have taken hundreds of pics since then - are those all lost?  is there a way to essentially not reset?  i thought the reset was okay because it said i'd lose no data or media. Help!  thanks much!

    my iphone 4s has been reporting invalid sim/sim card failure intermittently for a week. I thought it was a one/two-time thing, so had to manually eject SIM card and put back in.  Today, after it happened twice in 12 hours, someone told me to reset - i thought they meant reset all settings, not network settings.  while in the middle of resetting, there was an invalid SIM card again.  so a few questions - which should i do first?  try to manually back up from itunes (not connected to cloud - will be after tonight!), or eject SIM card?  don't know if one will jeopardize the other.  also, the last time i backed up was 6 days ago - have taken hundreds of pics since then - are those all lost?  is there a way to essentially not reset?  i thought the reset was okay because it said i'd lose no data or media. Help!  thanks much!

  • Firefox keeps saying the connection is untrusted... I save the exception, yet it NEVER works, everytime I use the same websites I have to "save the exception" again! What can I do to stop this, I'm about to throw in the towel!

    I used certain secured websites every day. And every day, I get the same old "connection is untrusted" messages, on every one of those websites. I do know the "add exception" thing, and I do add the exception for said websites... yet every time I start a new sessions, the exception hasn't been stored, and I have to do it all over again. It's getting really frustrating to use Firefox, since I am sick and tired of adding exceptions that aren't getting stored. I haven't added any new add-ons, only thing I have is Mc-Afee Site Advisor , and I had the same problem before I had to upgrade my Windows XP to Windows 7. One day it was working fine, then it started giving me trouble out of nowhere without new software or extension or anything being added. Nothing I've found online works, and I'm desperate for an answer.

    You can retrieve the certificate and check who issued the certificate.
    * Click the link at the bottom of the error page: "I Understand the Risks"
    Let Firefox retrieve the certificate: "Add Exception" -> "Get Certificate".
    * Click the "View..." button to inspect the certificate and check who is the issuer.

Maybe you are looking for

  • Revaluation run (MRNB) v/s Subsequent Debit / Credit (MIRO)

    Hello Experts We are working on ECC 6.0. I'am aware how to use MRNB & posting subsequent debit / credit note through MIRO. I want to know when to use MRNB in comparison to Subsequent Debit / Credit? Suppose vendor has suppiled certain goods at Rs 100

  • ST22 - Name of runtime error

    Hello, i would like to understand the meaning of the following runtime error .. could you please explain me what they mean? TIME_OUT                     OPEN_DATASET_NO_AUTHORITY    MESSAGE_TYPE_X               SYNTAX_ERROR                 RAISE_EXCE

  • Can I use compare mode with dual monitors? (LR 3.5)

    Hello. I'm a new Lightroom user, and was wondering if it's possible to span the compare mode across two monitors, so the curent select is on the left, and the candidate is on the right? This would be extremely helpful for me. I've seen another thread

  • 1 Instance's Gateway unreachable

    Dear Experts, We have faced this issue twice in same instance (02) in last 2 months. The instance 02 gateway becomes unreachable and impacts performance system-wide. To quickly fix the issue, we need to restart this instance. Following are the system

  • Table Field for total value release in Contract agreements

    Hi Gurus, Please tell me the table field for release in contract agreements. It is showing a structure field RM06E-GSABW, which does not have any associated table. Please let me know if any other way to get the same information. Thanks, Shibaji.