List of usage examples for org.apache.commons.lang SystemUtils LINE_SEPARATOR
String LINE_SEPARATOR
To view the source code for org.apache.commons.lang SystemUtils LINE_SEPARATOR.
Click Source Link
The line.separator
System Property.
From source file:de.openknowledge.cdi.monitoring.ComponentStatus.java
protected String serializeError(Throwable aT) { return ExceptionUtils.getMessage(aT) + SystemUtils.LINE_SEPARATOR + ExceptionUtils.getStackTrace(aT); }
From source file:au.com.dw.testdatacapturej.builder.MethodBuilder.java
/** * Create the start of the method wrapping code. * /*from ww w .j a v a2 s . c o m*/ * The format for the method name will be: * create[Param | Return][parameter index if is param][class name of object][fully qualified enclosing method name for the object using underscores instead of period] * * If the object is of class com.test.TestClass and is the second parameter, and the method from which it is the parameter is org.test.DummyClass.dummyMethod - * then the method name would be: * * createParam2TestClass_org_test_DummyClass_dummyMethod * * If the object were the return value then: * * createReturnTestClass_org_test_DummyClass_dummyMethod * * e.g. would generate something like: * * public createParam1TestClass_org_test_DummyClass_dummyMethod() * { * * @param enclosingMethod The fully qualified name of the method for which the object is the parameter or return value * @param object Object to be logged for code generation * @param paramIndex The index number of the parameter starting at 1 for the first parameter, else 0 if the object is a return value * @return */ public String createMethodLine(String enclosingMethod, Object object, int paramIndex) { StringBuilder builder = new StringBuilder(); String className = object.getClass().getSimpleName(); String enclosingMethodName = enclosingMethod.replace('.', '_'); builder.append("public "); builder.append(object.getClass().getName()); builder.append(" create"); // check if is a parameter or return value if (paramIndex != 0) { builder.append("Param" + paramIndex); } else { builder.append("Return"); } builder.append(className); builder.append("_"); builder.append(enclosingMethodName); builder.append("() {"); builder.append(SystemUtils.LINE_SEPARATOR); return builder.toString(); }
From source file:com.alibaba.otter.node.etl.common.io.download.impl.AbstractCommandDownload.java
public void download() throws IOException { // // w w w . j a v a2 s . c o m notifyStatusChange(DownloadStatus.CONNECTING); Exec.Result result = null; try { result = Exec.execute(cmd); if (false == this.isSuccess(result.getExitCode())) { aborted.set(true); notifyException(new DataRetrieveException(result.toString())); notifyStatusChange(DownloadStatus.EXCEPTION); } else { this.analyzeResult(result); this.notifyMessage(result.toString()); if (aborted.get()) { // notifyStatusChange(DownloadStatus.ABORT); } else if (paused.get()) { // ? notifyStatusChange(DownloadStatus.PAUSED); } else { // ? notifyStatusChange(DownloadStatus.COMPLETE); } } } catch (Exception ex) { aborted.set(true); notifyException(new DataRetrieveException( (result != null) ? ex.getMessage() + SystemUtils.LINE_SEPARATOR + result.toString() : ex.getMessage(), ex)); } }
From source file:au.com.dw.testdatacapturej.builder.MethodBuilderTest.java
/** * Test for primitive value wrapper// ww w .jav a 2s .com */ @Test public void testCreateMethodLineForIntegerParam1() { MethodBuilder builder = new MethodBuilder(); String result = builder.createMethodLine("org.test.DummyClass.dummyMethod", new Integer(100), 1); System.out.println(result); String expected = "public java.lang.Integer createParam1Integer_org_test_DummyClass_dummyMethod() {" + SystemUtils.LINE_SEPARATOR; assertEquals(expected, result); }
From source file:au.com.dw.testdatacapturej.reflection.TestGenNullTest.java
/** * Test for null String field.// w w w. j av a 2s. com */ @Test public void nullStringTest() { try { logger.logObject(builder, handler.handle(new NullStringHolder())); String result = builder.getLog(); String expected = SystemUtils.LINE_SEPARATOR + "au.com.dw.testdatacapturej.mock.dataholder.NullStringHolder nullStringHolder0 = new au.com.dw.testdatacapturej.mock.dataholder.NullStringHolder();" + SystemUtils.LINE_SEPARATOR + "nullStringHolder0.setNullField(null);" + SystemUtils.LINE_SEPARATOR; System.out.println(result); assertEquals(expected, result); } catch (Exception e) { e.printStackTrace(); fail(); } }
From source file:de.iew.services.impl.AuditServiceImpl.java
protected String toAuditEventMessage(String message, Throwable throwable) { StringBuilder sb = new StringBuilder(message); if (throwable != null) { sb.append(SystemUtils.LINE_SEPARATOR); sb.append(ExceptionUtils.getFullStackTrace(throwable)); }//w ww . j a v a 2 s .co m return sb.toString(); }
From source file:com.yahoo.flowetl.commons.runner.Main.java
/** * Gets some useful runtime info as a map of names -> info. *//*from ww w .jav a2 s . c o m*/ private static Map<String, Object> getRuntimeInfo() { Map<String, Object> sysInfo = new TreeMap<String, Object>(); StringBuilder jvminfo = new StringBuilder(); jvminfo.append("Vendor: "); jvminfo.append(SystemUtils.JAVA_VENDOR); jvminfo.append(", Version: "); jvminfo.append(SystemUtils.JAVA_VERSION + " - " + SystemUtils.JAVA_VM_INFO); jvminfo.append(", OS: "); jvminfo.append(SystemUtils.OS_NAME + " (" + SystemUtils.OS_VERSION + " : " + SystemUtils.OS_ARCH + ")"); sysInfo.put(WordUtils.capitalizeFully("jvm"), jvminfo.toString()); sysInfo.put(WordUtils.capitalizeFully("default charset encoding"), DEF_CHAR_SET.name()); String netAdd = NetUtils.getLocalAddress(); if (StringUtils.isEmpty(netAdd)) { netAdd = "????"; } String localName = NetUtils.getLocalHostName(); if (StringUtils.isEmpty(localName)) { localName = "????"; } sysInfo.put(WordUtils.capitalizeFully("network"), localName + " at ip address " + netAdd); String cPath = SystemUtils.JAVA_CLASS_PATH; String linesep = StringEscapeUtils.escapeJava(SystemUtils.LINE_SEPARATOR); sysInfo.put(WordUtils.capitalizeFully("classpath"), cPath); sysInfo.put(WordUtils.capitalizeFully("jvm home"), SystemUtils.JAVA_HOME); sysInfo.put(WordUtils.capitalizeFully("jvm tmpdir"), SystemUtils.JAVA_IO_TMPDIR); sysInfo.put(WordUtils.capitalizeFully("jvm libpath"), SystemUtils.JAVA_LIBRARY_PATH); sysInfo.put(WordUtils.capitalizeFully("line separator"), linesep); sysInfo.put(WordUtils.capitalizeFully("path separator"), StringEscapeUtils.escapeJava(SystemUtils.PATH_SEPARATOR)); sysInfo.put(WordUtils.capitalizeFully("user timezone"), SystemUtils.USER_TIMEZONE); sysInfo.put(WordUtils.capitalizeFully("user home"), SystemUtils.USER_HOME); sysInfo.put(WordUtils.capitalizeFully("user language"), SystemUtils.USER_LANGUAGE); sysInfo.put(WordUtils.capitalizeFully("user name"), SystemUtils.USER_NAME); return sysInfo; }
From source file:com.googlecode.markuputils.MarkupBuilder.java
/** * Appends new line to this builder.//from w w w . java 2 s . c o m * * @return a reference to this builder. */ public MarkupBuilder appendNewLine() { buffer.append(SystemUtils.LINE_SEPARATOR); return this; }
From source file:au.com.dw.testdatacapturej.builder.MethodBuilderTest.java
/** * Test for complicated object//from w w w .j a v a 2s . co m */ @Test public void testCreateMethodLineForObjectParam1() { MethodBuilder builder = new MethodBuilder(); String result = builder.createMethodLine("org.test.DummyClass.dummyMethod", new AllDataHolder(), 1); System.out.println(result); String expected = "public au.com.dw.testdatacapturej.mock.dataholder.AllDataHolder createParam1AllDataHolder_org_test_DummyClass_dummyMethod() {" + SystemUtils.LINE_SEPARATOR; assertEquals(expected, result); }
From source file:com.google.gdt.eclipse.designer.wizards.model.common.AbstractCreateOperation.java
/** * @return the text converted to use system line separator. *///from w w w. ja v a 2s.c om private static String toSystemEOL(String text) throws Exception { StringWriter stringWriter = new StringWriter(); BufferedReader br = new BufferedReader(new StringReader(text)); while (true) { String line = br.readLine(); if (line == null) { break; } stringWriter.write(line); stringWriter.write(SystemUtils.LINE_SEPARATOR); } return stringWriter.toString(); }