Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-144745

ReleaseInfo should provide access to the exact version (also for DXP)

    Details

      Description

      com.liferay.portal.kernel.util.ReleaseInfo internally has access to release information including the installed update (for 7.4). This is not exposed. In order to figure out the exact version at runtime, you'd either need to parse the output of ReleaseInfo.getReleaseInfo() (which concatenates all kinds of information, currently to 97 characters), or use the following Reflection code:

      Class<ReleaseInfo> clazz = ReleaseInfo.class;
      Field f = clazz.getDeclaredField("_VERSION_DISPLAY_NAME");
      f.setAccessible(true);
      String version = f.get(null).toString();

      (add exception handling to taste)

      Result in this case, for example: "7.4.13 Update 1"

      This is not particularly pretty code, but the only method I've found to detect the exact version at runtime that doesn't rely on parsing whatever format ReleaseInfo.getReleaseInfo() returns.

      The information is valuable and should be provided by ReleaseInfo without jumping through hoops.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              support-lep@liferay.com SE Support
              Reporter:
              olaf.kock Olaf Kock
              Participants of an Issue:
              Recent user:
              Olaf Kock
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                15 weeks, 5 days ago

                  Packages

                  Version Package