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:edu.usc.goffish.gofs.formats.gml.GMLWriter.java
protected void write(int indentation, KeyValuePair kvp) throws IOException { if (kvp instanceof ListKeyValuePair) { writeKVPStart(_indentation, kvp.Key()); writeKVPValue(_indentation, kvp.ValueAsList()); writeKVPEnd(_indentation);/*from w ww.j a v a 2 s .c om*/ } else { if (_writeIndentation) { for (int i = 0; i < indentation; i++) { _output.write(TABULATOR); } } kvp.write(_output); _output.write(System.lineSeparator()); } }
From source file:io.cloudslang.content.httpclient.build.auth.AuthSchemeProviderLookupBuilder.java
private static File createKrb5Configuration(String domain) throws IOException { File tempFile = File.createTempFile("krb", "kdc"); tempFile.deleteOnExit();/*from ww w . jav a2 s .c o m*/ ArrayList<String> lines = new ArrayList<>(); lines.add("[libdefaults]"); lines.add("\tdefault_realm = " + domain.toUpperCase()); lines.add("[realms]"); lines.add("\t" + domain.toUpperCase() + " = {"); lines.add("\t\tkdc = " + domain); lines.add("\t\tadmin_server = " + domain); lines.add("\t}"); FileWriter writer = null; try { writer = new FileWriter(tempFile); IOUtils.writeLines(lines, System.lineSeparator(), writer); } finally { if (writer != null) { // IOUtils.closeQuietly(writer); safeClose(writer); } } return tempFile; }
From source file:com.amazonaws.codepipeline.jenkinsplugin.ValidationTest.java
@Test public void validatePluginInvalidActionTypeCategoryFailure() { final String error = "AWS CodePipeline Jenkins plugin setup error. One or more required configuration parameters have not been specified." + System.lineSeparator(); thrown.expect(Failure.class); thrown.expectMessage(error);/*from www . ja va2 s . c om*/ thrown.expectMessage("Category: Please Choose A Category"); thrown.expectMessage("Version: 1"); thrown.expectMessage("Provider: Jenkins-Build"); Validation.validatePlugin("", "", "us-east-1", CategoryType.PleaseChooseACategory.getName(), "Jenkins-Build", "1", "ProjectName", null); }
From source file:dk.dma.msinm.legacy.nm.NmPdfExtractor.java
/** * Chops the text into blocks of text, each representing an NtM * @param text the full text/*from w w w. j a v a2s .c om*/ * @return the list of NtM texts */ private List<String> extractNoticeTextBlocks(String text) throws IOException { List<String> result = new ArrayList<>(); BufferedReader br = new BufferedReader(new StringReader(text)); String line; while ((line = br.readLine()) != null) { line = line.trim(); // A new block starts with the message number or "*" boolean newBlock = line.matches("^[\\d]+\\..*$"); if (!newBlock && line.length() > 0 && (int) line.charAt(0) == 61611) { newBlock = true; line = "*"; } // A translation starts with "Translation" boolean translation = line.matches("Translation"); if (newBlock || translation) { StringBuilder block = new StringBuilder(); block.append(line).append(System.lineSeparator()); while ((line = br.readLine()) != null) { // Strip header and footer, incl. blank lines if (!line.matches("^\\s+$") && !line.startsWith("Efterretninger for Sfarende, uge") && !line.startsWith("Carl Jacobsens Vej 31")) { block.append(line).append(System.lineSeparator()); } // Last line of a block is "(source)" if (line.trim().matches("\\(.+\\)")) { result.add(block.toString()); break; } } } } return result; }
From source file:net.di2e.ecdr.querylanguage.basic.CDRKeywordQueryLanguage.java
@Override public String getLanguageDescription(QueryConfiguration queryConfig) { // @formatter:off String description = "CDR Keyword Basic Query Language" + System.lineSeparator() + "****************************" + System.lineSeparator() + "Usage: To use the CQL query language specify the '" + getName() + "' in the {cdrs:queryLanguage} parameter placeholder." + System.lineSeparator() + " The CDR Keyword Basic query language supports booleans (AND, OR, NOT) and parenthesis in the {os:searchTerms} parameter value" + System.lineSeparator() + " Additionally the parameters below can be used for temporal, geospatial, property, or enhanced keyword searches" + System.lineSeparator() + System.lineSeparator() + "The examples below are only for the keywords that can be used in the {os:searchTerms}. They can be combined with any of the " + "additional parameters defined in the sections that follow. " + System.lineSeparator() + "Examples: ballpark" + System.lineSeparator() + " ballpark AND goodyear" + System.lineSeparator() + " ballpark AND (goodyear or peoria)" + System.lineSeparator() + " " + System.lineSeparator() + " " + System.lineSeparator() + "**** ID/URI Search Parameters ****" + System.lineSeparator() + System.lineSeparator() + "geo:uid - unique identifier of the record, matches the Metacard.ID field" + System.lineSeparator() + System.lineSeparator() + "ddf:resource-uri - URL encoded resource URI value that will be directly matched on, matches the Metacard.RESOURCE_URI field" + System.lineSeparator() + System.lineSeparator() + System.lineSeparator() + "**** Contextual Search Parameters ****" + System.lineSeparator() + System.lineSeparator() + "cdrsx:caseSensitive - boolean (1 or 0) specifying whether or not the keyword search should be case sensitive" + System.lineSeparator() + " default: 0 (false - case insensitive) " + System.lineSeparator() + System.lineSeparator() + "ecdr:fuzzy - boolean (1 or 0) specifying whether or not the keyword search should be fuzzy (fuzzy allows for slight misspellings or derivations to be found)" + System.lineSeparator() + " default: ${defaultFuzzyCustom} (${defaultFuzzy}) " + System.lineSeparator() + System.lineSeparator() + System.lineSeparator() + "**** Geospatial Search Parameters ****" + System.lineSeparator() + System.lineSeparator() + "geo:box - comma delimited list of lat/lon (deg) bounding box coordinates (geo format: geo:bbox ~ west,south,east,north). " + "This is also commonly referred to by minX, minY, maxX, maxY (where longitude is the X-axis, and latitude is the Y-axis)." + System.lineSeparator() + System.lineSeparator() + "geo:lat/lon - latitude and longitude, respectively, in decimal degrees (typical GPS receiver WGS84 coordinates). Should include a 'radius' parameter " + "that specifies the search radius in meters." + System.lineSeparator() + System.lineSeparator() + "geo:radius - the radius (in meters) parameter, used with the lat and lon parameters, specifies the search distance from this point." + System.lineSeparator() + " default: ${defaultRadius}" + System.lineSeparator() + System.lineSeparator() + "geo:geometry - The geometry is defined using the Well Known Text and supports the following 2D geographic shapes: POINT, LINESTRING, POLYGON, MULTIPOINT, " + "MULTILINESTRING, MULTIPOLYGON (the Geometry shall be expressed using the EPSG:4326e)" + System.lineSeparator() + " examples: POINT(1 5)" + System.lineSeparator() + " POLYGON((1 1,5 1,5 5,1 5,1 1),(2 2,2 3,3 3,3 2,2 2))" + System.lineSeparator() + System.lineSeparator() + "geo:polygon - (deprecated) polygon defined as comma separated latitude, longitude pairs, in clockwise order, with the last point being the same as the first " + "in order to close the polygon." + System.lineSeparator() + " example: 45.256,-110.45,46.46,-109.48,43.84,-109.86,45.256,-110.45" + System.lineSeparator() + System.lineSeparator() + "geo:relation - spatial operator for the relation to the result set " + System.lineSeparator() + " default: intersects" + System.lineSeparator() + " allowedValues: 'intersects', 'contains', 'disjoint'" + System.lineSeparator() + System.lineSeparator() + "geo:name - A string describing the location (place name) to perform the search " + System.lineSeparator() + " examples: Washington DC" + System.lineSeparator() + " Baltimore, MD" + System.lineSeparator() + System.lineSeparator() + "**** Temporal Search Parameters ****" + System.lineSeparator() + System.lineSeparator() + "time:start - replaced with a string of the beginning of the time slice of the search (RFC-3339 - Date and Time format, i.e. YYYY-MM-DDTHH:mm:ssZ). " + "Default value of \"1970-01-01T00:00:00Z\" is used when {time:end} is indicated but {time:start} is not specified." + System.lineSeparator() + System.lineSeparator() + "time:end - replaced with a string of the ending of the time slice of the search (RFC-3339 - Date and Time format, i.e. YYYY-MM-DDTHH:mm:ssZ). " + "Current GMT date/time is used when {time:start} is specified but not {time:end}." + System.lineSeparator() + System.lineSeparator() + "time:relation - temporal operation for the relation to the result set" + System.lineSeparator() + " default: intersects" + System.lineSeparator() + " allowedValues: 'intersects', 'contains', 'during', 'disjoint', 'equals'" + System.lineSeparator() + System.lineSeparator() + "cdrsx:dateType - the date type to compare against" + System.lineSeparator() + " default: ${defaultDateType}" + System.lineSeparator() + " allowedValues: ${dateTypeValues}" + System.lineSeparator() + System.lineSeparator() + System.lineSeparator() + "**** Content Collections Search Parameters ****" + System.lineSeparator() + System.lineSeparator() + "ecdr:collections - a comma separated list of content collections to search over. list of content collections can be retrieved by using the Describe spec" + System.lineSeparator() + System.lineSeparator() + System.lineSeparator() + "**** Other Parameters ****" + System.lineSeparator() + System.lineSeparator() + "ecdr:georssFormat - specifies how to return the results that include geospatial data, can be as GML or as Simple GeoRSS" + System.lineSeparator() + " allowedValues: 'simple', 'gml'" + System.lineSeparator() + System.lineSeparator() + "ddf:metadata-content-type - comma separate list that maps to the Metacard.CONTENT_TYPE attribute" + System.lineSeparator() + System.lineSeparator() + "ecdr:textPath - comma separated list of text paths (XPath-like) values to be searched over" + System.lineSeparator() + " example: /ddms:Resource/subtitle (this would return all records that contain an element of subtitle under the ddms:Resource root element" + System.lineSeparator() + System.lineSeparator() + System.lineSeparator() + "**** Sort Order ****" + System.lineSeparator() + System.lineSeparator() + "sru:sortKeys - space-separated list of sort keys, with individual sort keys comprised of a comma-separated sequence of " + "sub-parameters in the order listed below." + System.lineSeparator() + " path - Mandatory. An XPath expression for a tagpath to be used in the sort (wildcards '*' may be supported, see allowed values)" + System.lineSeparator() + " sortSchema - Optional. A short name for a URI identifying an XML schema to which the XPath expression applies" + System.lineSeparator() + " ascending - Optional. Boolean, default 'true'." + System.lineSeparator() + " caseSensitive - Optional. Boolean, default 'false'." + System.lineSeparator() + " missingValue - Optional. Default is 'highValue'." + System.lineSeparator() + " examples: Sort by relevance - score,relevance" + System.lineSeparator() + " Sort by updated time descending - entry/date,,false " + System.lineSeparator() + " Sort by distance - distance,cdrsx" + System.lineSeparator() + " 'path' allowedValues: " + SearchUtils.getAllowedSortValues(sortTypeConfigurationList) + System.lineSeparator(); // @formatter:on boolean fuzzy = queryConfig.isDefaultFuzzySearch(); description = StringUtils.replace(description, "${defaultFuzzy}", String.valueOf(fuzzy), 1); description = StringUtils.replace(description, "${defaultFuzzyCustom}", fuzzy ? SearchConstants.TRUE_STRING : SearchConstants.FALSE_STRING, 1); description = StringUtils.replace(description, "${defaultRadius}", String.valueOf(queryConfig.getDefaultRadius()), 1); description = StringUtils.replace(description, "${defaultDateType}", queryConfig.getDefaultDateType(), 1); description = StringUtils.replace(description, "${dateTypeValues}", dateTypeMap.keySet().toString(), 1); return description; }
From source file:com.hp.mqm.atrf.App.java
private List<OctaneTestResultOutput> outputToOctane() { if (!isOutput()) { logger.info(System.lineSeparator()); logger.info("PHASE : send data to ALM Octane"); }//from w w w.ja v a2 s . com int bulkSize = Integer.parseInt(configuration.getSyncBulkSize()); int fetchLimit = Integer.parseInt(configuration.getRunFilterFetchLimit()); int pageSize = Math.min(bulkSize, fetchLimit); AlmQueryBuilder queryBuilder = almWrapper.buildRunFilter(configuration); queryBuilder.addPageSize(pageSize); //PRINT EXPECTED RUN COUNT int expectedRunsCount = 0; try { expectedRunsCount = almWrapper.getExpectedRuns(queryBuilder); } catch (RestStatusException e) { logger.error(String.format( "Failed to execute Rest query in ALM. Validate Run Filter section in configuration. The received exception from ALM is %s", e.getMessage())); System.exit(ReturnCode.FAILURE.getReturnCode()); } expectedRunsCount = Math.min(expectedRunsCount, fetchLimit); logger.info(String.format("Expected runs : %d", expectedRunsCount)); int expectedBulks = expectedRunsCount / bulkSize; if (expectedRunsCount % bulkSize > 0) { expectedBulks++; } logger.info(String.format("Expected bulks : %d", expectedBulks)); //LOOP OF SEND long lastSentTime = 0; int runStartIndex = 0; int sleepBetweenPosts = Integer.parseInt(configuration.getSyncSleepBetweenPosts()) * 1000; long start = System.currentTimeMillis(); List<OctaneTestResultOutput> resultOutputs = new ArrayList<>(); for (int bulkId = 1; bulkId <= expectedBulks; bulkId++) { logger.info(String.format("Bulk #%s : preparing", bulkId)); //4.1 GET DATA FROM ALM queryBuilder.addStartIndex(runStartIndex + 1); List<Run> runs = almWrapper.fetchRuns(queryBuilder); almWrapper.fetchRunRelatedEntities(runs); runStartIndex += runs.size(); //4.2 SLEEP IF REQUIRED long fromLastSent = System.currentTimeMillis() - lastSentTime; long toSleep = sleepBetweenPosts - fromLastSent; if (toSleep > 0) { sleep(toSleep); } //4.3SEND/OUTPUT List<TestRunResultEntity> ngaRuns = prepareRunsForInjection(bulkId, runs); if (isOutput()) { File file = saveResults(configuration, ngaRuns); String note = ""; if (runStartIndex < expectedRunsCount) { note = String.format("(first %s runs)", bulkSize); } logger.info(String.format("The results are saved to %s: %s", note, file.getAbsolutePath())); System.exit(0); } else { String firstRunId = ngaRuns.get(0).getRunId(); String lastRunId = ngaRuns.get(ngaRuns.size() - 1).getRunId(); OctaneTestResultOutput currentOutput = null; try { currentOutput = sendResults(bulkId, ngaRuns); lastSentTime = System.currentTimeMillis(); ConfigurationUtilities.saveLastSentRunId(lastRunId); logger.info(String.format("Bulk #%s : sending %s runs , run ids from %s to %s , job id=%s, %s", bulkId, ngaRuns.size(), firstRunId, lastRunId, currentOutput.getId(), currentOutput.getStatus().toUpperCase())); } catch (Exception e) { String msg = e.getMessage(); int msgLength = 350; if (msg.length() > msgLength) { msg = msg.substring(0, msgLength); } logger.info(String.format("Bulk #%s : failed to send run ids from %s to %s: %s", bulkId, firstRunId, lastRunId, msg)); currentOutput = new OctaneTestResultOutput(); currentOutput.put(OctaneTestResultOutput.FIELD_STATUS, OctaneTestResultOutput.FAILED_SEND_STATUS); } resultOutputs.add(currentOutput); } } long end = System.currentTimeMillis(); logger.info(String.format("Finished sending data to ALM Octane in %d sec ", (end - start) / 1000)); return resultOutputs; }
From source file:org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.privileged.PrivilegedOperationExecutor.java
/** * Executes a privileged operation. It is up to the callers to ensure that * each privileged operation's parameters are constructed correctly. The * parameters are passed verbatim to the container-executor binary. * * @param prefixCommands in some cases ( e.g priorities using nice ), * prefix commands are necessary * @param operation the type and arguments for the operation to be executed * @param workingDir (optional) working directory for execution * @param env (optional) env of the command will include specified vars * @param grabOutput return (possibly large) shell command output * @param inheritParentEnv inherit the env vars from the parent process * @return stdout contents from shell executor - useful for some privileged * operations - e.g --tc_read//from w w w .ja v a2s . com * @throws org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.privileged.PrivilegedOperationException */ public String executePrivilegedOperation(List<String> prefixCommands, PrivilegedOperation operation, File workingDir, Map<String, String> env, boolean grabOutput, boolean inheritParentEnv) throws PrivilegedOperationException { String[] fullCommandArray = getPrivilegedOperationExecutionCommand(prefixCommands, operation); ShellCommandExecutor exec = new ShellCommandExecutor(fullCommandArray, workingDir, env, 0L, inheritParentEnv); try { exec.execute(); if (LOG.isDebugEnabled()) { LOG.debug("command array:"); LOG.debug(Arrays.toString(fullCommandArray)); LOG.debug("Privileged Execution Operation Output:"); LOG.debug(exec.getOutput()); } } catch (ExitCodeException e) { if (operation.isFailureLoggingEnabled()) { StringBuilder logBuilder = new StringBuilder("Shell execution returned " + "exit code: ") .append(exec.getExitCode()).append(". Privileged Execution Operation Output: ") .append(System.lineSeparator()).append(exec.getOutput()); logBuilder.append("Full command array for failed execution: ").append(System.lineSeparator()); logBuilder.append(Arrays.toString(fullCommandArray)); LOG.warn(logBuilder.toString()); } //stderr from shell executor seems to be stuffed into the exception //'message' - so, we have to extract it and set it as the error out throw new PrivilegedOperationException(e, e.getExitCode(), exec.getOutput(), e.getMessage()); } catch (IOException e) { LOG.warn("IOException executing command: ", e); throw new PrivilegedOperationException(e); } if (grabOutput) { return exec.getOutput(); } return null; }
From source file:net.di2e.ecdr.broker.endpoint.rest.CDRRestBrokerServiceImpl.java
@Override protected String replaceTemplateValues(String osdTemplate) { // @formatter:off String additionalParams = "cdrb:routeTo - a comma separated lists of siteNames (sources) that the query should be federated to " + System.lineSeparator() + " default: [sent to all sites]" + System.lineSeparator() + " allowedValues: " + getAllSites() + System.lineSeparator() + " localSourceId: " + getCatalogFramework().getId() + System.lineSeparator() + " example: site1,site2"; // @formatter:on osdTemplate = StringUtils.replace(osdTemplate, "${additionalBasicParameters}", additionalParams, 1); return super.replaceTemplateValues(osdTemplate); }
From source file:org.apache.metron.stellar.zeppelin.StellarInterpreter.java
/** * Generates an error message that is shown to the user. * * @param e An optional exception that occurred. * @param input The user input that led to the error condition. * @return An error message for the user. *//*from ww w . j av a2 s .c o m*/ private String getErrorMessage(Optional<Throwable> e, String input) { String message; if (e.isPresent()) { // base the error message on the exception String error = ExceptionUtils.getRootCauseMessage(e.get()); String trace = ExceptionUtils.getStackTrace(e.get()); message = error + System.lineSeparator() + trace; } else { // no exception provided; create generic error message message = "Invalid expression: " + input; } return message; }
From source file:org.assertj.maven.generator.AssertionsGeneratorReport.java
private void buildGeneratorReportError(StringBuilder reportBuilder) { reportBuilder.append(System.lineSeparator()); reportBuilder.append("Assertions failed with error : ").append(exception.getMessage()); reportBuilder.append(System.lineSeparator()); if (isNotEmpty(inputClasses)) { reportBuilder.append(INDENT).append("Given classes were : ").append(Arrays.toString(inputClasses)); reportBuilder.append(System.lineSeparator()); }//w w w . j a va 2 s.c o m if (isNotEmpty(inputPackages)) { reportBuilder.append(INDENT).append("Given packages were : ").append(Arrays.toString(inputPackages)); reportBuilder.append(System.lineSeparator()); } reportBuilder.append(System.lineSeparator()); reportBuilder.append("Full error stack : ").append(getStackTrace(exception)); }