NM
Size: a a a
NM
NM
AF
AF
KY
KY
KY
KY
NM
СФ
NM
ab
NM
СФ
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
String xmlFile() { // salt = 000000000005
try {
String salt = String.valueOf((long) (Math.random() * 900000000000L) + 100000000000L);
Path path = Paths.get ("${file}");
String fileName = path.getFileName().toString().split("\\.")[0];
String content = new String(Files.readAllBytes(path));
String replacement = "TRN_TST-5034018076-82602_TST-1215144519-82600_20200618_70772a04-0265-8deb-b56b-" + salt;
vars.put("filenames", replacement);
String modifiedContent = content.replace(fileName, replacement) + ".xml";
log.info(modifiedContent);
return replacement + ".xml";
} catch (IOException ex) {
log.info("Something went wrong");
ex.printStackTrace();
}
}
String replacement = xmlFile();
log.info("Result of function xmlFile: " + replacement);
СФ
СФ
NM
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
String xmlFile() { // salt = 000000000005
try {
String salt = String.valueOf((long) (Math.random() * 900000000000L) + 100000000000L);
Path path = Paths.get ("${file}");
String fileName = path.getFileName().toString().split("\\.")[0];
String content = new String(Files.readAllBytes(path));
String replacement = "TRN_TST-5034018076-82602_TST-1215144519-82600_20200618_70772a04-0265-8deb-b56b-" + salt;
vars.put("filenames", replacement);
String modifiedContent = content.replace(fileName, replacement) + ".xml";
log.info(modifiedContent);
return replacement + ".xml";
} catch (IOException ex) {
log.info("Something went wrong");
ex.printStackTrace();
}
}
String replacement = xmlFile();
log.info("Result of function xmlFile: " + replacement);
NM
NM
СФ