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:net.cyllene.hackerrank.downloader.HackerrankDownloader.java
private static void printHelp() { HelpFormatter formatter = new HelpFormatter(); String sUsage = "java -jar "; try {//from ww w . java 2s .c o m sUsage += new File( HackerrankDownloader.class.getProtectionDomain().getCodeSource().getLocation().toURI()) .getName(); } catch (URISyntaxException e) { sUsage += "hackerrank-downloader.jar"; } String header = ""; String footer = System.lineSeparator() + "If you are experiencing problems with JSON parser, " + "try to run program with \"-Dfile.encoding=UTF-8\" option" + System.lineSeparator() + System.lineSeparator() + "Application expects a file " + DownloaderSettings.KEYFILE_NAME + " to be created in your home directory. " + "It must contain a single ASCII line, a value of \"" + DownloaderSettings.SECRET_COOKIE_ID + "\" cookie variable, " + "which length is about 430 symbols."; formatter.printHelp(sUsage, header, DownloaderSettings.cliOptions, footer, true); }
From source file:com.netflix.genie.web.jobs.workflow.impl.InitialSetupTask.java
@VisibleForTesting void createClusterEnvironmentVariables(final Writer writer, final Cluster cluster) throws IOException { final String clusterId = cluster.getId(); writer.write(JobConstants.EXPORT + JobConstants.GENIE_CLUSTER_DIR_ENV_VAR + JobConstants.EQUALS_SYMBOL + JobConstants.DOUBLE_QUOTE_SYMBOL + "${" + JobConstants.GENIE_JOB_DIR_ENV_VAR + "}" + JobConstants.FILE_PATH_DELIMITER + JobConstants.GENIE_PATH_VAR + JobConstants.FILE_PATH_DELIMITER + JobConstants.CLUSTER_PATH_VAR + JobConstants.FILE_PATH_DELIMITER + clusterId + JobConstants.DOUBLE_QUOTE_SYMBOL + LINE_SEPARATOR); // Append new line writer.write(System.lineSeparator()); writer.write(JobConstants.EXPORT + JobConstants.GENIE_CLUSTER_ID_ENV_VAR + JobConstants.EQUALS_SYMBOL + JobConstants.DOUBLE_QUOTE_SYMBOL + clusterId + JobConstants.DOUBLE_QUOTE_SYMBOL + LINE_SEPARATOR); // Append new line writer.write(System.lineSeparator()); writer.write(JobConstants.EXPORT + JobConstants.GENIE_CLUSTER_NAME_ENV_VAR + JobConstants.EQUALS_SYMBOL + JobConstants.DOUBLE_QUOTE_SYMBOL + cluster.getMetadata().getName() + JobConstants.DOUBLE_QUOTE_SYMBOL + LINE_SEPARATOR); // Append new line writer.write(System.lineSeparator()); writer.write(JobConstants.EXPORT + JobConstants.GENIE_CLUSTER_TAGS_ENV_VAR + JobConstants.EQUALS_SYMBOL + JobConstants.DOUBLE_QUOTE_SYMBOL + this.tagsToString(DtoConverters.toV3Tags(cluster.getId(), cluster.getMetadata().getName(), cluster.getMetadata().getTags())) + JobConstants.DOUBLE_QUOTE_SYMBOL + LINE_SEPARATOR); // Append new line writer.write(System.lineSeparator()); }
From source file:com.pearson.eidetic.driver.threads.subthreads.SnapshotChecker.java
public Integer getKeep(JSONObject eideticParameters, Volume vol) { if ((eideticParameters == null) || (vol == null)) { return null; }/*from ww w . j a va 2 s . c o m*/ JSONObject createSnapshot = null; if (eideticParameters.containsKey("CreateSnapshot")) { createSnapshot = (JSONObject) eideticParameters.get("CreateSnapshot"); } if (createSnapshot == null) { logger.error("awsAccountNickname=\"" + uniqueAwsAccountIdentifier_ + "\",Event=Error, Error=\"Malformed Eidetic Tag\", Volume_id=\"" + vol.getVolumeId() + "\""); return null; } Integer keep = null; if (createSnapshot.containsKey("Retain")) { try { keep = Integer.parseInt(createSnapshot.get("Retain").toString()); } 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) + "\""); } } return keep; }
From source file:io.cloudslang.lang.cli.SlangCli.java
private String prettyPrintSystemProperties(Set<SystemProperty> systemProperties) { StringBuilder stringBuilder = new StringBuilder(); if (CollectionUtils.isEmpty(systemProperties)) { stringBuilder.append("No system properties found."); } else {// ww w . jav a 2 s .c o m stringBuilder.append("Following system properties were loaded:").append(System.lineSeparator()); for (SystemProperty systemProperty : systemProperties) { stringBuilder.append("\t"); stringBuilder.append(systemProperty.getFullyQualifiedName()); stringBuilder.append(": "); stringBuilder.append(systemProperty.getValue()); stringBuilder.append(System.lineSeparator()); } } return StringUtils.trim(stringBuilder.toString()); }
From source file:net.sourceforge.doddle_owl.ui.GeneralOntologySelectionPanel.java
public void actionPerformed(ActionEvent e) { DODDLEProject project = DODDLE_OWL.getCurrentProject(); if (e.getSource() == removeGeneralOntologyDirButton) { int result = JOptionPane.showConfirmDialog(this, Translator.getTerm("RemoveGeneralOntologyDirectoryButton") + ": " + System.lineSeparator() + Utils.TEMP_DIR); if (result == JOptionPane.YES_OPTION) { String tmpDirName = "net.sourceforge.doddle-owl"; // tmpDirName??????????? File tmpDir = new File(Utils.TEMP_DIR); if (tmpDir.getAbsolutePath().contains(tmpDirName)) { deleteFile(tmpDir); // ??????? }//from w w w . j a v a 2 s . co m } } else if (e.getSource() == edrCheckBox) { enableEDRDic(edrCheckBox.isSelected()); project.addLog("GenericEDRCheckBox", edrCheckBox.isSelected()); } else if (e.getSource() == edrtCheckBox) { enableEDRTDic(edrtCheckBox.isSelected()); project.addLog("TechnicalEDRCheckBox", edrtCheckBox.isSelected()); } else if (e.getSource() == wnCheckBox) { enableWordNetDic(wnCheckBox.isSelected()); wnVersionSelectionPanel.setEnabled(wnCheckBox.isSelected()); project.addLog("WordNetCheckBox", wnCheckBox.isSelected()); } else if (e.getSource() == jpnWnCheckBox) { enableJpnWordNetDic(jpnWnCheckBox.isSelected()); project.addLog("JpnWordNetCheckBox", jpnWnCheckBox.isSelected()); } else if (e.getSource() == jwoCheckBox) { if (jwoCheckBox.isSelected()) { File jwoDir = new File(JWO_HOME); if (!jwoDir.exists()) { jwoDir.mkdir(); } String[] tdbFiles = { "GOSP.dat", "GOSP.idn", "GOSP.info", "GPOS.dat", "GPOS.idn", "GPOS.info", "GSPO.dat", "GSPO.idn", "GSPO.info", "node2id.dat", "node2id.idn", "node2id.info", "nodes.dat", "nodes.info", "OSP.dat", "OSP.idn", "OSP.info", "OSPG.dat", "OSPG.idn", "OSPG.info", "POS.dat", "POS.idn", "POS.info", "POSG.dat", "POSG.idn", "POSG.info", "prefix2id.dat", "prefix2id.idn", "prefix2id.info", "prefixes.dat", "prefixes.info", "prefixIdx.dat", "prefixIdx.idn", "prefixIdx.info", "SPO.dat", "SPO.idn", "SPO.info", "SPOG.dat", "SPOG.idn", "SPOG.info", "this.info" }; for (String fname : tdbFiles) { File f = new File(JWO_HOME + File.separator + fname); if (!f.exists()) { URL url = DODDLE_OWL.class.getClassLoader() .getResource(Utils.RESOURCE_DIR + "jwo/" + f.getName()); try { if (url != null) { FileUtils.copyURLToFile(url, f); DODDLE_OWL.getLogger().log(Level.INFO, "copy: " + f.getAbsolutePath()); } } catch (IOException ioe) { ioe.printStackTrace(); } } } if (OWLOntologyManager.getRefOntology(jwoDir.getAbsolutePath()) == null) { dataset = TDBFactory.createDataset(jwoDir.getAbsolutePath()); Model ontModel = dataset.getDefaultModel(); ReferenceOWLOntology refOnt = new ReferenceOWLOntology(ontModel, jwoDir.getAbsolutePath(), nameSpaceTable); OWLOntologyManager.addRefOntology(refOnt.getURI(), refOnt); } } } }
From source file:de.tud.inf.db.sparqlytics.olap.Compute.java
/** * Extends the given runtime exception with the given query string. * /*from ww w .j a v a 2 s .c o m*/ * @param ex the exception to extend * @param query the query to add to the exception message * @return the extended exception */ protected RuntimeException extendRuntimeException(RuntimeException ex, String query) { StringBuilder builder = new StringBuilder(); String message = ex.getMessage(); if (message != null) { builder.append(message).append(System.lineSeparator()); } builder.append(ex.getClass().getSimpleName()).append(" caused by query:").append(System.lineSeparator()); builder.append(query); RuntimeException extended = new RuntimeException(builder.toString(), ex.getCause()); extended.setStackTrace(ex.getStackTrace()); return extended; }
From source file:com.opendoorlogistics.core.tables.io.PoiIO.java
private static String getOversizedWarningMessage(int nbOversized, String tableName) { String s = "Found " + nbOversized + " cell(s) in table \"" + tableName + "\" longer than maximum Excel cell length (" + MAX_CHAR_COUNT_IN_EXCEL_CELL + ")." + System.lineSeparator() + "This spreadsheet may not open correctly in Excel; Libreoffice or OpenOffice should be OK."; return s;/* w ww. jav a2s.co m*/ }
From source file:com.pearson.eidetic.driver.threads.MonitorSnapshotVolumeTime.java
@Override public void run() { Calendar calendar_int = Calendar.getInstance(); //0-365/*from www. j av a 2s. c o m*/ today_ = calendar_int.get(Calendar.DAY_OF_YEAR); ConcurrentHashMap<Region, ArrayList<Volume>> localVolumeTime; localVolumeTime = awsAccount_.getVolumeTime_Copy(); for (Map.Entry<Region, ArrayList<Volume>> entry : localVolumeTime.entrySet()) { Region region = entry.getKey(); splitFactorDay_.put(region, 10); HashSet<Date> newHashSet = new HashSet<>(); didMySnapshotDay_.put(entry.getKey(), newHashSet); } addAlreadyDoneTodaySnapshots(localVolumeTime); while (true) { try { //Reset my stuff if (isItTomorrow(today_)) { calendar_int = Calendar.getInstance(); today_ = calendar_int.get(Calendar.DAY_OF_YEAR); resetDidMySnapshotDay(); } localVolumeTime = awsAccount_.getVolumeTime_Copy(); for (Map.Entry<Region, ArrayList<Volume>> entry : localVolumeTime.entrySet()) { Region region = entry.getKey(); if (localVolumeTime.get(region).isEmpty()) { continue; } timeDay_.put(region, extractRunAt(localVolumeTime.get(region))); } for (Map.Entry<Region, ArrayList<Volume>> entry : localVolumeTime.entrySet()) { Region region = entry.getKey(); if (localVolumeTime.get(region).isEmpty()) { continue; } timeDay_.get(region).keySet().removeAll(didMySnapshotDay_.get(region)); Calendar calendar = Calendar.getInstance(); Date now = calendar.getTime(); now = dayFormat_.parse(dayFormat_.format(now)); List<Date> lessThanNow = findLessThanNow(timeDay_.get(region).keySet(), now); if (!lessThanNow.isEmpty()) { for (Date date : lessThanNow) { ArrayList<Volume> volumes = timeDay_.get(region).get(date); List<List<Volume>> listOfLists = Lists.partition(volumes, splitFactorDay_.get(region)); if (localVolumeTimeListDay_.get(region) == null || localVolumeTimeListDay_.get(region).isEmpty()) { localVolumeTimeListDay_.put(region, listsToArrayLists(listOfLists)); } else { try { localVolumeTimeListDay_.get(region).add(listsToArrayLists(listOfLists).get(0)); } catch (Exception e) { } } ArrayList<SnapshotVolumeTime> threads = new ArrayList<>(); for (ArrayList<Volume> vols : listsToArrayLists(listOfLists)) { threads.add(new SnapshotVolumeTime(awsAccount_.getAwsAccessKeyId(), awsAccount_.getAwsSecretKey(), awsAccount_.getUniqueAwsAccountIdentifier(), awsAccount_.getMaxApiRequestsPerSecond(), ApplicationConfiguration.getAwsCallRetryAttempts(), region, vols)); } didMySnapshotDay_.get(region).add(date); EideticSubThreads_.put(region, threads); } } } //localVolumeTimeListDay now has hashmaps of regions with keys of arrays of arrays of volumes to take snapshots of. HashMap<Region, Integer> secsSlept = new HashMap<>(); HashMap<Region, Boolean> allDead = new HashMap<>(); for (Map.Entry<Region, ArrayList<Volume>> entry : localVolumeTime.entrySet()) { Region region = entry.getKey(); if (localVolumeTimeListDay_.get(region) == null || localVolumeTimeListDay_.get(region).isEmpty()) { continue; } //Initializing content secsSlept.put(region, 0); //Initializing content allDead.put(region, false); Threads.threadExecutorFixedPool(EideticSubThreads_.get(region), splitFactorDay_.get(region), 300, TimeUnit.MINUTES); } //LETS SEE IF THEY'RE DEAD Boolean ejection = false; Boolean theyreDead; while (true) { for (Map.Entry<Region, ArrayList<SnapshotVolumeTime>> entry : EideticSubThreads_.entrySet()) { Region region = entry.getKey(); if (areAllThreadsDead(EideticSubThreads_.get(region))) { allDead.put(region, true); } else { secsSlept.replace(region, secsSlept.get(region), secsSlept.get(region) + 1); if (secsSlept.get(region) > 1800) { splitFactorDay_.replace(region, splitFactorDay_.get(region), splitFactorDay_.get(region) + 1); logger.info( "Event=\"increasing_splitFactor\", Monitor=\"SnapshotVolumeTime\", splitFactor=\"" + Integer.toString(splitFactorDay_.get(region)) + "\", VolumeTimeSize=\"" + Integer.toString(localVolumeTime.get(region).size()) + "\""); ejection = true; break; } } } //I dont like this theyreDead = true; for (Map.Entry<Region, ArrayList<SnapshotVolumeTime>> entry : EideticSubThreads_.entrySet()) { Region region = entry.getKey(); //If any of them have false if (!allDead.get(region)) { theyreDead = false; } } if (ejection || theyreDead) { break; } Threads.sleepSeconds(1); } //See if decrease splitfactor for (Map.Entry<Region, ArrayList<SnapshotVolumeTime>> entry : EideticSubThreads_.entrySet()) { Region region = entry.getKey(); int timeRemaining = 1800 - secsSlept.get(region); if ((splitFactorDay_.get(region) > 5) & (timeRemaining > 60)) { splitFactorDay_.replace(region, splitFactorDay_.get(region), splitFactorDay_.get(region) - 1); logger.info("awsAccountNickname=\"" + awsAccount_.getUniqueAwsAccountIdentifier() + "\",Event=\"decreasing_splitFactor\", Monitor=\"SnapshotVolumeNoTime\", splitFactor=\"" + Integer.toString(splitFactorDay_.get(region)) + "\", VolumeNoTimeSize=\"" + Integer.toString(localVolumeTime.get(region).size()) + "\""); } } localVolumeTimeListDay_.clear(); EideticSubThreads_.clear(); Threads.sleepSeconds(30); } catch (Exception e) { logger.error("awsAccountNickname=\"" + awsAccount_.getUniqueAwsAccountIdentifier() + "\",Error=\"MonitorSnapshotVolumeTimeFailure\", stacktrace=\"" + e.toString() + System.lineSeparator() + StackTrace.getStringFromStackTrace(e) + "\""); } } }
From source file:com.consol.citrus.admin.service.ProjectService.java
/** * Adds the citrus admin connector dependency to the target project Maven POM. *//*from w w w . j a v a2s .c o m*/ public void addConnector() { if (project.isMavenProject()) { try { String pomXml = FileUtils.readToString(new FileSystemResource(project.getMavenPomFile())); if (!pomXml.contains("<artifactId>citrus-admin-connector</artifactId>")) { pomXml = pomXml.replaceAll("</dependencies>", " <dependency>" + System.lineSeparator() + " <groupId>com.consol.citrus</groupId>" + System.lineSeparator() + " <artifactId>citrus-admin-connector</artifactId>" + System.lineSeparator() + " <version>1.0.0-beta-5</version>" + System.lineSeparator() + " </dependency>" + System.lineSeparator() + " </dependencies>"); FileUtils.writeToFile(pomXml, new FileSystemResource(project.getMavenPomFile()).getFile()); } project.getSettings().setUseConnector(true); project.getSettings().setConnectorActive(true); saveProject(project); if (springBeanService.getBeanDefinition(getProjectContextConfigFile(), getActiveProject(), WebSocketPushMessageListener.class.getSimpleName(), SpringBean.class) == null) { SpringBean pushMessageListener = new SpringBean(); pushMessageListener.setId(WebSocketPushMessageListener.class.getSimpleName()); pushMessageListener.setClazz(WebSocketPushMessageListener.class.getName()); if (!environment.getProperty("local.server.port", "8080").equals("8080")) { Property portProperty = new Property(); portProperty.setName("port"); portProperty.setValue(environment.getProperty("local.server.port")); pushMessageListener.getProperties().add(portProperty); } springBeanService.addBeanDefinition(getProjectContextConfigFile(), getActiveProject(), pushMessageListener); } } catch (IOException e) { throw new ApplicationRuntimeException( "Failed to add admin connector dependency to Maven pom.xml file", e); } } }
From source file:com.diffplug.gradle.oomph.OomphIdeExtension.java
void writeBrandingPlugin(File ideDir) throws IOException { // load iconImg and splashImg BufferedImage iconImg, splashImg; int numSet = Booleans.countTrue(icon != null, splash != null); if (numSet == 0) { // nothing is set, use Goomph iconImg = BrandingProductPlugin.getGoomphIcon(); splashImg = BrandingProductPlugin.getGoomphSplash(); } else if (numSet == 1) { // anything is set, use it for everything iconImg = loadImg(Optional.ofNullable(icon).orElse(splash)); splashImg = iconImg;//from www . j a va 2 s . c o m } else if (numSet == 2) { // both are set, use them each iconImg = loadImg(icon); splashImg = loadImg(splash); } else { throw Unhandled.integerException(numSet); } File branding = new File(ideDir, FileMisc.macContentsEclipse() + "dropins/com.diffplug.goomph.branding"); BrandingProductPlugin.create(branding, splashImg, iconImg, name, perspective); File bundlesInfo = new File(ideDir, FileMisc.macContentsEclipse() + "configuration/org.eclipse.equinox.simpleconfigurator/bundles.info"); FileMisc.modifyFile(bundlesInfo, content -> { return content + "com.diffplug.goomph.branding,1.0.0,dropins/com.diffplug.goomph.branding/,4,true" + System.lineSeparator(); }); }