/**
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You 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
 * <p/>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p/>
 * 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.
 */
package io.fabric8.kubernetes.client.internal;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.ning.http.client.Response;
import io.fabric8.kubernetes.api.model.Status;
import io.fabric8.kubernetes.client.KubernetesClient;
import io.fabric8.kubernetes.client.KubernetesClientException;

import java.io.IOException;

/**
 */
public class HttpUtils {
    /**
     * Checks if the response status code is the expected and throws the appropriate KubernetesClientException if not.
     * @param r                           The {@link com.ning.http.client.Response} object.
     * @param expectedStatusCode          The expected status code.
     * @throws KubernetesClientException  When the response code is not the expected.
     */
    public static void assertResponseCode(Response r, int expectedStatusCode, KubernetesClient client, ObjectMapper mapper) {
      int statusCode = r.getStatusCode();
      String customMessage = client.getConfiguration().getErrorMessages().get(statusCode);

      if (statusCode == expectedStatusCode) {
        return;
      } else if (customMessage != null) {
        throw new KubernetesClientException("Error accessing: " + r.getUri().toString() + ",due to:" + customMessage);
      } else {
        try {
          Status status = mapper.readerFor(Status.class).readValue(r.getResponseBodyAsStream());
          throw new KubernetesClientException(status.getMessage(), status.getCode(), status);
        } catch (IOException e) {
          throw KubernetesClientException.launderThrowable(e);
        }
      }
    }
}

@@ -4,255 +4,55 @@
 %0A * 
-Licensed to the Apache Software Foundation (ASF) under one or more%0A * contributor license agreements.  See the NOTICE file distributed with%0A * this work for additional information regarding copyright ownership.%0A * The ASF licenses this file to You
+Copyright (C) 2015 Red Hat, Inc.%0A *%0A * Licensed
  und
@@ -85,19 +85,16 @@
 sion 2.0
-%0A *
  (the %22L
@@ -102,16 +102,19 @@
 cense%22);
+%0A *
  you may
@@ -157,19 +157,16 @@
 nce with
-%0A *
  the Lic
@@ -170,17 +170,19 @@
 License.
- 
+%0A *
  You may
@@ -216,24 +216,27 @@
 se at%0A *
- %3Cp/%3E%0A *
+%0A *        
  http://
@@ -277,13 +277,8 @@
 0%0A *
- %3Cp/%3E
 %0A * 

fix license check failure