diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 4cfcf0eaa..fb94746af 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
- java: [ "8", "11" ]
+ java: [ "11" ]
steps:
# Checkout Repo
diff --git a/changelog.html b/changelog.html
index 08310ee2c..19c422a2b 100644
--- a/changelog.html
+++ b/changelog.html
@@ -44,9 +44,11 @@
Monitoring Plugin Changelog
-2.5.1 -- (tbd)
+2.6.0 -- (tbd)
- - [Issue #383] - Fixes: Database query fails on Oracle
+ - Requires Openfire 4.8.0
+ - [Issue #387] - Fixes: Compatibility issue with Openfire 4.9.0
+ - [Issue #383] - Fixes: Database query fails on Oracle
- [Issue #377] - Fixes: Erroneous index confirmation message
- [Issue #367] - Fixes: JRobin's repository uses invalid certificate
- [Issue #249] - Fixes: Erroneous index rebuild progress indicator
diff --git a/plugin.xml b/plugin.xml
index 19c4975ec..85ce780ae 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -6,9 +6,8 @@
Monitors conversations and statistics of the server.
Ignite Realtime
${project.version}
- 2024-04-17
- 4.7.0
- 1.8
+ 2024-08-23
+ 4.8.0
monitoring
8
diff --git a/pom.xml b/pom.xml
index 6bcfb4bf2..2340e2f21 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,11 +4,11 @@
plugins
org.igniterealtime.openfire
- 4.7.0
+ 4.8.0
org.igniterealtime.openfire.plugins
monitoring
- 2.5.1-SNAPSHOT
+ 2.6.0-SNAPSHOT
Monitoring Plugin
Monitors conversations and statistics of the server.
@@ -53,9 +53,9 @@
${jersey.version}
- org.jrobin
+ com.purej
jrobin
- 1.6.0
+ 1.7.1
jfree
@@ -103,7 +103,12 @@
jaxb-runtime
2.3.3
-
+
+ junit
+ junit
+ 4.13.1
+ test
+
@@ -113,13 +118,6 @@
Ignite Realtime Repository
https://igniterealtime.org/archiva/repository/maven/
-
-
-
- opennms-repo
- OpenNMS Release Repository
- https://maven.mirrors.opennms.org/maven2/
-
diff --git a/src/java/com/reucon/openfire/plugin/archive/impl/MessageIndexer.java b/src/java/com/reucon/openfire/plugin/archive/impl/MessageIndexer.java
index 977c68f96..b3a43b489 100644
--- a/src/java/com/reucon/openfire/plugin/archive/impl/MessageIndexer.java
+++ b/src/java/com/reucon/openfire/plugin/archive/impl/MessageIndexer.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright (C) 2008 Jive Software, 2024 Ignite Realtime Foundation. All rights reserved.
+ *
+ * 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 com.reucon.openfire.plugin.archive.impl;
import org.apache.lucene.document.*;
@@ -17,6 +32,7 @@
import javax.print.Doc;
import java.io.File;
import java.io.IOException;
+import java.nio.file.Path;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@@ -53,7 +69,7 @@ public class MessageIndexer extends LuceneIndexer
public MessageIndexer( final TaskEngine taskEngine, final ConversationManager conversationManager )
{
- super(taskEngine, new File(JiveGlobals.getHomeDirectory() + File.separator + MonitoringConstants.NAME + File.separator + "msgsearch"), "MESSAGE", SCHEMA_VERSION);
+ super(taskEngine, JiveGlobals.getHomePath().resolve(Path.of(MonitoringConstants.NAME, "msgsearch")), "MESSAGE", SCHEMA_VERSION);
this.conversationManager = conversationManager;
}
diff --git a/src/java/com/reucon/openfire/plugin/archive/impl/MucIndexer.java b/src/java/com/reucon/openfire/plugin/archive/impl/MucIndexer.java
index 7345d976b..e30a36598 100644
--- a/src/java/com/reucon/openfire/plugin/archive/impl/MucIndexer.java
+++ b/src/java/com/reucon/openfire/plugin/archive/impl/MucIndexer.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright (C) 2008 Jive Software, 2024 Ignite Realtime Foundation. All rights reserved.
+ *
+ * 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 com.reucon.openfire.plugin.archive.impl;
import org.apache.lucene.document.*;
@@ -13,6 +28,7 @@
import java.io.File;
import java.io.IOException;
+import java.nio.file.Path;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@@ -41,7 +57,7 @@ public class MucIndexer extends LuceneIndexer
public MucIndexer( final TaskEngine taskEngine, final ConversationManager conversationManager )
{
- super(taskEngine, new File(JiveGlobals.getHomeDirectory() + File.separator + MonitoringConstants.NAME + File.separator + "mucsearch"), "MUCSEARCH", SCHEMA_VERSION);
+ super(taskEngine, JiveGlobals.getHomePath().resolve(Path.of(MonitoringConstants.NAME, "mucsearch")), "MUCSEARCH", SCHEMA_VERSION);
this.conversationManager = conversationManager;
}
diff --git a/src/java/org/jivesoftware/openfire/archive/ArchiveIndexer.java b/src/java/org/jivesoftware/openfire/archive/ArchiveIndexer.java
index e741cb77d..51551ef6c 100644
--- a/src/java/org/jivesoftware/openfire/archive/ArchiveIndexer.java
+++ b/src/java/org/jivesoftware/openfire/archive/ArchiveIndexer.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 Jive Software. All rights reserved.
+ * Copyright (C) 2008 Jive Software, Ignite Realtime Foundation 2024. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,6 +27,7 @@
import java.io.File;
import java.io.IOException;
+import java.nio.file.Path;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@@ -67,7 +68,7 @@ public class ArchiveIndexer extends org.jivesoftware.openfire.index.LuceneIndexe
* @param taskEngine a task engine instance.
*/
public ArchiveIndexer(ConversationManager conversationManager, TaskEngine taskEngine) {
- super(taskEngine, new File(JiveGlobals.getHomeDirectory() + File.separator + MonitoringConstants.NAME + File.separator + "search"), "CONVERSATION", SCHEMA_VERSION);
+ super(taskEngine, JiveGlobals.getHomePath().resolve(Path.of(MonitoringConstants.NAME, "search")), "CONVERSATION", SCHEMA_VERSION);
this.conversationManager = conversationManager;
}
diff --git a/src/java/org/jivesoftware/openfire/archive/ConversationEventsQueue.java b/src/java/org/jivesoftware/openfire/archive/ConversationEventsQueue.java
index ea8c4006b..a2a3b6021 100644
--- a/src/java/org/jivesoftware/openfire/archive/ConversationEventsQueue.java
+++ b/src/java/org/jivesoftware/openfire/archive/ConversationEventsQueue.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 Jive Software. All rights reserved.
+ * Copyright (C) 2008 Jive Software, Ignite Realtime Foundation 2024. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,6 +16,7 @@
package org.jivesoftware.openfire.archive;
+import java.time.Duration;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -96,7 +97,7 @@ public void run() {
}
}
};
- taskEngine.scheduleAtFixedRate(sendTask, JiveConstants.SECOND * 3, JiveConstants.SECOND * 3);
+ taskEngine.scheduleAtFixedRate(sendTask, Duration.ofSeconds(3), Duration.ofSeconds(3));
}
/**
diff --git a/src/java/org/jivesoftware/openfire/archive/ConversationManager.java b/src/java/org/jivesoftware/openfire/archive/ConversationManager.java
index 9942d2a08..5935bf6c6 100644
--- a/src/java/org/jivesoftware/openfire/archive/ConversationManager.java
+++ b/src/java/org/jivesoftware/openfire/archive/ConversationManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 Jive Software. All rights reserved.
+ * Copyright (C) 2008 Jive Software, Ignite Realtime Foundation 2024. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -255,7 +255,7 @@ public void run() {
}
}
};
- taskEngine.scheduleAtFixedRate(cleanupTask, JiveConstants.MINUTE * 5, JiveConstants.MINUTE * 5);
+ taskEngine.scheduleAtFixedRate(cleanupTask, Duration.ofMinutes(5), Duration.ofMinutes(5));
// Schedule a task to do conversation purging.
maxAgeTask = new TimerTask() {
@@ -304,7 +304,7 @@ public void run() {
}
}
};
- taskEngine.scheduleAtFixedRate(maxAgeTask, JiveConstants.MINUTE, JiveConstants.MINUTE);
+ taskEngine.scheduleAtFixedRate(maxAgeTask, Duration.ofMinutes(1), Duration.ofMinutes(1));
// Register a statistic.
Statistic conversationStat = new Statistic() {
diff --git a/src/java/org/jivesoftware/openfire/index/LuceneIndexer.java b/src/java/org/jivesoftware/openfire/index/LuceneIndexer.java
index a376c64d0..8d23d0dca 100644
--- a/src/java/org/jivesoftware/openfire/index/LuceneIndexer.java
+++ b/src/java/org/jivesoftware/openfire/index/LuceneIndexer.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright (C) 2008 Jive Software, 2024 Ignite Realtime Foundation. All rights reserved.
+ *
+ * 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.jivesoftware.openfire.index;
import org.apache.commons.io.FileUtils;
@@ -39,7 +54,7 @@ public abstract class LuceneIndexer
private final int schemaVersion;
protected TaskEngine taskEngine;
protected RebuildFuture rebuildFuture;
- private File searchDir;
+ private Path searchDir;
private XMLProperties indexProperties;
private Directory directory;
private IndexSearcher searcher;
@@ -55,7 +70,7 @@ public abstract class LuceneIndexer
.setPlugin(MonitoringConstants.PLUGIN_NAME)
.build();
- public LuceneIndexer(TaskEngine taskEngine, File searchDir, String logName, int schemaVersion)
+ public LuceneIndexer(TaskEngine taskEngine, Path searchDir, String logName, int schemaVersion)
{
this.taskEngine = taskEngine;
this.searchDir = searchDir;
@@ -66,11 +81,12 @@ public LuceneIndexer(TaskEngine taskEngine, File searchDir, String logName, int
public void start()
{
Log.debug("Starting...");
- if ( !searchDir.exists() )
+ if (!Files.exists(searchDir))
{
- if ( !searchDir.mkdirs() )
- {
- Log.warn("Lucene index directory '{}' does not exist, but cannot be created!", searchDir);
+ try {
+ Files.createDirectories(searchDir);
+ } catch (IOException e) {
+ Log.warn("Lucene index directory '{}' does not exist, but cannot be created!", searchDir, e);
}
}
@@ -78,7 +94,7 @@ public void start()
try
{
indexProperties = loadPropertiesFile(searchDir);
- directory = FSDirectory.open(searchDir.toPath());
+ directory = FSDirectory.open(searchDir);
if ( !DirectoryReader.indexExists(directory) )
{
Log.info("Unable to find a Lucene index in {}. rebuilding.", directory);
@@ -94,7 +110,7 @@ public void start()
{
// See if the data on disk is of the schema version that we expect to be able to use.
// TODO make this optional through configuration.
- final Path schemaVersionFile = searchDir.toPath().resolve("openfire-schema.version");
+ final Path schemaVersionFile = searchDir.resolve("openfire-schema.version");
final Scanner scanner = new Scanner(schemaVersionFile);
int detectedSchemaVersion = -1;
if (scanner.hasNextInt())
@@ -169,17 +185,22 @@ public void run()
}
};
final Duration updateInterval = UPDATE_INTERVAL.getValue();
- taskEngine.schedule(indexUpdater, Duration.ofMinutes(1).toMillis(), updateInterval.toMillis());
+ taskEngine.schedule(indexUpdater, Duration.ofMinutes(1), updateInterval);
}
private void removeAndRebuildSearchDir() throws IOException {
directory.close();
- FileUtils.deleteDirectory(searchDir);
- if ( !searchDir.mkdirs() )
+ FileUtils.deleteDirectory(searchDir.toFile());
+ if (!Files.exists(searchDir))
{
- Log.warn("Lucene index directory '{}' cannot be recreated!", searchDir);
+ try {
+ Files.createDirectories(searchDir);
+ } catch (IOException e) {
+ Log.warn("Lucene index directory '{}' cannot be recreated!", searchDir, e);
+ }
}
- directory = FSDirectory.open(searchDir.toPath());
+
+ directory = FSDirectory.open(searchDir);
}
protected synchronized Instant getLastModified()
@@ -244,7 +265,7 @@ public void stop()
*/
public long getIndexSize()
{
- File[] files = searchDir.listFiles(( dir, name ) -> {
+ File[] files = searchDir.toFile().listFiles(( dir, name ) -> {
// Ignore the index properties file since it's not part of the index.
return !name.equals("indexprops.xml");
});
@@ -331,11 +352,11 @@ public synchronized Future rebuildIndex() {
Log.debug("Removing old data from directory: {}", searchDir);
try {
- FileUtils.cleanDirectory(searchDir);
- Files.write(searchDir.toPath().resolve("openfire-schema.version"), String.valueOf(this.schemaVersion).getBytes());
+ FileUtils.cleanDirectory(searchDir.toFile());
+ Files.write(searchDir.resolve("openfire-schema.version"), String.valueOf(this.schemaVersion).getBytes());
indexProperties = loadPropertiesFile(searchDir);
} catch ( IOException e ) {
- Log.warn("An exception occurred while trying to clean directory '{}' as part of a rebuild of the Lucene index that's in it.", searchDir);
+ Log.warn("An exception occurred while trying to clean directory '{}' as part of a rebuild of the Lucene index that's in it.", searchDir, e);
}
final Analyzer analyzer = new StandardAnalyzer();
@@ -431,9 +452,9 @@ public synchronized IndexSearcher getSearcher() throws IOException
* loaded. If an XML file for the search properties isn't already
* created, it will attempt to make a file with default values.
*/
- private XMLProperties loadPropertiesFile( File searchDir ) throws IOException
+ private XMLProperties loadPropertiesFile( Path searchDir ) throws IOException
{
- File indexPropertiesFile = new File(searchDir, "indexprops.xml");
+ File indexPropertiesFile = new File(searchDir.toFile(), "indexprops.xml");
// Make sure the file actually exists. If it doesn't, a new file
// will be created.
diff --git a/src/java/org/jivesoftware/openfire/plugin/MonitoringPlugin.java b/src/java/org/jivesoftware/openfire/plugin/MonitoringPlugin.java
index 9e50fd584..9bd8c3881 100644
--- a/src/java/org/jivesoftware/openfire/plugin/MonitoringPlugin.java
+++ b/src/java/org/jivesoftware/openfire/plugin/MonitoringPlugin.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 Jive Software, 2022-2023 Ignite Realtime Foundation. All rights reserved.
+ * Copyright (C) 2008 Jive Software, 2022-2024 Ignite Realtime Foundation. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,7 +17,9 @@
package org.jivesoftware.openfire.plugin;
import java.io.File;
-import java.io.FileFilter;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
@@ -170,28 +172,15 @@ public void initializePlugin(PluginManager manager, File pluginDirectory) {
xep0313Support2 = new Xep0313Support2(XMPPServer.getInstance());
xep0313Support2.start();
- // Check if we Enterprise is installed and stop loading this plugin if
- // found
- File pluginDir = new File(JiveGlobals.getHomeDirectory(), "plugins");
- File[] jars = pluginDir.listFiles(new FileFilter() {
- public boolean accept(File pathname) {
- String fileName = pathname.getName().toLowerCase();
- return (fileName.equalsIgnoreCase("enterprise.jar"));
- }
- });
- if (jars.length > 0) {
- // Do not load this plugin since Enterprise is still installed
- System.out
- .println("Enterprise plugin found. Stopping Monitoring Plugin");
- throw new IllegalStateException(
- "This plugin cannot run next to the Enterprise plugin");
- }
-
// Make sure that the monitoring folder exists under the home directory
- File dir = new File(JiveGlobals.getHomeDirectory() + File.separator
- + MonitoringConstants.NAME);
- if (!dir.exists()) {
- dir.mkdirs();
+ final Path monitoringFolder = JiveGlobals.getHomePath().resolve(MonitoringConstants.NAME);
+ if (!Files.exists(monitoringFolder))
+ {
+ try {
+ Files.createDirectories(monitoringFolder);
+ } catch (IOException e) {
+ Log.warn("Monitoring directory '{}' does not exist, but cannot be created!", monitoringFolder, e);
+ }
}
loadPublicWeb(pluginDirectory);
diff --git a/src/java/org/jivesoftware/openfire/reporting/stats/StatsEngine.java b/src/java/org/jivesoftware/openfire/reporting/stats/StatsEngine.java
index 7fb7fa4d0..959c187f3 100644
--- a/src/java/org/jivesoftware/openfire/reporting/stats/StatsEngine.java
+++ b/src/java/org/jivesoftware/openfire/reporting/stats/StatsEngine.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 Jive Software, 2022 Ignite Realtime Foundation. All rights reserved.
+ * Copyright (C) 2008 Jive Software, 2022-2024 Ignite Realtime Foundation. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +17,8 @@
import java.io.File;
import java.io.IOException;
+import java.nio.file.Path;
+import java.time.Duration;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
@@ -86,7 +88,7 @@ public void start() {
// After 10 milliseconds begin sampling in 60 second intervals. Note: We need to start
// asap so that the UI can access this info upon start up
- taskEngine.scheduleAtFixedRate(samplingTask, 10, STAT_RESOULUTION * 1000L);
+ taskEngine.scheduleAtFixedRate(samplingTask, Duration.ofMillis(10), Duration.ofSeconds(STAT_RESOULUTION));
}
catch (RrdException e) {
Log.error("Error initializing RrdbPool.", e);
@@ -104,10 +106,10 @@ public void purgeDefinitions() {
}
private void checkDatabase(StatDefinition[] def) throws RrdException, IOException {
- File directory = new File(getStatsDirectroy());
+ File directory = getStatsDirectory().toFile();
if (directory.exists()) {
// check if the rrd exists
- File rrdFile = new File(getRrdFilePath(def[0].getDbPath()));
+ File rrdFile = getRrdFilePath(def[0].getDbPath()).toFile();
if (rrdFile.exists() && rrdFile.canRead()) {
try {
// Import existing RRD file into the DB
@@ -163,8 +165,8 @@ private String determineDsType(Statistic.Type statType) {
* @param datasourceName the name of the data source.
* @return the path to the RRD file.
*/
- private String getRrdFilePath(String datasourceName) {
- return getStatsDirectroy() + datasourceName + ".rrd";
+ private Path getRrdFilePath(String datasourceName) {
+ return getStatsDirectory().resolve(datasourceName + ".rrd");
}
/**
@@ -172,9 +174,8 @@ private String getRrdFilePath(String datasourceName) {
*
* @return Returns the directory in which all of the stat databases will be stored.
*/
- private String getStatsDirectroy() {
- return JiveGlobals.getHomeDirectory() + File.separator + MonitoringConstants.NAME
- + File.separator + "stats" + File.separator;
+ private Path getStatsDirectory() {
+ return JiveGlobals.getHomePath().resolve(Path.of(MonitoringConstants.NAME, "stats"));
}
private StatDefinition createDefintion(String key) {
diff --git a/src/java/org/jivesoftware/openfire/reporting/util/TaskEngine.java b/src/java/org/jivesoftware/openfire/reporting/util/TaskEngine.java
index 3249bf1be..0da1348c1 100644
--- a/src/java/org/jivesoftware/openfire/reporting/util/TaskEngine.java
+++ b/src/java/org/jivesoftware/openfire/reporting/util/TaskEngine.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 Jive Software. All rights reserved.
+ * Copyright (C) 2008 Jive Software, Ignite Realtime Foundation 2024. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +20,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.time.Duration;
+import java.time.Instant;
import java.util.*;
import java.util.concurrent.*;
@@ -81,18 +83,18 @@ public Future> submit(Runnable task) {
* Schedules the specified task for execution after the specified delay.
*
* @param task task to be scheduled.
- * @param delay delay in milliseconds before task is to be executed.
+ * @param delay delay before task is to be executed.
* @throws IllegalArgumentException if delay is negative, or
* delay + System.currentTimeMillis() is negative.
* @throws IllegalStateException if task was already scheduled or
* cancelled, or timer was cancelled.
*/
- public void schedule(TimerTask task, long delay) {
+ public void schedule(TimerTask task, Duration delay) {
TimerTaskWrapper taskWrapper = new TimerTaskWrapper(task);
synchronized (wrappedTasks) {
wrappedTasks.put(task, taskWrapper);
}
- timer.schedule(taskWrapper, delay);
+ timer.schedule(taskWrapper, delay.toMillis());
}
/**
@@ -105,12 +107,12 @@ public void schedule(TimerTask task, long delay) {
* @throws IllegalStateException if task was already scheduled or
* cancelled, timer was cancelled, or timer thread terminated.
*/
- public void schedule(TimerTask task, Date time) {
+ public void schedule(TimerTask task, Instant time) {
TimerTaskWrapper taskWrapper = new TimerTaskWrapper(task);
synchronized (wrappedTasks) {
wrappedTasks.put(task, taskWrapper);
}
- timer.schedule(taskWrapper, time);
+ timer.schedule(taskWrapper, Date.from(time));
}
/**
@@ -136,19 +138,19 @@ public void schedule(TimerTask task, Date time) {
* is held down.
*
* @param task task to be scheduled.
- * @param delay delay in milliseconds before task is to be executed.
- * @param period time in milliseconds between successive task executions.
+ * @param delay delay before task is to be executed.
+ * @param period time between successive task executions.
* @throws IllegalArgumentException if delay is negative, or
* delay + System.currentTimeMillis() is negative.
* @throws IllegalStateException if task was already scheduled or
* cancelled, timer was cancelled, or timer thread terminated.
*/
- public void schedule(TimerTask task, long delay, long period) {
+ public void schedule(TimerTask task, Duration delay, Duration period) {
TimerTaskWrapper taskWrapper = new TimerTaskWrapper(task);
synchronized (wrappedTasks) {
wrappedTasks.put(task, taskWrapper);
}
- timer.schedule(taskWrapper, delay, period);
+ timer.schedule(taskWrapper, delay.toMillis(), period.toMillis());
}
/**
@@ -175,17 +177,17 @@ public void schedule(TimerTask task, long delay, long period) {
*
* @param task task to be scheduled.
* @param firstTime First time at which task is to be executed.
- * @param period time in milliseconds between successive task executions.
+ * @param period time between successive task executions.
* @throws IllegalArgumentException if time.getTime() is negative.
* @throws IllegalStateException if task was already scheduled or
* cancelled, timer was cancelled, or timer thread terminated.
*/
- public void schedule(TimerTask task, Date firstTime, long period) {
+ public void schedule(TimerTask task, Instant firstTime, Duration period) {
TimerTaskWrapper taskWrapper = new TimerTaskWrapper(task);
synchronized (wrappedTasks) {
wrappedTasks.put(task, taskWrapper);
}
- timer.schedule(taskWrapper, firstTime, period);
+ timer.schedule(taskWrapper, Date.from(firstTime), period.toMillis());
}
/**
@@ -212,19 +214,19 @@ public void schedule(TimerTask task, Date firstTime, long period) {
* with respect to one another.
*
* @param task task to be scheduled.
- * @param delay delay in milliseconds before task is to be executed.
- * @param period time in milliseconds between successive task executions.
+ * @param delay delay before task is to be executed.
+ * @param period time between successive task executions.
* @throws IllegalArgumentException if delay is negative, or
* delay + System.currentTimeMillis() is negative.
* @throws IllegalStateException if task was already scheduled or
* cancelled, timer was cancelled, or timer thread terminated.
*/
- public void scheduleAtFixedRate(TimerTask task, long delay, long period) {
+ public void scheduleAtFixedRate(TimerTask task, Duration delay, Duration period) {
TimerTaskWrapper taskWrapper = new TimerTaskWrapper(task);
synchronized (wrappedTasks) {
wrappedTasks.put(task, taskWrapper);
}
- timer.scheduleAtFixedRate(taskWrapper, delay, period);
+ timer.scheduleAtFixedRate(taskWrapper, delay.toMillis(), period.toMillis());
}
/**
@@ -252,17 +254,17 @@ public void scheduleAtFixedRate(TimerTask task, long delay, long period) {
*
* @param task task to be scheduled.
* @param firstTime First time at which task is to be executed.
- * @param period time in milliseconds between successive task executions.
+ * @param period time between successive task executions.
* @throws IllegalArgumentException if time.getTime() is negative.
* @throws IllegalStateException if task was already scheduled or
* cancelled, timer was cancelled, or timer thread terminated.
*/
- public void scheduleAtFixedRate(TimerTask task, Date firstTime, long period) {
+ public void scheduleAtFixedRate(TimerTask task, Instant firstTime, Duration period) {
TimerTaskWrapper taskWrapper = new TimerTaskWrapper(task);
synchronized (wrappedTasks) {
wrappedTasks.put(task, taskWrapper);
}
- timer.scheduleAtFixedRate(taskWrapper, firstTime, period);
+ timer.scheduleAtFixedRate(taskWrapper, Date.from(firstTime), period.toMillis());
}
/**
diff --git a/src/web/archive-search.jsp b/src/web/archive-search.jsp
index 639e1c787..70f29c0cd 100644
--- a/src/web/archive-search.jsp
+++ b/src/web/archive-search.jsp
@@ -10,7 +10,6 @@
<%@ page import="java.util.*" %>
<%@ page import="org.slf4j.Logger" %>
<%@ page import="org.slf4j.LoggerFactory" %>
-<%@ page import="com.reucon.openfire.plugin.archive.xep.AbstractXepSupport" %>
<%@ page import="org.jivesoftware.openfire.archive.*" %>
<%@ page import="org.jivesoftware.openfire.cluster.ClusterManager" %>
@@ -122,8 +121,13 @@
// occurs at 5:33 PM that day, it should be included in the results. In
// order to make this possible, we need to make the end date one millisecond
// before the next day starts.
- date = new Date(date.getTime() + JiveConstants.DAY - 1);
- search.setDateRangeMax(date);
+ final Calendar calendar = Calendar.getInstance();
+ calendar.setTime(date);
+ calendar.set(Calendar.HOUR_OF_DAY, 23);
+ calendar.set(Calendar.MINUTE, 59);
+ calendar.set(Calendar.SECOND, 59);
+ calendar.set(Calendar.MILLISECOND, 999);
+ search.setDateRangeMax(calendar.getTime());
}
catch (Exception e) {
// TODO: mark as an error in the JSP instead of logging..