Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#82: ClassCastException after Plugin update on DC #88

Merged
merged 16 commits into from
Sep 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up Java
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
'distribution': adopt
java-version: '11'
- name: Build with Maven
run: mvn -B package --file pom.xml
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ jobs:
uses: actions/checkout@v2

- name: Set up Java
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
'distribution': adopt
java-version: '11'

- name: Build with Maven 🔧
Expand Down
13 changes: 10 additions & 3 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ Allows confluence users to write contracts in a confluence macro which can be si
- easily send email to signers of the contract
- receive notifications, when your contract was signed

## ClassCastException issue
![ClassCastException in Macro](./docs/img/classcastexception.png)

If you observe issues in the Macro resulting in a `ClassCastException` please update digital-signature to version 7.0.5,
clear the plugin cache (one last time) and restart confluence.

For background information please refer to [#82](https://github.com/baloise/digital-signature/issues/82)
and ['How to clear Confluence plugins cache'](https://confluence.atlassian.com/confkb/how-to-clear-confluence-plugins-cache-297664846.html).

## Privacy Policy
- We do not transfer or store any data outside your Atlassian product.
- We have no access to any data you stored within your Atlassian product.
Expand All @@ -25,8 +34,6 @@ the [Wiki...](https://github.com/baloise/digital-signature/wiki/Signature-Macro-

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

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

### Mail notification
![](./docs/img/report_email_export.png)
![](./docs/img/send_mail.png.png)
![](./docs/img/send_mail.png)

## Contribute
Keep it simple: every contribution is welcome. Either if you report an issue, help on solving one, or contribute to the
Expand Down
42 changes: 0 additions & 42 deletions development.md

This file was deleted.

30 changes: 30 additions & 0 deletions docs/docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
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):

```bash
mkdir -p $HOME/docker/volumes/postgres
mkdir -p $HOME/docker/volumes/confluence
docker run --name postgres \
-v $HOME/docker/volumes/postgres:/var/lib/postgresql/data \
-e POSTGRES_PASSWORD=mysecretpassword \
-d postgres
docker run --name=confluence \
-v $HOME/docker/volumes/confluence:/var/atlassian/application-data/confluence \
-d \
-p 8090:8090 \
-p 8091:8091 \
-p 5005:5005 \
-e JVM_SUPPORT_RECOMMENDED_ARGS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005" \
atlassian/confluence-server:latest
docker inspect postgres | grep IPAddress # get the IP address of the postgres container
```

Start confluence setup and configure Postgres:
- jdbc:postgresql://192.168.65.2:5432/postgres (`docker inspect postgres | grep IP` to get ip address)
- in case of IP change search and replace in `/var/atlassian/application-data/confluence.cfg.xml`
- user: postgres
- password: mysecretpassword (defined above)

![](img/db.png)

- Skip tutorial
- Create new space "Test"
Binary file added docs/img/classcastexception.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/db.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions lombok.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
config.stopBubbling = true
lombok.addLombokGeneratedAnnotation = true
78 changes: 41 additions & 37 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,24 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<name>digital-signature</name>
<description>This is the com.baloise.confluence:digital-signature plugin for Atlassian Confluence.</description>
<packaging>atlassian-plugin</packaging>
<modelVersion>4.0.0</modelVersion>
<groupId>com.baloise.confluence</groupId>
<artifactId>digital-signature</artifactId>
<version>7.0.5</version>

<organization>
<name>Baloise</name>
<url>http://www.baloise.ch/</url>
</organization>

<name>digital-signature</name>
<description>This is the com.baloise.confluence:digital-signature plugin for Atlassian Confluence.</description>
<packaging>atlassian-plugin</packaging>

<issueManagement>
<system>Github</system>
<url>https://github.com/baloise/digital-signature/issues</url>
</issueManagement>

<scm>
<connection>scm:git:https://github.com/baloise/digital-signature.git</connection>
<developerConnection>scm:git:https://github.com/baloise/digital-signature.git</developerConnection>
Expand All @@ -31,30 +32,21 @@
<dependency>
<groupId>com.vladsch.flexmark</groupId>
<artifactId>flexmark</artifactId>
<version>0.60.2</version>
<version>0.62.2</version>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<scope>test</scope>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.9</version>
</dependency>

<dependency>
<groupId>com.atlassian.confluence</groupId>
<artifactId>confluence</artifactId>
<version>${confluence.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.atlassian.mywork</groupId>
<artifactId>mywork-api</artifactId>
<version>1.0.2</version>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.22</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-annotation</artifactId>
Expand All @@ -69,42 +61,54 @@
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>com.atlassian.confluence</groupId>
<artifactId>confluence</artifactId>
<version>${confluence.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.mywork</groupId>
<artifactId>mywork-api</artifactId>
<version>1.0.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>2.0.0-alpha1</version>
<scope>test</scope>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>1.1.1</version>
<scope>provided</scope>
</dependency>

<!-- WIRED TEST RUNNER DEPENDENCIES -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.atlassian.plugins</groupId>
<artifactId>atlassian-plugins-osgi-testrunner</artifactId>
<version>${plugin.testrunner.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>1.1.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.2-atlassian-1</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.0</version>
<version>1.10.19</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>2.0.0-alpha1</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,59 +11,59 @@
import static java.lang.String.format;

public class ContextHelper {
public Object getOrderedSignatures(Signature signature) {
SortedSet<Entry<String, Date>> ret = new TreeSet<>(Comparator.comparing((Function<Entry<String, Date>, Date>) Entry::getValue)
.thenComparing(Entry::getKey));
ret.addAll(signature.getSignatures().entrySet());
return ret;
}
public Object getOrderedSignatures(Signature2 signature) {
SortedSet<Entry<String, Date>> ret = new TreeSet<>(Comparator.comparing((Function<Entry<String, Date>, Date>) Entry::getValue)
.thenComparing(Entry::getKey));
ret.addAll(signature.getSignatures().entrySet());
return ret;
}

@SafeVarargs
public final <K, V> Map<K, V> union(Map<K, V>... maps) {
Map<K, V> union = new HashMap<>();
for (Map<K, V> map : maps) {
union.putAll(map);
}
return union;
@SafeVarargs
public final <K, V> Map<K, V> union(Map<K, V>... maps) {
Map<K, V> union = new HashMap<>();
for (Map<K, V> map : maps) {
union.putAll(map);
}
return union;
}

@SafeVarargs
public final <K> Set<K> union(Set<K>... sets) {
Set<K> union = new HashSet<>();
for (Set<K> set : sets) {
union.addAll(set);
}
return union;
@SafeVarargs
public final <K> Set<K> union(Set<K>... sets) {
Set<K> union = new HashSet<>();
for (Set<K> set : sets) {
union.addAll(set);
}
return union;
}

public Map<String, UserProfile> getProfiles(UserManager userManager, Set<String> userNames) {
Map<String, UserProfile> ret = new HashMap<>();
if (Signature.isPetitionMode(userNames)) return ret;
for (String userName : userNames) {
ret.put(userName, getProfileNotNull(userManager, userName));
}
return ret;
public Map<String, UserProfile> getProfiles(UserManager userManager, Set<String> userNames) {
Map<String, UserProfile> ret = new HashMap<>();
if (Signature2.isPetitionMode(userNames)) return ret;
for (String userName : userNames) {
ret.put(userName, getProfileNotNull(userManager, userName));
}
return ret;
}

public UserProfile getProfileNotNull(UserManager userManager, String userName) {
UserProfile profile = userManager.getUserProfile(userName);
return profile == null ? new DummyProfile(userName) : profile;
}
public UserProfile getProfileNotNull(UserManager userManager, String userName) {
UserProfile profile = userManager.getUserProfile(userName);
return profile == null ? new DummyProfile(userName) : profile;
}

public SortedSet<UserProfile> getOrderedProfiles(UserManager userManager, Set<String> userNames) {
SortedSet<UserProfile> ret = new TreeSet<>(new UserProfileByName());
if (Signature.isPetitionMode(userNames)) return ret;
for (String userName : userNames) {
ret.add(getProfileNotNull(userManager, userName));
}
return ret;
public SortedSet<UserProfile> getOrderedProfiles(UserManager userManager, Set<String> userNames) {
SortedSet<UserProfile> ret = new TreeSet<>(new UserProfileByName());
if (Signature2.isPetitionMode(userNames)) return ret;
for (String userName : userNames) {
ret.add(getProfileNotNull(userManager, userName));
}
return ret;
}

public String mailTo(UserProfile profile) {
return format("%s<%s>", profile.getFullName().trim(), profile.getEmail().trim());
}
public String mailTo(UserProfile profile) {
return format("%s<%s>", profile.getFullName().trim(), profile.getEmail().trim());
}

public boolean hasEmail(UserProfile profile) {
return profile != null && profile.getEmail() != null && !profile.getEmail().trim().isEmpty();
}
public boolean hasEmail(UserProfile profile) {
return profile != null && profile.getEmail() != null && !profile.getEmail().trim().isEmpty();
}
}
Loading
Loading