Skip to content

Commit

Permalink
Use specific method from java.lang.System to get line separator.
Browse files Browse the repository at this point in the history
  • Loading branch information
MishaDemianenko committed Sep 14, 2015
1 parent 6ddbc7f commit b5ad701
Show file tree
Hide file tree
Showing 20 changed files with 86 additions and 95 deletions.
Expand Up @@ -113,7 +113,7 @@ public String errorData( Throwable cause )
return printBase64Binary( return printBase64Binary(
Exceptions.stringify( cause ).getBytes( StandardCharsets.UTF_8 ) ) Exceptions.stringify( cause ).getBytes( StandardCharsets.UTF_8 ) )
// Below replaceAll call inserts a line break every 100 characters // Below replaceAll call inserts a line break every 100 characters
.replaceAll( "(.{100})", "$1" + System.getProperty( "line.separator" ) ); .replaceAll( "(.{100})", "$1" + System.lineSeparator() );
} }
} }


Expand Down
Expand Up @@ -122,7 +122,7 @@ private String readFully( BufferedReader reader ) throws IOException
while ( (line = reader.readLine()) != null ) while ( (line = reader.readLine()) != null )
{ {
builder.append( line ); builder.append( line );
builder.append( System.getProperty( "line.separator" ) ); builder.append( System.lineSeparator() );
} }
return builder.toString(); return builder.toString();
} }
Expand Down
Expand Up @@ -192,7 +192,7 @@ private static String lines( String... content )
StringBuilder result = new StringBuilder(); StringBuilder result = new StringBuilder();
for ( String line : content ) for ( String line : content )
{ {
result.append( line ).append( System.getProperty( "line.separator" ) ); result.append( line ).append( System.lineSeparator() );
} }
return result.toString(); return result.toString();
} }
Expand Down
Expand Up @@ -21,14 +21,16 @@


import org.neo4j.consistency.RecordType; import org.neo4j.consistency.RecordType;
import org.neo4j.helpers.ObjectUtil; import org.neo4j.helpers.ObjectUtil;
import org.neo4j.helpers.Strings;
import org.neo4j.kernel.impl.store.record.AbstractBaseRecord; import org.neo4j.kernel.impl.store.record.AbstractBaseRecord;
import org.neo4j.logging.Log; import org.neo4j.logging.Log;


import static org.neo4j.helpers.Strings.TAB;

public class InconsistencyMessageLogger implements InconsistencyLogger public class InconsistencyMessageLogger implements InconsistencyLogger
{ {
private final Log log; private final Log log;
public static final String LINE_SEPARATOR = System.getProperty( "line.separator" );
public static final String TAB = "\t";


public InconsistencyMessageLogger( Log log ) public InconsistencyMessageLogger( Log log )
{ {
Expand Down Expand Up @@ -63,16 +65,16 @@ public void warning( RecordType recordType, AbstractBaseRecord oldRecord, Abstra


private static String buildMessage( String message, AbstractBaseRecord record, Object[] args ) private static String buildMessage( String message, AbstractBaseRecord record, Object[] args )
{ {
StringBuilder builder = joinLines( message ).append( LINE_SEPARATOR ).append( TAB ).append( record ); StringBuilder builder = joinLines( message ).append( System.lineSeparator() ).append( TAB ).append( record );
appendArgs( builder, args ); appendArgs( builder, args );
return builder.toString(); return builder.toString();
} }


private static String buildMessage( String message, AbstractBaseRecord oldRecord, AbstractBaseRecord newRecord, Object[] args ) private static String buildMessage( String message, AbstractBaseRecord oldRecord, AbstractBaseRecord newRecord, Object[] args )
{ {
StringBuilder builder = joinLines( message ); StringBuilder builder = joinLines( message );
builder.append( LINE_SEPARATOR ).append( TAB ).append( "- " ).append( oldRecord ); builder.append( System.lineSeparator() ).append( TAB ).append( "- " ).append( oldRecord );
builder.append( LINE_SEPARATOR ).append( TAB ).append( "+ " ).append( newRecord ); builder.append( System.lineSeparator() ).append( TAB ).append( "+ " ).append( newRecord );
appendArgs( builder, args ); appendArgs( builder, args );
return builder.toString(); return builder.toString();
} }
Expand All @@ -94,7 +96,7 @@ private static StringBuilder appendArgs( StringBuilder builder, Object[] args )
{ {
return builder; return builder;
} }
builder.append( LINE_SEPARATOR ).append( TAB ).append( "Inconsistent with:" ); builder.append( System.lineSeparator() ).append( TAB ).append( "Inconsistent with:" );
for ( Object arg : args ) for ( Object arg : args )
{ {
builder.append( ' ' ).append( ObjectUtil.toString( arg ) ); builder.append( ' ' ).append( ObjectUtil.toString( arg ) );
Expand Down
Expand Up @@ -22,11 +22,9 @@
import org.junit.Test; import org.junit.Test;


import org.neo4j.consistency.RecordType; import org.neo4j.consistency.RecordType;
import org.neo4j.logging.AssertableLogProvider; import org.neo4j.helpers.Strings;
import org.neo4j.kernel.impl.store.record.NeoStoreRecord; import org.neo4j.kernel.impl.store.record.NeoStoreRecord;

import org.neo4j.logging.AssertableLogProvider;
import static org.neo4j.consistency.report.InconsistencyMessageLogger.LINE_SEPARATOR;
import static org.neo4j.consistency.report.InconsistencyMessageLogger.TAB;


public class MessageConsistencyLoggerTest public class MessageConsistencyLoggerTest
{ {
Expand Down Expand Up @@ -104,7 +102,7 @@ private String join( String firstLine, String... lines )
StringBuilder expected = new StringBuilder( firstLine ); StringBuilder expected = new StringBuilder( firstLine );
for ( String line : lines ) for ( String line : lines )
{ {
expected.append( LINE_SEPARATOR ).append( TAB ).append( line ); expected.append( System.lineSeparator() ).append( Strings.TAB ).append( line );
} }
return expected.toString(); return expected.toString();
} }
Expand Down
Expand Up @@ -235,7 +235,7 @@ case object Prettifier extends (String => String) {
} }


val space = " " val space = " "
val newline = System.getProperty("line.separator") val newline = System.lineSeparator()


def insertBreak(token: SyntaxToken, tail: Seq[SyntaxToken]): String = { def insertBreak(token: SyntaxToken, tail: Seq[SyntaxToken]): String = {
if (tail.isEmpty) if (tail.isEmpty)
Expand Down
Expand Up @@ -19,18 +19,18 @@
*/ */
package org.neo4j.cypher.export; package org.neo4j.cypher.export;


import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Iterator;
import java.util.Map;

import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.mockito.Mockito; import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock; import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer; import org.mockito.stubbing.Answer;


import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Iterator;
import java.util.Map;

import org.neo4j.cypher.javacompat.ExecutionResult; import org.neo4j.cypher.javacompat.ExecutionResult;
import org.neo4j.graphalgo.impl.util.PathImpl; import org.neo4j.graphalgo.impl.util.PathImpl;
import org.neo4j.graphdb.DynamicLabel; import org.neo4j.graphdb.DynamicLabel;
Expand All @@ -44,15 +44,14 @@
import org.neo4j.graphdb.Transaction; import org.neo4j.graphdb.Transaction;
import org.neo4j.test.TestGraphDatabaseFactory; import org.neo4j.test.TestGraphDatabaseFactory;


import static java.lang.System.lineSeparator;
import static java.util.Arrays.asList; import static java.util.Arrays.asList;
import static java.util.Collections.singletonMap; import static java.util.Collections.singletonMap;

import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;


public class ExportTest public class ExportTest
{ {


private final static String NL = System.getProperty( "line.separator" );
private GraphDatabaseService gdb; private GraphDatabaseService gdb;
private Transaction tx; private Transaction tx;


Expand Down Expand Up @@ -80,7 +79,7 @@ public void testEmptyGraph() throws Exception
public void testNodeWithProperties() throws Exception public void testNodeWithProperties() throws Exception
{ {
gdb.createNode().setProperty( "name", "Andres" ); gdb.createNode().setProperty( "name", "Andres" );
assertEquals( "create (_0 {`name`:\"Andres\"})" + NL, doExportGraph( gdb ) ); assertEquals( "create (_0 {`name`:\"Andres\"})" + lineSeparator(), doExportGraph( gdb ) );
} }


@Test @Test
Expand All @@ -89,7 +88,7 @@ public void testNodeWithFloatProperty() throws Exception
final float floatValue = 10.1f; final float floatValue = 10.1f;
final String expected = "10.100000"; final String expected = "10.100000";
gdb.createNode().setProperty( "float", floatValue ); gdb.createNode().setProperty( "float", floatValue );
assertEquals( "create (_0 {`float`:" + expected + "})" + NL, doExportGraph( gdb ) ); assertEquals( "create (_0 {`float`:" + expected + "})" + lineSeparator(), doExportGraph( gdb ) );
} }


@Test @Test
Expand All @@ -98,7 +97,7 @@ public void testNodeWithDoubleProperty() throws Exception
final double doubleValue = 123456.123456; final double doubleValue = 123456.123456;
final String expected = "123456.123456"; final String expected = "123456.123456";
gdb.createNode().setProperty( "double", doubleValue ); gdb.createNode().setProperty( "double", doubleValue );
assertEquals( "create (_0 {`double`:" + expected + "})" + NL, doExportGraph( gdb ) ); assertEquals( "create (_0 {`double`:" + expected + "})" + lineSeparator(), doExportGraph( gdb ) );
} }


private String doExportGraph( GraphDatabaseService db ) private String doExportGraph( GraphDatabaseService db )
Expand All @@ -120,7 +119,7 @@ public void testFromSimpleCypherResult() throws Exception
Node n = gdb.createNode(); Node n = gdb.createNode();
final ExecutionResult result = result( "node", n ); final ExecutionResult result = result( "node", n );
final SubGraph graph = CypherResultSubGraph.from( result, gdb, false ); final SubGraph graph = CypherResultSubGraph.from( result, gdb, false );
assertEquals( "create (_" + n.getId() + ")" + NL, doExportGraph( graph ) ); assertEquals( "create (_" + n.getId() + ")" + lineSeparator(), doExportGraph( graph ) );
} }


@Test @Test
Expand All @@ -129,7 +128,7 @@ public void testSingleNode() throws Exception
Node n = gdb.createNode(); Node n = gdb.createNode();
final ExecutionResult result = result( "node", n ); final ExecutionResult result = result( "node", n );
final SubGraph graph = CypherResultSubGraph.from( result, gdb, false ); final SubGraph graph = CypherResultSubGraph.from( result, gdb, false );
assertEquals( "create (_" + n.getId() + ")" + NL, doExportGraph( graph ) ); assertEquals( "create (_" + n.getId() + ")" + lineSeparator(), doExportGraph( graph ) );
} }


@Test @Test
Expand All @@ -140,7 +139,7 @@ public void testSingleNodeWithProperties() throws Exception
n.setProperty( "age", 42 ); n.setProperty( "age", 42 );
final ExecutionResult result = result( "node", n ); final ExecutionResult result = result( "node", n );
final SubGraph graph = CypherResultSubGraph.from( result, gdb, false ); final SubGraph graph = CypherResultSubGraph.from( result, gdb, false );
assertEquals( "create (_" + n.getId() + " {`age`:42, `name`:\"Node1\"})" + NL, doExportGraph( graph ) ); assertEquals( "create (_" + n.getId() + " {`age`:42, `name`:\"Node1\"})" + lineSeparator(), doExportGraph( graph ) );
} }


@Test @Test
Expand All @@ -150,7 +149,7 @@ public void testEscapingOfNodeStringPropertyValue() throws Exception
n.setProperty( "name", "Brutus \"Brutal\" Howell" ); n.setProperty( "name", "Brutus \"Brutal\" Howell" );
final ExecutionResult result = result( "node", n ); final ExecutionResult result = result( "node", n );
final SubGraph graph = CypherResultSubGraph.from( result, gdb, false ); final SubGraph graph = CypherResultSubGraph.from( result, gdb, false );
assertEquals( "create (_" + n.getId() + " {`name`:\"Brutus \\\"Brutal\\\" Howell\"})" + NL, assertEquals( "create (_" + n.getId() + " {`name`:\"Brutus \\\"Brutal\\\" Howell\"})" + lineSeparator(),
doExportGraph( graph ) ); doExportGraph( graph ) );
} }


Expand All @@ -161,7 +160,7 @@ public void testEscapingOfNodeStringArrayPropertyValue() throws Exception
n.setProperty( "name", new String[]{"Brutus \"Brutal\" Howell", "Dr."} ); n.setProperty( "name", new String[]{"Brutus \"Brutal\" Howell", "Dr."} );
final ExecutionResult result = result( "node", n ); final ExecutionResult result = result( "node", n );
final SubGraph graph = CypherResultSubGraph.from( result, gdb, false ); final SubGraph graph = CypherResultSubGraph.from( result, gdb, false );
assertEquals( "create (_" + n.getId() + " {`name`:[\"Brutus \\\"Brutal\\\" Howell\", \"Dr.\"]})" + NL, assertEquals( "create (_" + n.getId() + " {`name`:[\"Brutus \\\"Brutal\\\" Howell\", \"Dr.\"]})" + lineSeparator(),
doExportGraph( graph ) ); doExportGraph( graph ) );
} }


Expand All @@ -173,8 +172,8 @@ public void testEscapingOfRelationshipStringPropertyValue() throws Exception
rel.setProperty( "name", "Brutus \"Brutal\" Howell" ); rel.setProperty( "name", "Brutus \"Brutal\" Howell" );
final ExecutionResult result = result( "rel", rel ); final ExecutionResult result = result( "rel", rel );
final SubGraph graph = CypherResultSubGraph.from( result, gdb, true ); final SubGraph graph = CypherResultSubGraph.from( result, gdb, true );
assertEquals( "create (_0)" + NL + assertEquals( "create (_0)" + lineSeparator() +
"create _0-[:`REL` {`name`:\"Brutus \\\"Brutal\\\" Howell\"}]->_0" + NL, doExportGraph( graph ) ); "create _0-[:`REL` {`name`:\"Brutus \\\"Brutal\\\" Howell\"}]->_0" + lineSeparator(), doExportGraph( graph ) );
} }


@Test @Test
Expand All @@ -185,8 +184,8 @@ public void testEscapingOfRelationshipStringArrayPropertyValue() throws Exceptio
rel.setProperty( "name", new String[]{"Brutus \"Brutal\" Howell", "Dr."} ); rel.setProperty( "name", new String[]{"Brutus \"Brutal\" Howell", "Dr."} );
final ExecutionResult result = result( "rel", rel ); final ExecutionResult result = result( "rel", rel );
final SubGraph graph = CypherResultSubGraph.from( result, gdb, true ); final SubGraph graph = CypherResultSubGraph.from( result, gdb, true );
assertEquals( "create (_0)" + NL + assertEquals( "create (_0)" + lineSeparator() +
"create _0-[:`REL` {`name`:[\"Brutus \\\"Brutal\\\" Howell\", \"Dr.\"]}]->_0" + NL, "create _0-[:`REL` {`name`:[\"Brutus \\\"Brutal\\\" Howell\", \"Dr.\"]}]->_0" + lineSeparator(),
doExportGraph( graph ) ); doExportGraph( graph ) );
} }


Expand All @@ -197,7 +196,7 @@ public void testEscapingStringPropertyWithBackslash() throws Exception
n.setProperty( "name", "Some\\thing" ); n.setProperty( "name", "Some\\thing" );
final ExecutionResult result = result( "node", n ); final ExecutionResult result = result( "node", n );
final SubGraph graph = CypherResultSubGraph.from( result, gdb, false ); final SubGraph graph = CypherResultSubGraph.from( result, gdb, false );
assertEquals( "create (_" + n.getId() + " {`name`:\"Some\\\\thing\"})" + NL, assertEquals( "create (_" + n.getId() + " {`name`:\"Some\\\\thing\"})" + lineSeparator(),
doExportGraph( graph ) ); doExportGraph( graph ) );
} }


Expand All @@ -208,7 +207,7 @@ public void testEscapingStringPropertyWithBackslashAndDoubleQuote() throws Excep
n.setProperty( "name", "Some\\\"thing" ); n.setProperty( "name", "Some\\\"thing" );
final ExecutionResult result = result( "node", n ); final ExecutionResult result = result( "node", n );
final SubGraph graph = CypherResultSubGraph.from( result, gdb, false ); final SubGraph graph = CypherResultSubGraph.from( result, gdb, false );
assertEquals( "create (_" + n.getId() + " {`name`:\"Some\\\\\\\"thing\"})" + NL, assertEquals( "create (_" + n.getId() + " {`name`:\"Some\\\\\\\"thing\"})" + lineSeparator(),
doExportGraph( graph ) ); doExportGraph( graph ) );
} }


Expand All @@ -220,7 +219,7 @@ public void testSingleNodeWithArrayProperties() throws Exception
n.setProperty( "age", new int[]{1, 2} ); n.setProperty( "age", new int[]{1, 2} );
final ExecutionResult result = result( "node", n ); final ExecutionResult result = result( "node", n );
final SubGraph graph = CypherResultSubGraph.from( result, gdb, false ); final SubGraph graph = CypherResultSubGraph.from( result, gdb, false );
assertEquals( "create (_" + n.getId() + " {`age`:[1, 2], `name`:[\"a\", \"b\"]})" + NL, doExportGraph( graph ) ); assertEquals( "create (_" + n.getId() + " {`age`:[1, 2], `name`:[\"a\", \"b\"]})" + lineSeparator(), doExportGraph( graph ) );
} }


@Test @Test
Expand All @@ -231,21 +230,21 @@ public void testSingleNodeLabels() throws Exception
n.addLabel( DynamicLabel.label( "Bar" ) ); n.addLabel( DynamicLabel.label( "Bar" ) );
final ExecutionResult result = result( "node", n ); final ExecutionResult result = result( "node", n );
final SubGraph graph = CypherResultSubGraph.from( result, gdb, false ); final SubGraph graph = CypherResultSubGraph.from( result, gdb, false );
assertEquals( "create (_" + n.getId() + ":`Foo`:`Bar`)" + NL, doExportGraph( graph ) ); assertEquals( "create (_" + n.getId() + ":`Foo`:`Bar`)" + lineSeparator(), doExportGraph( graph ) );
} }


@Test @Test
public void testExportIndex() throws Exception public void testExportIndex() throws Exception
{ {
gdb.schema().indexFor( DynamicLabel.label( "Foo" ) ).on( "bar" ).create(); gdb.schema().indexFor( DynamicLabel.label( "Foo" ) ).on( "bar" ).create();
assertEquals( "create index on :`Foo`(`bar`)" + NL , doExportGraph( gdb ) ); assertEquals( "create index on :`Foo`(`bar`)" + lineSeparator() , doExportGraph( gdb ) );
} }


@Test @Test
public void testExportUniquenessConstraint() throws Exception public void testExportUniquenessConstraint() throws Exception
{ {
gdb.schema().constraintFor( DynamicLabel.label( "Foo" ) ).assertPropertyIsUnique( "bar" ).create(); gdb.schema().constraintFor( DynamicLabel.label( "Foo" ) ).assertPropertyIsUnique( "bar" ).create();
assertEquals( "create constraint on (n:`Foo`) assert n.`bar` is unique" + NL, doExportGraph( gdb ) ); assertEquals( "create constraint on (n:`Foo`) assert n.`bar` is unique" + lineSeparator(), doExportGraph( gdb ) );
} }


@Test @Test
Expand All @@ -258,9 +257,9 @@ public void testExportIndexesViaCypherResult() throws Exception
Node n = gdb.createNode( label ); Node n = gdb.createNode( label );
final ExecutionResult result = result( "node", n ); final ExecutionResult result = result( "node", n );
final SubGraph graph = CypherResultSubGraph.from( result, gdb, true ); final SubGraph graph = CypherResultSubGraph.from( result, gdb, true );
assertEquals( "create index on :`Foo`(`bar2`)" + NL + assertEquals( "create index on :`Foo`(`bar2`)" + lineSeparator() +
"create index on :`Foo`(`bar`)" + NL + "create index on :`Foo`(`bar`)" + lineSeparator() +
"create (_0:`Foo`)" + NL, doExportGraph( graph ) ); "create (_0:`Foo`)" + lineSeparator(), doExportGraph( graph ) );
} }


@Test @Test
Expand All @@ -273,9 +272,9 @@ public void testExportConstraintsViaCypherResult() throws Exception
Node n = gdb.createNode( label ); Node n = gdb.createNode( label );
final ExecutionResult result = result( "node", n ); final ExecutionResult result = result( "node", n );
final SubGraph graph = CypherResultSubGraph.from( result, gdb, true ); final SubGraph graph = CypherResultSubGraph.from( result, gdb, true );
assertEquals( "create constraint on (n:`Foo`) assert n.`bar2` is unique" + NL + assertEquals( "create constraint on (n:`Foo`) assert n.`bar2` is unique" + lineSeparator() +
"create constraint on (n:`Foo`) assert n.`bar` is unique" + NL + "create constraint on (n:`Foo`) assert n.`bar` is unique" + lineSeparator() +
"create (_0:`Foo`)" + NL, doExportGraph( graph ) ); "create (_0:`Foo`)" + lineSeparator(), doExportGraph( graph ) );
} }


private void commitAndStartNewTransactionAfterSchemaChanges() private void commitAndStartNewTransactionAfterSchemaChanges()
Expand All @@ -292,8 +291,8 @@ public void testFromRelCypherResult() throws Exception
final Relationship rel = n.createRelationshipTo( n, DynamicRelationshipType.withName( "REL" ) ); final Relationship rel = n.createRelationshipTo( n, DynamicRelationshipType.withName( "REL" ) );
final ExecutionResult result = result( "rel", rel ); final ExecutionResult result = result( "rel", rel );
final SubGraph graph = CypherResultSubGraph.from( result, gdb, true ); final SubGraph graph = CypherResultSubGraph.from( result, gdb, true );
assertEquals( "create (_0)" + NL + assertEquals( "create (_0)" + lineSeparator() +
"create _0-[:`REL`]->_0" + NL, doExportGraph( graph ) ); "create _0-[:`REL`]->_0" + lineSeparator(), doExportGraph( graph ) );
} }


@Test @Test
Expand All @@ -305,9 +304,9 @@ public void testFromPathCypherResult() throws Exception
final Path path = new PathImpl.Builder( n1 ).push( rel ).build(); final Path path = new PathImpl.Builder( n1 ).push( rel ).build();
final ExecutionResult result = result( "path", path ); final ExecutionResult result = result( "path", path );
final SubGraph graph = CypherResultSubGraph.from( result, gdb, true ); final SubGraph graph = CypherResultSubGraph.from( result, gdb, true );
assertEquals( "create (_0)" + NL + assertEquals( "create (_0)" + lineSeparator() +
"create (_1)" + NL + "create (_1)" + lineSeparator() +
"create _0-[:`REL`]->_1" + NL, doExportGraph( graph ) ); "create _0-[:`REL`]->_1" + lineSeparator(), doExportGraph( graph ) );
} }


@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
Expand Down Expand Up @@ -373,8 +372,8 @@ public void testFromSimpleGraph() throws Exception
final Relationship relationship = n0.createRelationshipTo( n1, DynamicRelationshipType.withName( "REL" ) ); final Relationship relationship = n0.createRelationshipTo( n1, DynamicRelationshipType.withName( "REL" ) );
relationship.setProperty( "related", true ); relationship.setProperty( "related", true );
final SubGraph graph = DatabaseSubGraph.from( gdb ); final SubGraph graph = DatabaseSubGraph.from( gdb );
assertEquals( "create (_" + n0.getId() + ")" + NL + assertEquals( "create (_" + n0.getId() + ")" + lineSeparator() +
"create (_" + n1.getId() + " {`name`:\"Node1\"})" + NL + "create (_" + n1.getId() + " {`name`:\"Node1\"})" + lineSeparator() +
"create _" + n0.getId() + "-[:`REL` {`related`:true}]->_" + n1.getId() + NL, doExportGraph( graph ) ); "create _" + n0.getId() + "-[:`REL` {`related`:true}]->_" + n1.getId() + lineSeparator(), doExportGraph( graph ) );
} }
} }
Expand Up @@ -24,10 +24,6 @@ import org.neo4j.cypher.internal.frontend.v2_3.perty.print.{PrintCommand, PrintN


import scala.collection.mutable import scala.collection.mutable


object StringPrintingConverter {
val NEW_LINE = System.getProperty("line.separator")
}

class StringPrintingConverter(var builder: mutable.StringBuilder = new mutable.StringBuilder()) extends PrintingConverter[String] { class StringPrintingConverter(var builder: mutable.StringBuilder = new mutable.StringBuilder()) extends PrintingConverter[String] {
def clear() { def clear() {
builder.clear() builder.clear()
Expand All @@ -41,7 +37,7 @@ class StringPrintingConverter(var builder: mutable.StringBuilder = new mutable.S
builder = builder ++= text builder = builder ++= text


case PrintNewLine(indent) => case PrintNewLine(indent) =>
builder.append(StringPrintingConverter.NEW_LINE) builder.append(System.lineSeparator())
var remaining = indent var remaining = indent
while (remaining > 0) { while (remaining > 0) {
builder = builder += ' ' builder = builder += ' '
Expand Down
3 changes: 3 additions & 0 deletions community/kernel/src/main/java/org/neo4j/helpers/Strings.java
Expand Up @@ -27,6 +27,9 @@
*/ */
public final class Strings public final class Strings
{ {

public static final String TAB = "\t";

private Strings() private Strings()
{ {
} }
Expand Down

0 comments on commit b5ad701

Please sign in to comment.