GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [java] ExceptionAsFlowControl: False positive on Lambda/asynchronous · Issue #4815 · pmd/pmd

[java] ExceptionAsFlowControl: False positive on Lambda/asynchronous #4815

New issue
Copy link
New issue
Copy link
Closed
#7105
Closed
[java] ExceptionAsFlowControl: False positive on Lambda/asynchronous#4815
#7105
Copy link
Labels
a:false-positivePMD flags a piece of code that is not problematic
Milestone
7.29.0

Description

@blacelle
blacelle
opened on Feb 12, 2024
Issue body actions

Affects PMD Version:
7.0.0-rc4

Rule: ExceptionAsFlowControl

Description:
Given rules is a false-positive as the exception in the Lambda would typically not be caught in the outer catch block.

Code Sample demonstrating the issue:

	protected void doPublish(String issueLabel, Map<?, ?> details) {
	        ExecutorService es = ...;
		try {
			es.execute(() -> {
				try {
					unsafeDoPublish(details);
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			});
		} catch (RuntimeException e) {
			// Do not re-throw else it would go directly to the UncaughtExceptionHandler
			LOGGER.warn("Issue publishing notification " + details, e);
		}
	}

Expected outcome:

PMD reports a violation at line ..., but that's wrong. That's a false positive.

Running PMD through: [CLI | Ant | Maven | Gradle | Designer | Other]
Maven

Activity

  1. blacelle
    added
    a:false-positivePMD flags a piece of code that is not problematic
    on Feb 12, 2024
  2. adangel
    changed the title [-][java] 7.0.0-rc4 ExceptionAsFlowControl false-positive on Lambda/asynchronous[/-] [+][java] ExceptionAsFlowControl false-positive on Lambda/asynchronous (7.0.0-rc4)[/+] on Feb 13, 2024
  3. jsotuyod
    added
    needs:pmd7-revalidationThe issue hasn't yet been retested vs PMD 7 and may be stale
    and removed
    needs:pmd7-revalidationThe issue hasn't yet been retested vs PMD 7 and may be stale
    on Mar 17, 2024
  4. UncleOwen
    added this to the 7.29.0 milestone on Sep 26, 2026
  5. UncleOwen
    closed this as completedin #7105on Sep 26, 2026
  6. lukasgraef
    added a commit that references this issue on Sep 26, 2026

    [java] ExceptionAsFlowControl: stop at a lambda body (pmd#7105)

    This issue will close once commit 5ce9238 is merged into the 'master' branch.
    5ce9238
  7. Eljees
    added a commit that references this issue on Sep 28, 2026

    [java] ExceptionAsFlowControl: a throw in a lambda invoked by the met…

    4e64d1a
  8. UncleOwen
    added a commit that references this issue on Sep 30, 2026

    [java] ExceptionAsFlowControl: a throw in a lambda invoked by the met…

    5c9271c
  9. adangel
    changed the title [-][java] ExceptionAsFlowControl false-positive on Lambda/asynchronous (7.0.0-rc4)[/-] [+][java] ExceptionAsFlowControl: False positive on Lambda/asynchronous[/+] on Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    a:false-positivePMD flags a piece of code that is not problematic

    Type

    No type

    Projects

    No projects

      Milestone

      • 7.29.0

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.