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 62525 - refactoring totally destroy source code
Summary: refactoring totally destroy source code
Status: VERIFIED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 5.x
Hardware: All All
: P2 blocker (vote)
Assignee: Jan Becicka
URL:
Keywords:
: 61446 68166 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-08-17 22:52 UTC by tprochazka
Modified: 2007-09-26 09:14 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 tprochazka 2005-08-17 22:52:31 UTC
Tested with netbeans-4_2-daily-bin-200508161800-16_Aug_2005_1800

Sometimes (often) new refactorin module in Netbeans 4.2dev totaly destroy code. I 
tkink, that the proble arise only when code contains non US-ASCII chars (I use 
UTF8 encoding of source file)

For exampple when move this code:

/*
* Licence
*/

package cz.test.demo.auto.next;

/**
 * XYZ
 * @author  ěščřžýáíé
 */
public class FTP {

    /** Creates a new instance  */
    public FTP() {
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
    }

}

move to package 'test', result is:

/*
* Licence
*/

package test;

/**
 * XYZ
 * @author  ěščřžýáíé
 */
public class FTP {

  FTP** Creates a new instance  */
    public FTP() {
 FTP}

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
    }

}

and after undo:

/*
* Licence
*/

packcz.test.demo.auto.nexttest;

/**
 * XYZ
 * @author  ěščřžýáíé
 */
public class  /P {

  FTP** Creates a new instance  */
    publ    FTP() {
 FTP}

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
    }

}
Comment 1 Milan Kubec 2005-08-18 14:58:24 UTC
If this is reproducible it would be serious issue. But I'm not able to reproduce
the issue with provided class. Please could you provide steps to reproduce
starting with clean userdir? Also describe how do you create and edit the class
(just in editor or you use also some visual editing)? Did you create some form
files? Raising prio and marking as INCOMPLETE until there are steps to reproduce.
Comment 2 tprochazka 2005-08-25 21:20:53 UTC
It’s happen only when I switch to UTF-8 in 
Options: Editing -> Java Sources -> Default Encoding
and use UTF8 file with non US-ASCII characters.

When I run NB with parameter -J-Dfile.encoding=UTF-8 is refactoring OK, but files 
created with my modified templates (they are in UTF-8), which use __USER__ set to 
‘Tomáš Prochazka’ is created as ‘Tomáš Procházka’

Why NB use two another and incompatibility way to change default encodings?
Comment 3 Milan Kubec 2005-09-01 14:09:36 UTC
Easily reproducible with info provided from reporter. Raising prio to P2.

Summary of steps to reproduce:
1) Change default encoding to UTF-8 in Tools | Options (Editing -> Java Sources
-> Default Encoding)
2) Modify property String table of Java Sources node to look like this:
USER=ěščřžýáíé
3) Create java class from template
4) Rename the class using Refactor | Rename
Source code is completly broken.
Comment 4 tprochazka 2005-09-02 12:09:45 UTC
Perfect, that you (mkubec) managed this issue.
But, I still don't know, why NB has two ways to change default encoding :-(
Comment 5 Jan Becicka 2005-09-07 10:14:34 UTC
Checking in src/org/netbeans/modules/java/settings/JavaSettings.java;
/cvs/java/src/org/netbeans/modules/java/settings/JavaSettings.java,v  <-- 
JavaSettings.java
new revision: 1.71; previous revision: 1.70
done
Checking in javacore/src/org/netbeans/modules/javacore/parser/Util.java;
/cvs/java/javacore/src/org/netbeans/modules/javacore/parser/Util.java,v  <-- 
Util.java
new revision: 1.7; previous revision: 1.6
done
Checking in
javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/ResourceImpl.java;
/cvs/java/javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/ResourceImpl.java,v
 <--  ResourceImpl.java
new revision: 1.94; previous revision: 1.93
done
Checking in javacore/src/org/netbeans/modules/javacore/JMManager.java;
/cvs/java/javacore/src/org/netbeans/modules/javacore/JMManager.java,v  <-- 
JMManager.java
new revision: 1.121; previous revision: 1.120
done

> But, I still don't know, why NB has two ways to change default encoding :-(
System.property "file.encoding" is general JDK settings for all files while Java
Sources | Default Encoding is NetBeans setting for java files.
Comment 6 Jan Becicka 2005-11-08 08:39:32 UTC
*** Issue 68166 has been marked as a duplicate of this issue. ***
Comment 7 Jan Becicka 2005-11-09 13:57:14 UTC
*** Issue 61446 has been marked as a duplicate of this issue. ***
Comment 8 Max Sauer 2007-02-14 15:18:36 UTC
Verified.
---    
NetBeans IDE Dev (Build 070214)
1.6.0; Java HotSpot(TM) Server VM 1.6.0-b105
Linux version 2.6.12-1.1390_FC4smp running on i386
en_US (nb); UTF-8
Comment 9 Quality Engineering 2007-09-20 10:08:42 UTC
Reorganization of java component