List of usage examples for java.lang System lineSeparator
String lineSeparator
To view the source code for java.lang System lineSeparator.
Click Source Link
From source file:com.pearson.eidetic.driver.threads.subthreads.SnapshotVolumeNoTime.java
@Override public void run() { isFinished_ = false;/*from w w w.j a va 2s .co m*/ //kill thread if wrong creds \/ \/ \/ \/ AmazonEC2Client ec2Client = connect(region_, awsAccessKeyId_, awsSecretKey_); for (Volume vol : VolumeNoTime_) { try { Date date = new java.util.Date(); JSONParser parser = new JSONParser(); String inttagvalue = getIntTagValue(vol); if (inttagvalue == null) { continue; } JSONObject eideticParameters; try { Object obj = parser.parse(inttagvalue); eideticParameters = (JSONObject) obj; } catch (Exception e) { logger.error("awsAccountNickname=\"" + uniqueAwsAccountIdentifier_ + "\",Event=Error, Error=\"Malformed Eidetic Tag\", Volume_id=\"" + vol.getVolumeId() + "\", stacktrace=\"" + e.toString() + System.lineSeparator() + StackTrace.getStringFromStackTrace(e) + "\""); continue; } String period = getPeriod(eideticParameters, vol); if (period == null) { continue; } Integer keep = getKeep(eideticParameters, vol); if (keep == null) { continue; } Boolean success; success = snapshotDecision(ec2Client, vol, period); if (!success) { continue; } success = snapshotCreation(ec2Client, vol, period, date); if (!success) { continue; } snapshotDeletion(ec2Client, vol, period, keep); } catch (Exception e) { logger.error("awsAccountNickname=\"" + uniqueAwsAccountIdentifier_ + "\",Event=\"Error\", Error=\"error in SnapshotVolumeNoTime workflow\", stacktrace=\"" + e.toString() + System.lineSeparator() + StackTrace.getStringFromStackTrace(e) + "\""); } } ec2Client.shutdown(); isFinished_ = true; }
From source file:org.apache.openaz.xacml.std.pip.finders.ConfigurableEngineFinder.java
protected void configureEngine(String engineId, Properties properties) throws PIPException { /*/*from w w w . j a v a 2s . com*/ * Get the class name for the engine */ String engineClassName = properties.getProperty(engineId + CLASSNAME); if (engineClassName == null) { throw new PIPException("No " + CLASSNAME + " property for PIP engine \"" + engineId + "\""); } /* * Get an instance of the engine */ ConfigurableEngine configurableEngine = newEngine(engineClassName); /* * Configure the engine */ configurableEngine.configure(engineId, properties); if (this.logger.isDebugEnabled()) { this.logger.debug("Engine " + engineId + " Provides: "); Collection<PIPRequest> attributes = configurableEngine.attributesProvided(); for (PIPRequest attribute : attributes) { this.logger.debug(System.lineSeparator() + AttributeUtils.prettyPrint(attribute)); } this.logger.debug("Engine " + engineId + " Requires: "); attributes = configurableEngine.attributesRequired(); for (PIPRequest attribute : attributes) { this.logger.debug(System.lineSeparator() + AttributeUtils.prettyPrint(attribute)); } } /* * Register the engine */ this.register(configurableEngine); }
From source file:org.apache.metron.stellar.zeppelin.StellarInterpreter.java
@Override public InterpreterResult interpret(final String input, InterpreterContext context) { InterpreterResult result = new InterpreterResult(SUCCESS, TEXT, ""); try {//from w w w .j a v a2 s . c om // allow separate expressions on each line String[] expressions = input.split(System.lineSeparator()); for (String expression : expressions) { result = execute(expression); } } catch (Throwable t) { // unexpected exception String message = getErrorMessage(Optional.of(t), input); result = new InterpreterResult(ERROR, TEXT, message); } // result is from the last expression that was executed return result; }
From source file:com.kotcrab.vis.editor.Log.java
private static void prepareLogFile() { File logDirectory = new File(App.APP_FOLDER_PATH, "logs"); logDirectory.mkdir();/* ww w. j a va2 s . c om*/ SimpleDateFormat fileDateFormat = new SimpleDateFormat("yy-MM-dd"); String fileName = fileDateFormat.format(new Date()); String fileNameYearMonth = fileName.substring(0, 5); File[] files = logDirectory.listFiles(); if (files != null) { //we are deleting files that are not from current month for (File f : files) { if (f.getName().contains(fileNameYearMonth) == false) f.delete(); } } try { logFile = new File(logDirectory, "viseditor " + fileName + ".txt"); boolean fileExists = logFile.exists(); logFile.createNewFile(); logFileStream = new BufferedOutputStream(new FileOutputStream(logFile, true)); if (fileExists) logFileStream.write(System.lineSeparator().getBytes()); } catch (IOException e) { exception(e); } info("VisEditor " + App.VERSION + " (version code: " + App.VERSION_CODE + ")"); info("Started: " + fileName); }
From source file:com.kotcrab.vis.editor.util.CrashReporter.java
private void println(String s) { crashReport.append(s); crashReport.append(System.lineSeparator()); }
From source file:com.mycompany.projecta.CommonTasks.java
@Override public String ReadFile(String project) throws Exception { //Implementing the Interface methods CommonTasks commonObject = new CommonTasks(); String source = ""; String target = ""; String buildResult = ""; String fileExtension = ""; String result = ""; String urlRepository = ""; String jobName = ""; String localhost = "http://localhost:8080"; List<String> jobList = null; Boolean deleteJobs = false;// w ww . j a v a 2 s. c o m try (BufferedReader br = new BufferedReader(new FileReader(project))) { StringBuilder sb = new StringBuilder(); String line = br.readLine(); //Running 'MasterJob' by default if 'true' if (MasterJob) { SendPost("MasterJob", "trigger", ""); Thread.sleep(16000); buildResult = SendPost("MasterJob", "build result", ""); if ("failed".equals(buildResult)) { return "MasterJob build error. None of the Services will be executed "; } Thread.sleep(16000); } //Once the 'MarterJob' is executed with no errors, we continue with //the rest of the files while (line != null && !"".equals(line)) { noText = false; sb.append(line); sb.append(System.lineSeparator()); if (!NamingConvention(line)) return line + written_locatedError; switch (line) { case "Project Build": line = br.readLine(); if (line.contains("Service")) { SendPost(line, "trigger", ""); } else return line + written_locatedError; Thread.sleep(20000); buildResult = SendPost(line, "build result", ""); if ("failed".equals(buildResult)) { return line + " Build has failed "; } ; Thread.sleep(20000); break; case "Copy Directory to Directory": line = br.readLine(); if ("source".equals(line)) { source = br.readLine(); } else return line + written_locatedError; line = br.readLine(); if ("target".equals(line)) { target = br.readLine(); } else return line + written_locatedError; result = DirectoryToDirectory(source, target); if (!"passed".equals(result)) return source + "" + target + path_writtenError; break; case "Copy File to Directory": line = br.readLine(); if ("source".equals(line)) { source = br.readLine(); } else return line + written_locatedError; line = br.readLine(); if ("file extension".equals(line)) { fileExtension = br.readLine(); } else return line + written_locatedError; line = br.readLine(); if ("target".equals(line)) { target = br.readLine(); } else return line + written_locatedError; result = FileToDirectory(source, target, fileExtension); if (!"passed".equals(result)) return source + "" + target + path_writtenError; break; case "Project Creation": line = br.readLine(); if (line.contains("Service")) { jobName = line; } else return line + written_locatedError; if (listJobs(localhost, jobName)) return jobName + " is already created "; //Verify whether the Services is already created or not line = br.readLine(); if (line.contains("url repository")) { line = br.readLine(); } else return line + written_locatedError; if (line.contains("https")) { urlRepository = line; } else return line + written_locatedError; result = SendPost(jobName, "creation", urlRepository); if ("failed".equals(result)) { return "failed"; } ; Thread.sleep(14000); break; case "Shell command Ping": line = br.readLine(); result = ExecuteCommandPing(line); if (result.contains("Ping execution failed")) return result; System.out.println(result); break; case "Shell command": line = br.readLine(); ExecuteCommand(line); break; case "Project Delete": while (line != null && !"".equals(line)) { line = br.readLine(); if ("end".equals(line)) return "delete passed"; if (!listJobs(localhost, line)) return line + " is already deleted or it has not been created "; Thread.sleep(2000); if (line.contains("Service")) { deleteJob(localhost, line); } else return line + written_locatedError; Thread.sleep(2000); } deleteJobs = true; break; } if (deleteJobs) return "delete passed"; line = br.readLine(); } if (noText) return "Text Line was not founded "; } return "passed"; }
From source file:com.semfapp.adamdilger.semf.NonConformanceActivity.java
public void createPdf() { Document document = Pdf.getTemplate(getApplicationContext(), data.getJobNumber()); try {//from w w w . j a va2s . c o m Document body = Jsoup.parse(getAssets().open("nonConformance.html"), "utf-8", "http://www.example.com"); Element site = body.getElementById("site"); Element siteLocation = body.getElementById("site_location"); Element recipient = body.getElementById("recipient"); Element recipientEmail = body.getElementById("recipient_email"); Element description = body.getElementById("description_list"); Element actions = body.getElementById("actions_list"); String[] descriptionArray, actionsArray; descriptionArray = data.getDescription().split(System.lineSeparator()); actionsArray = data.getActions().split(System.lineSeparator()); site.text(data.getSite()); siteLocation.text(data.getLocation()); recipient.html("<p>" + data.getRecipient() + "</p>"); recipientEmail.html("<p>" + data.getRecipientEmail() + "</p>"); //add each bullet from arrays as a <p> for (int x = 0; x < descriptionArray.length; x++) { String f = ""; for (String bullet : descriptionArray) { f += "<p>" + bullet + "</p>"; } description.html(f); } for (int x = 0; x < actionsArray.length; x++) { String f = ""; for (String bullet : actionsArray) { f += "<p>" + bullet + "</p>"; } actions.html(f); } document.getElementById("main").html(body.html()); } catch (Exception e) { System.out.println("ERROR: " + e.toString()); } String filePath = MainActivity.pdf.createFilePath(this, "Non Conformance"); MainActivity.pdf.createPdfToFile(this, document.html(), filePath, null); pdfAttatchment = new File(filePath); }
From source file:org.assertj.maven.generator.AssertionsGeneratorReport.java
private void buildGeneratorReportSuccess(StringBuilder reportBuilder) { reportBuilder.append(System.lineSeparator()); reportBuilder.append("Directory where custom assertions files have been generated:\n"); reportBuilder.append(INDENT).append(directoryPathWhereAssertionFilesAreGenerated) .append(System.lineSeparator()); reportBuilder.append(System.lineSeparator()); reportBuilder.append("Custom assertions files generated:\n"); for (String fileName : generatedCustomAssertionFileNames) { reportBuilder.append(INDENT).append(fileName).append(System.lineSeparator()); }// w w w.j a v a 2 s . c o m if (!inputClassesNotFound.isEmpty()) { reportBuilder.append(System.lineSeparator()); reportBuilder.append( "No custom assertions files generated for the following input classes as they were not found:\n"); for (String inputClassNotFound : inputClassesNotFound) { reportBuilder.append(INDENT).append(inputClassNotFound).append(System.lineSeparator()); } } reportEntryPointClassesGeneration(reportBuilder); }
From source file:com.adguard.compiler.LocaleUtils.java
public static void convertFromChromeToFirefoxLocales(File chromeLocalesDir) throws IOException { for (File file : chromeLocalesDir.listFiles()) { File chromeLocaleFile = new File(file, "messages.json"); if (!SupportedLocales.supported(file.getName())) { FileUtils.deleteQuietly(file); continue; }//from w ww .j a va2s . c o m String firefoxLocale = StringUtils.replace(file.getName(), "_", "-"); File appLocaleFile = new File(chromeLocalesDir, firefoxLocale + ".properties"); byte[] content = FileUtils.readFileToByteArray(chromeLocaleFile); Map map = objectMapper.readValue(content, Map.class); StringBuilder sb = new StringBuilder(); for (Object key : map.keySet()) { String message = (String) ((Map) map.get(key)).get("message"); message = message.replaceAll("\n", "\\\\n"); sb.append(key).append("=").append(message); sb.append(System.lineSeparator()); } FileUtils.writeStringToFile(appLocaleFile, sb.toString(), "utf-8"); FileUtils.deleteQuietly(file); } }
From source file:nl.knaw.huygens.alexandria.dropwizard.cli.commands.DiffCommand.java
private void doDiff(final TAGStore store, final CLIContext context, final String filename, final Optional<String> documentName) { Long documentId = getIdForExistingDocument(documentName.get()); TAGDocument original = store.getDocument(documentId); String viewName = context.getActiveView(); TAGView tagView = MAIN_VIEW.equals(viewName) ? TAGViews.getShowAllMarkupView(store) : getExistingView(viewName, store, context); File editedFile = workFilePath(filename).toFile(); try {//from www .j a va 2s.c o m String newTAGML = FileUtils.readFileToString(editedFile, StandardCharsets.UTF_8); TAGMLImporter importer = new TAGMLImporter(store); TAGDocument edited = importer.importTAGML(newTAGML); TAGComparison comparison = new TAGComparison(original, tagView, edited); if (MAIN_VIEW.equals(viewName)) { System.out.printf("diff for %s:%n", filename); } else { System.out.printf("diff for %s, using view %s:%n", filename, viewName); } if (comparison.hasDifferences()) { System.out.printf("%s%n", String.join(System.lineSeparator(), comparison.getDiffLines())); } else { System.out.println("no changes"); } } catch (IOException e) { e.printStackTrace(); throw new UncheckedIOException(e); } }