Source:
<code>public void startServer() { <START> final Semaphore serverTaskInitialized = new Semaphore(0); <END> Thread serverThread = new Thread(new Runnable() { @Override public void run() { try { if (serverTask == null) { serverTask = initializeJava(); } messagesLogFile = new File(serverTask.getOutputDir() + "/" + serverTask.getServerName() + "/logs/messages.log"); if (messagesLogFile.exists()) { messagesLogFile.delete(); } serverTaskInitialized.release(); copyConfigFiles(); serverTask.setClean(clean); serverTask.setOperation("debug"); if (serverStartTimeout < 0) { serverStartTimeout = 30; } serverTask.setTimeout(Long.toString(serverStartTimeout * 1000)); serverTask.execute(); } catch (Exception e) { log.debug("Error starting server", e); } } }); serverThread.start(); try { serverTaskInitialized.acquire(); if (verifyTimeout < 0) { verifyTimeout = 30; } long timeout = verifyTimeout * 1000; long endTime = System.currentTimeMillis() + timeout; String startMessage = serverTask.waitForStringInLog(START_APP_MESSAGE_REGEXP, timeout, messagesLogFile); if (startMessage == null) { stopServer(); throw new MojoExecutionException(MessageFormat .format(messages.getString("error.server.start.verify"), verifyTimeout)); } timeout = endTime - System.currentTimeMillis(); } catch (Exception e) { log.debug("Error waiting for server to start ", e); } }</code><technical_language>reformat new section spaces instead of tabs</technical_language>

Target:
public void startServer() { try { if (serverTask == null) { serverTask = initializeJava(); } String logsDirectory = serverTask.getOutputDir() + "/" + serverTask.getServerName() + "/logs"; messagesLogFile = new File(logsDirectory + "/messages.log"); copyConfigFiles(); serverTask.setClean(clean); serverTask.setOperation("debug"); if (serverStartTimeout < 0) { serverStartTimeout = 30; } serverTask.setTimeout(Long.toString(serverStartTimeout * 1000)); WatchService watchService = FileSystems.getDefault().newWatchService(); boolean logsExist = new File(logsDirectory).isDirectory(); if (logsExist) { Paths .get(logsDirectory) .register(watchService, StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_MODIFY); } Thread serverThread = new Thread(new Runnable() { @Override public void run() { try { serverTask.execute(); } catch (Exception e) { log.debug("Error starting server", e); } } }); serverThread.start(); if (logsExist) { boolean messagesModified = false; WatchKey key; while (!messagesModified && (key = watchService.take()) != null) { for (WatchEvent<?> event : key.pollEvents()) { if (event.context().toString().equals("messages.log")) { messagesModified = true; debug("messages.log has been changed"); } } } } if (verifyTimeout < 0) { verifyTimeout = 30; } long timeout = verifyTimeout * 1000; long endTime = System.currentTimeMillis() + timeout; String startMessage = serverTask.waitForStringInLog(START_APP_MESSAGE_REGEXP, timeout, messagesLogFile); if (startMessage == null) { stopServer(); throw new MojoExecutionException( MessageFormat.format(messages.getString("error.server.start.verify"), verifyTimeout)); } timeout = endTime - System.currentTimeMillis(); } catch (Exception e) { log.debug("Error starting server", e); } }