Skip to content

Commit 0d6bcc4

Browse files
authored
CCS-4351-bugfixes_NullPointerException (#579)
* fix null pointer exception
1 parent b826f54 commit 0d6bcc4

File tree

5 files changed

+15
-9
lines changed

5 files changed

+15
-9
lines changed

pantheon-bundle/src/main/java/com/redhat/pantheon/auth/keycloak/KeycloakFilter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public class KeycloakFilter extends KeycloakOIDCFilter implements Filter {
4949

5050
private static final Logger log = LoggerFactory.getLogger(KeycloakFilter.class.getName());
5151
private static final String KARAF_ETC = "karaf.etc";
52-
private static final String KEYCLOAKOIDCFILTER_CONFIG_FILE_NAME = "keycloak.json";
52+
private static final String KEYCLOAKOIDCFILTER_CONFIG_FILE_NAME = "keycloak.json";
5353
protected KeycloakDeployment keycloakDeployment;
5454
private PathBasedKeycloakConfigResolver keycloakConfigResolver;
5555
/**

pantheon-bundle/src/main/java/com/redhat/pantheon/servlet/DocumentPreviewFilter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha
5959
}
6060
// FIXME - need to rework document preview servlets to support latest suffix (variant preview servlet already works)
6161
String forwardString = firstResource.get().getPath() + ".preview/" + mode;
62-
XrefValidationHelper.initList();
62+
new XrefValidationHelper().initList();
6363
request.getRequestDispatcher(forwardString).forward(request, response);
6464
} catch (RepositoryException e) {
6565
throw new ServletException(e);

pantheon-bundle/src/main/java/com/redhat/pantheon/servlet/util/VersionUploadOperation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ protected void versionUpload(SlingHttpServletRequest request,
127127
resolver.commit();
128128

129129
Map<String, Object> context = asciidoctorService.buildContextFromRequest(request);
130-
XrefValidationHelper.initList();
130+
new XrefValidationHelper().initList();
131131
asciidoctorService.getDocumentHtml(document, localeObj, document.getWorkspace().getCanonicalVariantName(),
132132
true, context, true);
133133

pantheon-bundle/src/main/java/com/redhat/pantheon/validation/helper/XrefValidationHelper.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,24 @@
88

99
public class XrefValidationHelper {
1010

11-
private static List<String> xRefs;
11+
private List<String> xRefs;
12+
13+
public XrefValidationHelper() {
14+
initList();
15+
}
16+
17+
public List<String> getObjectsToValidate() {
1218

13-
public static List<String> getObjectsToValidate() {
1419
return xRefs;
1520
}
1621

17-
public static void initList() {
22+
public void initList() {
1823
xRefs = new ArrayList<>();
1924
}
2025

21-
public static void setObjectsToValidate(List<String> objectsToValidate) {
26+
public void setObjectsToValidate(List<String> objectsToValidate) {
2227
if(objectsToValidate.size()>0){
23-
xRefs.addAll(objectsToValidate);
28+
xRefs.addAll(objectsToValidate);
2429
}
2530
}
2631
}

pantheon-bundle/src/main/java/com/redhat/pantheon/validation/validators/XrefValidator.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ private Violations checkIfXrefValid(Violations violations) {
6767
private ErrorDetails checkXref() {
6868
ErrorDetails errorDetails = new ErrorDetails();
6969
try {
70-
List<String> xrefTargets = XrefValidationHelper.getObjectsToValidate();
70+
XrefValidationHelper xrefValidationHelper = new XrefValidationHelper();
71+
List<String> xrefTargets = xrefValidationHelper.getObjectsToValidate();
7172
if(null == xrefTargets || xrefTargets.size()==0){
7273
return errorDetails;
7374
}

0 commit comments

Comments
 (0)