Skip to content

Commit 496cd11

Browse files
authored
Fix NPE in report environment for older Coherence versions (#29)
* Fix NPE in report environment for older Coh versions * Fixup sonarcloud complaint * update workflow
1 parent fba5e95 commit 496cd11

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

.github/workflows/test-against-released.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2020, 2022 Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -44,10 +44,8 @@ jobs:
4444
version:
4545
- 14.1.1-0-10
4646
- 14.1.1-0-9
47-
- 21.06.1
48-
- 21.12.4
49-
- 22.06.1
5047
- 22.06.2
48+
- 22.09
5149

5250
steps:
5351
- name: Checkout
@@ -63,7 +61,7 @@ jobs:
6361
- name: Set up JDK 11 for Build
6462
uses: actions/setup-java@v1
6563
with:
66-
java-version: '11'
64+
java-version: '17'
6765

6866
- name: Print Versions
6967
run: mvn -version && ant -version

coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/panel/CoherenceMemberPanel.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
package com.oracle.coherence.plugin.visualvm.panel;
2727

2828

29+
import com.oracle.coherence.plugin.visualvm.Localization;
2930
import com.oracle.coherence.plugin.visualvm.helper.GraphHelper;
3031
import com.oracle.coherence.plugin.visualvm.helper.RenderHelper;
3132
import com.oracle.coherence.plugin.visualvm.helper.RequestSender;
@@ -636,12 +637,19 @@ public String getMenuItem()
636637
/**
637638
* Return a sanitized message to make common errors more meaningful.
638639
* @param e {@link Exception} to get message from
640+
*
639641
* @return final message
640642
*/
641643
private String getSanitizedMessage(Exception e)
642644
{
643645
String sError = e.getMessage();
644-
return sError.contains("name cannot be null") ? "Node no longer available." : sError;
646+
647+
if (sError == null)
648+
{
649+
return Localization.getLocalText("LBL_operation_not_available");
650+
}
651+
652+
return sError.contains("name cannot be null") ? Localization.getLocalText("LBL_node_not_available") : sError;
645653
}
646654

647655
// ----- constants ------------------------------------------------------

coherence-visualvm-plugin/src/main/resources/com/oracle/coherence/plugin/visualvm/Bundle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ LBL_thread_dump_completed=Completed.
126126
LBL_copy_to_clipboard=Copy contents to Clipboard
127127
LBL_copied=Data has been copied to the Clipboard.
128128
LBL_data_saved=Thread Dump has been saved to {0}.
129+
LBL_operation_not_available=Operation is not available in this version.
130+
LBL_node_not_available=Node no longer available.
129131

130132
# CoherencePersistencePanel
131133
LBL_total_active_space=Total Active Persistence Space Used (MB)

0 commit comments

Comments
 (0)