aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-03-14 09:31:13 +0300
committerGravatar Vitaly Takmazov2018-03-14 09:31:13 +0300
commitb1e8980ed1460340fe4e8db2ce0d7ee1d213854a (patch)
treecd4d2ff004863d2c74736ea0d5790d8ef60fa4b1
parent876f07840f6fa73e6f2ca0350d4ca8922c869075 (diff)
cleanup or supress warnings
-rw-r--r--juick-notifications/src/test/java/com/juick/components/test/NotificationTests.java1
-rw-r--r--juick-server/src/main/java/com/juick/server/api/rss/MessagesView.java1
-rw-r--r--juick-server/src/main/java/com/juick/server/api/rss/RepliesView.java3
-rw-r--r--juick-server/src/main/java/com/juick/server/api/rss/extension/JuickModuleGenerator.java8
-rw-r--r--juick-server/src/main/java/com/juick/server/xmpp/s2s/util/DialbackUtils.java5
-rw-r--r--juick-www/src/main/java/com/mitchellbosecke/pebble/extension/filters/TagsListFilter.java1
6 files changed, 12 insertions, 7 deletions
diff --git a/juick-notifications/src/test/java/com/juick/components/test/NotificationTests.java b/juick-notifications/src/test/java/com/juick/components/test/NotificationTests.java
index 9688e935..f1a4787d 100644
--- a/juick-notifications/src/test/java/com/juick/components/test/NotificationTests.java
+++ b/juick-notifications/src/test/java/com/juick/components/test/NotificationTests.java
@@ -57,6 +57,7 @@ public class NotificationTests {
MockitoAnnotations.initMocks(this);
}
+ @SuppressWarnings("unchecked")
@Test
public void CleanUpTest() {
when(push.getInvalidAPNSTokens()).thenReturn(Collections.singleton("yoyo"));
diff --git a/juick-server/src/main/java/com/juick/server/api/rss/MessagesView.java b/juick-server/src/main/java/com/juick/server/api/rss/MessagesView.java
index 7be9ec09..9e1de074 100644
--- a/juick-server/src/main/java/com/juick/server/api/rss/MessagesView.java
+++ b/juick-server/src/main/java/com/juick/server/api/rss/MessagesView.java
@@ -62,6 +62,7 @@ public class MessagesView extends AbstractRssFeedView {
setContentType("application/rss+xml;charset=UTF-8");
}
+ @SuppressWarnings("unchecked")
@Override
protected List<Item> buildFeedItems(@Nonnull Map<String, Object> model,
@Nonnull HttpServletRequest request,
diff --git a/juick-server/src/main/java/com/juick/server/api/rss/RepliesView.java b/juick-server/src/main/java/com/juick/server/api/rss/RepliesView.java
index a5411397..b1e813c4 100644
--- a/juick-server/src/main/java/com/juick/server/api/rss/RepliesView.java
+++ b/juick-server/src/main/java/com/juick/server/api/rss/RepliesView.java
@@ -56,8 +56,9 @@ public class RepliesView extends AbstractRssFeedView {
setContentType("application/rss+xml;charset=UTF-8");
}
+ @SuppressWarnings("unchecked")
@Override
- protected List<Item> buildFeedItems(@Nonnull Map<String, Object> model,
+ protected @Nonnull List<Item> buildFeedItems(@Nonnull Map<String, Object> model,
@Nonnull HttpServletRequest request,
@Nonnull HttpServletResponse response) {
List<ResponseReply> msgs = (List<ResponseReply>)model.get("messages");
diff --git a/juick-server/src/main/java/com/juick/server/api/rss/extension/JuickModuleGenerator.java b/juick-server/src/main/java/com/juick/server/api/rss/extension/JuickModuleGenerator.java
index eb103136..90dec35f 100644
--- a/juick-server/src/main/java/com/juick/server/api/rss/extension/JuickModuleGenerator.java
+++ b/juick-server/src/main/java/com/juick/server/api/rss/extension/JuickModuleGenerator.java
@@ -38,16 +38,16 @@ public class JuickModuleGenerator implements ModuleGenerator {
return JuickModule.URI;
}
- private static final Set NAMESPACES;
+ private static final Set<Namespace> NAMESPACES;
static {
- Set nss = new HashSet();
+ Set<Namespace> nss = new HashSet<>();
nss.add(JUICK_NS);
NAMESPACES = Collections.unmodifiableSet(nss);
}
@Override
- public Set getNamespaces() {
+ public Set<Namespace> getNamespaces() {
return NAMESPACES;
}
@@ -56,7 +56,7 @@ public class JuickModuleGenerator implements ModuleGenerator {
// this is not necessary, it is done to avoid the namespace definition in every item.
Element root = element;
while (root.getParent()!=null && root.getParent() instanceof Element) {
- root = (Element) element.getParent();
+ root = element.getParentElement();
}
root.addNamespaceDeclaration(JUICK_NS);
diff --git a/juick-server/src/main/java/com/juick/server/xmpp/s2s/util/DialbackUtils.java b/juick-server/src/main/java/com/juick/server/xmpp/s2s/util/DialbackUtils.java
index 71405f34..d25dbad8 100644
--- a/juick-server/src/main/java/com/juick/server/xmpp/s2s/util/DialbackUtils.java
+++ b/juick-server/src/main/java/com/juick/server/xmpp/s2s/util/DialbackUtils.java
@@ -18,6 +18,7 @@
package com.juick.server.xmpp.s2s.util;
import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.commons.codec.digest.HmacAlgorithms;
import org.apache.commons.codec.digest.HmacUtils;
import rocks.xmpp.addr.Jid;
@@ -30,7 +31,7 @@ public class DialbackUtils {
}
public static String generateDialbackKey(String secret, Jid to, Jid from, String id) {
- return HmacUtils.hmacSha256Hex(DigestUtils.sha256(secret),
- (to.toEscapedString() + " " + from.toEscapedString() + " " + id).getBytes());
+ return new HmacUtils(HmacAlgorithms.HMAC_SHA_256, DigestUtils.sha256(secret))
+ .hmacHex(to.toEscapedString() + " " + from.toEscapedString() + " " + id);
}
}
diff --git a/juick-www/src/main/java/com/mitchellbosecke/pebble/extension/filters/TagsListFilter.java b/juick-www/src/main/java/com/mitchellbosecke/pebble/extension/filters/TagsListFilter.java
index 02953f79..bfbf18fb 100644
--- a/juick-www/src/main/java/com/mitchellbosecke/pebble/extension/filters/TagsListFilter.java
+++ b/juick-www/src/main/java/com/mitchellbosecke/pebble/extension/filters/TagsListFilter.java
@@ -28,6 +28,7 @@ import java.util.stream.Collectors;
* Created by vitalyster on 23.05.2017.
*/
public class TagsListFilter implements Filter {
+ @SuppressWarnings("unchecked")
@Override
public Object apply(Object input, Map<String, Object> args) {
return ((List<Tag>) input).stream().map(Tag::getName).collect(Collectors.toList());