Skip to content

Commit

Permalink
deprecate Helper.cr() and similar for removal
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 a45b1ba commit 81e4e14
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2012, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2018 IBM Corporation. All rights reserved.
* Copyright (c) 2012, 2023 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2023 IBM Corporation. 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 All @@ -17,21 +17,23 @@
// - 500441: Eclipselink core has System.getProperty() calls that are not potentially executed under doPriv()
package org.eclipse.persistence.internal.core.helper;

import org.eclipse.persistence.internal.security.PrivilegedAccessHelper;

public class CoreHelper {

/** Store CR string, for some reason \n is not platform independent. */
/** Store CR string, for some reason \n is not platform independent.
* @deprecated Use {@link System#lineSeparator()}. */
@Deprecated(forRemoval = true)
protected static String CR = null;

/**
* Return a string containing the platform-appropriate
* characters for carriage return.
* characters for carriage return
* @deprecated Use {@link System#lineSeparator()}.
*/
@Deprecated(forRemoval = true)
public static String cr() {
// bug 2756643
if (CR == null) {
CR = PrivilegedAccessHelper.getSystemProperty("line.separator");
CR = System.lineSeparator();
}
return CR;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ public class Helper extends CoreHelper implements Serializable {

// Changed static initialization to lazy initialization for bug 2756643

/** Store CR string, for some reason \n is not platform independent. */
/** Store CR string, for some reason \n is not platform independent.
* @deprecated Use {@link System#lineSeparator()}. */
@Deprecated(forRemoval = true)
protected static String CR;

/** formatting strings for indenting */
Expand Down Expand Up @@ -825,10 +827,12 @@ public static boolean[] copyBooleanArray(boolean[] original){
/**
* Return a string containing the platform-appropriate
* characters for carriage return.
* @deprecated Use {@link System#lineSeparator()}.
*/
@Deprecated(forRemoval = true)
public static String cr() {
if (CR == null) {
CR = PrivilegedAccessHelper.getSystemProperty("line.separator");
CR = System.lineSeparator();
}
return CR;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
// - 500441: Eclipselink core has System.getProperty() calls that are not potentially executed under doPriv()
package org.eclipse.persistence.internal.oxm;

import org.eclipse.persistence.internal.security.PrivilegedAccessHelper;
import org.xml.sax.Locator;

import javax.xml.namespace.QName;
Expand All @@ -31,7 +30,6 @@ public class Constants {
public static final String BOOLEAN_STRING_TRUE = "true";
public static final String CDATA = "CDATA";
public static final char COLON = ':';
private static String CR;
public static final String DEFAULT_XML_ENCODING = "UTF-8";
public static final Charset DEFAULT_CHARSET = Charset.forName(DEFAULT_XML_ENCODING);
public static final char DOT = '.';
Expand Down Expand Up @@ -185,12 +183,11 @@ public boolean isApplicationXML() {
/**
* Return a string containing the platform-appropriate
* characters for carriage return.
* @deprecated Use {@link System#lineSeparator()}.
*/
@Deprecated(forRemoval = true)
public static String cr() {
if (CR == null) {
CR = PrivilegedAccessHelper.getSystemProperty("line.separator");
}
return CR;
return System.lineSeparator();
}

}

0 comments on commit 81e4e14

Please sign in to comment.