This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 228693 - Surround with try-catch is invalid in resource part of try-catch
Summary: Surround with try-catch is invalid in resource part of try-catch
Status: VERIFIED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 7.3
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Jan Lahoda
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-18 10:19 UTC by Jiri Prox
Modified: 2013-08-30 11:50 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Prox 2013-04-18 10:19:45 UTC
Surround with try-catch hint is invalid in resource part of try-catch

Steps to reproduce:

1) have a code:
    public void test() {
        try (FileReader fr = new FileReader("");) {
        }
    }

2) use Surround statement with try-catch on the 'try' line

->
public void test() {
        try (try {
            final FileReader fr = new FileReader("");
        } catch (FileNotFoundException ex) {
            Logger.getLogger(ClassB.class.getName()).log(Level.SEVERE, null, ex);
        };) {
        }
    }



Product Version: NetBeans IDE Dev (Build 201304162301)
Java: 1.8.0-ea; Java HotSpot(TM) 64-Bit Server VM 25.0-b23
Runtime: Java(TM) SE Runtime Environment 1.8.0-ea-b82
System: Windows 7 version 6.1 running on amd64; Cp1250; en_US (nb)
User directory: C:\Users\jprox\AppData\Roaming\NetBeans\dev
Cache directory: C:\Users\jprox\AppData\Local\NetBeans\Cache\dev
Comment 1 Jan Lahoda 2013-05-13 12:35:11 UTC
http://hg.netbeans.org/jet-main/rev/3cf69a3b4f8e
Comment 2 Jan Lahoda 2013-05-13 12:37:51 UTC
Correction, the correct changeset is:
http://hg.netbeans.org/jet-main/rev/a8c437858726
Comment 3 Quality Engineering 2013-05-18 02:55:55 UTC
Integrated into 'main-golden', will be available in build *201305172300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/a8c437858726
User: Jan Lahoda <jlahoda@netbeans.org>
Log: #228693: don't show surround-with when the error is inside the resource section of the TWR.
Comment 4 Jiri Prox 2013-08-30 11:50:16 UTC
v.