aboutsummaryrefslogtreecommitdiffstats
path: root/filters/provider
diff options
context:
space:
mode:
Diffstat (limited to 'filters/provider')
-rwxr-xr-xfilters/provider/pom.xml90
-rw-r--r--filters/provider/src/main/java/org/openecomp/sdnc/filters/Activator.java68
-rw-r--r--filters/provider/src/main/java/org/openecomp/sdnc/filters/LogFilter.java222
-rw-r--r--filters/provider/src/main/java/org/openecomp/sdnc/filters/RequestResponseLoggingFilter.java279
4 files changed, 659 insertions, 0 deletions
diff --git a/filters/provider/pom.xml b/filters/provider/pom.xml
new file mode 100755
index 0000000..7b00001
--- /dev/null
+++ b/filters/provider/pom.xml
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.openecomp.sdnc.core</groupId>
+ <artifactId>filters</artifactId>
+ <version>1.0.0</version>
+ </parent>
+ <artifactId>filters-provider</artifactId>
+ <packaging>bundle</packaging>
+ <name>Filters - Provider</name>
+ <url>http://maven.apache.org</url>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.11</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ <version>3.0.1</version>
+ <scope>provided</scope>
+ </dependency>
+
+
+ <dependency>
+ <groupId>equinoxSDK381</groupId>
+ <artifactId>org.eclipse.osgi</artifactId>
+ <version>${equinox.osgi.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>${commons.codec.version}</version>
+ </dependency>
+
+<!--
+ <dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <version>${mysql.connector.version}</version>
+ </dependency>
+-->
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>${bundle.plugin.version}</version>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>org.openecomp.sdnc.filters</Bundle-SymbolicName>
+ <Bundle-Activator>org.openecomp.sdnc.filters.Activator</Bundle-Activator>
+ <Export-Package>org.openecomp.sdnc.filters</Export-Package>
+ <DynamicImport-Package>org.openecomp.sdnc.filters</DynamicImport-Package>
+ <Import-Package>javax.servlet.*,java.io.*,org.osgi.framework.*,org.slf4j.*,org.apache.commons.codec.binary.*</Import-Package>
+ <!--
+ <Import-Package>org.openecomp.sdnc.filters.filters.*,javax.servlet.*,java.io.*,org.osgi.framework.*,org.slf4j.*</Import-Package>
+ <Embed-Dependency>*;scope=compile|runtime;artifactId=!sli-common|org.eclipse.osgi|slf4j-api|jcl-over-slf4j|mysql-connector-java|xml-apis</Embed-Dependency>
+ <Import-Package>*</Import-Package>
+ -->
+ <Embed-Transitive>true</Embed-Transitive>
+ </instructions>
+ </configuration>
+
+ </plugin>
+
+
+ </plugins>
+ </build>
+</project>
diff --git a/filters/provider/src/main/java/org/openecomp/sdnc/filters/Activator.java b/filters/provider/src/main/java/org/openecomp/sdnc/filters/Activator.java
new file mode 100644
index 0000000..d246d63
--- /dev/null
+++ b/filters/provider/src/main/java/org/openecomp/sdnc/filters/Activator.java
@@ -0,0 +1,68 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * 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.sdnc.filters;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.net.URL;
+import java.util.Properties;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class Activator implements BundleActivator {
+
+ private ServiceRegistration registration = null;
+
+ private static final Logger LOG = LoggerFactory.getLogger(Activator.class);
+
+ @Override
+ public void start(BundleContext ctx) throws Exception {
+
+
+
+ Object impl = new String();
+ String regName = impl.getClass().getName();
+
+ if (registration == null)
+ {
+ LOG.debug("Registering Filters service "+regName);
+ registration = ctx.registerService(regName, impl, null);
+ }
+
+ }
+
+ @Override
+ public void stop(BundleContext ctx) throws Exception {
+
+ if (registration != null)
+ {
+ registration.unregister();
+ registration = null;
+ }
+ }
+
+}
diff --git a/filters/provider/src/main/java/org/openecomp/sdnc/filters/LogFilter.java b/filters/provider/src/main/java/org/openecomp/sdnc/filters/LogFilter.java
new file mode 100644
index 0000000..aa1d530
--- /dev/null
+++ b/filters/provider/src/main/java/org/openecomp/sdnc/filters/LogFilter.java
@@ -0,0 +1,222 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * 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.sdnc.filters;
+
+import java.io.IOException;
+import java.util.UUID;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.codec.binary.Base64;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.TimeZone;
+
+
+
+/**
+ * Logs IN request according ECOMP Logging Guidelines
+ */
+public class LogFilter implements Filter {
+
+ //X-ECOMP is shared between audit and metric
+ public static final String BEGIN_TIMESTAMP = "AUDIT-BeginTimestamp";
+ public static final String END_TIMESTAMP = "AUDIT-EndTimestamp";
+ public static final String REQUEST_ID = "X-ECOMP-RequestID";
+ public static final String SERVICE_INSTANCE = "X-ECOMP-ServiceInstanceID";
+ public static final String THREAD_ID ="X-ECOMP-ThreadId"; //optional
+ public static final String PHYSICAL_SERVER_NAME="X-ECOMP-PhysicalServerName"; //optional
+ public static final String SERVICE_NAME="X-ECOMP-ServiceName";
+ public static final String PARTNER_NAME="X-ECOMP-PartnerName";
+ public static final String STATUS_CODE="AUDIT-StatusCode";
+ public static final String RESP_CODE="AUDIT-ResponseCode";
+ public static final String RESP_DESC="AUDIT-ResponseDescription";
+ public static final String INSTANCE_UUID="AUDIT-InstanceUUID";
+ public static final String CATEGORY="AUDIT-INFO";
+ public static final String SEVERITY ="AUDIT-Severity"; //optional
+ public static final String SERVER_IP="AUDIT-ServerIP"; //by chef node['ip']
+ public static final String ELAPSED_TIME="AUDIT-ElapsedTime";
+ public static final String SERVER_HOST="AUDIT-Server";//by chef node['fqdn']
+ public static final String CLIENT_IP="AUDIT-ClientIPaddress";
+ public static final String CLASS="AUDIT-Classname"; //optional
+ public static final String UNUSED="AUDIT-Unused"; //empty
+ public static final String PROCESS_KEY="AUDIT-ProcessKey"; //optional
+ public static final String CUST_1="AUDIT-CustomField1";//optional
+ public static final String CUST_2="AUDIT-CustomField2"; //optional
+ public static final String CUST_3="AUDIT-CustomField3"; //optional
+ public static final String CUST_4="AUDIT-CustomField4"; //optional
+ public static final String DETAIL_MESSAGE="AUDIT-DetailMessage";//optional
+
+
+ private static final Logger log = LoggerFactory.getLogger(LogFilter.class);
+ private static final Logger AUDIT = LoggerFactory.getLogger("org.openecomp.sdnc.filters.audit");
+ @Override
+ public void destroy() {
+ }
+
+ @Override
+ public void doFilter(final ServletRequest request, final ServletResponse response,
+ final FilterChain filterChain) throws IOException, ServletException {
+
+ long startTime = System.currentTimeMillis();
+ try {
+
+ if ( request != null && request instanceof HttpServletRequest ) {
+ pre((HttpServletRequest)request);
+ }
+ filterChain.doFilter(request, response);
+
+
+ } finally {
+
+ if (request != null && request instanceof HttpServletRequest ) {
+ post((HttpServletRequest)request,(HttpServletResponse)response,startTime);
+ }
+ MDC.clear();
+ }
+
+ }
+
+ @Override
+ public void init(FilterConfig filterConfig) throws ServletException {
+ }
+
+
+
+ private void pre(HttpServletRequest request) {
+
+ UUID uuid = UUID.randomUUID();
+ // check if uuid is in header X-ECOMP-RequestID
+
+ String ecompUUID = request.getHeader(REQUEST_ID);
+
+ if (ecompUUID != null && ecompUUID.length() > 0) {
+ try {
+ uuid = UUID.fromString(ecompUUID);
+ log.info("UUID is ECOMP UUID " + uuid.toString());
+ } catch (Exception ex){
+ log.warn("Failed to convert ECOMP UUID to java.util.UUID format:" + ecompUUID,ex);
+ }
+ }
+ MDC.put(REQUEST_ID, uuid.toString());
+
+ String userName="unknown";
+
+ /* below returning org.opendaylight.aaa.shiro.realm.TokenAuthRealm$ODLPrincipal@745dfcfe
+ if ( request.getUserPrincipal() != null) {
+ userName = request.getUserPrincipal().getName();
+ }
+ */
+ // going directly after Authorization header
+ if (request.getHeader("Authorization") != null) {
+ String authzHeader = request.getHeader("Authorization");
+ String usernameAndPassword = new String(Base64.decodeBase64(authzHeader.substring(6).getBytes()));
+
+ int userNameIndex = usernameAndPassword.indexOf(":");
+ String username = usernameAndPassword.substring(0, userNameIndex);
+ userName = username;
+
+ }
+
+
+ MDC.put(PARTNER_NAME, userName);
+ //just to initilaze for metric logger (outbound calls)
+ MDC.put("X-ECOMP-TargetEntity","");
+ MDC.put("X-ECOMP-TargetServiceName","");
+
+ MDC.put(SERVICE_NAME,request.getRequestURL().toString());
+ MDC.put(SERVICE_INSTANCE,"");
+
+ }
+
+
+ private void post(HttpServletRequest request,HttpServletResponse response,long startTime) {
+
+ //AUDIT.info("{}|{}|{}{}",request.getRemoteHost(),request.getMethod(),request.getRequestURL().toString(),request.getQueryString());
+ //AUDIT.info(request.getRemoteHost() + D + request.getMethod() + D + request.getRequestURL().toString() + D + request.getQueryString());
+ //METRIC.info(request.getMethod() + D + response.getStatus() + D + request.getRequestURL().toString() + D + (System.currentTimeMillis() - startTime) + " ms");
+ MDC.put(BEGIN_TIMESTAMP,asIso8601(startTime));
+ MDC.put(END_TIMESTAMP,asIso8601(System.currentTimeMillis()));
+ //MDC.put(REQUEST_ID,"already done above");
+ MDC.put(SERVICE_NAME,request.getRequestURL().toString());
+ int idx = request.getPathInfo().toString().lastIndexOf(":");
+ String instance = "";
+ if ( idx != -1 ) {
+ instance = request.getPathInfo().substring(idx+1);
+ }
+ MDC.put(SERVICE_INSTANCE,instance);
+ MDC.put(THREAD_ID,"");
+ MDC.put(PHYSICAL_SERVER_NAME,"");
+ //MDC.put(PARTNER_NAME,"already done above");
+ if ( response.getStatus() >= 400 ) {
+ MDC.put(STATUS_CODE,"ERROR");
+ } else {
+ MDC.put(STATUS_CODE,"COMPLETE");
+ }
+
+ MDC.put(RESP_CODE,"" + response.getStatus());
+ MDC.put(RESP_DESC,"");
+ MDC.put(INSTANCE_UUID,"");
+ MDC.put(CATEGORY,"");
+ MDC.put(SEVERITY,"");
+ //MDC.put(SERVER_IP,""); //by chef
+ MDC.put(ELAPSED_TIME,"" + (System.currentTimeMillis() - startTime));
+ //MDC.put(SERVER_HOST,""); //by chef
+ MDC.put(CLIENT_IP,request.getRemoteHost());
+ MDC.put(CLASS,"");
+ MDC.put(UNUSED,"");
+ MDC.put(PROCESS_KEY,"");
+ MDC.put(CUST_1,"");
+ MDC.put(CUST_2,"");
+ MDC.put(CUST_3,"");
+ MDC.put(CUST_4,"");
+ MDC.put(DETAIL_MESSAGE,request.getMethod());
+
+ AUDIT.info("");
+ }
+
+ private String asIso8601(Date date) {
+ TimeZone tz = TimeZone.getTimeZone("UTC");
+ DateFormat df = new SimpleDateFormat("yyy-MM-dd'T'hh:mm:ss:SS'+00:00'");
+ df.setTimeZone(tz);
+ return df.format(date);
+ }
+
+ private String asIso8601(long tsInMillis) {
+ return asIso8601(new Date(tsInMillis));
+ }
+
+
+}
diff --git a/filters/provider/src/main/java/org/openecomp/sdnc/filters/RequestResponseLoggingFilter.java b/filters/provider/src/main/java/org/openecomp/sdnc/filters/RequestResponseLoggingFilter.java
new file mode 100644
index 0000000..5fe22b2
--- /dev/null
+++ b/filters/provider/src/main/java/org/openecomp/sdnc/filters/RequestResponseLoggingFilter.java
@@ -0,0 +1,279 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * 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.sdnc.filters;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.util.Enumeration;
+import java.util.zip.GZIPInputStream;
+import java.util.zip.Inflater;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletInputStream;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletResponseWrapper;
+
+public class RequestResponseLoggingFilter implements Filter {
+
+ private static org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger("org.openecomp.sdnc.filters.request.response");
+
+ private static class ByteArrayServletStream extends ServletOutputStream {
+
+ ByteArrayOutputStream baos;
+
+ ByteArrayServletStream(ByteArrayOutputStream baos) {
+ this.baos = baos;
+ }
+
+ public void write(int param) throws IOException {
+ baos.write(param);
+ }
+ }
+
+ private static class ByteArrayPrintWriter {
+
+ private ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+ private PrintWriter pw = new PrintWriter(baos);
+
+ private ServletOutputStream sos = new ByteArrayServletStream(baos);
+
+ public PrintWriter getWriter() {
+ return pw;
+ }
+
+ public ServletOutputStream getStream() {
+ return sos;
+ }
+
+ byte[] toByteArray() {
+ return baos.toByteArray();
+ }
+ }
+
+ private class BufferedServletInputStream extends ServletInputStream {
+
+ ByteArrayInputStream bais;
+
+ public BufferedServletInputStream(ByteArrayInputStream bais) {
+ this.bais = bais;
+ }
+
+ public int available() {
+ return bais.available();
+ }
+
+ public int read() {
+ return bais.read();
+ }
+
+ public int read(byte[] buf, int off, int len) {
+ return bais.read(buf, off, len);
+ }
+
+ }
+
+ private class BufferedRequestWrapper extends HttpServletRequestWrapper {
+
+ ByteArrayInputStream bais;
+
+ ByteArrayOutputStream baos;
+
+ BufferedServletInputStream bsis;
+
+ byte[] buffer;
+
+ public BufferedRequestWrapper(HttpServletRequest req) throws IOException {
+ super(req);
+
+ InputStream is = req.getInputStream();
+ baos = new ByteArrayOutputStream();
+ byte buf[] = new byte[1024];
+ int letti;
+ while ((letti = is.read(buf)) > 0) {
+ baos.write(buf, 0, letti);
+ }
+ buffer = baos.toByteArray();
+
+ }
+
+ public ServletInputStream getInputStream() {
+ try {
+ bais = new ByteArrayInputStream(buffer);
+ bsis = new BufferedServletInputStream(bais);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ return bsis;
+ }
+
+ public byte[] getBuffer() {
+ return buffer;
+ }
+
+ }
+
+ public void init(FilterConfig filterConfig) throws ServletException {
+ }
+
+ public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
+ throws IOException, ServletException {
+
+ final HttpServletRequest httpRequest = (HttpServletRequest) servletRequest;
+ BufferedRequestWrapper bufferedRequest = new BufferedRequestWrapper(httpRequest);
+
+ StringBuilder requestHeaders = new StringBuilder("REQUEST|");
+ requestHeaders.append(httpRequest.getMethod());
+ requestHeaders.append(":");
+ requestHeaders.append(httpRequest.getRequestURL().toString());
+ requestHeaders.append("|");
+ String header;
+ for (Enumeration<String> e = httpRequest.getHeaderNames(); e.hasMoreElements();) {
+ header = e.nextElement();
+ requestHeaders.append(header);
+ requestHeaders.append(":");
+ requestHeaders.append(httpRequest.getHeader(header));
+ requestHeaders.append(";");
+
+ }
+ log.info(requestHeaders.toString());
+
+ log.info("REQUEST BODY|" + new String(bufferedRequest.getBuffer()));
+
+ final HttpServletResponse response = (HttpServletResponse) servletResponse;
+
+ final ByteArrayPrintWriter pw = new ByteArrayPrintWriter();
+ HttpServletResponse wrappedResp = new HttpServletResponseWrapper(response) {
+ public PrintWriter getWriter() {
+ return pw.getWriter();
+ }
+
+ public ServletOutputStream getOutputStream() {
+ return pw.getStream();
+ }
+
+ };
+
+ try {
+
+ filterChain.doFilter(bufferedRequest, wrappedResp);
+
+ }catch (Exception e){
+ log.error("Chain Exception",e);
+ throw e;
+ } finally {
+ byte[] bytes = pw.toByteArray();
+ response.getOutputStream().write(bytes);
+
+ StringBuilder responseHeaders = new StringBuilder("RESPONSE HEADERS|");
+
+ for (String headerName : response.getHeaderNames()) {
+ responseHeaders.append(headerName);
+ responseHeaders.append(":");
+ responseHeaders.append(response.getHeader(headerName));
+ responseHeaders.append(";");
+
+ }
+ log.info(responseHeaders.toString());
+
+ if ("gzip".equals(response.getHeader("Content-Encoding"))) {
+
+ log.info("UNGZIPED RESPONSE BODY|" + decompressGZIPByteArray(bytes));
+
+ } else {
+
+ log.info("RESPONSE BODY|" + new String(bytes));
+ }
+ }
+ }
+
+ public void destroy() {
+ }
+
+ private String decompressGZIPByteArray(byte[] bytes) {
+
+ BufferedReader in = null;
+ InputStreamReader inR = null;
+ ByteArrayInputStream byteS = null;
+ GZIPInputStream gzS = null;
+ StringBuilder str = new StringBuilder();
+ try {
+ byteS = new ByteArrayInputStream(bytes);
+ gzS = new GZIPInputStream(byteS);
+ inR = new InputStreamReader(gzS);
+ in = new BufferedReader(inR);
+
+ if (in != null) {
+
+ String content;
+
+ while ((content = in.readLine()) != null) {
+ str.append(content);
+ }
+ }
+
+ } catch (Exception e) {
+ log.error("Failed get read GZIPInputStream", e);
+ } finally {
+
+ if (byteS != null)
+ try {
+ byteS.close();
+ } catch (IOException e1) {
+ log.error("Failed to close ByteStream", e1);
+ }
+ if (gzS != null)
+ try {
+ gzS.close();
+ } catch (IOException e2) {
+ log.error("Failed to close GZStream", e2);
+ }
+ if (inR != null)
+ try {
+ inR.close();
+ } catch (IOException e3) {
+ log.error("Failed to close InputReader", e3);
+ }
+ if (in != null)
+ try {
+ in.close();
+ } catch (IOException e) {
+ log.error("Failed to close BufferedReader", e);
+ }
+ }
+ return str.toString();
+ }
+}