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 73804 - CCE when extracting method form part of case block
Summary: CCE when extracting method form part of case block
Status: VERIFIED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 5.x
Hardware: All All
: P3 blocker (vote)
Assignee: Daniel Prusa
URL:
Keywords:
: 82401 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-03-21 12:34 UTC by Jiri Prox
Modified: 2007-09-26 09:14 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
exception (891 bytes, text/plain)
2006-03-21 12:35 UTC, Jiri Prox
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Prox 2006-03-21 12:34:18 UTC
NB 5.0 200601251500
JDK 1.5.0_05

CCE is thrown when trying to extract new method from part of case branch of
switch statement.

Steps to reproduce:
1) open some class and write this code:
        int x = 1;
        switch (x) {
            case 1: 
                |>System.out.println("a");
                System.out.println("b");<|
                break;
        }
2) select both println commands (as marked with '|>' and '<|' symbols)
3) call Extract method
-> CCE thrown

In step 2) it is important to select both lines otherwise it works

java.lang.ClassCastException: org.netbeans.jmi.javamodel.Case$Impl
	at
org.netbeans.modules.javacore.internalapi.JavaModelUtil.getSelectedStatements(JavaModelUtil.java:168)
	at
org.netbeans.modules.refactoring.plugins.ExtractMethodRefactoringPlugin.checkStatements(ExtractMethodRefactoringPlugin.java:139)
Comment 1 Jiri Prox 2006-03-21 12:35:27 UTC
Created attachment 29322 [details]
exception
Comment 2 Daniel Prusa 2006-05-11 10:30:14 UTC
Fixed in trunk.

/cvs/java/javacore/src/org/netbeans/modules/javacore/internalapi/JavaModelUtil.java
new revision: 1.20; previous revision: 1.19
Comment 3 Daniel Prusa 2006-05-11 12:13:20 UTC
Fix merged into release55 branch.

/cvs/java/javacore/src/org/netbeans/modules/javacore/internalapi/JavaModelUtil.java
new revision: 1.12.4.3.2.2; previous revision: 1.12.4.3.2.1
Comment 4 Jiri Prox 2006-07-14 13:53:51 UTC
verified
Comment 5 Jiri Prox 2006-08-10 15:25:09 UTC
*** Issue 82401 has been marked as a duplicate of this issue. ***
Comment 6 Quality Engineering 2007-09-20 09:54:34 UTC
Reorganization of java component