This is the mail archive of the frysk@sources.redhat.com mailing list for the frysk project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch: fix up Syscall a bit


My only general concern is the over-use of throwing exceptions in syscall look-ups. (I realize, Tom., that you just changed the Exception and did not put the original Exception in there). I thought this would be a good place to ask the question as it is in the patch. In the location:
@@ -259,24 +260,21 @@
syscallList = task.getIsa().getSyscallList ();
unknownSyscalls = task.getIsa().getUnknownSyscalls ();
}
- catch (Exception e)
+ catch (TaskException e)
{
- throw new RuntimeException ("Could not get the isa");
+ throw new RuntimeException ("Could not get the isa", e);
}
if (num < 0)
{
- throw new RuntimeException ("Negative Syscall Number:" + - Integer.toString(num));
+ throw new RuntimeException ("Negative syscall number: " + num);
}
else if (num >= syscallList.length)
{
- synchronized (Syscall.class)
+ synchronized (unknownSyscalls)
{
Integer key = new Integer(num);
- if (unknownSyscalls == null)
- unknownSyscalls = new HashMap();
- else if (unknownSyscalls.containsKey(key))
+ if (unknownSyscalls.containsKey(key))
return (Syscall) unknownSyscalls.get(key);
class UnknownSyscall

And here:
@@ -327,9 +324,9 @@
{
syscall = task.getIsa().syscallByName(name);
}
- catch (Exception e)
+ catch (TaskException e)
{
- throw new RuntimeException ("Could not get the name of isa");
+ throw new RuntimeException ("Could not get the name of isa", e);
}
return syscall;

This exception will stop the event loop for implementing clients (and as the exception is unchecked, very hard to check on the severity). Would it be better to return null in these places instead of completely aborting with a throw?


Regards

Phil


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]