From 3385b9c2ddea4aa1e4841a6566f3fc380643894d Mon Sep 17 00:00:00 2001 From: shuyangzhou Date: Wed, 10 Jan 2024 13:23:24 -0800 Subject: [PATCH] LPS-205919 JSONFactory and Language are portal-impl service, safe to use util. --- .../client/AnalyticsCloudClientImpl.java | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/modules/apps/analytics/analytics-settings-rest-impl/src/main/java/com/liferay/analytics/settings/rest/internal/client/AnalyticsCloudClientImpl.java b/modules/apps/analytics/analytics-settings-rest-impl/src/main/java/com/liferay/analytics/settings/rest/internal/client/AnalyticsCloudClientImpl.java index d9066f2162ff3a..299ea5685297f9 100644 --- a/modules/apps/analytics/analytics-settings-rest-impl/src/main/java/com/liferay/analytics/settings/rest/internal/client/AnalyticsCloudClientImpl.java +++ b/modules/apps/analytics/analytics-settings-rest-impl/src/main/java/com/liferay/analytics/settings/rest/internal/client/AnalyticsCloudClientImpl.java @@ -22,10 +22,10 @@ import com.liferay.petra.string.StringPool; import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.json.JSONArray; -import com.liferay.portal.kernel.json.JSONFactory; +import com.liferay.portal.kernel.json.JSONFactoryUtil; import com.liferay.portal.kernel.json.JSONObject; import com.liferay.portal.kernel.json.JSONUtil; -import com.liferay.portal.kernel.language.Language; +import com.liferay.portal.kernel.language.LanguageUtil; import com.liferay.portal.kernel.log.Log; import com.liferay.portal.kernel.log.LogFactoryUtil; import com.liferay.portal.kernel.model.Company; @@ -128,7 +128,8 @@ public Map connectAnalyticsDataSource( "Unable to connect analytics data source"); } - JSONObject contentJSONObject = _jsonFactory.createJSONObject(content); + JSONObject contentJSONObject = JSONFactoryUtil.createJSONObject( + content); _connectionProperties = contentJSONObject.toMap(); @@ -397,7 +398,7 @@ private JSONObject _decodeToken(String connectionToken) throws Exception { throw new IllegalArgumentException(); } - return _jsonFactory.createJSONObject( + return JSONFactoryUtil.createJSONObject( new String(Base64.decode(connectionToken))); } catch (Exception exception) { @@ -428,7 +429,7 @@ private JSONArray _getGroupsJSONArray(Group[] groups, Locale locale) catch (PortalException portalException) { _log.error(portalException); - return _language.get(locale, "unknown"); + return LanguageUtil.get(locale, "unknown"); } } ); @@ -465,12 +466,6 @@ private Http.Options _getOptions( @Reference private Http _http; - @Reference - private JSONFactory _jsonFactory; - - @Reference - private Language _language; - private static class ObjectMapperHolder { private static final ObjectMapper _objectMapper = new ObjectMapper() {