Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Joda DateTime library and update to java.time package #575

Merged
merged 12 commits into from
Oct 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/maven-jdk8-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- uses: BSFishy/pip-action@v1
with:
packages: |
sphinx==1.8.5
sphinx==4.2.0
fgdrf marked this conversation as resolved.
Show resolved Hide resolved
- name: Build docs with sphinx
run: mvn install -B -f docs/pom.xml -Dtycho.mode=maven -Pdocs
- name: Run uDig product & sdk build (parallel)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
Expand All @@ -28,7 +29,6 @@

import org.apache.commons.io.FileUtils;
import org.eclipse.core.runtime.Platform;
import org.joda.time.DateTime;

import org.locationtech.udig.omsbox.OmsBoxPlugin;
import org.locationtech.udig.omsbox.utils.OmsBoxConstants;
Expand Down Expand Up @@ -180,7 +180,7 @@ public Process exec( String script, final PrintStream internalStream, final Prin
// environment.put("CLASSPATH", classPath);

final Process process = processBuilder.start();
internalStream.println("Process started: " + new DateTime().toString(OmsBoxConstants.dateTimeFormatterYYYYMMDDHHMMSS));
internalStream.println("Process started: " + LocalDateTime.now().format(OmsBoxConstants.dateTimeFormatterYYYYMMDDHHMMSS));
internalStream.println("");

// command launched
Expand Down Expand Up @@ -247,7 +247,7 @@ public void run() {
internalStream.println("");
internalStream.println("");
internalStream.println("Process finished: "
+ new DateTime().toString(OmsBoxConstants.dateTimeFormatterYYYYMMDDHHMMSS));
+ LocalDateTime.now().format(OmsBoxConstants.dateTimeFormatterYYYYMMDDHHMMSS));
};
}.start();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@
*/
package org.locationtech.udig.omsbox.utils;

import java.time.format.DateTimeFormatter;
import java.util.HashMap;

import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;

public class OmsBoxConstants {
public static final String CATEGORY_OTHERS = "Others";
Expand All @@ -38,8 +37,8 @@ public class OmsBoxConstants {
public static final String STATISTICS = "Statistics";

public static String dateTimeFormatterYYYYMMDDHHMMSS_string = "yyyy-MM-dd HH:mm:ss";
public static DateTimeFormatter dateTimeFormatterYYYYMMDDHHMMSS = DateTimeFormat
.forPattern(dateTimeFormatterYYYYMMDDHHMMSS_string);
public static DateTimeFormatter dateTimeFormatterYYYYMMDDHHMMSS = DateTimeFormatter
.ofPattern(dateTimeFormatterYYYYMMDDHHMMSS_string);

public static String LOGLEVEL_GUI_ON = "ON";
public static String LOGLEVEL_GUI_OFF = "OFF";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import i18n.omsbox.Messages;

import java.lang.reflect.InvocationTargetException;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -47,7 +48,6 @@
import org.eclipse.ui.dialogs.FilteredTree;
import org.eclipse.ui.dialogs.PatternFilter;
import org.eclipse.ui.part.ViewPart;
import org.joda.time.DateTime;

import org.locationtech.udig.omsbox.OmsBoxPlugin;
import org.locationtech.udig.omsbox.core.ModuleDescription;
Expand Down Expand Up @@ -397,9 +397,9 @@ public void runSelectedModule() throws Exception {
if (script == null) {
return;
}

String scriptID = currentSelectedModuleGui.getModuleDescription().getName() + " "
+ new DateTime().toString(OmsBoxConstants.dateTimeFormatterYYYYMMDDHHMMSS);
+ LocalDateTime.now().format(OmsBoxConstants.dateTimeFormatterYYYYMMDDHHMMSS);
handler.runModule(scriptID, script);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintStream;
import java.time.LocalDateTime;

import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
Expand All @@ -23,8 +24,6 @@
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.console.IConsole;
import org.eclipse.ui.console.IConsoleManager;
import org.joda.time.DateTime;

import org.locationtech.udig.omsbox.OmsBoxPlugin;
import org.locationtech.udig.omsbox.core.IProcessListener;
import org.locationtech.udig.omsbox.core.JConsoleOutputConsole;
Expand Down Expand Up @@ -83,7 +82,7 @@ private void execute( String path ) {
Process process = executor.exec(path, internalStream, errorStream, loggerLevelGui, ramLevel);

File scriptFile = new File(path);
scriptID = scriptFile.getName() + " " + new DateTime().toString(OmsBoxConstants.dateTimeFormatterYYYYMMDDHHMMSS);
scriptID = scriptFile.getName() + " " + LocalDateTime.now().format(OmsBoxConstants.dateTimeFormatterYYYYMMDDHHMMSS);
OmsBoxPlugin.getDefault().addProcess(process, scriptID);

// cleanup when leaving uDig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,21 @@
package org.locationtech.udig.omsbox.view.actions;

import java.io.File;

import org.locationtech.udig.ui.ExceptionDetailsDialog;
import java.time.LocalDateTime;

import org.apache.commons.io.FileUtils;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.program.Program;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.ui.IViewActionDelegate;
import org.eclipse.ui.IViewPart;
import org.joda.time.DateTime;

import org.locationtech.udig.omsbox.OmsBoxPlugin;
import org.locationtech.udig.omsbox.utils.OmsBoxConstants;
import org.locationtech.udig.omsbox.view.OmsBoxView;
import org.locationtech.udig.ui.ExceptionDetailsDialog;
fgdrf marked this conversation as resolved.
Show resolved Hide resolved

/**
* @author Andrea Antonello (www.hydrologis.com)
Expand All @@ -53,7 +50,7 @@ public void run( IAction action ) {
File tempFile = File.createTempFile("omsbox_", ".oms");
if (tempFile == null || !tempFile.exists() || tempFile.getAbsolutePath() == null) {
// try with user's home folder
String ts = new DateTime().toString(OmsBoxConstants.dateTimeFormatterYYYYMMDDHHMMSS);
String ts = LocalDateTime.now().format(OmsBoxConstants.dateTimeFormatterYYYYMMDDHHMMSS);
String userHomePath = System.getProperty("user.home"); //$NON-NLS-1$

File userHomeFile = new File(userHomePath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;

import org.locationtech.udig.catalog.IGeoResource;
import org.locationtech.udig.ui.ExceptionDetailsDialog;
import org.locationtech.udig.ui.PlatformGIS;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.operation.IRunnableWithProgress;
Expand All @@ -25,13 +21,13 @@
import org.eclipse.ui.IExportWizard;
import org.eclipse.ui.IWorkbench;
import org.geotools.data.simple.SimpleFeatureSource;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;

import org.locationtech.udig.catalog.IGeoResource;
import org.locationtech.udig.catalog.kml.core.KmlToolPlugin;
import org.locationtech.udig.catalog.kml.core.KmlUtils;
import org.locationtech.udig.catalog.kml.internal.Messages;
import org.locationtech.udig.catalog.kml.internal.ui.ImageConstants;
import org.locationtech.udig.ui.ExceptionDetailsDialog;
import org.locationtech.udig.ui.PlatformGIS;

/**
* @author Andrea Antonello (www.hydrologis.com)
Expand All @@ -41,7 +37,6 @@ public class KmlExportWizard extends Wizard implements IExportWizard {

public static boolean canFinish = false;
private KmlExportWizardPage mainPage;
public static DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern("yyyyMMddHHmm"); //$NON-NLS-1$

public KmlExportWizard() {
super();
Expand Down
Loading