Source:
<code>public void doWork (InputStream is, OutputStream os) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8)); PrintWriter out = new PrintWriter(new OutputStreamWriter(os, StandardCharsets.UTF_8)); try { String request = in.readLine(); <START> if ("PING".equals(request)) <END> { out.println("PONG"); } else if (RecoveryDriver.isScan(request)) { boolean isAsync = RecoveryDriver.isAsyncScan(request); boolean anyProblems = false; if (!isAsync) { synchronized (this) { doWait = true; } } _periodicRecovery.wakeUp(); tsLogger.i18NLogger.info_recovery_WorkerService_3(); if (!isAsync) { synchronized (this) { if (doWait) { try { wait(); } catch (Exception ex) { tsLogger.i18NLogger.info_recovery_WorkerService_4(); } } } } if (RecoveryDriver.isVerboseScan(request)) { for (final RecoveryModule recoveryModule : RecoveryManager.manager().getModules()) { if (recoveryModule instanceof ExtendedRecoveryModule) { if (!((ExtendedRecoveryModule) recoveryModule).isPeriodicWorkSuccessful()) { anyProblems = true; } break; } } } out.println(anyProblems ? "ERROR" : "DONE"); } else out.println("ERROR"); out.flush(); } catch (IOException ex) { tsLogger.i18NLogger.warn_recovery_WorkerService_2(); } catch ( Exception ex ) { tsLogger.i18NLogger.warn_recovery_WorkerService_1(ex); } }</code><technical_language>@ochaloup Testing a null request is key I get for JBTM-3257. of tests results in that? I thinking a test open socket close socket (without sending anything) result in request String request = in.readLine(); null? If do need send "SCAN" in <LINK_0> toServer.println <LINK_1> println I of a abruptly kill socket in Java is / predictable in a platform neutral manner</technical_language>

Target:
public void doWork (InputStream is, OutputStream os) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8)); PrintWriter out = new PrintWriter(new OutputStreamWriter(os, StandardCharsets.UTF_8)); try { String request = in.readLine(); if ("PING".equals(request)) { out.println("PONG"); } else if (RecoveryDriver.isScan(request)) { boolean isAsync = RecoveryDriver.isAsyncScan(request); boolean anyProblems = false; if (!isAsync) { synchronized (this) { doWait = true; } } _periodicRecovery.wakeUp(); tsLogger.i18NLogger.info_recovery_WorkerService_3(); if (!isAsync) { synchronized (this) { if (doWait && _periodicRecovery.getMode() != PeriodicRecovery.Mode.TERMINATED) { try { wait(); } catch (Exception ex) { if(tsLogger.logger.isTraceEnabled()) { tsLogger.logger.trace("Waiting for recovery scan to complete finished with an exception", ex); } tsLogger.i18NLogger.info_recovery_WorkerService_4(); } } } } if (RecoveryDriver.isVerboseScan(request)) { for (final RecoveryModule recoveryModule : RecoveryManager.manager().getModules()) { if (recoveryModule instanceof ExtendedRecoveryModule) { if (!((ExtendedRecoveryModule) recoveryModule).isPeriodicWorkSuccessful()) { anyProblems = true; } break; } } } out.println(anyProblems ? "ERROR" : "DONE"); } else out.println("ERROR"); out.flush(); } catch (IOException ioe) { tsLogger.i18NLogger.warn_recovery_WorkerService_2(ioe); } catch ( Exception ex ) { tsLogger.i18NLogger.warn_recovery_WorkerService_1(ex); } }