Skip to content

Commit

Permalink
Fix: disable pmdTest and fix PMD errors
Browse files Browse the repository at this point in the history
  • Loading branch information
yatharthranjan committed Jul 9, 2024
1 parent eb9fcf9 commit 2343690
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 10 deletions.
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -207,3 +207,7 @@ tasks.named("dependencyUpdates").configure {
isNonStable(it.candidate.version)
}
}

pmd {
sourceSets = [sourceSets.main]
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package org.radarbase.appserver.exception;

public class EmailMessageTransmitException extends MessageTransmitException {

private static final long serialVersionUID = -1927189245766939L;

public EmailMessageTransmitException(String message) {
super(message);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package org.radarbase.appserver.exception;

public class FcmMessageTransmitException extends MessageTransmitException {

private static final long serialVersionUID = -923871442166939L;

public FcmMessageTransmitException(String message) {
super(message);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.radarbase.appserver.service.FcmNotificationService;
import org.radarbase.appserver.service.MessageType;
import org.radarbase.appserver.service.transmitter.DataMessageTransmitter;
import org.radarbase.appserver.service.transmitter.EmailNotificationTransmitter;
import org.radarbase.appserver.service.transmitter.FcmTransmitter;
import org.radarbase.appserver.service.transmitter.NotificationTransmitter;

Expand Down Expand Up @@ -123,17 +124,15 @@ public void execute(JobExecutionContext context) throws JobExecutionException {
} catch (Exception e) {
log.error("Could not transmit a message", e);
throw new JobExecutionException("Could not transmit a message", e);
} finally {
// Here handle the exceptions that occurred while transmitting the message via the
// transmitters. At present, only the FcmTransmitter affects the job execution state.
Optional<Exception> fcmException = exceptions.stream()
.filter(e -> e instanceof FcmMessageTransmitException)
.findFirst();
if (fcmException.isPresent()) {
throw new JobExecutionException("Could not transmit a message", fcmException.get());
}
}

// Here handle the exceptions that occurred while transmitting the message via the
// transmitters. At present, only the FcmTransmitter affects the job execution state.
Optional<Exception> fcmException = exceptions.stream()
.filter(e -> e instanceof FcmMessageTransmitException)
.findFirst();
if (fcmException.isPresent()) {
throw new JobExecutionException("Could not transmit a message", fcmException.get());
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

@Slf4j
@Component
@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
public class FcmTransmitter implements NotificationTransmitter, DataMessageTransmitter {

protected static final boolean IS_DELIVERY_RECEIPT_REQUESTED = true;
Expand Down

0 comments on commit 2343690

Please sign in to comment.