protected void processMessage()

in sonar-plugin-agent/src/main/java/jetbrains/buildserver/sonarplugin/SonarProcessListener.java [66:87]


    protected void processMessage(AgentRunningBuild build, String message, BuildMessage1 buildMessage) {
        if (mySonarIsWorking) {
            final int start = message.indexOf(ANALYSIS_SUCCESSFUL);
            if (start >= 0) {
                final String url = message.substring(start + ANALYSIS_SUCCESSFUL.length());
                // TODO: save URL to a parameter instead to be able to specify URL strictly in configuration
                FileWriter fw = null;
                try {
                    final File output = new File(build.getBuildTempDirectory(), Constants.SONAR_SERVER_URL_FILENAME);
                    fw = new FileWriter(output);
                    fw.write(url);
                    myWatcher.addNewArtifactsPath(output.getAbsolutePath() + "=>" + Constants.SONAR_SERVER_URL_ARTIF_LOCATION);
                } catch (IOException e) {
                    build.getBuildLogger().message("Cannot save Sonar URL \"" + url + "\" to file \"" + "\": " + e.getMessage());
                } finally {
                    Util.close(fw);
                }
            }
        } else {
            ServiceMessagesProcessor.processTextMessage(buildMessage, myMessageProcessor);
        }
    }