Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: The field StringPool.SLASH is deprecated
Hi, I have imported a project into Liferay developer studio and appear some java errors like this:
The field StringPool.SLASH is deprecated
on this code:
for(String val : orderValue.split("###")){
if(val.contains(StringPool.SLASH)){
// parent category
String category =
val.substring(0 , val.indexOf(StringPool.SLASH));
// order per catalog
String order =
val.substring(val.indexOf(StringPool.SLASH)+1);
How can I update this code?
1. this is a deprecation warning, not an error. You can just leave it as is, or ignore it.
2. Which version are you talking about? I've checked the DXP 7.3 source code, and don't see deprecation there
3. What I see in that code is
public static final String SLASH = FORWARD_SLASH;
- so you might want to be more explicit than "slash" and explicitly reference "forward-slash" as opposed to backslash
Of course, you can always test for "/" occurrences.
Ok. My version is liferay-commerce-2.0.5
Thanks for your response.
May be it is because StringPool is now in the package com.liferay.petra.string.StringPool.
The dependency is now :
<dependency>
<groupId>com.liferay</groupId>
<artifactId>com.liferay.petra.string</artifactId>
<scope>provided</scope>
</dependency>
The 6.2 class com.liferay.portal.kernel.util.StringPool is deprecated.
When Liferay move classes from the kernel to a module, the older classes are first deprecated and after they are deleted.