You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jmeter.apache.org by vlsi <gi...@git.apache.org> on 2016/04/19 23:40:43 UTC

[GitHub] jmeter pull request: Used multi-catch, enhanced for loops, contain...

Github user vlsi commented on a diff in the pull request:

    https://github.com/apache/jmeter/pull/174#discussion_r60316883
  
    --- Diff: src/core/org/apache/jmeter/reporters/ResultCollector.java ---
    @@ -386,16 +384,14 @@ public void loadExistingFile() {
                                 SaveService.loadTestResults(bufferedInputStream,
                                         new ResultCollectorHelper(this, visualizer));
                                 parsedOK = true;
    -                        } catch (ConversionException e) {
    -                            log.warn("Failed to load "+filename+" using XStream. Error was: "+e);
                             } catch (Exception e) {
    -                            log.warn("Failed to load "+filename+" using XStream. Error was: "+e);
    +                            log.warn("Failed to load " + filename + " using XStream. Error was: " + e);
    --- End diff --
    
    I think comma should be used to log exception stacktrace, shouldn't it?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Re: [GitHub] jmeter pull request: Used multi-catch, enhanced for loops, contain...

Posted by sebb <se...@gmail.com>.
On 19 April 2016 at 23:44, Vladimir Sitnikov
<si...@gmail.com> wrote:
> sebb>Yes, but is a stack trace necessary here?
> sebb>So long as it's obvious what the problem is and how to fix it without
>
> You do not think "catch (Exception e)" is obvious, do you?

Depends.

> What if it fails with NPE in unknown line?

Then I agree the stack trace is needed.
However for most cases it probably is not; I think the problem here is
that the catch is too broad.
I would probably catch the more obvious exceptions and let anything
else ripple up.

Looking at it again, I wonder why the catch was changed from
ConversionException?
The log message does not say.

> Vladimir

Re: [GitHub] jmeter pull request: Used multi-catch, enhanced for loops, contain...

Posted by Vladimir Sitnikov <si...@gmail.com>.
sebb>Yes, but is a stack trace necessary here?
sebb>So long as it's obvious what the problem is and how to fix it without

You do not think "catch (Exception e)" is obvious, do you?
What if it fails with NPE in unknown line?

Vladimir

Re: [GitHub] jmeter pull request: Used multi-catch, enhanced for loops, contain...

Posted by sebb <se...@gmail.com>.
On 19 April 2016 at 22:40, vlsi <gi...@git.apache.org> wrote:
> Github user vlsi commented on a diff in the pull request:
>
>     https://github.com/apache/jmeter/pull/174#discussion_r60316883
>
>     --- Diff: src/core/org/apache/jmeter/reporters/ResultCollector.java ---
>     @@ -386,16 +384,14 @@ public void loadExistingFile() {
>                                  SaveService.loadTestResults(bufferedInputStream,
>                                          new ResultCollectorHelper(this, visualizer));
>                                  parsedOK = true;
>     -                        } catch (ConversionException e) {
>     -                            log.warn("Failed to load "+filename+" using XStream. Error was: "+e);
>                              } catch (Exception e) {
>     -                            log.warn("Failed to load "+filename+" using XStream. Error was: "+e);
>     +                            log.warn("Failed to load " + filename + " using XStream. Error was: " + e);
>     --- End diff --
>
>     I think comma should be used to log exception stacktrace, shouldn't it?

Yes, but is a stack trace necessary here?
So long as it's obvious what the problem is and how to fix it without
the stack trace, that just adds noise.

>
> ---
> If your project is set up for it, you can reply to this email and have your
> reply appear on GitHub as well. If your project does not have this feature
> enabled and wishes so, or if the feature is enabled but not working, please
> contact infrastructure at infrastructure@apache.org or file a JIRA ticket
> with INFRA.
> ---