The Artima Developer Community
Sponsored Link

Java Answers Forum
Performance in ways of Exception Handling.

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
venkat

Posts: 4
Nickname: javaven
Registered: Aug, 2003

Performance in ways of Exception Handling. Posted: Jan 22, 2005 9:04 AM
Reply to this message Reply
Advertisement
I have two options in storing Error mesages for exception handling in our current assignment.Can u people suggest me which following ways of Exception Handling can be choosen in Performance Consideration?

1) Having a ErrDesc.java whose object is created inside each and every throws block by sending appropriate error code.

public class ErrDesc {
public String getDesc(int errorid) {
String errdesc="";
if ((errorid > 100) && (errorid < 200)) {
switch(errorid) {
case 101: errdesc = "[component1]ErrorDesc1"
break;
}
}
else if((errorid > 200) && (errorid < 300)) {
switch(errorid) {
case 201: errdesc = "[component2]ErrorDesc2"
break;
}
}
.
.
}
}

2) Having ErrDesc.java which has each error code and error message as below.

public final static String errorcode101 = "errormesg101";
public final static String errorcode201 = "errormesg201";
.
.
.
These messages can be captured from the caller java classes, by just specifying ErrDesc.errorcode101.

Please suggest which approach is best and why?

Regards,

JavaVen.

Topic: API Extension java.lang.reflect.Array - help me make it worthy! Previous Topic   Next Topic Topic: Can't select all text

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use