* String literals on the left
* Unnecessary initialization of variables
* Change ArrayList to using List
* Remove extra semicolons
* Empty Constructor comments
* Useless parenthesis
I also added a comment on some code that is suspicious. Not comfortable
with changing that code.
Issue-ID: POLICY-482
Change-Id: I89d889737d398d047fab4b25cb5d962ee1ecdd03
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
- List<String> activePoliciesInPDP = new ArrayList<String>();
+ List<String> activePoliciesInPDP = new ArrayList<>();
if(!policyEntityobjects.isEmpty()){
for(Object object : policyEntityobjects){
policyEntity = (PolicyEntity) object;
if(!policyEntityobjects.isEmpty()){
for(Object object : policyEntityobjects){
policyEntity = (PolicyEntity) object;
@RequestMapping(value={"/get_AutoPushPoliciesContainerData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getPolicyGroupContainerData(HttpServletRequest request, HttpServletResponse response){
try{
@RequestMapping(value={"/get_AutoPushPoliciesContainerData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getPolicyGroupContainerData(HttpServletRequest request, HttpServletResponse response){
try{
- Set<String> scopes = null;
- List<String> roles = null;
+ Set<String> scopes;
+ List<String> roles;
data = new ArrayList<>();
String userId = UserUtils.getUserSession(request).getOrgUserId();
Map<String, Object> model = new HashMap<>();
data = new ArrayList<>();
String userId = UserUtils.getUserSession(request).getOrgUserId();
Map<String, Object> model = new HashMap<>();
scopes.add(multipleScopes[i]);
}
}else{
scopes.add(multipleScopes[i]);
}
}else{
- if(!userRole.getScope().equals("")){
+ if(!"".equals(userRole.getScope())){
scopes.add(userRole.getScope());
}
}
scopes.add(userRole.getScope());
}
}
// Get the current selection
String selectedItem = policyId;
//
// Get the current selection
String selectedItem = policyId;
//
- assert (selectedItem != null);
+ assert selectedItem != null;
// create the id of the target file
// Our standard for file naming is:
// <domain>.<filename>.<version>.xml
// create the id of the target file
// Our standard for file naming is:
// <domain>.<filename>.<version>.xml
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(groups));
JSONObject j = new JSONObject(msg);
out.write(j.toString());
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(groups));
JSONObject j = new JSONObject(msg);
out.write(j.toString());
+ //
+ // Why is this here? This defeats the purpose of the loop??
+ // Sonar says to remove it or make it conditional
+ //
request.setCharacterEncoding("UTF-8");
PrintWriter out = response.getWriter();
logger.error(e);
request.setCharacterEncoding("UTF-8");
PrintWriter out = response.getWriter();
logger.error(e);
- out.write(PolicyUtils.CATCH_EXCEPTION);;
+ out.write(PolicyUtils.CATCH_EXCEPTION);
request.setCharacterEncoding("UTF-8");
PrintWriter out = response.getWriter();
logger.error(e);
request.setCharacterEncoding("UTF-8");
PrintWriter out = response.getWriter();
logger.error(e);
- out.write(PolicyUtils.CATCH_EXCEPTION);;
+ out.write(PolicyUtils.CATCH_EXCEPTION);
@SuppressWarnings("unchecked")
@SuppressWarnings("unchecked")
- private String connectTriggerSignature(int index, ArrayList<Object> triggerSignatures, Object object) {
+ private String connectTriggerSignature(int index, List<Object> triggerSignatures, Object object) {
StringBuilder resultBody = new StringBuilder();
Map<String, String> connectTraps = (Map<String, String>) triggerSignatures.get(index);
try{
StringBuilder resultBody = new StringBuilder();
Map<String, String> connectTraps = (Map<String, String>) triggerSignatures.get(index);
try{
//connect traps data set to JSON Body as String
@SuppressWarnings({ "unchecked", "rawtypes" })
//connect traps data set to JSON Body as String
@SuppressWarnings({ "unchecked", "rawtypes" })
- private String getUIConnectTraps(ArrayList<Object> connectTrapSignatures) {
+ private String getUIConnectTraps(List<Object> connectTrapSignatures) {
StringBuilder resultBody = new StringBuilder();
String connectMainBody = "";
for(int j = 0; j < connectTrapSignatures.size(); j++){
StringBuilder resultBody = new StringBuilder();
String connectMainBody = "";
for(int j = 0; j < connectTrapSignatures.size(); j++){
private String clearTimeOut;
private String trapMaxAge;
private String verificationclearTimeOut;
private String clearTimeOut;
private String trapMaxAge;
private String verificationclearTimeOut;
- private ArrayList<Object> connecttriggerSignatures;
- private ArrayList<Object> connectVerificationSignatures;
+ private List<Object> connecttriggerSignatures;
+ private List<Object> connectVerificationSignatures;
public String getClearTimeOut() {
return clearTimeOut;
public String getClearTimeOut() {
return clearTimeOut;
- public ArrayList<Object> getConnecttriggerSignatures() {
+ public List<Object> getConnecttriggerSignatures() {
return connecttriggerSignatures;
}
return connecttriggerSignatures;
}
- public void setConnecttriggerSignatures(ArrayList<Object> connecttriggerSignatures) {
+ public void setConnecttriggerSignatures(List<Object> connecttriggerSignatures) {
this.connecttriggerSignatures = connecttriggerSignatures;
}
this.connecttriggerSignatures = connecttriggerSignatures;
}
- public ArrayList<Object> getConnectVerificationSignatures() {
+ public List<Object> getConnectVerificationSignatures() {
return connectVerificationSignatures;
}
return connectVerificationSignatures;
}
- public void setConnectVerificationSignatures(ArrayList<Object> connectVerificationSignatures) {
+ public void setConnectVerificationSignatures(List<Object> connectVerificationSignatures) {
this.connectVerificationSignatures = connectVerificationSignatures;
}
}
\ No newline at end of file
this.connectVerificationSignatures = connectVerificationSignatures;
}
}
\ No newline at end of file
CreateFirewallController.commonClassDao = commonClassDao;
}
CreateFirewallController.commonClassDao = commonClassDao;
}
- public CreateFirewallController(){}
+ public CreateFirewallController(){
+ // Empty constructor
+ }
private List<String> termCollectorList;
private List<String> termCollectorList;