Skip to content

Commit

Permalink
Bugfix: set the pc screenshot file to avoid NPE (#278)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhou9584 committed Feb 17, 2023
1 parent 47a5b2a commit a66262b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public File getScreenShot(DeviceInfo deviceInfo, Logger logger) throws Exception
File pcScreenShotImageFile = deviceInfo.getPcScreenshotImageFile();
if (pcScreenShotImageFile == null) {
pcScreenShotImageFile = new File(screenshotDir, deviceInfo.getName() + "-" + deviceInfo.getSerialNum() + "-" + "pc" + ".jpg");
deviceInfo.setPcScreenshotImageFile(pcScreenShotImageFile);
String pcImageRelPath = pcScreenShotImageFile.getAbsolutePath().replace(new File(getDeviceStoragePath()).getAbsolutePath(), "");
pcImageRelPath = getDeviceFolderUrlPrefix() + pcImageRelPath.replace(File.separator, "/");
deviceInfo.setPcImageRelPath(pcImageRelPath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class ThreadPoolUtil {
private static final AtomicInteger SCREENSHOT_THREAD_NUMBER = new AtomicInteger(1);
public static final Executor SCREENSHOT_EXECUTOR = newThreadPoolExecutor(SCREENSHOT_THREAD_NUMBER, 20, 60L, "ScreenshotExecutor");
private static final AtomicInteger TEST_THREAD_NUMBER = new AtomicInteger(1);
public static final Executor TEST_EXECUTOR = newThreadPoolExecutor(TEST_THREAD_NUMBER, 30, 60L, "ScreenshotExecutor");
public static final Executor TEST_EXECUTOR = newThreadPoolExecutor(TEST_THREAD_NUMBER, 30, 60L, "TestExecutor");

public static Executor newThreadPoolExecutor(AtomicInteger threadCounter, int corePoolSize, long keepAliveTimeSeconds, String threadNamePrefix) {
return new ThreadPoolExecutor(corePoolSize, Integer.MAX_VALUE, keepAliveTimeSeconds,
Expand Down

0 comments on commit a66262b

Please sign in to comment.