[Soot-list] Do I understand traps?

Martin Schäf martinschaef at googlemail.com
Mon Jan 16 11:02:49 EST 2012


Hi,

this might be a very special problem, but I don't think the bug is in my tool:

I have a static analysis tool that does stuff if a called method can
throw an exception. However, when it encounters a call to

javax.swing.text.JTextComponent.setCaretPosition

It says this one would not throw anything, even though it does
according to the specification.
http://docs.oracle.com/javase/6/docs/api/javax/swing/text/JTextComponent.html#setCaretPosition(int)

The source is:
            public void setCaretPosition(int position) {
                Document doc = getDocument();
                if (doc != null) {
                    if (position > doc.getLength() || position < 0) {
                        throw new IllegalArgumentException("bad position: "
                                + position);
                    }
                    caret.setDot(position);
                }
            }

When debugging into the sootMethod, I find a trap that handles this
exception including a catch-block, i.e., it is not thrown out.

Where is the bug? Does soot make a mistake when computing the
traps/exceptions list, or am I confused about the meaning of traps?

Thanks in advance,
M


More information about the Soot-list mailing list