You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by mb...@apache.org on 2021/08/08 21:50:54 UTC
[roller] 17/19: cleanup + unused code removal.
This is an automated email from the ASF dual-hosted git repository.
mbien pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/roller.git
commit c4b405bd5ee44bbfdba1acea8bf3327193e04ffe
Author: Michael Bien <mb...@gmail.com>
AuthorDate: Thu Jul 8 03:42:52 2021 +0200
cleanup + unused code removal.
---
.../roller/weblogger/business/WebloggerImpl.java | 5 +--
.../plugins/entry/ConvertLineBreaksPlugin.java | 4 +-
.../plugins/entry/ObfuscateEmailPlugin.java | 2 +-
.../business/plugins/entry/SmileysPlugin.java | 14 +++----
.../ui/rendering/model/UtilitiesModel.java | 43 -------------------
.../util/StandaloneWebappClassLoader.java | 12 +-----
.../atomprotocol/CommentCollection.java | 49 ----------------------
7 files changed, 13 insertions(+), 116 deletions(-)
diff --git a/app/src/main/java/org/apache/roller/weblogger/business/WebloggerImpl.java b/app/src/main/java/org/apache/roller/weblogger/business/WebloggerImpl.java
index de70600..4dcb1b5 100644
--- a/app/src/main/java/org/apache/roller/weblogger/business/WebloggerImpl.java
+++ b/app/src/main/java/org/apache/roller/weblogger/business/WebloggerImpl.java
@@ -31,10 +31,7 @@ import org.apache.roller.weblogger.business.runnable.ThreadManager;
import org.apache.roller.weblogger.business.search.IndexManager;
import org.apache.roller.weblogger.business.themes.ThemeManager;
import org.apache.roller.weblogger.config.PingConfig;
-import org.apache.roller.weblogger.config.WebloggerConfig;
-import org.apache.roller.weblogger.config.WebloggerRuntimeConfig;
import org.apache.xmlrpc.util.SAXParsers;
-import org.springframework.security.access.method.P;
import org.xml.sax.SAXNotRecognizedException;
import org.xml.sax.SAXNotSupportedException;
@@ -54,7 +51,7 @@ import java.util.Properties;
@com.google.inject.Singleton
public abstract class WebloggerImpl implements Weblogger {
- private static Log log = LogFactory.getLog(WebloggerImpl.class);
+ private static final Log log = LogFactory.getLog(WebloggerImpl.class);
// managers
private final AutoPingManager autoPingManager;
diff --git a/app/src/main/java/org/apache/roller/weblogger/business/plugins/entry/ConvertLineBreaksPlugin.java b/app/src/main/java/org/apache/roller/weblogger/business/plugins/entry/ConvertLineBreaksPlugin.java
index b592309..eed268a 100644
--- a/app/src/main/java/org/apache/roller/weblogger/business/plugins/entry/ConvertLineBreaksPlugin.java
+++ b/app/src/main/java/org/apache/roller/weblogger/business/plugins/entry/ConvertLineBreaksPlugin.java
@@ -43,7 +43,7 @@ import org.apache.roller.weblogger.pojos.Weblog;
*/
public class ConvertLineBreaksPlugin implements WeblogEntryPlugin {
- private static Log mLogger = LogFactory.getLog(ConvertLineBreaksPlugin.class);
+ private static final Log mLogger = LogFactory.getLog(ConvertLineBreaksPlugin.class);
private static final String NAME = "Convert Line Breaks";
private static final String DESCRIPTION = "Convert plain text paragraphs to html by adding p and br tags";
@@ -96,7 +96,7 @@ public class ConvertLineBreaksPlugin implements WeblogEntryPlugin {
try {
BufferedReader br = new BufferedReader(new StringReader(str));
- String line = null;
+ String line;
boolean insidePara = false;
while((line = br.readLine()) != null) {
diff --git a/app/src/main/java/org/apache/roller/weblogger/business/plugins/entry/ObfuscateEmailPlugin.java b/app/src/main/java/org/apache/roller/weblogger/business/plugins/entry/ObfuscateEmailPlugin.java
index a674de7..9b5195e 100644
--- a/app/src/main/java/org/apache/roller/weblogger/business/plugins/entry/ObfuscateEmailPlugin.java
+++ b/app/src/main/java/org/apache/roller/weblogger/business/plugins/entry/ObfuscateEmailPlugin.java
@@ -32,7 +32,7 @@ import org.apache.roller.util.RegexUtil;
*/
public class ObfuscateEmailPlugin implements WeblogEntryPlugin {
- private static Log mLogger = LogFactory.getLog(ObfuscateEmailPlugin.class);
+ private static final Log mLogger = LogFactory.getLog(ObfuscateEmailPlugin.class);
protected String name = "Email Scrambler";
diff --git a/app/src/main/java/org/apache/roller/weblogger/business/plugins/entry/SmileysPlugin.java b/app/src/main/java/org/apache/roller/weblogger/business/plugins/entry/SmileysPlugin.java
index 97bb5b8..2b4acd2 100644
--- a/app/src/main/java/org/apache/roller/weblogger/business/plugins/entry/SmileysPlugin.java
+++ b/app/src/main/java/org/apache/roller/weblogger/business/plugins/entry/SmileysPlugin.java
@@ -35,15 +35,15 @@ import org.apache.roller.weblogger.pojos.Weblog;
*/
public class SmileysPlugin implements WeblogEntryPlugin {
- private static Log log = LogFactory.getLog(SmileysPlugin.class);
+ private static final Log log = LogFactory.getLog(SmileysPlugin.class);
// public for tests
public static Pattern[] smileyPatterns = new Pattern[0];
static String[] imageTags = new String[0];
- private static Properties smileyDefs = new Properties();
+ private static final Properties smileyDefs = new Properties();
- private String name = "Emoticons";
- private String description = "Change ASCII emoticons to graphics. " +
+ private final String name = "Emoticons";
+ private final String description = "Change ASCII emoticons to graphics. " +
":-) becomes <img src='./images/smileys/smile.gif'>";
@@ -88,7 +88,7 @@ public class SmileysPlugin implements WeblogEntryPlugin {
String[] tempS = new String[SmileysPlugin.smileyDefs.size()];
log.debug("# smileys: " + smileyDefs.size());
int count = 0;
- Enumeration enum1 = SmileysPlugin.smileyDefs.propertyNames();
+ Enumeration<?> enum1 = SmileysPlugin.smileyDefs.propertyNames();
while(enum1.hasMoreElements()) {
String smiley = (String)enum1.nextElement();
String smileyAlt = htmlEscape(smiley);
@@ -113,7 +113,7 @@ public class SmileysPlugin implements WeblogEntryPlugin {
*/
@Override
public String render(WeblogEntry entry, String text) {
- Matcher matcher = null;
+ Matcher matcher;
for (int i=0; i<smileyPatterns.length; i++) {
matcher = smileyPatterns[i].matcher(text);
text = matcher.replaceAll(imageTags[i]);
@@ -150,7 +150,7 @@ public class SmileysPlugin implements WeblogEntryPlugin {
* @param smiley
* @return
*/
- private static char[] escape_regex = new char[]
+ private static final char[] escape_regex = new char[]
{'-', '(', ')', '\\', '|', ':', '^', '$', '*', '+', '?',
'{', '}', '!', '=', '<', '>', '&', '[', ']' };
diff --git a/app/src/main/java/org/apache/roller/weblogger/ui/rendering/model/UtilitiesModel.java b/app/src/main/java/org/apache/roller/weblogger/ui/rendering/model/UtilitiesModel.java
index 3c3af9a..a27a4a3 100644
--- a/app/src/main/java/org/apache/roller/weblogger/ui/rendering/model/UtilitiesModel.java
+++ b/app/src/main/java/org/apache/roller/weblogger/ui/rendering/model/UtilitiesModel.java
@@ -47,49 +47,6 @@ public class UtilitiesModel implements Model {
private static final Log log = LogFactory.getLog(UtilitiesModel.class);
- private static Pattern mLinkPattern =
- Pattern.compile("<a href=.*?>", Pattern.CASE_INSENSITIVE);
- private static final Pattern OPENING_B_TAG_PATTERN =
- Pattern.compile("<b>", Pattern.CASE_INSENSITIVE);
- private static final Pattern CLOSING_B_TAG_PATTERN =
- Pattern.compile("</b>", Pattern.CASE_INSENSITIVE);
- private static final Pattern OPENING_I_TAG_PATTERN =
- Pattern.compile("<i>", Pattern.CASE_INSENSITIVE);
- private static final Pattern CLOSING_I_TAG_PATTERN =
- Pattern.compile("</i>", Pattern.CASE_INSENSITIVE);
- private static final Pattern OPENING_BLOCKQUOTE_TAG_PATTERN =
- Pattern.compile("<blockquote>", Pattern.CASE_INSENSITIVE);
- private static final Pattern CLOSING_BLOCKQUOTE_TAG_PATTERN =
- Pattern.compile("</blockquote>", Pattern.CASE_INSENSITIVE);
- private static final Pattern BR_TAG_PATTERN =
- Pattern.compile("<br */*>", Pattern.CASE_INSENSITIVE);
- private static final Pattern OPENING_P_TAG_PATTERN =
- Pattern.compile("<p>", Pattern.CASE_INSENSITIVE);
- private static final Pattern CLOSING_P_TAG_PATTERN =
- Pattern.compile("</p>", Pattern.CASE_INSENSITIVE);
- private static final Pattern OPENING_PRE_TAG_PATTERN =
- Pattern.compile("<pre>", Pattern.CASE_INSENSITIVE);
- private static final Pattern CLOSING_PRE_TAG_PATTERN =
- Pattern.compile("</pre>", Pattern.CASE_INSENSITIVE);
- private static final Pattern OPENING_UL_TAG_PATTERN =
- Pattern.compile("<ul>", Pattern.CASE_INSENSITIVE);
- private static final Pattern CLOSING_UL_TAG_PATTERN =
- Pattern.compile("</ul>", Pattern.CASE_INSENSITIVE);
- private static final Pattern OPENING_OL_TAG_PATTERN =
- Pattern.compile("<ol>", Pattern.CASE_INSENSITIVE);
- private static final Pattern CLOSING_OL_TAG_PATTERN =
- Pattern.compile("</ol>", Pattern.CASE_INSENSITIVE);
- private static final Pattern OPENING_LI_TAG_PATTERN =
- Pattern.compile("<li>", Pattern.CASE_INSENSITIVE);
- private static final Pattern CLOSING_LI_TAG_PATTERN =
- Pattern.compile("</li>", Pattern.CASE_INSENSITIVE);
- private static final Pattern CLOSING_A_TAG_PATTERN =
- Pattern.compile("</a>", Pattern.CASE_INSENSITIVE);
- private static final Pattern OPENING_A_TAG_PATTERN =
- Pattern.compile("<a href=.*?>", Pattern.CASE_INSENSITIVE);
- private static final Pattern QUOTE_PATTERN =
- Pattern.compile(""", Pattern.CASE_INSENSITIVE);
-
private ParsedRequest parsedRequest = null;
private Weblog weblog = null;
diff --git a/app/src/main/java/org/apache/roller/weblogger/util/StandaloneWebappClassLoader.java b/app/src/main/java/org/apache/roller/weblogger/util/StandaloneWebappClassLoader.java
index cb6004f..008ca12 100644
--- a/app/src/main/java/org/apache/roller/weblogger/util/StandaloneWebappClassLoader.java
+++ b/app/src/main/java/org/apache/roller/weblogger/util/StandaloneWebappClassLoader.java
@@ -22,7 +22,6 @@
package org.apache.roller.weblogger.util;
import java.io.File;
-import java.io.FilenameFilter;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
@@ -66,15 +65,8 @@ public class StandaloneWebappClassLoader extends URLClassLoader {
private static void addURLs(String dirPath, List<URL> urlList) throws Exception {
File libDir = new File(dirPath);
- String[] libJarNames = libDir.list(new FilenameFilter() {
- @Override
- public boolean accept(File dir, String pathname) {
- if (pathname.endsWith(".jar")) {
- return true;
- }
- return false;
- }
- });
+ String[] libJarNames = libDir.list((File dir, String pathname) -> pathname.endsWith(".jar") );
+
for (int i=0; i<libJarNames.length; i++) {
String url = "file://" + dirPath + FS + libJarNames[i];
urlList.add(new URL(url));
diff --git a/app/src/main/java/org/apache/roller/weblogger/webservices/atomprotocol/CommentCollection.java b/app/src/main/java/org/apache/roller/weblogger/webservices/atomprotocol/CommentCollection.java
deleted file mode 100644
index 3d2f597..0000000
--- a/app/src/main/java/org/apache/roller/weblogger/webservices/atomprotocol/CommentCollection.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you
- * may not use this file except in compliance with the License. You may
- * obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.roller.weblogger.webservices.atomprotocol;
-
-import com.rometools.propono.atom.server.AtomException;
-import com.rometools.propono.atom.server.AtomRequest;
-import com.rometools.rome.feed.atom.Feed;
-import java.util.Map.Entry;
-
-
-/**
- * Collection of weblog entry comments.
- * @author davidm.johnson@sun.com
- */
-public class CommentCollection {
-
- public String postEntry(AtomRequest areq, Entry entry) throws AtomException {
- return null;
- }
-
- public Entry getEntry(AtomRequest areq) throws AtomException {
- return null;
- }
-
- public Feed getCollection(AtomRequest areg) throws AtomException {
- return null;
- }
-
- public void putEntry(AtomRequest areq, Entry entry) throws AtomException {
- }
-
- public void deleteEntry(AtomRequest areq) throws AtomException {
- }
-}
\ No newline at end of file