Skip to content

Commit

Permalink
LPD-15632 Fix ObjectEntryLocalServiceTest.testAddObjectEntryWithEncry…
Browse files Browse the repository at this point in the history
…ptedObjectField() javax.crypto.Cipher.getInstance(String)'s exception message has changed
  • Loading branch information
shuyangzhou authored and brianchandotcom committed Jan 28, 2024
1 parent eb673d3 commit 749484f
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
import com.liferay.portal.kernel.util.ContentTypes;
import com.liferay.portal.kernel.util.FileUtil;
import com.liferay.portal.kernel.util.HashMapBuilder;
import com.liferay.portal.kernel.util.JavaDetector;
import com.liferay.portal.kernel.util.LinkedHashMapBuilder;
import com.liferay.portal.kernel.util.ListUtil;
import com.liferay.portal.kernel.util.LocaleUtil;
Expand Down Expand Up @@ -1155,7 +1156,7 @@ public void testAddObjectEntryWithEncryptedObjectField() throws Exception {
EncryptorException.class.getName(), ": ",
EncryptorException.class.getName(), ": ",
NoSuchAlgorithmException.class.getName(),
": Invalid transformation format:"),
_getNoSuchAlgorithmExceptionMessage()),
() -> _objectEntryLocalService.getValues(
objectEntry.getObjectEntryId()));

Expand All @@ -1165,7 +1166,7 @@ public void testAddObjectEntryWithEncryptedObjectField() throws Exception {
EncryptorException.class.getName(), ": ",
EncryptorException.class.getName(), ": ",
NoSuchAlgorithmException.class.getName(),
": Invalid transformation format:"),
_getNoSuchAlgorithmExceptionMessage()),
() -> _addObjectEntry(
HashMapBuilder.<String, Serializable>put(
"emailAddress", RandomTestUtil.randomString()
Expand Down Expand Up @@ -3229,6 +3230,14 @@ private BigDecimal _getBigDecimal(long value) {
return BigDecimalUtil.stripTrailingZeros(BigDecimal.valueOf(value));
}

private String _getNoSuchAlgorithmExceptionMessage() {
if (JavaDetector.isJDK21()) {
return ": Null or empty transformation";
}

return ": Invalid transformation format:";
}

private Map<String, Serializable> _getValuesFromCacheField(
ObjectEntry objectEntry)
throws Exception {
Expand Down

0 comments on commit 749484f

Please sign in to comment.