Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanseifert committed Jun 20, 2022
2 parents f765e37 + c34d974 commit 700b7f2
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 9 deletions.
6 changes: 6 additions & 0 deletions changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/plugins/maven-changes-plugin/xsd/changes-1.0.0.xsd">
<body>

<release version="2.1.2" date="2022-06-20">
<action type="fix" dev="sseifert">
Add explicit handling for responses with invalid JSON payload for packager manager install status and bundle status calls.
</action>
</release>

<release version="2.1.0" date="2022-06-16">
<action type="add" dev="sseifert">
Check package manager installstatus.jsp before and after installation of content package to make sure packager manager is also completed with installing embedded packages.
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

<groupId>io.wcm.tooling.commons</groupId>
<artifactId>io.wcm.tooling.commons.crx-packmgr-helper</artifactId>
<version>2.1.0</version>
<version>2.1.2</version>
<packaging>jar</packaging>

<name>CRX Package Manager Helper</name>
Expand All @@ -48,7 +48,7 @@
<site.url.module.prefix>tooling/commons/crx-packmgr-helper</site.url.module.prefix>

<!-- Enable reproducible builds -->
<project.build.outputTimestamp>2022-06-16T17:01:06Z</project.build.outputTimestamp>
<project.build.outputTimestamp>2022-06-20T10:50:19Z</project.build.outputTimestamp>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.util.EntityUtils;
import org.json.JSONException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -80,8 +81,13 @@ public BundleStatus execute() {
}

private BundleStatus toBundleStatus(String jsonString) {
BundleStatusParser parser = new BundleStatusParser(bundleStatusWhitelistBundleNames);
return parser.parse(jsonString);
try {
BundleStatusParser parser = new BundleStatusParser(bundleStatusWhitelistBundleNames);
return parser.parse(jsonString);
}
catch (JSONException ex) {
throw PackageManagerHttpActionException.forJSONException(bundleStatusURL, jsonString, ex);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.util.EntityUtils;
import org.json.JSONException;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -79,11 +80,16 @@ private PackageManagerInstallStatus toPackageManagerInstallStatus(String jsonStr
boolean finished = false;
int itemCount = 0;

JSONObject json = new JSONObject(jsonString);
JSONObject status = json.optJSONObject("status");
if (status != null) {
finished = status.optBoolean("finished");
itemCount = status.optInt("itemCount");
try {
JSONObject json = new JSONObject(jsonString);
JSONObject status = json.optJSONObject("status");
if (status != null) {
finished = status.optBoolean("finished");
itemCount = status.optInt("itemCount");
}
}
catch (JSONException ex) {
throw PackageManagerHttpActionException.forJSONException(packageManagerInstallStatusURL, jsonString, ex);
}

return new PackageManagerInstallStatus(finished, itemCount);
Expand Down

0 comments on commit 700b7f2

Please sign in to comment.