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.
|Summary:||CodeCompletion took 12450 ms.|
|Component:||Filesystems||Assignee:||Jaroslav Havlin <jhavlin>|
|Issue Type:||DEFECT||Exception Reporter:|
|Attachments:||Patch to allow user/dev to turn off logging on FileObjectFactory class|
Description victork 2013-12-10 10:43:16 UTC
Created attachment 143006 [details] Patch to allow user/dev to turn off logging on FileObjectFactory class The exception reports for this bug originally assigned to bug 229017 which is a generic report about performance of core org.netbeans.modules.masterfs.filebasedfs.FileBasedFileSystem.getFileObject method. This bug however related to upper layer there a call to this slow core routine is not always necessary. The problem resides in calls to FileObjectFactory::checkCacheState() which uses the slow File.exists() method and only used to perform developer checks(To see if someone not using Java IO API directly, etc) and to warn about it. WARNING flag of the class is currently always enabled(If it is not active those checks are not preformed and checkCacheState() just returns). checkCacheState() not declared as throwing exceptions and there are no try()/catch() block so it seems to only rely on the return value(which is always true to prevent asserts triggering in it's callers). Proposed patch adds valuable org.netbeans.modules.masterfs.filebasedfs.fileobjects.disableFactoryWarnings argument support(Can be defined in the netbeans command line) which is by default(then not set) is false(current behaviour). Turning it on will disable the WARNING in the class and subsequently turn checkCacheState() into dummy routine always returning "True" without logging it's warn line(it's main purpose which unfortunately heavily reduces performance). Look in exception reports 697970 and 698215(Profile dumps) which are currently assigned to generic bug 229017 for the details. Go to "Code completion" group and walk down up to getValidFileObject()->getFileObject()->issueIfExist()->checkCacheState().
Comment 1 Jaroslav Havlin 2013-12-10 15:33:56 UTC
Good idea, but it is already possible to disable the warning. FileObjectFactory::checkCacheState() is called only from assertions, which are enabled only in daily builds, in standard releases they are disabled by default. So if you need better performance in daily builds, you can disable all assertions (-da java attribute). If you want other assertions to be enabled, disable only assertions in FileObjectFactory - start NetBeans with this attribute: -J-da:org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObjectFactory Thank you very much for the patch, but I would prefer not to add a new system property, but rather use the existing way to disable calling of checkCacheState.
Comment 2 victork 2013-12-10 15:43:23 UTC
Oh thanks - didn't know it is possible to disable them such a way(That can happen to non Java programmers :D) :) Will probably revert the patch and add your flag to the cmd line as it basically does almost the same.