Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Cannot rename file settings.gradle in XXXX to build.gradle #4

Closed
dantwinkler opened this Issue · 19 comments

3 participants

@dantwinkler

This happens when the project is opened.

@kelemen
Owner

I don't understand the problem. Is it an error message that pops up or you want to rename settings.gradle to build.gradle?

@cesarizu

It happens to me all the time. Just openning the project or reloading causes this. Also I had a BuildTemplate.gradle file that got renamed to build.gradle inside one project.

@kelemen
Owner

I have never experienced this. Can you share a project with which I can reproduce it?

@cesarizu

It is happening on projects that have both settings.gradle and build.gradle. See https://github.com/cesarizu/samplelombok

@kelemen
Owner

I cannot reproduce this issue. Can you send me a stack trace or something which may help? Or can you debug it and check where it happens?

@cesarizu

Actually before I mentioned about renaming other files. This is happening on the GradleProjectType project (even not being a gradle project). The src/org/netbeans/gradle/project/filesupport/GradleTemplate.gradle is renamed to src/org/netbeans/gradle/project/filesupport/build.gradle.

I'll try to find why is this happening. BTW I'm using netbeans dev.

@kelemen
Owner

This seems very strange as there is no rename support in this project.

Gradle filetypes are managed separately, they are completely independent of projects. (you can actually open any .gradle files and edit it without being part of a project).

@cesarizu

Here's a stacktrace:

Caused: org.netbeans.modules.masterfs.filebasedfs.utils.FSException: Cannot rename file settings.gradle in /Users/cesar/src/cesarizu/samplelombok to build.gradle.
    at org.netbeans.modules.masterfs.filebasedfs.utils.FSException.io(FSException.java:118)
    at org.netbeans.modules.masterfs.filebasedfs.fileobjects.BaseFileObj.rename(BaseFileObj.java:420)
    at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObj.rename(FileObj.java:392)
    at org.netbeans.modules.masterfs.filebasedfs.fileobjects.BaseFileObj$1.call(BaseFileObj.java:481)
    at org.netbeans.modules.masterfs.filebasedfs.fileobjects.BaseFileObj$1.call(BaseFileObj.java:478)
    at org.netbeans.modules.masterfs.filebasedfs.FileBasedFileSystem.runAsInconsistent(FileBasedFileSystem.java:119)
    at org.netbeans.modules.masterfs.filebasedfs.fileobjects.BaseFileObj.rename(BaseFileObj.java:485)
    at org.openide.loaders.FileEntry.rename(FileEntry.java:96)
    at org.openide.loaders.MultiDataObject.handleRename(MultiDataObject.java:637)
    at org.openide.loaders.DataObject$1Op.run(DataObject.java:693)
    at org.openide.loaders.DataObject$1WrapRun.run(DataObject.java:890)
    at org.openide.loaders.DataObjectPool$1WrapAtomicAction.run(DataObjectPool.java:261)
    at org.openide.filesystems.EventControl.runAtomicAction(EventControl.java:127)
    at org.openide.filesystems.FileSystem.runAtomicAction(FileSystem.java:607)
    at org.openide.loaders.DataObjectPool.runAtomicAction(DataObjectPool.java:273)
    at org.openide.loaders.DataObject.invokeAtomicAction(DataObject.java:910)
    at org.openide.loaders.DataObject.rename(DataObject.java:707)
    at org.openide.loaders.DataNode.setName(DataNode.java:157)
Caused: java.lang.IllegalArgumentException
    at org.openide.loaders.DataNode.setName(DataNode.java:166)
    at org.openide.loaders.DataNode.setName(DataNode.java:178)
    at org.netbeans.gradle.file.GradleDataObject.createNodeDelegate(GradleDataObject.java:52)
    at org.openide.loaders.DataObject$1.run(DataObject.java:310)
    at org.openide.util.Mutex.readAccess(Mutex.java:367)
    at org.openide.util.Mutex$1R.run(Mutex.java:1309)
    at org.openide.util.Mutex.doWrapperAccess(Mutex.java:1326)
    at org.openide.util.Mutex.readAccess(Mutex.java:356)
    at org.openide.loaders.DataObject.getNodeDelegateImpl(DataObject.java:306)
    at org.openide.loaders.DataObject.getNodeDelegate(DataObject.java:298)
    at org.netbeans.gradle.project.view.GradleProjectChildFactory$5.createNode(GradleProjectChildFactory.java:122)
    at org.netbeans.gradle.project.view.GradleProjectChildFactory.createNodeForKey(GradleProjectChildFactory.java:91)
    at org.netbeans.gradle.project.view.GradleProjectChildFactory.createNodeForKey(GradleProjectChildFactory.java:37)
    at org.openide.nodes.ChildFactory.createNodesForKey(ChildFactory.java:120)
    at org.openide.nodes.AsynchChildren.createNodes(AsynchChildren.java:160)
    at org.openide.nodes.Children$Keys$KE.nodes(Children.java:1662)
[catch] at org.openide.nodes.ChildrenArray.nodesFor(ChildrenArray.java:149)
    at org.openide.nodes.EntrySupportDefault$Info.nodes(EntrySupportDefault.java:787)
    at org.openide.nodes.EntrySupportDefault.updateAdd(EntrySupportDefault.java:423)
    at org.openide.nodes.EntrySupportDefault.setEntries(EntrySupportDefault.java:288)
    at org.openide.nodes.EntrySupport.setEntries(EntrySupport.java:83)
    at org.openide.nodes.Children$Keys$2.run(Children.java:1556)
    at org.openide.util.Mutex$1Exec.run(Mutex.java:1246)
    at org.openide.nodes.Children$ProjectManagerDeadlockDetector.execute(Children.java:1921)
    at org.openide.util.Mutex.postRequest(Mutex.java:1252)
    at org.openide.util.Mutex.postRequest(Mutex.java:1215)
    at org.openide.util.Mutex.postWriteRequest(Mutex.java:587)
    at org.openide.nodes.Children$Keys.applyKeys(Children.java:1565)
    at org.openide.nodes.Children$Keys.setKeys(Children.java:1509)
    at org.openide.nodes.AsynchChildren$1.add(AsynchChildren.java:188)
    at org.netbeans.gradle.project.view.GradleProjectChildFactory.addGradleFile(GradleProjectChildFactory.java:119)
    at org.netbeans.gradle.project.view.GradleProjectChildFactory.addProjectFiles(GradleProjectChildFactory.java:151)
    at org.netbeans.gradle.project.view.GradleProjectChildFactory.readKeys(GradleProjectChildFactory.java:228)
    at org.netbeans.gradle.project.view.GradleProjectChildFactory.createKeys(GradleProjectChildFactory.java:234)
    at org.openide.nodes.AsynchChildren.run(AsynchChildren.java:206)
    at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1452)
    at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2032)
ALL [null]: Cannot rename file settings.gradle in /Users/cesar/src/cesarizu/samplelombok to build.gradle.
ALL [null]: Cannot rename file settings.gradle in /Users/cesar/src/cesarizu/samplelombok to build.gradle.
SEVERE [org.openide.util.RequestProcessor]: Error in RequestProcessor org.openide.loaders.FolderChildren$DelayedNode
@kelemen
Owner

I guess that this bug is os dependent, that is why I have never seen this. Looking at this stack trace I see a strange place

at org.openide.loaders.DataNode.setName(DataNode.java:178)
at org.netbeans.gradle.file.GradleDataObject.createNodeDelegate(GradleDataObject.java:52)

Why setName is called is beyond me. Once again, I think i need to check the sources of NetBeans ...

@kelemen
Owner

On the 122th line of GradleProjectChildFactory, can you try to replace

return new FilterNode(fileData.getNodeDelegate()) {

with this:

return new FilterNode(fileData.getNodeDelegate().cloneNode()) {

and check if this solves the problem?

@cesarizu

Still getting the same error changing that. I just realized something else. To stop the renaming of GradleTemplate.gradle I created a build.gradle on the same directory. Now the filesupport package is gone and when I go to the Files tab and browse to that folder I get the following error:

SEVERE [org.openide.util.RequestProcessor]: Error in RequestProcessor org.openide.loaders.FolderChildren$DelayedNode

msg
msg
Caused: org.netbeans.modules.masterfs.filebasedfs.utils.FSException: Cannot rename file GradleTemplate.gradle in /Users/cesar/src/external/netbeans-gradle-project/src/org/netbeans/gradle/project/filesupport to build.gradle.
    at org.netbeans.modules.masterfs.filebasedfs.utils.FSException.io(FSException.java:118)
    at org.netbeans.modules.masterfs.filebasedfs.fileobjects.BaseFileObj.rename(BaseFileObj.java:420)
    at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObj.rename(FileObj.java:392)
    at org.netbeans.modules.masterfs.filebasedfs.fileobjects.BaseFileObj$1.call(BaseFileObj.java:481)
    at org.netbeans.modules.masterfs.filebasedfs.fileobjects.BaseFileObj$1.call(BaseFileObj.java:478)
    at org.netbeans.modules.masterfs.filebasedfs.FileBasedFileSystem.runAsInconsistent(FileBasedFileSystem.java:119)
    at org.netbeans.modules.masterfs.filebasedfs.fileobjects.BaseFileObj.rename(BaseFileObj.java:485)
    at org.openide.loaders.FileEntry.rename(FileEntry.java:96)
    at org.openide.loaders.MultiDataObject.handleRename(MultiDataObject.java:637)
    at org.openide.loaders.DataObject$1Op.run(DataObject.java:693)
    at org.openide.loaders.DataObject$1WrapRun.run(DataObject.java:890)
    at org.openide.loaders.DataObjectPool$1WrapAtomicAction.run(DataObjectPool.java:261)
    at org.openide.filesystems.EventControl.runAtomicAction(EventControl.java:127)
    at org.openide.filesystems.FileSystem.runAtomicAction(FileSystem.java:607)
    at org.openide.loaders.DataObjectPool.runAtomicAction(DataObjectPool.java:273)
    at org.openide.loaders.DataObject.invokeAtomicAction(DataObject.java:910)
    at org.openide.loaders.DataObject.rename(DataObject.java:707)
    at org.openide.loaders.DataNode.setName(DataNode.java:157)
Caused: java.lang.IllegalArgumentException
    at org.openide.loaders.DataNode.setName(DataNode.java:166)
    at org.openide.loaders.DataNode.setName(DataNode.java:178)
    at org.netbeans.gradle.file.GradleDataObject.createNodeDelegate(GradleDataObject.java:52)
    at org.openide.loaders.DataObject$1.run(DataObject.java:310)
    at org.openide.util.Mutex.readAccess(Mutex.java:367)
    at org.openide.util.Mutex$1R.run(Mutex.java:1309)
    at org.openide.nodes.Children$ProjectManagerDeadlockDetector.execute(Children.java:1921)
    at org.openide.util.Mutex.doWrapperAccess(Mutex.java:1328)
    at org.openide.util.Mutex.readAccess(Mutex.java:356)
    at org.openide.loaders.DataObject.getNodeDelegateImpl(DataObject.java:306)
    at org.openide.loaders.DataObject.getNodeDelegate(DataObject.java:298)
    at org.openide.loaders.DataObject.getClonedNodeDelegate(DataObject.java:331)
    at org.openide.loaders.FolderChildren.createNode(FolderChildren.java:239)
    at org.openide.loaders.FolderChildren$DelayedNode.run(FolderChildren.java:425)
    at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1452)
    at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2032)
Caused: org.openide.util.RequestProcessor$SlowItem: task failed due to
    at org.openide.util.RequestProcessor.post(RequestProcessor.java:424)
    at org.openide.loaders.FolderChildren$DelayedNode.(FolderChildren.java:420)
    at org.openide.loaders.FolderChildren$DelayedNode.(FolderChildren.java:409)
    at org.openide.loaders.FolderChildren$DelayedNode.(FolderChildren.java:405)
    at org.openide.loaders.FolderChildren.createNodes(FolderChildren.java:220)
    at org.openide.loaders.FolderChildren.createNodes(FolderChildren.java:73)
    at org.openide.nodes.Children$Keys$KE.nodes(Children.java:1662)
    at org.openide.nodes.EntrySupportLazyState$EntryInfo.getNode(EntrySupportLazyState.java:294)
    at org.openide.nodes.EntrySupportLazyState$EntryInfo.getNode(EntrySupportLazyState.java:260)
    at org.openide.nodes.EntrySupportLazy$LazySnapshot.get(EntrySupportLazy.java:885)
    at org.openide.nodes.FilterNode$Children$LazySupport$FilterNodeEntry.nodes(FilterNode.java:1885)
    at org.openide.nodes.EntrySupportLazyState$EntryInfo.getNode(EntrySupportLazyState.java:294)
    at org.openide.nodes.FilterNode$Children$LazySupport$FilterLazySnapshot.get(FilterNode.java:1740)
    at org.openide.nodes.FilterNode$Children$LazySupport$FilterNodeEntry.nodes(FilterNode.java:1885)
    at org.openide.nodes.EntrySupportLazyState$EntryInfo.getNode(EntrySupportLazyState.java:294)
    at org.openide.nodes.FilterNode$Children$LazySupport$FilterLazySnapshot.get(FilterNode.java:1740)
    at org.openide.nodes.EntrySupportLazy$LazySnapshot.get(EntrySupportLazy.java:880)
    at org.openide.nodes.EntrySupportLazy$LazySnapshot.get(EntrySupportLazy.java:865)
    at org.openide.explorer.view.VisualizerChildren.getChildAt(VisualizerChildren.java:127)
    at org.openide.explorer.view.VisualizerNode.getChildAt(VisualizerNode.java:321)
    at javax.swing.tree.DefaultTreeModel.getChild(DefaultTreeModel.java:156)
    at javax.swing.tree.FixedHeightLayoutCache$VisibleFHTreeStateNodeEnumeration.nextElement(FixedHeightLayoutCache.java:1506)
    at javax.swing.tree.FixedHeightLayoutCache$VisibleFHTreeStateNodeEnumeration.nextElement(FixedHeightLayoutCache.java:1461)
    at javax.swing.tree.AbstractLayoutCache.getPreferredWidth(AbstractLayoutCache.java:228)
    at javax.swing.plaf.basic.BasicTreeUI.updateCachedPreferredSize(BasicTreeUI.java:1820)
    at javax.swing.plaf.basic.BasicTreeUI.getPreferredSize(BasicTreeUI.java:1921)
    at javax.swing.plaf.basic.BasicTreeUI.getPreferredSize(BasicTreeUI.java:1909)
    at javax.swing.JComponent.getPreferredSize(JComponent.java:1634)
    at javax.swing.ScrollPaneLayout.layoutContainer(ScrollPaneLayout.java:769)
    at org.openide.explorer.view.TreeView$ExplorerScrollPaneLayout.layoutContainer(TreeView.java:1724)
    at java.awt.Container.layout(Container.java:1419)
    at java.awt.Container.doLayout(Container.java:1408)
    at java.awt.Container.validateTree(Container.java:1505)
    at java.awt.Container.validate(Container.java:1478)
    at org.openide.explorer.view.TreeView.access$101(TreeView.java:151)
    at org.openide.explorer.view.TreeView$3.run(TreeView.java:670)
    at org.openide.util.Mutex.readAccess(Mutex.java:367)
    at org.openide.util.Mutex$1R.run(Mutex.java:1309)
    at org.openide.nodes.Children$ProjectManagerDeadlockDetector.execute(Children.java:1921)
    at org.openide.util.Mutex.doWrapperAccess(Mutex.java:1328)
    at org.openide.util.Mutex.readAccess(Mutex.java:356)
    at org.openide.explorer.view.TreeView.validate(TreeView.java:667)
    at javax.swing.RepaintManager.validateInvalidComponents(RepaintManager.java:670)
    at javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1671)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:682)
    at java.awt.EventQueue.access$000(EventQueue.java:85)
    at java.awt.EventQueue$1.run(EventQueue.java:643)
    at java.awt.EventQueue$1.run(EventQueue.java:641)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:652)
    at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:158)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
[catch] at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
ALL [null]: Cannot rename file GradleTemplate.gradle in /Users/cesar/src/external/netbeans-gradle-project/src/org/netbeans/gradle/project/filesupport to build.gradle.
ALL [null]: Cannot rename file GradleTemplate.gradle in /Users/cesar/src/external/netbeans-gradle-project/src/org/netbeans/gradle/project/filesupport to build.gradle.
@kelemen
Owner

I strongly believe that the bug must be in GradleDataObject. To make matters worse, I don't truly understand what this class does. While other classes only containing code I believe I understand (since like 95% of them was written by me), this one was copy-pasted from the the Maven project's sources and Geertjan's code. I guess this bug is the price to pay for this sin :)

@cesarizu

It seems to be working for me now :S I removed the netbeans dir and started fresh. I realized I had two modules: org.netbeans.gradle and org.netbeans.gradle.project. Now the logs just show one org.netbeans.gradle.project.

Thanks for your help :) Maybe this is what's happening to the original submitter @dantwinkler

@kelemen
Owner

What is this "org.netbeans.gradle" project?

Anyway the possibility of renaming .gradle files randomly seems a serious issue to me. I will not mark this issue as fixed as long as I don't understand what is going on. Checking the sources of NetBeans did not help, according to the sources, this should have never happened. It does call rename on the object but it gets the name from the object to be renamed (so it should be a no-op).

@cesarizu

To test, I changed the BUILD_FILE_NAME = "build.gradle" to something else on the GradleProjectConstants class but still got the renaming to build.gradle so then I started to suspect of another module. I think I had Geertjan's module installed sometime in the past, although I uninstalled it.

@kelemen
Owner

I have checked his sources and did not find anything that could cause this (since this part of code was left the same as his, athough not long ago, I merged some code from the Maven plugin).

Anyway I will wait what @dantwinkler has to say on this issue.

@kelemen
Owner

And thank you for helping with this one. At the very least, I will add this to the troubleshooting guide.

@kelemen
Owner

With a second look at the stack trace, I now see that org.netbeans.gradle.file.GradleDataObject is not in this project as the fully qualified name in this project of this class is org.netbeans.gradle.filesupport.GradleDataObject. Knowing this, I will close this issue. This should not affect many, since I think you need a very old version of Geertjan's code (which I think is no longer available, or at least I could not find it).

@kelemen kelemen closed this
@dantwinkler

That was in fact the problem, I removed the older plugin and the error no longer happens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.