junichi11 / cakephp-netbeans

CakePHP support in NetBeans
http://cakephp.org
71 stars 18 forks source link

Java NullpointerException on Mountain Lion #66

Closed crapp closed 10 years ago

crapp commented 10 years ago

I created a new Project with default values on Os X 10.8 wit latest Netbeans, Java and CakePHP (2.4.2). After creating it everything looks good and the project has the right structure. After I restart Netbeans I get a Java Nullpointer Exception

java.lang.NullPointerException at org.cakephp.netbeans.CakePhpFrameworkProvider.getConfigurationFiles(CakePhpFrameworkProvider.java:122) at org.netbeans.modules.php.project.PhpProject.hasConfigFiles(PhpProject.java:636) at org.netbeans.modules.php.project.ui.logicalview.ImportantFilesNodeFactory$ImportantFilesChildrenList.keys(ImportantFilesNodeFactory.java:123) at org.netbeans.spi.project.ui.support.NodeFactorySupport$DelegateChildren$1.run(NodeFactorySupport.java:202) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1432) [catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2042)

image

I have tried for hours now but I can't resolve this issue. I deleted Java, Netbeans (all traces)... Same Project on Linux with no Problems. I have no idea how to debug such a plugin. If you can give me some hints I will try it.

junichi11 commented 10 years ago

Hi,

Did you change Config directory name to other name?

pmjohann commented 10 years ago

Dear @junichi11 , I have the exact same problem as @crapp , I actually had this error on Mountain Lion, and now on Mavericks, so I had to move back to 7.3.1. Could you help me please what I should type in the Config field?

Thanks in advance!

crapp commented 10 years ago

This is the complete Project hierarchy pasted on ideone.com

Oh and no, I did not rename any file or folder

pmjohann commented 10 years ago

Thanks @crapp , but I misread it, I thought I had to manually define in NetBeans where my Config folder is, I didn't rename the Config folder itself. It still doesn't work on 7.4 though, but it runs fine on 7.3.1 ...

The error I'm getting is the following (seems it's the same as yours): java.lang.NullPointerException at org.cakephp.netbeans.CakePhpFrameworkProvider.getConfigurationFiles(CakePhpFrameworkProvider.java:122) at org.netbeans.modules.php.project.PhpProject.hasConfigFiles(PhpProject.java:636) at org.netbeans.modules.php.project.ui.logicalview.ImportantFilesNodeFactory$ImportantFilesChildrenList.keys(ImportantFilesNodeFactory.java:123) at org.netbeans.spi.project.ui.support.NodeFactorySupport$DelegateChildren$1.run(NodeFactorySupport.java:202) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1432) [catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2042)

junichi11 commented 10 years ago

Thanks for your answer. I'm not sure what is the cause yet.

crapp commented 10 years ago

I downloaded the file from plugins.netbeans.org. Version 0.9.6 for Netbeans 7.4 I will search for the file messages.log and paste it's contents here. Maybe it provides more information.

crapp commented 10 years ago

Here is the promised messages.log file from Netbeans on ideone.com You can see there is a second NullPointer Exception at the end. Maybe this helps. You can also see the version numbers of all installed Plugins and Netbeans itself

junichi11 commented 10 years ago

I see. Perhaps, Zip file is not unzipped correctly. app/Config directory doesn't exist.

@pmjohann said

It still doesn't work on 7.4 though, but it runs fine on 7.3.1 ...

NetBeans 7.4 requires java7. NetBeans 7.3 requires java6 or 7. So, the cause might be java7.

workaround

Thanks for your reporting.

junichi11 commented 10 years ago

@crapp I'm sorry, I made a mistake. Your directory structure has app/Config.

junichi11 commented 10 years ago

Could you try to use the following?:

https://github.com/junichi11/cakephp-netbeans/releases/tag/v0.9.7

crapp commented 10 years ago

@junichi11 Sorry but same error message. Really strange isn't it?

junichi11 commented 10 years ago

Thank you for trying it. Oh... I would like to debug but unfortunately I don't have mac environment. Umm... I try to add some logs later as a testing version.

junichi11 commented 10 years ago

@crapp @pmjohann

I added a few log to getDirectory(). Then, I changed to like the following (for testing): config files are not got if config directory is null. Could you try to test a new nbm(0.9.7.2)? If OK, please let me know the IDE log. Perhaps, you will get like the following result:

INFO [org.cakephp.netbeans.module.CakePhp2ModuleImpl]: dir type:APP, file type:CONFIG INFO [org.cakephp.netbeans.module.CakePhp2ModuleImpl]: version:2.4.2 INFO [org.cakephp.netbeans.module.CakePhp2ModuleImpl]: directoryType APP:/path/to/NetBeansProjects/cakeissue66/app, subpath: Config INFO [org.cakephp.netbeans.module.CakePhp2ModuleImpl]: children: webroot, tmp, Console, Lib, Config, Model, index.php, Vendor, .htaccess, Plugin, View, Test, Locale, Controller, INFO [org.cakephp.netbeans.module.CakePhp2ModuleImpl]: dir type:APP, file type:CONFIG INFO [org.cakephp.netbeans.module.CakePhp2ModuleImpl]: version:2.4.2 INFO [org.cakephp.netbeans.module.CakePhp2ModuleImpl]: directoryType APP:/path/to/NetBeansProjects/cakeissue66/app, subpath: Config INFO [org.cakephp.netbeans.module.CakePhp2ModuleImpl]: children: webroot, tmp, Console, Lib, Config, Model, index.php, Vendor, .htaccess, Plugin, View, Test, Locale, Controller, INFO [org.cakephp.netbeans.module.CakePhp2ModuleImpl]: dir type:APP, file type:CONTROLLER INFO [org.cakephp.netbeans.module.CakePhp2ModuleImpl]: dir type:APP, file type:MODEL INFO [org.cakephp.netbeans.module.CakePhp2ModuleImpl]: dir type:APP, file type:VIEW INFO [org.cakephp.netbeans.module.CakePhp2ModuleImpl]: dir type:APP, file type:HELPER

Thanks.

pmjohann commented 10 years ago

Thank you @junichi11 , I would love to test it with the new 0.9.7.2 nbm, but the last version I can find here is 0.9.6: http://plugins.netbeans.org/plugin/44579

Please give me a download link to the updated nbm file! Thanks once more!

junichi11 commented 10 years ago

@pmjohann

https://github.com/junichi11/cakephp-netbeans/releases

note

You can use this version only for testing. This issue is not fixed with 0.9.7.2 yet. It's the version for getting the log.

Thanks for your cooperation.

pmjohann commented 10 years ago

Hi @junichi11 ,

Here's my log: INFO [org.cakephp.netbeans.module.CakePhp2ModuleImpl]: dir type:APP, file type:CONFIG INFO [org.cakephp.netbeans.module.CakePhp2ModuleImpl]: version:2.4.1 INFO [org.cakephp.netbeans.module.CakePhp2ModuleImpl]: directoryType APP:/Volumes/Media HD/HOME/Dropbox/WEBSERVER/www/app, subpath: Config INFO [org.cakephp.netbeans.module.CakePhp2ModuleImpl]: children: View, config, Controller, webroot, console, .DS_Store, Plugin, Test, tmp, Lib, Locale, .htaccess, Vendor, Model, index.php, INFO [org.cakephp.netbeans.CakePhpFrameworkProvider]: config directory is null INFO [org.cakephp.netbeans.module.CakePhp2ModuleImpl]: dir type:APP, file type:CONTROLLER INFO [org.cakephp.netbeans.module.CakePhp2ModuleImpl]: dir type:APP, file type:MODEL INFO [org.cakephp.netbeans.module.CakePhp2ModuleImpl]: dir type:APP, file type:VIEW INFO [org.cakephp.netbeans.module.CakePhp2ModuleImpl]: dir type:APP, file type:HELPER INFO [org.cakephp.netbeans.module.CakePhp2ModuleImpl]: dir type:APP, file type:WEBROOT

BTW, you wrote that the issue is not fixed yet, but it is! (at least for me). The plugin now correctly detects the Controller, Model, View etc. folders, and no longer produces the error I submitted!

Let me know if I can help with anything else.

Thank you for your help!

junichi11 commented 10 years ago

Hi @pmjohann ,

Thank you! I've got it. Config directory name is lowercase. Then, also console... The cause is this. Are your Config and Console directory names displayed correctly? (i.e. not config/console but Config/Console?)

BTW, you wrote that the issue is not fixed yet, but it is! (at least for me). The plugin now correctly detects the Controller, Model, View etc. folders, and no longer produces the error I submitted!

Perhaps, error is not shown but I guess that some features will not work. e.g. run command, important file node has no item, database.php file is not created when create new project with NB, e.t.c.

Thanks.

junichi11 commented 10 years ago

It seems that app/Config, app/Console directory names are shown as app/config, app/console in Mac. So, we can't get Config/Console directories. I'll add the fix for workaround.

junichi11 commented 10 years ago

I have added lowercase problem to NetBeans bug tracker [1].

[1] https://netbeans.org/bugzilla/show_bug.cgi?id=238679

junichi11 commented 10 years ago

@crapp @pmjohann

I have fixed this issue. Could you try to test it? You can get new version (0.9.7.3)

If there is no problem, I'll provide a new nbm (as version 0.9.8) on Plugin Portal.

Thanks.

crapp commented 10 years ago

@junichi11 Great work, bug is fixed. Its good to have Cake back on my Mac. Keep up your good work!

junichi11 commented 10 years ago

@crapp Thanks for testing it :+1:

junichi11 commented 10 years ago

I have uploaded a new version to Plugin Portal.

Thanks.