|
@@ -49,9 +49,12 @@ public class ScreenShotThread extends Thread {
|
|
|
try {
|
|
|
File screenShotFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
|
|
|
try {
|
|
|
- String path = AddressUtil.getScreenShotFilePath(traceId, udid, DeviceUtil.getDeviceTimeStamp(udid));
|
|
|
+ String deviceTimestamp = DeviceUtil.getDeviceTimeStamp(udid);
|
|
|
+ // 解析timestamp防止返回的不是数字
|
|
|
+ long ignored = Long.parseLong(deviceTimestamp);
|
|
|
+ String path = AddressUtil.getScreenShotFilePath(traceId, udid, deviceTimestamp);
|
|
|
FileUtils.copyFile(screenShotFile, new File(path));
|
|
|
- } catch (IOException e) {
|
|
|
+ } catch (IOException | NumberFormatException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
FileReader fr;
|
|
@@ -60,9 +63,12 @@ public class ScreenShotThread extends Thread {
|
|
|
if(fr.read() == -1){
|
|
|
screenShotFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
|
|
|
try {
|
|
|
- String path = AddressUtil.getScreenShotFilePath(traceId, udid, DeviceUtil.getDeviceTimeStamp(udid));
|
|
|
+ String deviceTimestamp = DeviceUtil.getDeviceTimeStamp(udid);
|
|
|
+ // 解析timestamp防止返回的不是数字
|
|
|
+ long ignored = Long.parseLong(deviceTimestamp);
|
|
|
+ String path = AddressUtil.getScreenShotFilePath(traceId, udid, deviceTimestamp);
|
|
|
FileUtils.copyFile(screenShotFile, new File(path));
|
|
|
- } catch (IOException e) {
|
|
|
+ } catch (IOException | NumberFormatException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
if(fr.read() == -1){
|