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.puppycrawl.tools.checkstyle.MainTest.java
@Test public void testExistingTargetFilePlainOutputToFileWithoutRwPermissions() throws Exception { final File file = temporaryFolder.newFile("file.output"); assertTrue(file.setReadable(true, true)); assertTrue(file.setWritable(false, false)); exit.expectSystemExitWithStatus(-1); exit.checkAssertionAfterwards(new Assertion() { @Override/* w ww . j a va2 s. co m*/ public void checkAssertion() throws IOException { assertEquals("Permission denied : '" + file.getCanonicalPath() + "'." + System.lineSeparator(), systemOut.getLog()); assertEquals("", systemErr.getLog()); } }); Main.main("-c", "src/test/resources/com/puppycrawl/tools/checkstyle/config-classname.xml", "-f", "plain", "-o", file.getCanonicalPath(), "src/test/resources/com/puppycrawl/tools/checkstyle/InputMain.java"); }
From source file:com.hybridbpm.core.util.HybridbpmCoreUtil.java
public static String updateConnectorCodeOutParameters(Module Module) { ConnectorModel connectorModel = HybridbpmCoreUtil.jsonToObject(Module.getModel(), ConnectorModel.class); String code = Module.getCode(); try {/* ww w . j a v a 2 s .c o m*/ StringBuilder parametersBuilder = new StringBuilder(); for (FieldModel field : connectorModel.getOutParameters()) { parametersBuilder.append(FieldModelUtil.getConnectorParameterTemplate(field)) .append(System.lineSeparator()); } return replaceGeneratedCode(code, parametersBuilder.toString(), SyntaxConstant.CONNECTOR_OUT_PARAMETERS_START, SyntaxConstant.CONNECTOR_OUT_PARAMETERS_END); } catch (Exception ex) { logger.log(Level.SEVERE, ex.getMessage(), ex); return code; } }
From source file:nick.gaImageRecognitionGui.panel.JPanelTestSavedConfiguration.java
private void jButtonStartTestActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonStartTestActionPerformed String testFolder = testImagesFolderLocation.getText(); String testFalsePositivesFolder = testFalseImagesFolderLocation.getText(); String configurationFolder = configurationsFolderLocation.getText(); Util.savePreferences(StringConstants.TEST_IMAGES_FOLDER_LOCATION_PREF_KEY, testFolder); Util.savePreferences(StringConstants.TEST_FALSE_IMAGES_FOLDER_LOCATION_PREF_KEY, testFalsePositivesFolder); Util.savePreferences(StringConstants.TEST_CONFIGURATION_FOLDER_LOCATION_PREF_KEY, configurationFolder); Individual[] individualsJoined = ConfigurationUtil.readConfigurationsFromFolder(configurationFolder); List<BufferedImage> faceImages = IOUtil.getImagesFromFolder(testFolder); List<BufferedImage> nonFaceImages = IOUtil.getImagesFromFolder(testFalsePositivesFolder); BufferedImage[] faces = faceImages.toArray(new BufferedImage[faceImages.size()]); BufferedImage[] nonFaces = nonFaceImages.toArray(new BufferedImage[nonFaceImages.size()]); double foundPercentageFaces = ScannerUtil.scannImages(faces, individualsJoined); double foundPercentageNonFace = ScannerUtil.scannImages(nonFaces, individualsJoined); long numberOfPostitives = (long) (faces.length * foundPercentageFaces); long sizeOfFailedPositives = nonFaces.length; long numberOfFailedPositives = (long) (nonFaces.length * foundPercentageNonFace); long sizeOfPostitives = faces.length; long TP = numberOfPostitives; long TN = sizeOfFailedPositives - numberOfFailedPositives; long FN = numberOfFailedPositives; long FP = sizeOfPostitives - numberOfPostitives; // float statisticalAccuracy = ((float)(numberOfPostitives+(sizeOfFailedPositives-numberOfFailedPositives))/(sizeOfPostitives + sizeOfFailedPositives)); double mcc = ((TP * TN - FP * FN) / Math.sqrt((TP + FP) * (TP + FN) * (TN + FP) * (TN + FN))); double accuracy = ((double) (TP + TN) / (TP + FP + FN + TN)); jTextAreaResults.append("----------------------------"); jTextAreaResults.append(System.lineSeparator()); jTextAreaResults.append("Test faces found (size): " + numberOfPostitives); jTextAreaResults.append(System.lineSeparator()); jTextAreaResults.append("Test non faces found (size): " + numberOfFailedPositives); jTextAreaResults.append(System.lineSeparator()); jTextAreaResults.append("Test faces found (%): " + foundPercentageFaces); jTextAreaResults.append(System.lineSeparator()); jTextAreaResults.append("Test non faces found (%): " + foundPercentageNonFace); jTextAreaResults.append(System.lineSeparator()); jTextAreaResults.append("Matthews correlation coefficient : " + mcc); jTextAreaResults.append(System.lineSeparator()); jTextAreaResults.append("Accuracy : " + accuracy); jTextAreaResults.append(System.lineSeparator()); jTextAreaResults.append("----------------------------"); }
From source file:kmi.taa.core.PredicateObjectRetriever.java
public String readRDF(InputStream istream, String base) { StringBuilder builder = new StringBuilder(); Model model = ModelFactory.createDefaultModel(); try {/*w w w. ja v a 2 s . c o m*/ model.read(istream, base); StmtIterator it = model.listStatements(); while (it.hasNext()) { Statement stmt = it.nextStatement(); Property ppty = stmt.getPredicate(); RDFNode obj = stmt.getObject(); String objcleaned = removeType(obj.toString()); builder.append(URLDecoder.decode(ppty.getURI(), "UTF-8") + "\t" + objcleaned); builder.append(System.lineSeparator()); } return builder.toString(); } catch (Exception e) { e.printStackTrace(); return ""; } }
From source file:com.pearson.eidetic.driver.threads.RefreshAwsAccountVolumes.java
private ConcurrentHashMap<Region, ArrayList<Volume>> processLocalVolumeTime( ConcurrentHashMap<Region, ArrayList<Volume>> localVolumeTime, Region region) { for (Map.Entry pair : volTimeHasTag_.entrySet()) { Boolean contin = (Boolean) pair.getValue(); if (contin) { continue; }//from w ww .j av a2s .c o m Volume vol = (Volume) pair.getKey(); try { localVolumeTime.get(region).remove(vol); } catch (Exception e) { logger.info("awsAccountNickname=\"" + uniqueAwsAccountIdentifier_ + "\",Event=\"Error\", Error=\"error removing vol from VolumeTime_\", Volume_id=\"" + vol.getVolumeId() + "\", stacktrace=\"" + e.toString() + System.lineSeparator() + StackTrace.getStringFromStackTrace(e) + "\""); } } volTimeHasTag_.clear(); return localVolumeTime; }
From source file:com.hybridbpm.core.util.HybridbpmCoreUtil.java
private static String replaceGeneratedCode(String code, String generatedCode, String BEGIN, String END) { StringBuilder codeBuilder = new StringBuilder(); if (code.contains(BEGIN) && code.contains(END)) { int start = code.indexOf(BEGIN); int end = code.indexOf(END); codeBuilder.append(code.substring(0, start)); codeBuilder.append(BEGIN).append(System.lineSeparator()); codeBuilder.append(generatedCode.replaceAll(System.lineSeparator() + System.lineSeparator(), System.lineSeparator())); codeBuilder.append(" ").append(code.substring(end, code.length())); return codeBuilder.toString(); } else {/* w ww . j a v a 2s .co m*/ return code; } }
From source file:com.pearson.eidetic.driver.threads.MonitorSnapshotVolumeTime.java
private void addAlreadyDoneTodaySnapshots(ConcurrentHashMap<Region, ArrayList<Volume>> localVolumeTime) { HashMap<Region, HashMap<Date, ArrayList<Volume>>> timeDay = new HashMap<>(); for (Map.Entry<Region, ArrayList<Volume>> entry : localVolumeTime.entrySet()) { Region region = entry.getKey(); if (localVolumeTime.get(region).isEmpty()) { continue; }//from w w w . j a va 2 s . c o m 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; } AmazonEC2Client ec2Client = connect(region, awsAccount_.getAwsAccessKeyId(), awsAccount_.getAwsSecretKey()); for (Volume vol : localVolumeTime.get(region)) { 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=\"" + awsAccount_.getUniqueAwsAccountIdentifier() + "\",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); //Success true means we need to take a snapshot, which it can handle l8r //Success false means we need to add to hashset if (!success) { String runAt = getRunAt(eideticParameters, vol); try { date = dayFormat_.parse(runAt); } catch (ParseException e) { logger.error("awsAccountNickname=\"" + awsAccount_.getUniqueAwsAccountIdentifier() + "\",Event=Error, Error=\"Malformed Eidetic Tag\", Volume_id=\"" + vol.getVolumeId() + "\", stacktrace=\"" + e.toString() + System.lineSeparator() + StackTrace.getStringFromStackTrace(e) + "\""); } if (date == null) { continue; } didMySnapshotDay_.get(region).add(date); } } } }
From source file:at.tugraz.sss.servs.kcprojwiki.impl.SSKCProjWikiImportCommons.java
public void updateVorgangEmployeeResources(final SSKCProjWikiConf conf, final SSKCProjWikiVorgang vorgang, final String vorgangTitle) throws SSErr { try {/* w w w . jav a 2 s. c o m*/ final String editToken = getWikiPageEditToken(conf, vorgangTitle); final String vorgangPageContent = getWikiPageContent(conf, vorgangTitle); final List<NameValuePair> postPars = new ArrayList<>(); final HttpResponse response; final HttpPost httpPost = new HttpPost(conf.wikiURI + SSMediaWikiLangE.apiActionEdit + SSStrU.ampersand + SSMediaWikiLangE.formatEqualsJson); String content = removeEmployeeResourcesFromVorgangContent(vorgangPageContent) + System.lineSeparator(); httpPost.addHeader(SSMediaWikiLangE.Cookie.toString(), sessionID); for (SSKCProjWikiVorgangEmployeeResource employeeResource : vorgang.employeeResources.values()) { content += SSStrU.doubleCurlyBracketOpen + SSMediaWikiLangE.WorksInVorgang + SSStrU.pipe + employeeResource.employee + SSStrU.pipe + employeeResource.used.toString() + SSStrU.pipe + employeeResource.total.toString() + SSStrU.pipe + vorgang.vorgangEnd + SSStrU.doubleCurlyBracketClose + System.lineSeparator(); } postPars.add(new BasicNameValuePair(SSMediaWikiLangE.title.toString(), vorgangTitle)); postPars.add(new BasicNameValuePair(SSMediaWikiLangE.text.toString(), content.trim())); postPars.add(new BasicNameValuePair(SSMediaWikiLangE.token.toString(), editToken)); httpPost.setEntity(new UrlEncodedFormEntity(postPars)); response = httpclient.execute(httpPost); parseUpdateResponse(response, vorgangTitle); } catch (Exception error) { SSServErrReg.regErrThrow(error); } }
From source file:net.di2e.ecdr.commons.endpoint.rest.AbstractRestSearchEndpoint.java
protected String getQueryLanguageDescriptions() { StringBuilder sb = new StringBuilder(); Iterator<QueryLanguage> langIter = queryLanguageList.iterator(); while (langIter.hasNext()) { sb.append(langIter.next().getLanguageDescription(queryConfiguration)); if (langIter.hasNext()) { sb.append(System.lineSeparator()); sb.append(System.lineSeparator()); sb.append(System.lineSeparator()); }//from w w w.j a v a2 s. co m } return sb.toString(); }
From source file:com.puppycrawl.tools.checkstyle.MainTest.java
@Test public void testExistingFilePlainOutputToFileWithoutReadAndRwPermissions() throws Exception { final File file = temporaryFolder.newFile("file.output"); // That works fine on Linux/Unix, but .... // It's not possible to make a file unreadable in Windows NTFS for owner. // http://stackoverflow.com/a/4354686 // https://github.com/google/google-oauth-java-client/issues/55#issuecomment-69403681 //assertTrue(file.setReadable(false, false)); assertTrue(file.setWritable(false, false)); exit.expectSystemExitWithStatus(-1); exit.checkAssertionAfterwards(new Assertion() { @Override/*from w w w .j ava 2 s . c o m*/ public void checkAssertion() throws IOException { assertEquals("Permission denied : '" + file.getCanonicalPath() + "'." + System.lineSeparator(), systemOut.getLog()); assertEquals("", systemErr.getLog()); } }); Main.main("-c", "src/test/resources/com/puppycrawl/tools/checkstyle/config-classname.xml", "-f", "plain", "-o", file.getCanonicalPath(), "src/test/resources/com/puppycrawl/tools/checkstyle/InputMain.java"); }