Skip to content

Commit

Permalink
Avoid using deprecated Helper.cr() calls
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Jungmann <lukas.jungmann@oracle.com>
  • Loading branch information
lukasj committed Aug 21, 2023
1 parent 81e4e14 commit 9da70bf
Show file tree
Hide file tree
Showing 83 changed files with 296 additions and 332 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,11 @@ public static org.eclipse.persistence.tools.schemaframework.TableDefinition tabl
public String toString() {
StringBuffer buf = new StringBuffer();
buf.append(getClass().getSimpleName() + ": " + this.getType());
buf.append(org.eclipse.persistence.internal.helper.Helper.cr());
buf.append(System.lineSeparator());
if (getItems() != null) {
buf.append("MenuItems: " + getItems().getClass().getSimpleName());
buf.append(getItems().toString());
buf.append(org.eclipse.persistence.internal.helper.Helper.cr());
buf.append(System.lineSeparator());
}
return buf.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,31 +119,31 @@ public void removeMenu(Menu aMenu) {
public String allToString() {
StringBuffer buf = new StringBuffer();
buf.append("Restaurant: " + this.getName());
buf.append(org.eclipse.persistence.internal.helper.Helper.cr());
buf.append(System.lineSeparator());
if (getMenus() != null) {
buf.append("Menus: " + getMenus().getClass().getSimpleName());
buf.append(getMenus().toString());
buf.append(org.eclipse.persistence.internal.helper.Helper.cr());
buf.append(System.lineSeparator());
}
if (getWaiters() != null) {
buf.append("Waiters: " + getWaiters().getClass().getSimpleName());
buf.append(getWaiters().toString());
buf.append(org.eclipse.persistence.internal.helper.Helper.cr());
buf.append(System.lineSeparator());
}
if (getPreferredCustomers() != null) {
buf.append("PreferredCustomers: " + getPreferredCustomers().getClass().getSimpleName());
buf.append(getPreferredCustomers().toString());
buf.append(org.eclipse.persistence.internal.helper.Helper.cr());
buf.append(System.lineSeparator());
}
if (getLocations() != null) {
buf.append("Locations: " + getLocations().getClass().getSimpleName());
buf.append(getLocations().toString());
buf.append(org.eclipse.persistence.internal.helper.Helper.cr());
buf.append(System.lineSeparator());
}
if (getSlogans() != null) {
buf.append("Slogan: " + getSlogans().getClass().getSimpleName());
buf.append(getSlogans().toString());
buf.append(org.eclipse.persistence.internal.helper.Helper.cr());
buf.append(System.lineSeparator());
}
return buf.toString();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand Down Expand Up @@ -229,15 +229,15 @@ public String toString() {
return buffer.toString();
}

buffer.append(System.getProperty("line.separator"));
buffer.append(System.lineSeparator());
if ((container instanceof IndirectContainer) && (!((IndirectContainer)container).isInstantiated())) {
buffer.append("\t");
buffer.append("uninstantiated order lines...");
} else {
for (Enumeration stream = getLineStream(); stream.hasMoreElements();) {
buffer.append("\t");
buffer.append(stream.nextElement());
buffer.append(System.getProperty("line.separator"));
buffer.append(System.lineSeparator());
}
}
return buffer.toString();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand Down Expand Up @@ -94,6 +94,6 @@ public int hashCode() {
}

public String toString() {
return "OrderLine(" + id + ": " + itemName + " - " + quantity + ")" + org.eclipse.persistence.internal.helper.Helper.cr() + "\t" + System.identityHashCode(this);
return "OrderLine(" + id + ": " + itemName + " - " + quantity + ")" + System.lineSeparator() + "\t" + System.identityHashCode(this);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand Down Expand Up @@ -35,8 +35,8 @@ public ClientServerTestModel() {
public void addRequiredSystems() {
try {
getSession().getLog().write("WARNING, some JDBC drivers may fail if they are not thread safe." +
Helper.cr() + "JDBC-ODBC will not be run for this test." + Helper.cr() +
"Oracle OCI may fail." + Helper.cr() + "DB2 IBM JDBC may fail." + Helper.cr());
System.lineSeparator() + "JDBC-ODBC will not be run for this test." + System.lineSeparator() +
"Oracle OCI may fail." + System.lineSeparator() + "DB2 IBM JDBC may fail." + System.lineSeparator());
getSession().getLog().flush();
} catch (java.io.IOException e) {
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand Down Expand Up @@ -90,7 +90,7 @@ protected void verify() {
if (endSize != (startSize - 1)) {
StringBuffer buffer = new StringBuffer();
buffer.append("Parent collection was not updated correctly.");
buffer.append(Helper.cr());
buffer.append(System.lineSeparator());
buffer.append("Start size: ");
buffer.append(startSize);
buffer.append(" End size: ");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand Down Expand Up @@ -28,8 +28,8 @@ public HelperSystemPropertyTest() {

@Override
public void verify() {
if (!org.eclipse.persistence.internal.helper.Helper.cr().equals(System.getProperty("line.separator"))) {
throw new TestErrorException("Helper.cr() returns the incorrect value.");
if (!System.lineSeparator().equals(System.getProperty("line.separator"))) {
throw new TestErrorException("System.lineSeparator() returns the incorrect value.");
}

if (!org.eclipse.persistence.internal.helper.Helper.pathSeparator().equals(System.getProperty("path.separator"))) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand Down Expand Up @@ -93,10 +93,10 @@ public void verify() {
if (!errors.isEmpty()) {
StringBuffer buffer = new StringBuffer();
buffer.append("Errors occurred with duplicate SQL being executed whilst building an object tree. The UnitOfWork cache should have been hit instead:");
buffer.append(Helper.cr());
buffer.append(System.lineSeparator());
for (int i = 0; i < errors.size(); i++) {
buffer.append(errors.get(i));
buffer.append(Helper.cr());
buffer.append(System.lineSeparator());
}
throw new TestErrorException(buffer.toString());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand Down Expand Up @@ -33,7 +33,7 @@ public void test() {
try {
uow.commit();
} catch (org.eclipse.persistence.exceptions.DatabaseException ex) {
throw new TestErrorException("Inserted instead of updating" + org.eclipse.persistence.internal.helper.Helper.cr() +
throw new TestErrorException("Inserted instead of updating" + System.lineSeparator() +
ex.toString());
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand Down Expand Up @@ -187,7 +187,7 @@ public void test() {
@Override
public void verify() {
if (caughtException == null) {
throw new TestErrorException("The proper exception was not thrown:" + org.eclipse.persistence.internal.helper.Helper.cr() + "caught exception was null! \n\n[EXPECTING] " + expectedException);
throw new TestErrorException("The proper exception was not thrown:" + System.lineSeparator() + "caught exception was null! \n\n[EXPECTING] " + expectedException);
}

if (caughtException instanceof JPQLException) {
Expand All @@ -206,7 +206,7 @@ public void verify() {
}
}
}
throw new TestErrorException("The proper exception was not thrown:" + org.eclipse.persistence.internal.helper.Helper.cr() + "[CAUGHT] " + caughtException + "\n\n[EXPECTING] " + expectedException);
throw new TestErrorException("The proper exception was not thrown:" + System.lineSeparator() + "[CAUGHT] " + caughtException + "\n\n[EXPECTING] " + expectedException);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand Down Expand Up @@ -377,10 +377,10 @@ protected void logHeadNote(Writer log) {
super.logHeadNote(log);
try {
if (!System.getProperties().containsKey("toplink.loadbuild.baseline-version")) {
log.write(getIndentationString() + "BASELINE VERSION: NONE SET" + org.eclipse.persistence.internal.helper.Helper.cr());
log.write(getIndentationString() + "BASELINE VERSION: NONE SET" + System.lineSeparator());
} else {
String baselineVersion = System.getProperties().getProperty("toplink.loadbuild.baseline-version");
log.write(getIndentationString() + "BASELINE VERSION: " + baselineVersion + org.eclipse.persistence.internal.helper.Helper.cr());
log.write(getIndentationString() + "BASELINE VERSION: " + baselineVersion + System.lineSeparator());
}
} catch (IOException exception) {
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand Down Expand Up @@ -42,7 +42,7 @@ protected void setup() {
throw new TestWarningException("ScrollableCursor is not supported on this platform");
}
if (getSession().getPlatform().isDB2()) {
throw new TestWarningException("java.sql.SQLException: [IBM][JDBC Driver] CLI0626E" + Helper.cr() +
throw new TestWarningException("java.sql.SQLException: [IBM][JDBC Driver] CLI0626E" + System.lineSeparator() +
"Updatable result set is not supported in this version of DB2 JDBC 2.0 driver.");
}
TYPE_SCROLL_INSENSITIVE_isSupported = true;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand Down Expand Up @@ -35,7 +35,7 @@ public SimplePojoProjectXMLClientTest() {
public void setup() throws TestErrorException {
simplePojoProjectXMLClient = new SimplePojoProjectXMLClientTest();

System.out.println(System.getProperty("line.separator") + System.getProperty("line.separator") + "Now running Simple POJO test using Project Deployment XML file...");
System.out.println(System.lineSeparator() + System.lineSeparator() + "Now running Simple POJO test using Project Deployment XML file...");

try {
org.eclipse.persistence.sessions.Project project = XMLProjectReader.read("PojoEmployee.xml");
Expand All @@ -53,7 +53,7 @@ public void test() throws TestErrorException {
for (Iterator itr = objects.iterator(); itr.hasNext(); ) {
simplePojoProjectXMLClient.printObjectAttributes(itr.next());
}
System.out.println(System.getProperty("line.separator") + System.getProperty("line.separator") + "Test using Project Deployment XML file is complete" + System.getProperty("line.separator") + System.getProperty("line.separator"));
System.out.println(System.lineSeparator() + System.lineSeparator() + "Test using Project Deployment XML file is complete" + System.lineSeparator() + System.lineSeparator());
} catch (Exception e) {
throw new TestErrorException("" + e);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand Down Expand Up @@ -36,7 +36,7 @@ public SimplePojoSessionsXMLClientTest() {
public void setup() throws TestErrorException {
simplePojoSessionsXMLClient = new SimplePojoSessionsXMLClientTest();

System.out.println(System.getProperty("line.separator") + System.getProperty("line.separator") + "Now running Simple POJO test using Sessions XML file...");
System.out.println(System.lineSeparator() + System.lineSeparator() + "Now running Simple POJO test using Sessions XML file...");

try {
org.eclipse.persistence.sessions.factories.XMLSessionConfigLoader xmlLoader = new org.eclipse.persistence.sessions.factories.XMLSessionConfigLoader("SimplePojoClientSessions.xml");
Expand All @@ -54,7 +54,7 @@ public void test() throws TestErrorException {
for (Iterator itr = objects.iterator(); itr.hasNext(); ) {
simplePojoSessionsXMLClient.printObjectAttributes(itr.next());
}
System.out.println(System.getProperty("line.separator") + System.getProperty("line.separator") + "Test using Project Deployment XML file is complete" + System.getProperty("line.separator") + System.getProperty("line.separator"));
System.out.println(System.lineSeparator() + System.lineSeparator() + "Test using Project Deployment XML file is complete" + System.lineSeparator() + System.lineSeparator());
} catch (Exception e) {
throw new TestErrorException("" + e);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand Down Expand Up @@ -341,7 +341,7 @@ public void logResult(Writer log) {

for (int i = 0; i < numberOfTests; i++) {
try {
log.write(org.eclipse.persistence.internal.helper.Helper.cr() + Helper.getTabs(getNestedCounter() + 1) + "Test Thread " + i);
log.write(System.lineSeparator() + Helper.getTabs(getNestedCounter() + 1) + "Test Thread " + i);
} catch (IOException exception) {
}
test[i].logResult(log);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand Down Expand Up @@ -112,7 +112,7 @@ protected void test(WriteTypeObjectTest testCase) throws TestWarningException {
try {
super.test(testCase);
} catch (NullPointerException e) {
throw new TestWarningException("Blob value was returned as null, this means the drivers max size was exceeded." + org.eclipse.persistence.internal.helper.Helper.cr() + caughtException);
throw new TestWarningException("Blob value was returned as null, this means the drivers max size was exceeded." + System.lineSeparator() + caughtException);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand Down Expand Up @@ -128,11 +128,11 @@ public void verify() {
if (errors.isEmpty() == false) {
StringBuffer buffer = new StringBuffer();
buffer.append("The following assertions failed:");
buffer.append(Helper.cr());
buffer.append(System.lineSeparator());
for (int i = 0; i < errors.size(); i++) {
Throwable t = (Throwable)errors.get(i);
buffer.append(t);
buffer.append(Helper.cr());
buffer.append(System.lineSeparator());
}
throw new TestErrorException(buffer.toString());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand Down Expand Up @@ -94,10 +94,10 @@ public void verify() {
if (!errors.isEmpty()) {
StringBuffer buffer = new StringBuffer();
buffer.append("Errors occurred with duplicate SQL being executed whilst building an object tree. The UnitOfWork cache should have been hit instead:");
buffer.append(Helper.cr());
buffer.append(System.lineSeparator());
for (int i = 0; i < errors.size(); i++) {
buffer.append(errors.get(i));
buffer.append(Helper.cr());
buffer.append(System.lineSeparator());
}
throw new TestErrorException(buffer.toString());
}
Expand Down

0 comments on commit 9da70bf

Please sign in to comment.