import java.io.OutputStream;
import java.text.DecimalFormat;
import java.util.Collection;
+import java.util.Objects;
import java.util.UUID;
+import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.gson.Gson;
* @return String
* @throws IOException e
*/
+ private static String loggerPatternBreaking(String loggerInput) {
+ return Objects.nonNull(loggerInput) ? loggerInput.replaceAll("[\n\r\t]", "_") : StringUtils.EMPTY;
+ }
public static String storeChunkFileInLocal(String dirName, String fileName, InputStream uploadedInputStream)
throws IOException {
File tmpDir = new File(dirName);
dirName = File.separator + dirName;
- LOG.info("tmpdir = {}" , dirName);
+ if(LOG.isInfoEnabled()) {
+ LOG.info("tmpdir = {}" , loggerPatternBreaking(dirName));
+ }
if(!tmpDir.exists()) {
tmpDir.mkdirs();
}
}
String fileLocation = ToolUtil.storeChunkFileInLocal(localDirName, fileName, uploadedInputStream);
- LOG.info("the fileLocation when upload package is :{}" , fileLocation);
+ if(LOG.isInfoEnabled()) {
+ LOG.info("the fileLocation when upload package is :{}", loggerPatternBreaking(fileLocation));
+ }
uploadedInputStream.close();
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.regex.Matcher;
import javax.ws.rs.Consumes;
import com.google.common.collect.Maps;
import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.cxf.common.util.CollectionUtils;
import org.eclipse.jetty.http.HttpStatus;
import org.glassfish.jersey.media.multipart.BodyPartEntity;
return list;
}
+ private String loggerPatternBreaking(String loggerInput) {
+ return Objects.nonNull(loggerInput) ? loggerInput.replaceAll("[\n\r\t]", "_") : StringUtils.EMPTY;
+ }
@Path("/scenarios")
@GET
File scenarioDir = new File(VTP_YAML_STORE, scenario);
List<File> yamls = FileUtil.searchFiles(scenarioDir, CommonConstant.YAML_SUFFIX);
if (!CollectionUtils.isEmpty(yamls)) {
+ if (LOG.isInfoEnabled()) {
+ LOG.error("The scenario yaml {} has sub testcase yamls, delete failed", loggerPatternBreaking(scenarioName));
+ }
LOG.error("The scenario yaml {} has sub testcase yamls, delete failed", scenarioName);
throw new VTPException(
new VTPError().setMessage(MessageFormat.format("The scenario yaml {0} has sub testcase yamls, delete failed !!!", scenarioName))