So, I’ve analyzed my project with Sonar and I get this weird error: Always use curly braces for if/else/for/while/do statements I know normally what this mean (and I don’t create blocks without curly braces) but in this case it’s weird: The errors appears mostly at this types of code (when using && or ||) and I was wondering why:
if (isCreate && latitude && longitude) {
...some code here...
}
EDIT:
The entire code:
var map = Ext.getCmp('map_canvas').getMap();
var latitude = Ext.getCmp('latitudeCmp').getValue();
var longitude = Ext.getCmp('longitudeCmp').getValue();
if (isCreate && latitude && longitude) {
var center = new google.maps.LatLng(latitude, longitude);
map.setCenter(center);
var marker = new google.maps.Marker({ position: center, map: map,icon: staticPath+'/images/residence_gMap.png'});
markersArray.push(marker);
} else if (latitude && longitude) {
var center = new google.maps.LatLng(latitude, longitude);
map.setCenter(center);
} else if (!latitude && !longitude) {
var siteEditAction = Seam.Component.getInstance('siteEditAction');
siteEditAction.getGeolocalizationParameters(fillMapParamsCallback, exceptionHandler);
}
As I answered in Sonar Mailing List ( http://markmail.org/message/dva7u5pxtggsiz7x ): you face with following two issues, which
will be fixed in next release –
http://jira.codehaus.org/browse/SONARPLUGINS-2079 and
http://jira.codehaus.org/browse/SONARPLUGINS-2200