// This should be the place where the bug is reported.
Location getPrincipalLocation()
{
- if (null != m_locations && m_locations.size() > 0) {
- return m_locations.get(0);
+ if (null == m_locations) {
+ return null;
}
+
+ for (int idx = 0; idx < m_locations.size(); ++idx) {
+ Location loc = m_locations.get(idx);
+ if (Location.METHOD_CALLED.equals(loc.getMethodRole())) {
+ // METHOD_CALLED locations describe the method that is being called,
+ // but the bug is located in the caller, not in the callee.
+ // Thus, ignore this information about the callee.
+ continue;
+ }
+ return loc;
+ }
+
return null;
}