Skip to content

Commit 6409687

Browse files
authored
Merge pull request baloise#88 from baloise/feature/82_cache-issue
baloise#82: ClassCastException after Plugin update on DC
2 parents a04afba + 49243e8 commit 6409687

36 files changed

+1387
-1039
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@v2
1515
- name: Set up Java
16-
uses: actions/setup-java@v1
16+
uses: actions/setup-java@v3
1717
with:
18+
'distribution': adopt
1819
java-version: '11'
1920
- name: Build with Maven
2021
run: mvn -B package --file pom.xml

.github/workflows/release.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ jobs:
1414
uses: actions/checkout@v2
1515

1616
- name: Set up Java
17-
uses: actions/setup-java@v1
17+
uses: actions/setup-java@v3
1818
with:
19+
'distribution': adopt
1920
java-version: '11'
2021

2122
- name: Build with Maven 🔧

README.MD

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ Allows confluence users to write contracts in a confluence macro which can be si
1212
- easily send email to signers of the contract
1313
- receive notifications, when your contract was signed
1414

15+
## ClassCastException issue
16+
![ClassCastException in Macro](./docs/img/classcastexception.png)
17+
18+
If you observe issues in the Macro resulting in a `ClassCastException` please update digital-signature to version 7.0.5,
19+
clear the plugin cache (one last time) and restart confluence.
20+
21+
For background information please refer to [#82](https://github.com/baloise/digital-signature/issues/82)
22+
and ['How to clear Confluence plugins cache'](https://confluence.atlassian.com/confkb/how-to-clear-confluence-plugins-cache-297664846.html).
23+
1524
## Privacy Policy
1625
- We do not transfer or store any data outside your Atlassian product.
1726
- We have no access to any data you stored within your Atlassian product.
@@ -25,8 +34,6 @@ the [Wiki...](https://github.com/baloise/digital-signature/wiki/Signature-Macro-
2534

2635
## Using Confluence Data Center Version
2736
Digital-signature can be used on Confluence Data Center, however it is not yet officially tested and approved.
28-
When performing an update you might have to invalidate the plugin cache and restart Confluence. For details refer
29-
to [#68](https://github.com/baloise/digital-signature/issues/68).
3037

3138
## Feature overview
3239
### Insert / edit macro
@@ -45,7 +52,7 @@ to [#68](https://github.com/baloise/digital-signature/issues/68).
4552

4653
### Mail notification
4754
![](./docs/img/report_email_export.png)
48-
![](./docs/img/send_mail.png.png)
55+
![](./docs/img/send_mail.png)
4956

5057
## Contribute
5158
Keep it simple: every contribution is welcome. Either if you report an issue, help on solving one, or contribute to the

development.md

Lines changed: 0 additions & 42 deletions
This file was deleted.

docs/docker.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Setup following a [tutorial from coffeetime.solutions]( http://coffeetime.solutions/run-atlassian-jira-and-confluence-with-postgresql-on-docker/#Overview_of_series_How_to_run_Jira_and_Confluence_behind_NGINX_reverse_proxy_on_Docker):
2+
3+
```bash
4+
mkdir -p $HOME/docker/volumes/postgres
5+
mkdir -p $HOME/docker/volumes/confluence
6+
docker run --name postgres \
7+
-v $HOME/docker/volumes/postgres:/var/lib/postgresql/data \
8+
-e POSTGRES_PASSWORD=mysecretpassword \
9+
-d postgres
10+
docker run --name=confluence \
11+
-v $HOME/docker/volumes/confluence:/var/atlassian/application-data/confluence \
12+
-d \
13+
-p 8090:8090 \
14+
-p 8091:8091 \
15+
-p 5005:5005 \
16+
-e JVM_SUPPORT_RECOMMENDED_ARGS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005" \
17+
atlassian/confluence-server:latest
18+
docker inspect postgres | grep IPAddress # get the IP address of the postgres container
19+
```
20+
21+
Start confluence setup and configure Postgres:
22+
- jdbc:postgresql://192.168.65.2:5432/postgres (`docker inspect postgres | grep IP` to get ip address)
23+
- in case of IP change search and replace in `/var/atlassian/application-data/confluence.cfg.xml`
24+
- user: postgres
25+
- password: mysecretpassword (defined above)
26+
27+
![](img/db.png)
28+
29+
- Skip tutorial
30+
- Create new space "Test"

docs/img/classcastexception.png

40.8 KB
Loading

docs/img/db.png

45.7 KB
Loading

lombok.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
config.stopBubbling = true
2+
lombok.addLombokGeneratedAnnotation = true

pom.xml

Lines changed: 41 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,24 @@
44
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
55
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
66

7+
<name>digital-signature</name>
8+
<description>This is the com.baloise.confluence:digital-signature plugin for Atlassian Confluence.</description>
9+
<packaging>atlassian-plugin</packaging>
710
<modelVersion>4.0.0</modelVersion>
811
<groupId>com.baloise.confluence</groupId>
912
<artifactId>digital-signature</artifactId>
1013
<version>7.0.5</version>
14+
1115
<organization>
1216
<name>Baloise</name>
1317
<url>http://www.baloise.ch/</url>
1418
</organization>
1519

16-
<name>digital-signature</name>
17-
<description>This is the com.baloise.confluence:digital-signature plugin for Atlassian Confluence.</description>
18-
<packaging>atlassian-plugin</packaging>
19-
2020
<issueManagement>
2121
<system>Github</system>
2222
<url>https://github.com/baloise/digital-signature/issues</url>
2323
</issueManagement>
24+
2425
<scm>
2526
<connection>scm:git:https://github.com/baloise/digital-signature.git</connection>
2627
<developerConnection>scm:git:https://github.com/baloise/digital-signature.git</developerConnection>
@@ -31,30 +32,21 @@
3132
<dependency>
3233
<groupId>com.vladsch.flexmark</groupId>
3334
<artifactId>flexmark</artifactId>
34-
<version>0.60.2</version>
35+
<version>0.62.2</version>
3536
</dependency>
3637

3738
<dependency>
38-
<groupId>junit</groupId>
39-
<artifactId>junit</artifactId>
40-
<version>4.13.1</version>
41-
<scope>test</scope>
39+
<groupId>com.google.code.gson</groupId>
40+
<artifactId>gson</artifactId>
41+
<version>2.8.9</version>
4242
</dependency>
4343

4444
<dependency>
45-
<groupId>com.atlassian.confluence</groupId>
46-
<artifactId>confluence</artifactId>
47-
<version>${confluence.version}</version>
48-
<scope>provided</scope>
49-
</dependency>
50-
51-
<dependency>
52-
<groupId>com.atlassian.mywork</groupId>
53-
<artifactId>mywork-api</artifactId>
54-
<version>1.0.2</version>
45+
<groupId>org.projectlombok</groupId>
46+
<artifactId>lombok</artifactId>
47+
<version>1.18.22</version>
5548
<scope>provided</scope>
5649
</dependency>
57-
5850
<dependency>
5951
<groupId>com.atlassian.plugin</groupId>
6052
<artifactId>atlassian-spring-scanner-annotation</artifactId>
@@ -69,42 +61,54 @@
6961
<scope>runtime</scope>
7062
</dependency>
7163

64+
<dependency>
65+
<groupId>com.atlassian.confluence</groupId>
66+
<artifactId>confluence</artifactId>
67+
<version>${confluence.version}</version>
68+
<scope>provided</scope>
69+
</dependency>
70+
<dependency>
71+
<groupId>com.atlassian.mywork</groupId>
72+
<artifactId>mywork-api</artifactId>
73+
<version>1.0.2</version>
74+
<scope>provided</scope>
75+
</dependency>
7276
<dependency>
7377
<groupId>javax.inject</groupId>
7478
<artifactId>javax.inject</artifactId>
7579
<version>1</version>
7680
<scope>provided</scope>
7781
</dependency>
78-
7982
<dependency>
80-
<groupId>org.slf4j</groupId>
81-
<artifactId>slf4j-simple</artifactId>
82-
<version>2.0.0-alpha1</version>
83-
<scope>test</scope>
83+
<groupId>javax.ws.rs</groupId>
84+
<artifactId>jsr311-api</artifactId>
85+
<version>1.1.1</version>
86+
<scope>provided</scope>
8487
</dependency>
8588

8689
<!-- WIRED TEST RUNNER DEPENDENCIES -->
90+
<dependency>
91+
<groupId>org.junit.jupiter</groupId>
92+
<artifactId>junit-jupiter-engine</artifactId>
93+
<version>5.8.2</version>
94+
<scope>test</scope>
95+
</dependency>
8796
<dependency>
8897
<groupId>com.atlassian.plugins</groupId>
8998
<artifactId>atlassian-plugins-osgi-testrunner</artifactId>
9099
<version>${plugin.testrunner.version}</version>
91100
<scope>test</scope>
92101
</dependency>
93-
<dependency>
94-
<groupId>javax.ws.rs</groupId>
95-
<artifactId>jsr311-api</artifactId>
96-
<version>1.1.1</version>
97-
<scope>provided</scope>
98-
</dependency>
99-
<dependency>
100-
<groupId>com.google.code.gson</groupId>
101-
<artifactId>gson</artifactId>
102-
<version>2.2.2-atlassian-1</version>
103-
</dependency>
104102
<dependency>
105103
<groupId>org.mockito</groupId>
106104
<artifactId>mockito-all</artifactId>
107-
<version>1.9.0</version>
105+
<version>1.10.19</version>
106+
<scope>test</scope>
107+
</dependency>
108+
<dependency>
109+
<groupId>org.slf4j</groupId>
110+
<artifactId>slf4j-simple</artifactId>
111+
<version>2.0.0-alpha1</version>
108112
<scope>test</scope>
109113
</dependency>
110114
</dependencies>

src/main/java/com/baloise/confluence/digitalsignature/ContextHelper.java

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -11,59 +11,59 @@
1111
import static java.lang.String.format;
1212

1313
public class ContextHelper {
14-
public Object getOrderedSignatures(Signature signature) {
15-
SortedSet<Entry<String, Date>> ret = new TreeSet<>(Comparator.comparing((Function<Entry<String, Date>, Date>) Entry::getValue)
16-
.thenComparing(Entry::getKey));
17-
ret.addAll(signature.getSignatures().entrySet());
18-
return ret;
19-
}
14+
public Object getOrderedSignatures(Signature2 signature) {
15+
SortedSet<Entry<String, Date>> ret = new TreeSet<>(Comparator.comparing((Function<Entry<String, Date>, Date>) Entry::getValue)
16+
.thenComparing(Entry::getKey));
17+
ret.addAll(signature.getSignatures().entrySet());
18+
return ret;
19+
}
2020

21-
@SafeVarargs
22-
public final <K, V> Map<K, V> union(Map<K, V>... maps) {
23-
Map<K, V> union = new HashMap<>();
24-
for (Map<K, V> map : maps) {
25-
union.putAll(map);
26-
}
27-
return union;
21+
@SafeVarargs
22+
public final <K, V> Map<K, V> union(Map<K, V>... maps) {
23+
Map<K, V> union = new HashMap<>();
24+
for (Map<K, V> map : maps) {
25+
union.putAll(map);
2826
}
27+
return union;
28+
}
2929

30-
@SafeVarargs
31-
public final <K> Set<K> union(Set<K>... sets) {
32-
Set<K> union = new HashSet<>();
33-
for (Set<K> set : sets) {
34-
union.addAll(set);
35-
}
36-
return union;
30+
@SafeVarargs
31+
public final <K> Set<K> union(Set<K>... sets) {
32+
Set<K> union = new HashSet<>();
33+
for (Set<K> set : sets) {
34+
union.addAll(set);
3735
}
36+
return union;
37+
}
3838

39-
public Map<String, UserProfile> getProfiles(UserManager userManager, Set<String> userNames) {
40-
Map<String, UserProfile> ret = new HashMap<>();
41-
if (Signature.isPetitionMode(userNames)) return ret;
42-
for (String userName : userNames) {
43-
ret.put(userName, getProfileNotNull(userManager, userName));
44-
}
45-
return ret;
39+
public Map<String, UserProfile> getProfiles(UserManager userManager, Set<String> userNames) {
40+
Map<String, UserProfile> ret = new HashMap<>();
41+
if (Signature2.isPetitionMode(userNames)) return ret;
42+
for (String userName : userNames) {
43+
ret.put(userName, getProfileNotNull(userManager, userName));
4644
}
45+
return ret;
46+
}
4747

48-
public UserProfile getProfileNotNull(UserManager userManager, String userName) {
49-
UserProfile profile = userManager.getUserProfile(userName);
50-
return profile == null ? new DummyProfile(userName) : profile;
51-
}
48+
public UserProfile getProfileNotNull(UserManager userManager, String userName) {
49+
UserProfile profile = userManager.getUserProfile(userName);
50+
return profile == null ? new DummyProfile(userName) : profile;
51+
}
5252

53-
public SortedSet<UserProfile> getOrderedProfiles(UserManager userManager, Set<String> userNames) {
54-
SortedSet<UserProfile> ret = new TreeSet<>(new UserProfileByName());
55-
if (Signature.isPetitionMode(userNames)) return ret;
56-
for (String userName : userNames) {
57-
ret.add(getProfileNotNull(userManager, userName));
58-
}
59-
return ret;
53+
public SortedSet<UserProfile> getOrderedProfiles(UserManager userManager, Set<String> userNames) {
54+
SortedSet<UserProfile> ret = new TreeSet<>(new UserProfileByName());
55+
if (Signature2.isPetitionMode(userNames)) return ret;
56+
for (String userName : userNames) {
57+
ret.add(getProfileNotNull(userManager, userName));
6058
}
59+
return ret;
60+
}
6161

62-
public String mailTo(UserProfile profile) {
63-
return format("%s<%s>", profile.getFullName().trim(), profile.getEmail().trim());
64-
}
62+
public String mailTo(UserProfile profile) {
63+
return format("%s<%s>", profile.getFullName().trim(), profile.getEmail().trim());
64+
}
6565

66-
public boolean hasEmail(UserProfile profile) {
67-
return profile != null && profile.getEmail() != null && !profile.getEmail().trim().isEmpty();
68-
}
66+
public boolean hasEmail(UserProfile profile) {
67+
return profile != null && profile.getEmail() != null && !profile.getEmail().trim().isEmpty();
68+
}
6969
}

0 commit comments

Comments
 (0)