Quantcast
Channel: VMware Communities : All Content - All Communities
Viewing all articles
Browse latest Browse all 179681

vCD query service "Unmatched opening and closing brackets" error if the string contains a "(" without a ")"

$
0
0

I have hit a snag or bug in the query service or vCO's implementation where if I pass in a string that has the open paren character "(" without also a closing ")" I get the error:

 

Bad request: Unmatched opening and closing brackets in expression (name==Self%20Service%20Compute%20(ws2012000002).

 

In this case the string being passed in was "Self Service Compute (ws2012000002"

 

Below is the full content of the action I am using.  I did try to work around this by replacing the parens with their character codes as is obvious is what happens with the spaces but that went through as the characters and were not changed.

 

var host = vdc.parent.getHost();

var queryService = host.getQueryService();

var searchString = vAppName;

 

 

// replace characters that are breaking the query service.  If it has an opening "(" without a ")" it breaks the query.

// didn't seem to work... keeping the attmpt as a reference.

// var searchString = System.getModule("com.qualcomm.basic").QCreplaceAllString(vAppName,String.fromCharCode(parseInt("28",16)),"%28",false); // (

// searchString = System.getModule("com.qualcomm.basic").QCreplaceAllString(searchString,String.fromCharCode(parseInt("29",16)),"%29",false); // )

 

 

// System.log("Search String is: " + searchString);

 

 

var expression = new VclExpression(VclQueryVAppField.NAME, searchString , VclExpressionType.EQUALS);

var filter = new VclFilter(expression);

var params = new VclQueryParams();

params.setFilter(filter);

 

 

var resultSet = queryService.queryRecords(VclQueryRecordType.ADMINVAPP, params)

 

 

var nameOk = true;

 

 

while (resultSet != null)  {

     var records = resultSet.getRecords(new VclQueryResultAdminVAppRecord());

     System.log(records.length + " records found");

  if (records.length > 0) nameOk = false;

     for (i = 0; i < records.length; i++) {

          System.log(records[i].name);

     }

     resultSet = resultSet.getNextPage();

}

 

 

return nameOk;

 

if anyone has a clue how to work around this I would appreciate it.  If this is a bug I will report it.


Viewing all articles
Browse latest Browse all 179681

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>