2 * Copyright 2017 BOCO Corporation. CMCC Technologies Co., Ltd
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.onap.vfc.nfvo.emsdriver.commons.utils;
19 import java.io.PrintWriter;
20 import java.io.StringWriter;
22 public class StringUtil {
24 public static String getStackTrace(Throwable t){
26 StringWriter sw = null;
27 PrintWriter pw = null;
29 sw = new StringWriter();
30 pw = new PrintWriter(sw);
31 t.printStackTrace(pw);
34 return sw.getBuffer().toString();
35 } catch (Exception e) {
39 if(pw != null) pw.close();
40 if(sw != null) sw.close();
41 } catch (Exception e2) {
48 public static String addSlash(String dirName) {
49 if (dirName.endsWith(File.separator))
51 return dirName + File.separator;
54 public static boolean isBank(String str){
56 if(str == null || str.trim().length() == 0){