Bug 204089 - Cannot copy Java Package from one Project to another
Cannot copy Java Package from one Project to another
Status: VERIFIED FIXED
Product: java
Classification: Unclassified
Component: Refactoring
7.1
PC Windows Vista
: P1 (vote)
: 7.1
Assigned To: Tomas Zezula
issues@java
: 71_HR_FIX
: 201324 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-10-22 02:51 UTC by bht
Modified: 2011-11-25 12:41 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
:


Attachments
Testcase in zip file (2.53 MB, application/octet-stream)
2011-10-22 03:06 UTC, bht
Details
log files before copy (25.34 KB, application/octet-stream)
2011-10-22 03:07 UTC, bht
Details
log files after copy (74.16 KB, application/octet-stream)
2011-10-22 03:10 UTC, bht
Details
log file after copy (97.06 KB, text/plain)
2011-11-06 02:44 UTC, bht
Details
Patch file with logging (2.38 KB, patch)
2011-11-18 12:58 UTC, Tomas Zezula
Details | Diff
Patched module with logging (1.31 MB, application/octet-stream)
2011-11-18 12:59 UTC, Tomas Zezula
Details

Note You need to log in before you can comment on or make changes to this bug.
Description bht 2011-10-22 02:51:57 UTC
Microsoft Windows 2000 [Version 5.00.2195]
java version "1.6.0_25"
Java(TM) SE Runtime Environment (build 1.6.0_25-b06)
Java HotSpot(TM) Client VM (build 20.0-b11, mixed mode, sharing)


How to reproduce:

- Open NetBeans with new userdir without importing settings.
- Open Maven project apache-wicket-1.5.1\src\wicket-examples provided with the wicket distribution downloaded from http://wicket.apache.org/
- Start GlassFish server in debug mode (this might not be required but I did it).
- Undeploy all applications (this might not be required but I did it).
- Menu|Tools|Options|Files|Uncheck Enable auto-scanning of sources
- Menu|Tools|Options|Miscellaneous|Maven|Globale Execution Options, add --fail-never
- Run Maven project with GlassFish 3.1 (this might not be required but I did it).
- No server selected, select GlassFish 3.1, check Remember Permanently
- Open attached project CopyTest
At this stage, the project does not compile, because org.apache.util.convert.IConverter is not found. As part of the test, don't fix that. In fact, NetBeans earlier failed to indicate that this class was missing.
At least one exception is shown in the log already.
- Projects Window|Right click|Veiw packages as tree
- In CopyTest project, create package org.apache.wicket.examples by copying and pasting the complete package name inclusing dots at once (already done).
- In the Projects window, in the Maven project, select the package forminput and copy it
- In the Projects window, in the CopyTest project, select the package org.apache.wicket.examples and paste.

An exception occurs and the copy operation copied only the first four files:
- BeforeAndAfterBorder.html
- BeforeAndAfterBorder.java
- FormInput.html
- FormInput.java
Comment 1 bht 2011-10-22 03:06:38 UTC
Created attachment 112321 [details]
Testcase in zip file
Comment 2 bht 2011-10-22 03:07:41 UTC
Created attachment 112322 [details]
log files before copy
Comment 3 bht 2011-10-22 03:10:57 UTC
Created attachment 112323 [details]
log files after copy
Comment 4 bht 2011-10-22 20:19:21 UTC
*** Bug 201324 has been marked as a duplicate of this bug. ***
Comment 5 Tomas Zezula 2011-11-03 13:00:20 UTC
I am not able to reproduce it.
The logged exception are only log should not affect functionality. Anyway I've rewritten the TreeRootNode not to cause them.
jet-main 002c73ed1b13
Comment 6 Quality Engineering 2011-11-04 15:04:34 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/002c73ed1b13
User: Tomas Zezula <tzezula@netbeans.org>
Log: #204089:Cannot copy Java Package from one Project to another
Comment 7 bht 2011-11-06 02:43:20 UTC
In my case, it still reproduces in the latest dev build.

Product Version: NetBeans IDE Dev (Build 201111040600)

It looks like I am hitting a frequently occurring issue now:

NullPointerException
NetBeans Error Report Upload Complete
It has now been added to the database with id #539839. It has been classified as a duplicate of report #23304.
This bug was already resolved.
You can check bug #126271 in Bugzilla for more information.
Comment 8 bht 2011-11-06 02:44:40 UTC
Created attachment 112873 [details]
log file after copy
Comment 9 Tomas Zezula 2011-11-07 08:57:19 UTC
Works for me.
Even in the log there is no exception (or anything else) regarding the copy operation.

The:
java.lang.NullPointerException
	at com.sun.tools.javac.comp.Flow.visitMethodDef(Flow.java:775)
	at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:674)

comes from different thread and has no effect on copy.
Comment 10 Tomas Zezula 2011-11-07 09:44:31 UTC
I've retested with a full build again following exactly the steps (Start GlassFish server in debug mode (this might not be required but I did it) and Undeploy all applications (this might not be required but I did it)) and works fine all files were copied.
Comment 11 bht 2011-11-16 19:26:31 UTC
I reproduced this twice on the first two attempts with a new, much faster computer in a completely different environment where I started fresh with downloading all files from the net including the testcase. There seems to be a new bug where the lib jars in the attached projects cannot be found. I added only one jar file in the fix dialog on opening the testcase and it fixed itself. You may have to do this as well until NetBeans is happy with the libraries - except the missing class org.apache.util.convert.IConverter.

Here are the slightly modified steps that I recorded again:

How to reproduce:

- Open NetBeans with new userdir without importing settings.
- Open Maven project apache-wicket-1.5.1\src\wicket-examples provided with the wicket distribution downloaded from http://wicket.apache.org/
- Start GlassFish server in debug mode (this might not be required but I did it).
- Undeploy all applications (this might not be required but I did it).
- Menu|Tools|Options|Files|Uncheck Enable auto-scanning of sources
- Menu|Tools|Options|Miscellaneous|Maven|Globale Execution Options, add --fail-never
- Run Maven project with GlassFish 3.1 (this might not be required but I did it).
- No server selected, select GlassFish 3.1, check Remember Permanently
- Open attached project CopyTest
At this stage, the project does not compile, because org.apache.util.convert.IConverter is not found. As part of the test, don't fix that. In fact, NetBeans earlier failed to indicate that this class was missing.
At least one exception is shown in the log already.
- Projects Window|Right click|View packages as tree
- In CopyTest project, create package org.apache.wicket.examples by copying and pasting the complete package name including dots at once (already done).
- In the Projects window, in the Maven project, select the package forminput and copy it
- In the Projects window, in the CopyTest project, select the package org.apache.wicket.examples and paste.

An exception occurs and the copy operation copied only the first four files:
- BeforeAndAfterBorder.html
- BeforeAndAfterBorder.java
- FormInput.html
- FormInput.java
Comment 12 bht 2011-11-16 19:42:49 UTC
May be this helps to reproduce this - id doesn't do any harm before running the test:

in apache-wicket-1.5.1\src
run mvn -Dmaven.test.skip=true
Comment 13 Tomas Zezula 2011-11-18 07:58:41 UTC
Do I understand correctly, that I need to run:

in apache-wicket-1.5.1\src
run mvn -Dmaven.test.skip=true

to reproduce the problem?
Without running this the copy works fine, right?
Comment 14 bht 2011-11-18 09:34:04 UTC
I can't say that it is really necessary. I am just trying to think what could help. Re your first question, I have not been able to run the testcase successfully even once following the steps on this page.

In similar scenarios where the same library was missing (and later other libraries), but without even trying to copy files, I got NullPointerExceptions today that I reported with the Exception Reporter. I think this is a very interesting case, possibly quite rewarding to solve. Other problems will disappear with it.

This is a very common scenario where a project is copied without libraries and the developer is gradually adding the libraries until the project no longer breaks. I always get these errors with NetBeans when I do this.
Comment 15 Tomas Zezula 2011-11-18 11:02:49 UTC
Sorry, still works fine for me even when doing all the steps (including starting GF in debug mode, undeploy). All files were copied to CopyTest project.

No exception is thrown (even the NPE from Flow.visitMethodDef is not thrown, but it is harmless for the copy operation). Can you verify that the files are really not copied on disk? That it's not just UI refresh problem.
Thanks
Comment 16 Tomas Zezula 2011-11-18 12:58:06 UTC
Created attachment 113314 [details]
Patch file with logging
Comment 17 Tomas Zezula 2011-11-18 12:59:49 UTC
Created attachment 113315 [details]
Patched module with logging
Comment 18 Tomas Zezula 2011-11-18 13:07:40 UTC
Please can you try to reproduce the problem with applied patch containing the logging.
If you build the IDE from source apply the Patch file before build. If you are using builds download a night build and replace the netbeans/platform/modules/org-openide-loaders.jar with the Patched module.
Then start the IDE with the following command line option:

-J-Dorg.openide.loaders.DataFolder.level=FINE

do the copy of the forminput folder and attach the log file.
Thanks
Comment 19 Tomas Zezula 2011-11-18 13:11:27 UTC
The Tree View is just a FilterNode on top of the FolderNode, the copy operation is handled by FN.
Without logging from reporter it's hard to say why the files were not copied.
Comment 20 Tomas Zezula 2011-11-18 13:13:44 UTC
Jirko, can you try it on Windows? To verify that it's not Windows specific issue, I am not able to reproduce it on UNIX.
Comment 21 bht 2011-11-18 17:11:00 UTC
I was going to ask whether Windows was actually tried. I have reproduced it multiple times on different computers, Windows 2000 and Windows XP.

I can reate any number of testcases such as this one - these problems are dead easy to reproduce. But the creation of the testcases from production code takes days with many generations of successive removal of detail.

I would prefer that a few more people try to reproduce this on Windows. I am running out of time - I don't have the resources now to build the IDE for the logging. Please don't mark this as incomplete. This is as complete as it can get.

BTW I am changing to priority 1 because of data loss.
Comment 22 David Strupl 2011-11-21 09:54:03 UTC
I have just tried (several times) on a Windows 7 machine. Unfortunately we are not able to reproduce this - closing as "works for me".

Mariane and Co.: If someone is able to reproduce so we can debug it please reopen.
Comment 23 Tomas Zezula 2011-11-21 11:30:28 UTC
I am still not able to reproduce, but I've think that I probably found what can be the problem.
Comment 24 Tomas Zezula 2011-11-21 12:47:07 UTC
Fixed jet-main 0edc81c2aa11
Comment 25 Jiri Prox 2011-11-22 13:11:43 UTC
The fix seems to be ok


Product Version: NetBeans IDE Dev (Build 20111122-9a8edc0fe2de)
Java: 1.7.0_02; Java HotSpot(TM) 64-Bit Server VM 22.0-b10
System: Windows 7 version 6.1 running on amd64; Cp1250; en_US (nb)
User directory: C:\Users\jprox\.netbeans\dev
Cache directory: C:\Users\jprox\.netbeans\dev\var\cache
Comment 26 Quality Engineering 2011-11-22 15:51:14 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/0edc81c2aa11
User: Tomas Zezula <tzezula@netbeans.org>
Log: #204089:Cannot copy Java Package from one Project to another
Comment 27 Jan Becicka 2011-11-23 12:27:07 UTC
Patch is OK.
Comment 28 Tomas Zezula 2011-11-23 17:18:33 UTC
integrated into 7.1 f7b0d1285982
Comment 29 Quality Engineering 2011-11-24 07:15:58 UTC
Integrated into 'releases'
Changeset: http://hg.netbeans.org/releases/rev/f7b0d1285982
User: Tomas Zezula <tzezula@netbeans.org>
Log: #204089:Cannot copy Java Package from one Project to another
Comment 30 Jiri Prox 2011-11-25 12:41:36 UTC
verified


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo