diff options
22 files changed, 35 insertions, 32 deletions
diff --git a/juick-api/src/main/java/com/juick/api/configuration/ApiInitializer.java b/juick-api/src/main/java/com/juick/api/configuration/ApiInitializer.java index bc97d587..965fd32b 100644 --- a/juick-api/src/main/java/com/juick/api/configuration/ApiInitializer.java +++ b/juick-api/src/main/java/com/juick/api/configuration/ApiInitializer.java @@ -1,7 +1,7 @@ package com.juick.api.configuration; import com.juick.configuration.DataConfiguration; -import org.apache.commons.lang3.CharEncoding; +import org.apache.commons.codec.CharEncoding; import org.springframework.web.filter.CharacterEncodingFilter; import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; diff --git a/juick-crosspost/src/main/java/com/juick/components/Crosspost.java b/juick-crosspost/src/main/java/com/juick/components/Crosspost.java index d2736d85..23b8ce4f 100644 --- a/juick-crosspost/src/main/java/com/juick/components/Crosspost.java +++ b/juick-crosspost/src/main/java/com/juick/components/Crosspost.java @@ -23,9 +23,9 @@ import com.juick.Message; import com.juick.Tag; import com.juick.service.CrosspostService; import com.juick.service.MessagesService; +import org.apache.commons.codec.CharEncoding; import org.apache.commons.codec.binary.Base64; import org.apache.commons.io.IOUtils; -import org.apache.commons.lang3.CharEncoding; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.Pair; import org.slf4j.Logger; diff --git a/juick-crosspost/src/main/java/com/juick/components/configuration/CrosspostInitializer.java b/juick-crosspost/src/main/java/com/juick/components/configuration/CrosspostInitializer.java index d486e201..442bd1c8 100644 --- a/juick-crosspost/src/main/java/com/juick/components/configuration/CrosspostInitializer.java +++ b/juick-crosspost/src/main/java/com/juick/components/configuration/CrosspostInitializer.java @@ -1,7 +1,7 @@ package com.juick.components.configuration; import com.juick.configuration.DataConfiguration; -import org.apache.commons.lang3.CharEncoding; +import org.apache.commons.codec.CharEncoding; import org.springframework.web.filter.CharacterEncodingFilter; import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; diff --git a/juick-notifications/build.gradle b/juick-notifications/build.gradle index de2e4f24..7b97f05b 100644 --- a/juick-notifications/build.gradle +++ b/juick-notifications/build.gradle @@ -22,6 +22,7 @@ dependencies { compile "org.apache.httpcomponents:httpclient:4.5.3" compile "org.apache.commons:commons-lang3:3.6" + compile "org.apache.commons:commons-text:1.1" compile "rocks.xmpp:xmpp-core-client:0.7.4" compile "rocks.xmpp:xmpp-extensions-client:0.7.4" diff --git a/juick-notifications/src/main/java/com/juick/components/Notifications.java b/juick-notifications/src/main/java/com/juick/components/Notifications.java index 74ca2bb7..0a315f76 100644 --- a/juick-notifications/src/main/java/com/juick/components/Notifications.java +++ b/juick-notifications/src/main/java/com/juick/components/Notifications.java @@ -22,17 +22,14 @@ import com.google.android.gcm.server.*; import com.juick.TokensList; import com.notnoop.apns.APNS; import com.notnoop.apns.ApnsService; -import org.apache.commons.lang3.StringEscapeUtils; -import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; +import org.apache.commons.text.StringEscapeUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.HttpMethod; import org.springframework.web.client.RestTemplate; import rocks.xmpp.core.XmppException; -import rocks.xmpp.core.session.Extension; -import rocks.xmpp.core.session.XmppSessionConfiguration; import rocks.xmpp.extensions.component.accept.ExternalComponent; import javax.annotation.PostConstruct; diff --git a/juick-notifications/src/main/java/com/juick/components/configuration/NotificationsInitializer.java b/juick-notifications/src/main/java/com/juick/components/configuration/NotificationsInitializer.java index 2421f0e9..4249d988 100644 --- a/juick-notifications/src/main/java/com/juick/components/configuration/NotificationsInitializer.java +++ b/juick-notifications/src/main/java/com/juick/components/configuration/NotificationsInitializer.java @@ -1,6 +1,6 @@ package com.juick.components.configuration; -import org.apache.commons.lang3.CharEncoding; +import org.apache.commons.codec.CharEncoding; import org.springframework.web.filter.CharacterEncodingFilter; import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; diff --git a/juick-rss/src/main/java/com/juick/rss/configuration/RssInitializer.java b/juick-rss/src/main/java/com/juick/rss/configuration/RssInitializer.java index 2dd6d117..b46a0602 100644 --- a/juick-rss/src/main/java/com/juick/rss/configuration/RssInitializer.java +++ b/juick-rss/src/main/java/com/juick/rss/configuration/RssInitializer.java @@ -1,7 +1,7 @@ package com.juick.rss.configuration; import com.juick.configuration.DataConfiguration; -import org.apache.commons.lang3.CharEncoding; +import org.apache.commons.codec.CharEncoding; import org.springframework.web.filter.CharacterEncodingFilter; import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; diff --git a/juick-rss/src/test/java/com/juick/rss/tests/RSSTests.java b/juick-rss/src/test/java/com/juick/rss/tests/RSSTests.java index a9ac848c..5130f2bc 100644 --- a/juick-rss/src/test/java/com/juick/rss/tests/RSSTests.java +++ b/juick-rss/src/test/java/com/juick/rss/tests/RSSTests.java @@ -9,7 +9,7 @@ import com.juick.rss.configuration.RssMvcConfiguration; import com.juick.service.MessagesService; import com.juick.service.TagService; import com.juick.service.UserService; -import org.apache.commons.lang3.RandomStringUtils; +import org.apache.commons.text.RandomStringGenerator; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -80,13 +80,15 @@ public class RSSTests { private User ugnich, freefd; String ugnichName, ugnichPassword, freefdName, freefdPassword; + final static RandomStringGenerator generator = new RandomStringGenerator.Builder().withinRange('a', 'z').build(); + private static Message getMessage(final User user, final String messageText) { Message msg = new Message(); msg.setMid(1); msg.setUser(user); - msg.setText(messageText == null ? RandomStringUtils.randomAlphanumeric(24) : messageText); - msg.setTags(Collections.singletonList(new Tag(RandomStringUtils.randomAlphabetic(4)))); + msg.setText(messageText == null ? generator.generate(24) : messageText); + msg.setTags(Collections.singletonList(new Tag(generator.generate(4)))); return msg; } diff --git a/juick-server/build.gradle b/juick-server/build.gradle index 8f23e8db..9a093d04 100644 --- a/juick-server/build.gradle +++ b/juick-server/build.gradle @@ -23,6 +23,7 @@ dependencies { compile "org.apache.httpcomponents:httpclient:4.5.3" providedCompile "org.apache.commons:commons-lang3:3.6" providedCompile "org.apache.commons:commons-collections4:4.1" + providedCompile "org.apache.commons:commons-text:1.1" providedCompile "commons-io:commons-io:2.5" providedCompile "commons-codec:commons-codec:1.10" diff --git a/juick-server/src/test/java/com/juick/tests/util/MockUtils.java b/juick-server/src/test/java/com/juick/tests/util/MockUtils.java index c67b26ef..5344dd23 100644 --- a/juick-server/src/test/java/com/juick/tests/util/MockUtils.java +++ b/juick-server/src/test/java/com/juick/tests/util/MockUtils.java @@ -2,7 +2,7 @@ package com.juick.tests.util; import com.juick.Message; import com.juick.User; -import org.apache.commons.lang3.RandomStringUtils; +import org.apache.commons.text.RandomStringGenerator; import java.util.Date; @@ -10,12 +10,13 @@ import java.util.Date; * Created by vitalyster on 12.01.2017. */ public class MockUtils { + final static RandomStringGenerator generator = new RandomStringGenerator.Builder().withinRange('a', 'z').build(); public static Message mockMessage(Integer mid, final User user, final String messageText) { Message msg = new Message(); msg.setMid(mid); msg.setUser(user); - msg.setText(messageText == null ? RandomStringUtils.randomAlphanumeric(24) : messageText); + msg.setText(messageText == null ? generator.generate(24) : messageText); msg.setDate(new Date()); return msg; } diff --git a/juick-ws/src/main/java/com/juick/ws/configuration/WebsocketInitializer.java b/juick-ws/src/main/java/com/juick/ws/configuration/WebsocketInitializer.java index ed6b1069..bb3d3087 100644 --- a/juick-ws/src/main/java/com/juick/ws/configuration/WebsocketInitializer.java +++ b/juick-ws/src/main/java/com/juick/ws/configuration/WebsocketInitializer.java @@ -1,7 +1,7 @@ package com.juick.ws.configuration; import com.juick.configuration.DataConfiguration; -import org.apache.commons.lang3.CharEncoding; +import org.apache.commons.codec.CharEncoding; import org.springframework.web.filter.CharacterEncodingFilter; import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; diff --git a/juick-www/src/main/java/com/juick/www/configuration/WwwInitializer.java b/juick-www/src/main/java/com/juick/www/configuration/WwwInitializer.java index 138c7121..199fbf85 100644 --- a/juick-www/src/main/java/com/juick/www/configuration/WwwInitializer.java +++ b/juick-www/src/main/java/com/juick/www/configuration/WwwInitializer.java @@ -2,7 +2,7 @@ package com.juick.www.configuration; import com.juick.configuration.DataConfiguration; import com.juick.configuration.SearchConfiguration; -import org.apache.commons.lang3.CharEncoding; +import org.apache.commons.codec.CharEncoding; import org.springframework.web.filter.CharacterEncodingFilter; import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; diff --git a/juick-www/src/main/java/com/juick/www/controllers/Home.java b/juick-www/src/main/java/com/juick/www/controllers/Home.java index 8e875f2f..ebf56b73 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/Home.java +++ b/juick-www/src/main/java/com/juick/www/controllers/Home.java @@ -25,10 +25,10 @@ import com.juick.util.UserUtils; import com.juick.util.WebUtils; import com.juick.www.Utils; import com.juick.www.WebApp; -import org.apache.commons.lang3.CharEncoding; -import org.apache.commons.lang3.StringEscapeUtils; +import org.apache.commons.codec.CharEncoding; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; +import org.apache.commons.text.StringEscapeUtils; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.CookieValue; diff --git a/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java b/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java index 4dcf6c10..24e100ce 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java +++ b/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java @@ -29,9 +29,9 @@ import com.juick.service.*; import com.juick.util.UserUtils; import com.juick.www.Utils; import com.juick.www.WebApp; -import org.apache.commons.lang3.CharEncoding; -import org.apache.commons.lang3.StringEscapeUtils; +import org.apache.commons.codec.CharEncoding; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.text.StringEscapeUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.core.env.Environment; diff --git a/juick-www/src/main/java/com/juick/www/controllers/PageTemplates.java b/juick-www/src/main/java/com/juick/www/controllers/PageTemplates.java index fdb741f6..2183140f 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/PageTemplates.java +++ b/juick-www/src/main/java/com/juick/www/controllers/PageTemplates.java @@ -24,8 +24,8 @@ import com.juick.service.TagService; import com.juick.service.UserService; import com.juick.util.MessageUtils; import com.juick.www.WebApp; -import org.apache.commons.lang3.CharEncoding; -import org.apache.commons.lang3.StringEscapeUtils; +import org.apache.commons.codec.CharEncoding; +import org.apache.commons.text.StringEscapeUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.util.StringUtils; diff --git a/juick-www/src/main/java/com/juick/www/controllers/Tags.java b/juick-www/src/main/java/com/juick/www/controllers/Tags.java index bc2679ef..c3ef5153 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/Tags.java +++ b/juick-www/src/main/java/com/juick/www/controllers/Tags.java @@ -22,9 +22,9 @@ import com.juick.service.TagService; import com.juick.util.UserUtils; import com.juick.www.Utils; import com.juick.www.WebApp; -import org.apache.commons.lang3.CharEncoding; -import org.apache.commons.lang3.StringEscapeUtils; +import org.apache.commons.codec.CharEncoding; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.text.StringEscapeUtils; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; diff --git a/juick-www/src/main/java/com/juick/www/controllers/User.java b/juick-www/src/main/java/com/juick/www/controllers/User.java index 973b9153..a249d8d0 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/User.java +++ b/juick-www/src/main/java/com/juick/www/controllers/User.java @@ -26,8 +26,8 @@ import com.juick.util.UserUtils; import com.juick.www.Utils; import com.juick.www.WebApp; import org.apache.commons.codec.CharEncoding; -import org.apache.commons.lang3.StringEscapeUtils; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.text.StringEscapeUtils; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.CookieValue; diff --git a/juick-xmpp-bot/src/main/java/com/juick/components/configuration/BotInitializer.java b/juick-xmpp-bot/src/main/java/com/juick/components/configuration/BotInitializer.java index 54dd6ff2..1803aedf 100644 --- a/juick-xmpp-bot/src/main/java/com/juick/components/configuration/BotInitializer.java +++ b/juick-xmpp-bot/src/main/java/com/juick/components/configuration/BotInitializer.java @@ -1,7 +1,7 @@ package com.juick.components.configuration; import com.juick.configuration.DataConfiguration; -import org.apache.commons.lang3.CharEncoding; +import org.apache.commons.codec.CharEncoding; import org.springframework.web.filter.CharacterEncodingFilter; import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; diff --git a/juick-xmpp/src/main/java/com/juick/components/configuration/XmppInitializer.java b/juick-xmpp/src/main/java/com/juick/components/configuration/XmppInitializer.java index 28dab1ef..ac33acc5 100644 --- a/juick-xmpp/src/main/java/com/juick/components/configuration/XmppInitializer.java +++ b/juick-xmpp/src/main/java/com/juick/components/configuration/XmppInitializer.java @@ -1,6 +1,6 @@ package com.juick.components.configuration; -import org.apache.commons.lang3.CharEncoding; +import org.apache.commons.codec.CharEncoding; import org.springframework.web.filter.CharacterEncodingFilter; import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; diff --git a/juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionOut.java b/juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionOut.java index 99df858e..a5d71be1 100644 --- a/juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionOut.java +++ b/juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionOut.java @@ -5,7 +5,7 @@ import com.juick.components.s2s.util.DialbackUtils; import com.juick.xmpp.extensions.StreamError; import com.juick.xmpp.extensions.StreamFeatures; import com.juick.xmpp.utils.XmlUtils; -import org.apache.commons.lang3.RandomStringUtils; +import org.apache.commons.text.RandomStringGenerator; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; @@ -32,11 +32,12 @@ public class ConnectionOut extends Connection implements Runnable { public String to; String checkSID = null; String dbKey = null; + RandomStringGenerator generator = new RandomStringGenerator.Builder().withinRange('a', 'z').build(); public ConnectionOut(XMPPServer xmpp, String hostname) throws CertificateException, UnrecoverableKeyException, NoSuchAlgorithmException, XmlPullParserException, KeyManagementException, KeyStoreException, IOException { super(xmpp); to = hostname; - dbKey = DialbackUtils.generateDialbackKey(RandomStringUtils.randomAscii(15), to, xmpp.HOSTNAME, streamID); + dbKey = DialbackUtils.generateDialbackKey(generator.generate(15), to, xmpp.HOSTNAME, streamID); } public ConnectionOut(XMPPServer xmpp, String hostname, String checkSID, String dbKey) throws Exception { diff --git a/src/test/java/com/juick/rss/LegacyRSS.java b/src/test/java/com/juick/rss/LegacyRSS.java index 220f00cb..89a2517c 100644 --- a/src/test/java/com/juick/rss/LegacyRSS.java +++ b/src/test/java/com/juick/rss/LegacyRSS.java @@ -21,9 +21,9 @@ import com.juick.Message; import com.juick.Tag; import com.juick.util.DateFormattersHolder; import com.juick.util.MessageUtils; -import org.apache.commons.lang3.CharEncoding; -import org.apache.commons.lang3.StringEscapeUtils; +import org.apache.commons.codec.CharEncoding; import org.apache.commons.lang3.math.NumberUtils; +import org.apache.commons.text.StringEscapeUtils; import org.springframework.jdbc.core.JdbcTemplate; import javax.servlet.ServletException; diff --git a/src/test/java/com/juick/tests/MessageTests.java b/src/test/java/com/juick/tests/MessageTests.java index 89dd440e..4ee36d36 100644 --- a/src/test/java/com/juick/tests/MessageTests.java +++ b/src/test/java/com/juick/tests/MessageTests.java @@ -3,7 +3,7 @@ package com.juick.tests; import com.fasterxml.jackson.databind.ObjectMapper; import com.juick.Message; import com.juick.util.DateFormattersHolder; -import org.apache.commons.lang3.CharEncoding; +import org.apache.commons.codec.CharEncoding; import org.json.JSONObject; import org.junit.Test; import org.w3c.dom.Document; |