Fixing sonar qube issues 93/26993/2
authorshrikantawachar <shrikant.awachar@amdocs.com>
Wed, 27 Dec 2017 09:21:38 +0000 (14:51 +0530)
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>
Wed, 27 Dec 2017 11:50:54 +0000 (11:50 +0000)
Fixed critical , major , minor issues in DefaultOutput class. Updated license header.

Change-Id: Ie79498108433c5cc16a3adb04c6f6072724d381d
Issue-ID: SDC-343
Signed-off-by: shrikantawachar <shrikant.awachar@amdocs.com>
openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/interceptors/DefaultOutput.java

index 271ff45..4f5fe39 100644 (file)
@@ -1,23 +1,18 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+/*
+ * Copyright © 2016-2017 European Support Limited
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * ============LICENSE_END=========================================================
  */
-
 package org.openecomp.server.interceptors;
 
 
@@ -28,20 +23,20 @@ import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.NewCookie;
 import javax.ws.rs.core.Response;
-import java.io.Serializable;
 import java.lang.annotation.Annotation;
 import java.net.URI;
+import java.util.Collections;
 import java.util.Date;
 import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 
-public class DefaultOutput extends Response implements Serializable {
+public class DefaultOutput extends Response {
 
   private static final long serialVersionUID = 8061802931931401706L;
 
   private final int status;
-  private final transient Object entity;
+  private final Object entity;
   private MultivaluedMap<String, Object> metadata;
 
   public DefaultOutput(int s0, Object e0) {
@@ -49,6 +44,7 @@ public class DefaultOutput extends Response implements Serializable {
     this.entity = e0;
   }
 
+  @Override
   public Object getEntity() {
     return entity;
   }
@@ -74,7 +70,7 @@ public class DefaultOutput extends Response implements Serializable {
   }
 
   @Override
-  public boolean hasEntity() throws IllegalStateException {
+  public boolean hasEntity() {
     return false;
   }
 
@@ -85,6 +81,7 @@ public class DefaultOutput extends Response implements Serializable {
 
   @Override
   public void close() {
+    //close() is not implemented for DefaultOutput
   }
 
   @Override
@@ -104,7 +101,7 @@ public class DefaultOutput extends Response implements Serializable {
 
   @Override
   public Set<String> getAllowedMethods() {
-    return null;
+    return Collections.emptySet();
   }
 
   @Override
@@ -134,7 +131,7 @@ public class DefaultOutput extends Response implements Serializable {
 
   @Override
   public Set<Link> getLinks() {
-    return null;
+    return Collections.emptySet();
   }
 
   @Override
@@ -153,6 +150,7 @@ public class DefaultOutput extends Response implements Serializable {
     return null;
   }
 
+  @Override
   public int getStatus() {
     return status;
   }
@@ -166,6 +164,7 @@ public class DefaultOutput extends Response implements Serializable {
     this.metadata = meta;
   }
 
+  @Override
   public MultivaluedMap<String, Object> getMetadata() {
     // don't worry about cloning for now
     return metadata;