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.
I see 2 issues invoking templateDO.createFromTemplate(dataFolder, targetName); 1) for templateDO a template defined in layer.xml, I get error (See attachement for stacktrace) SEVERE [global] java.lang.IllegalArgumentException: unmatched braces in the pattern at position 19 at org.openide.util.MapFormat.processPattern(MapFormat.java:213) with content as follows ============ <?php //namespace org::netbeans::saas; class SaasService { public function SaasService() { $this->__construct(); } public function __construct() { } } ?> ============== 2) for templateDO in the hg repository "/main/websvc.saas.codegen/src/org/netbeans/modules/websvc/saas/codegen/php/resources/RestConnection.template", I get following truncated contents instead of the full =================== <?php require_once "HTTP/Request.php"; require "RestResponse.php"; class RestConnection { private $url = ""; private $response = ""; private $responseBody = ""; private $req = null; public function RestConnection($url = "", $params = null) { ======================
Created attachment 62640 [details] Error from DataObject.createFromTemplate()
The web services templates are not maintained by the PHP team
The main issue here is in using template files with contents that has "__" (described as 1st issue). This causes the second issue with truncated contents. I think this is a bug in the org.openide.util.MapFormat.processPattern() method, so assigning this to the nb utilities component.
Reassigned to component "openide". I do not know which subcomponent to use.
I tried DataObject.createFromTemplate() with mentioned templates and new files were created successfully. Please, provide a test case or steps how to reproduce in IDE.
No feedback from the reporter. Closing as worksforme.
Created attachment 63032 [details] Error snapshot from IDE
Created attachment 63033 [details] Php template that has the issue using DataObject.createTemplate()
Created attachment 63034 [details] Error snapshot from IDE - uploaded again with correct mime
Sorry for responding late! I had removed the offending code in the template file on the NB repository. I am attaching the template file that causes the issue. Also I am lowering the priority of this bug to P2, since I can live without the __construct() function for now.
It is still incomplete. The attached screen shot just shows the exception and DataObject.createTemplate() works for me with attached template. Please, steps to reproduce or test case.
I shown steps to reproduce this to Jirka earlier today, so removing the INCOMPLETE keyword...
Any reason some templates really need to use __?
__ is a terminator set in GsfDataLoader (see f.setLeftBrace( "__" )). That's why it cannot be used in template.
I am lowering the priority of this issue to P4, since we are not using literals prefixed with "__" in any of our PHP templates.
Rather a wontfix I think.
*** Issue 144386 has been marked as a duplicate of this issue. ***
first of all, I apologize for the duplicated issue, haven't really searched. If I understand what you're saying, you won't fix that? If so, I can't agree. If you want to support PHP, users should be able to create templates containing a PHP 5 style constructor! In fact, every magic PHP function starts with a '__', that's part of the game.
This issue has already 5 duplicates see http://statistics.netbeans.org/exceptions/detail.do?id=6567
This issue should be fixed. Also I think P4 is not the right priority. It's at least P3. The problem is that PHP users are not able to use the functionality to create template from their files, if the file contains magic functions, which are very common. Steps to reproduce (You have to have a distribution with PHP cluster): 1) Create new php file and replace the content with: <?php class test { function __construct() { } function __destruct() { } } ?> 2) Invoke Save as Template... action from the context menu and save it as a template. 3) Try to create new file from this template -> you get the exception I'm reassigning the issue to Radek, for more evaluation.
According to jskrivanek comments the cause is GsfDataLoader:181 (f.setLeftBrace) where as braces is "__". We would like to see this issue fixed because php templates containing constructor (in php __construct()). Seems to me that we cannot fix this problem in php. But we would like to see this issue fixed because its very typical php scenario, so priority increased. Please, evaluate, thanks.
Setting the left brace to "__" is normal - it's what is shown in the javadoc example for MapFormat - and it's also what the Java module sets it to. However, in looking at the Java module I noticed they had another call in there: f.setExactMatch(false); This apparently turns off error checking on __ in the file - which is exactly what I want. When I did that, I can successfully create PHP files containing __ as well. Fixed in c6618a7ab4d5.
Thanks, Tor, now it's really work.
This issue has already 10 duplicates see http://statistics.netbeans.org/exceptions/detail.do?id=6567
'ruby/gsf -> editor/csl' mass-move to be able to deleted gsf/ruby. Having to change the version and platform of all closed moved issues to the same due to Issuezilla deficiencies - choosing version == 6.5 and TM = 7.0.