#44 try...catch parentheses were set wrong

open
nobody
None
5
2015-04-15
2004-01-04
Anonymous
No

When trying to decompile the following code from eclipse:
protected void checkWriteFile()
{
try
{
getSecurityManager().checkWrite(getFilename());
}
catch (SecurityException e)
{
JOptionPane.showMessageDialog(
window,
"SecurityException catched - we are not
allowed to write the file!: " + e,
"SecurityException catched!",
JOptionPane.ERROR_MESSAGE);
return;
}
catch (Throwable t)
{
JOptionPane.showMessageDialog(
window,
"Throwable during check: " + t,
"Exception catched!",
JOptionPane.ERROR_MESSAGE);
return;
}
JOptionPane.showMessageDialog(
window,
"File \"" + getFilename() + "\" can be
written succsessful!",
"Success",
JOptionPane.INFORMATION_MESSAGE);
}

Got the following result from JReverse Pro 1.4.1:

protected void checkWriteFile()
{
try {

getSecurityManager().checkWrite(getFilename());
catch (SecurityException securityexception) {
}
}
JOptionPane.showMessageDialog(window , new
StringBuffer("SecurityException catched - we are not
allowed to write the file!:
").append(securityexception).toString() ,
"SecurityException catched!" , 0);
return;
catch (Throwable throwable) {
JOptionPane.showMessageDialog(window ,
new StringBuffer("Throwable during check:
").append(throwable).toString() , "Exception catched!"
, 0);
return;
}
JOptionPane.showMessageDialog(window , new
StringBuffer("File
\"").append(getFilename()).append("\" can be written
succsessful!").toString() , "Success" , 1);
return;
}

As obvious the parenthesis were not closed before the
catch statements arrived in the output.

Discussion


Log in to post a comment.