Compare commits
11 Commits
jding/juni
...
release/7.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
89ac637904 | ||
|
|
6d8b1b51c7 | ||
|
|
e30b1a45d2 | ||
|
|
e3e23006ed | ||
|
|
0e04133323 | ||
|
|
a8f2e79338 | ||
|
|
6950d5cf6a | ||
|
|
5d8dc7531f | ||
|
|
8a6b2ab76a | ||
|
|
5d277417ae | ||
|
|
c4c8ab5ba6 |
@@ -46,7 +46,7 @@ public class MyURLClassLoader extends URLClassLoader {
|
||||
private Map pclasses = new HashMap();
|
||||
|
||||
public MyURLClassLoader(String fileName) throws IOException {
|
||||
this(new File(fileName).toURL());
|
||||
this(new File(fileName).toURI().toURL());
|
||||
}
|
||||
|
||||
public MyURLClassLoader(URL url) {
|
||||
|
||||
@@ -85,6 +85,7 @@ import org.talend.core.context.Context;
|
||||
import org.talend.core.context.RepositoryContext;
|
||||
import org.talend.core.exception.TalendInternalPersistenceException;
|
||||
import org.talend.core.hadoop.BigDataBasicUtil;
|
||||
import org.talend.core.hadoop.IHadoopDistributionService;
|
||||
import org.talend.core.model.general.ILibrariesService;
|
||||
import org.talend.core.model.general.ModuleNeeded;
|
||||
import org.talend.core.model.general.Project;
|
||||
@@ -133,14 +134,15 @@ import org.talend.core.repository.utils.ProjectDataJsonProvider;
|
||||
import org.talend.core.repository.utils.RepositoryPathProvider;
|
||||
import org.talend.core.repository.utils.XmiResourceManager;
|
||||
import org.talend.core.runtime.CoreRuntimePlugin;
|
||||
import org.talend.core.runtime.hd.IDynamicDistributionManager;
|
||||
import org.talend.core.runtime.repository.item.ItemProductKeys;
|
||||
import org.talend.core.runtime.services.IGenericWizardService;
|
||||
import org.talend.core.runtime.services.IMavenUIService;
|
||||
import org.talend.core.runtime.util.ItemDateParser;
|
||||
import org.talend.core.runtime.util.SharedStudioUtils;
|
||||
import org.talend.core.service.ICoreUIService;
|
||||
import org.talend.core.service.IUpdateService;
|
||||
import org.talend.core.service.IDetectCVEService;
|
||||
import org.talend.core.service.IUpdateService;
|
||||
import org.talend.core.utils.CodesJarResourceCache;
|
||||
import org.talend.cwm.helper.SubItemHelper;
|
||||
import org.talend.cwm.helper.TableHelper;
|
||||
@@ -2449,6 +2451,15 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
runProcessService.clearProjectRelatedSettings();
|
||||
}
|
||||
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IHadoopDistributionService.class)) {
|
||||
IHadoopDistributionService hdService = GlobalServiceRegister.getDefault()
|
||||
.getService(IHadoopDistributionService.class);
|
||||
if (hdService != null) {
|
||||
IDynamicDistributionManager dynamicDistrManager = hdService.getDynamicDistributionManager();
|
||||
dynamicDistrManager.reset(null);
|
||||
}
|
||||
}
|
||||
|
||||
// clear detect CVE cache
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IDetectCVEService.class)) {
|
||||
IDetectCVEService detectCVESvc = GlobalServiceRegister.getDefault().getService(IDetectCVEService.class);
|
||||
|
||||
@@ -39,6 +39,9 @@ import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.runtime.CoreRuntimePlugin;
|
||||
import org.talend.core.runtime.projectsetting.ProjectPreferenceManager;
|
||||
import org.talend.designer.runprocess.IRunProcessService;
|
||||
import org.talend.utils.JavaVersion;
|
||||
import org.talend.utils.StudioKeysFileCheck;
|
||||
import org.talend.utils.VersionException;
|
||||
|
||||
/**
|
||||
* Utilities around perl stuff. <br/>
|
||||
@@ -280,6 +283,10 @@ public final class JavaUtils {
|
||||
if (version == null) {
|
||||
return defaultCompliance;
|
||||
}
|
||||
JavaVersion ver = new JavaVersion(version);
|
||||
if (ver.getMajor() > 8) {
|
||||
return String.valueOf(ver.getMajor());
|
||||
}
|
||||
if (version.startsWith(JavaCore.VERSION_1_8)) {
|
||||
return JavaCore.VERSION_1_8;
|
||||
}
|
||||
@@ -361,4 +368,26 @@ public final class JavaUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static void validateJavaVersion() {
|
||||
try {
|
||||
// validate jvm which is used to start studio
|
||||
StudioKeysFileCheck.validateJavaVersion();
|
||||
|
||||
// validate default complier's compliance level
|
||||
IVMInstall install = JavaRuntime.getDefaultVMInstall();
|
||||
String ver = getCompilerCompliance((IVMInstall2) install, JavaCore.VERSION_1_8);
|
||||
|
||||
if (new JavaVersion(ver).compareTo(new JavaVersion(StudioKeysFileCheck.JAVA_VERSION_MAXIMUM_STRING)) > 0) {
|
||||
VersionException e = new VersionException(VersionException.ERR_JAVA_VERSION_NOT_SUPPORTED,
|
||||
"The maximum Java version supported by Studio is " + StudioKeysFileCheck.JAVA_VERSION_MAXIMUM_STRING
|
||||
+ ". Your compiler's compliance level is " + ver);
|
||||
throw e;
|
||||
}
|
||||
} catch (Exception e1) {
|
||||
if (e1 instanceof VersionException) {
|
||||
throw e1;
|
||||
}
|
||||
ExceptionHandler.process(e1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,8 @@ public interface IDynamicDistributionManager {
|
||||
|
||||
public void reloadAllDynamicDistributions(IProgressMonitor monitor) throws Exception;
|
||||
|
||||
public void reset(IProgressMonitor monitor);
|
||||
|
||||
public boolean isLoaded();
|
||||
|
||||
public void load(IProgressMonitor monitor, boolean resetModulesCache) throws Exception;
|
||||
|
||||
@@ -17,6 +17,7 @@ import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.talend.commons.utils.VersionUtils;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.prefs.ITalendCorePrefConstants;
|
||||
import org.talend.core.runtime.util.SharedStudioUtils;
|
||||
import org.talend.core.ui.CoreUIPlugin;
|
||||
import org.talend.core.ui.branding.IBrandingService;
|
||||
import org.talend.daikon.token.TokenGenerator;
|
||||
@@ -41,6 +42,8 @@ public class DefaultTokenCollector extends AbstractTokenCollector {
|
||||
|
||||
private static final TokenKey OS = new TokenKey("os"); //$NON-NLS-1$
|
||||
|
||||
private static final TokenKey SHARE_MODE = new TokenKey("share.mode"); //$NON-NLS-1$
|
||||
|
||||
public static final String COLLECTOR_SYNC_NB = "COLLECTOR_SYNC_NB"; //$NON-NLS-1$
|
||||
|
||||
public DefaultTokenCollector() {
|
||||
@@ -70,7 +73,7 @@ public class DefaultTokenCollector extends AbstractTokenCollector {
|
||||
|
||||
// typeStudio
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IBrandingService.class)) {
|
||||
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(
|
||||
IBrandingService brandingService = GlobalServiceRegister.getDefault().getService(
|
||||
IBrandingService.class);
|
||||
tokenStudioObject.put(TYPE_STUDIO.getKey(), brandingService.getAcronym());
|
||||
// tokenStudioObject.put(TYPE_STUDIO.getKey(), brandingService.getShortProductName());
|
||||
@@ -92,6 +95,8 @@ public class DefaultTokenCollector extends AbstractTokenCollector {
|
||||
tokenStudioObject.put(STOP_COLLECTOR.getKey(), "0"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
// Share mode
|
||||
tokenStudioObject.put(SHARE_MODE.getKey(), SharedStudioUtils.isSharedStudioMode());
|
||||
return tokenStudioObject;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
<dependency>
|
||||
<groupId>org.json</groupId>
|
||||
<artifactId>json</artifactId>
|
||||
<version>20230227</version>
|
||||
<version>20231013</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<artifactId>studio-tacokit-dependencies</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<properties>
|
||||
<tacokit.components.version>1.27.26</tacokit.components.version>
|
||||
<tacokit.components.version>1.27.28</tacokit.components.version>
|
||||
</properties>
|
||||
<repositories>
|
||||
<repository>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<properties>
|
||||
<tcomp.version>1.38.11</tcomp.version>
|
||||
<tcomp.version>1.38.12</tcomp.version>
|
||||
<slf4j.version>1.7.32</slf4j.version>
|
||||
<log4j2.version>2.17.1</log4j2.version>
|
||||
<reload4j.version>1.2.19</reload4j.version>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<packaging>pom</packaging>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>Talend OpenSource Release</id>
|
||||
<id>talend_open</id>
|
||||
<url>https://artifacts-oss.talend.com/nexus/content/repositories/TalendOpenSourceRelease/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
@@ -10,4 +10,5 @@ bin.includes = META-INF/,\
|
||||
templates/,\
|
||||
lib/crypto-utils.jar,\
|
||||
lib/slf4j-api-1.7.25.jar,\
|
||||
distribution/license.json
|
||||
distribution/license.json,\
|
||||
lib/jboss-marshalling-2.0.12.Final.jar
|
||||
|
||||
@@ -278,8 +278,8 @@ public class ModulesNeededProvider {
|
||||
public static void reset() {
|
||||
// clean the cache
|
||||
ExtensionModuleManager.getInstance().clearCache();
|
||||
getModulesNeeded().clear();
|
||||
getAllManagedModules().clear();
|
||||
componentImportNeedsList.clear();
|
||||
allManagedModules.clear();
|
||||
systemModules = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -229,7 +229,6 @@ public abstract class AbstractLibrariesService implements ILibrariesService {
|
||||
public void resetModulesNeeded() {
|
||||
ModulesNeededProvider.reset();
|
||||
ModuleStatusProvider.reset();
|
||||
ModulesNeededProvider.getModulesNeeded().clear();
|
||||
checkLibraries();
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ public class HotClassLoader extends URLClassLoader {
|
||||
if (pathToAdd2 != null && pathToAdd2.length() > 0) {
|
||||
try {
|
||||
File pathToAdd = new File(pathToAdd2).getCanonicalFile();
|
||||
addURL(pathToAdd.toURL());
|
||||
addURL(pathToAdd.toURI().toURL());
|
||||
} catch (IOException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
|
||||
@@ -122,4 +122,6 @@ DataTransferMessages.DataTransfer_browse=B&rowse...
|
||||
DataTransferMessages.ArchiveExport_selectDestinationTitle=Export to Archive File
|
||||
WorkbenchMessages.ShowView_errorTitle=Problems Showing View
|
||||
ComponentsManager.form.install.dialog.restart.title=Restarting Studio
|
||||
ComponentsManager.form.install.dialog.restart.message=We need to restart studio to finish the installation.\n\nDo you want to restart studio right now?
|
||||
ComponentsManager.form.install.dialog.restart.message=We need to restart studio to finish the installation.\n\nDo you want to restart studio right now?
|
||||
JavaVersion.CheckError=Java upgrade required, minimal required java version is {0}, current version is {1}.
|
||||
JavaVersion.CheckError.notSupported=The maximum Java version supported by Studio is {0}. Your current version is {1}.
|
||||
@@ -78,6 +78,7 @@ import org.talend.repository.ProjectManager;
|
||||
import org.talend.repository.model.IRepositoryService;
|
||||
import org.talend.repository.ui.login.LoginHelper;
|
||||
import org.talend.utils.StudioKeysFileCheck;
|
||||
import org.talend.utils.VersionException;
|
||||
|
||||
/**
|
||||
* This class controls all aspects of the application's execution.
|
||||
@@ -112,6 +113,23 @@ public class Application implements IApplication {
|
||||
StudioKeysFileCheck.check(ConfigurationScope.INSTANCE.getLocation().toFile());
|
||||
|
||||
Display display = PlatformUI.createDisplay();
|
||||
|
||||
try {
|
||||
StudioKeysFileCheck.validateJavaVersion();
|
||||
} catch (Exception e) {
|
||||
Shell shell = new Shell(display, SWT.NONE);
|
||||
if (e instanceof VersionException) {
|
||||
String msg = Messages.getString("JavaVersion.CheckError", StudioKeysFileCheck.JAVA_VERSION_MINIMAL_STRING,
|
||||
StudioKeysFileCheck.getJavaVersion());
|
||||
if (!((VersionException) e).requireUpgrade()) {
|
||||
msg = Messages.getString("JavaVersion.CheckError.notSupported",
|
||||
StudioKeysFileCheck.JAVA_VERSION_MAXIMUM_STRING, StudioKeysFileCheck.getJavaVersion());
|
||||
}
|
||||
MessageDialog.openError(shell, null, msg);
|
||||
}
|
||||
return IApplication.EXIT_OK;
|
||||
}
|
||||
|
||||
try {
|
||||
// TUP-5816 don't put any code ahead of this part unless you make sure it won't trigger workspace
|
||||
// initialization.
|
||||
|
||||
@@ -2848,7 +2848,7 @@ public class DatabaseForm extends AbstractForm {
|
||||
File file = new File(stringToFile);
|
||||
if (file != null) {
|
||||
try {
|
||||
MyURLClassLoader cl = new MyURLClassLoader(file.toURL());
|
||||
MyURLClassLoader cl = new MyURLClassLoader(new URL[] {file.toURI().toURL()},this.getClass().getClassLoader());
|
||||
Class[] classes = cl.getAssignableClasses(Driver.class);
|
||||
for (Class classe : classes) {
|
||||
driverClassTxt.add(classe.getName());
|
||||
@@ -6109,7 +6109,7 @@ public class DatabaseForm extends AbstractForm {
|
||||
File file = new File(stringToFile);
|
||||
if (file != null) {
|
||||
try {
|
||||
MyURLClassLoader cl = new MyURLClassLoader(file.toURL());
|
||||
MyURLClassLoader cl = new MyURLClassLoader(new URL[] {file.toURI().toURL()},this.getClass().getClassLoader());
|
||||
Class[] classes = cl.getAssignableClasses(Driver.class);
|
||||
for (Class classe : classes) {
|
||||
generalJdbcClassNameText.add(classe.getName());
|
||||
|
||||
@@ -12,40 +12,106 @@
|
||||
// ============================================================================
|
||||
package org.talend.utils;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/*
|
||||
* Created by bhe on Dec 24, 2019
|
||||
*/
|
||||
public class JavaVersion implements Comparable<JavaVersion> {
|
||||
|
||||
private int major, minor, security;
|
||||
private static final Logger LOGGER = Logger.getLogger(JavaVersion.class.getCanonicalName());
|
||||
|
||||
private int major, minor, buildNumber, security;
|
||||
|
||||
public JavaVersion(String v) {
|
||||
parseVersion(v);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the major
|
||||
*/
|
||||
public int getMajor() {
|
||||
return major;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the minor
|
||||
*/
|
||||
public int getMinor() {
|
||||
return minor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the buildNumber
|
||||
*/
|
||||
public int getBuildNumber() {
|
||||
return buildNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the security
|
||||
*/
|
||||
public int getSecurity() {
|
||||
return security;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(JavaVersion o) {
|
||||
if (this.major - o.major == 0) {
|
||||
if (this.minor - o.minor == 0) {
|
||||
return this.security - o.security;
|
||||
if (this.buildNumber - o.buildNumber == 0) {
|
||||
return this.security - o.security;
|
||||
}
|
||||
return this.buildNumber - o.buildNumber;
|
||||
}
|
||||
return this.minor - o.minor;
|
||||
}
|
||||
return this.major - o.major;
|
||||
}
|
||||
|
||||
private String normalizeVersion(String v) {
|
||||
v = v.replaceAll("[^\\d._]", "");
|
||||
if (v.isEmpty()) {
|
||||
v = "0";
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
private void parseVersion(String v) {
|
||||
if (v == null || v.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
String[] version = v.split("[\\._]");
|
||||
this.major = Integer.parseInt(version[0]);
|
||||
if (version.length > 1) {
|
||||
this.minor = Integer.parseInt(version[1]);
|
||||
|
||||
try {
|
||||
this.major = Integer.parseInt(normalizeVersion(version[0]));
|
||||
} catch (Exception e) {
|
||||
LOGGER.log(Level.WARNING, "Major version parse error of " + v, e);
|
||||
}
|
||||
if (version.length > 2) {
|
||||
|
||||
if (version.length > 1 && !StringUtils.isEmpty(version[1])) {
|
||||
try {
|
||||
this.minor = Integer.parseInt(normalizeVersion(version[1]));
|
||||
} catch (Exception e) {
|
||||
LOGGER.log(Level.WARNING, "Minor version parse error of " + v, e);
|
||||
}
|
||||
}
|
||||
|
||||
if (version.length > 2 && !StringUtils.isEmpty(version[2])) {
|
||||
try {
|
||||
this.buildNumber = Integer.parseInt(normalizeVersion(version[2]));
|
||||
} catch (Exception e) {
|
||||
LOGGER.log(Level.WARNING, "Build number parse error of " + v, e);
|
||||
}
|
||||
}
|
||||
|
||||
if (version.length > 3 && !StringUtils.isEmpty(version[3])) {
|
||||
// strip non number part if any
|
||||
String securityNumber = version[version.length - 1];
|
||||
String securityNumber = version[3];
|
||||
for (int i = 0; i < securityNumber.length(); i++) {
|
||||
char c = securityNumber.charAt(i);
|
||||
if (c > '9' || c < '0') {
|
||||
@@ -53,8 +119,11 @@ public class JavaVersion implements Comparable<JavaVersion> {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this.security = Integer.parseInt(securityNumber);
|
||||
try {
|
||||
this.security = Integer.parseInt(securityNumber);
|
||||
} catch (Exception e) {
|
||||
LOGGER.log(Level.WARNING, "Security version parse error of " + v, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,6 +132,7 @@ public class JavaVersion implements Comparable<JavaVersion> {
|
||||
int result = 1;
|
||||
result = result * prime + this.major;
|
||||
result = result * prime + this.minor;
|
||||
result = result * prime + this.buildNumber;
|
||||
result = result * prime + this.security;
|
||||
return result;
|
||||
}
|
||||
@@ -84,10 +154,11 @@ public class JavaVersion implements Comparable<JavaVersion> {
|
||||
sb.append(".");
|
||||
sb.append(this.minor);
|
||||
sb.append(".");
|
||||
if (this.major == 1) {
|
||||
sb.append("0_");
|
||||
sb.append(this.buildNumber);
|
||||
if (this.security > 0) {
|
||||
sb.append("_");
|
||||
sb.append(this.security);
|
||||
}
|
||||
sb.append(this.security);
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,10 +32,14 @@ public class StudioKeysFileCheck {
|
||||
|
||||
private static final String JAVA_VERSION_PROP = "java.version";
|
||||
|
||||
private static final String JAVA_VERSION_MINIMAL_STRING = "1.8.0_161";
|
||||
public static final String JAVA_VERSION_MINIMAL_STRING = "1.8.0_161";
|
||||
|
||||
private static final JavaVersion JAVA_VERSION_MINIMAL = new JavaVersion(JAVA_VERSION_MINIMAL_STRING);
|
||||
|
||||
public static final String JAVA_VERSION_MAXIMUM_STRING = "11";
|
||||
|
||||
private static final JavaVersion JAVA_VERSION_MAXIMUM = new JavaVersion(JAVA_VERSION_MAXIMUM_STRING);
|
||||
|
||||
private StudioKeysFileCheck() {
|
||||
|
||||
}
|
||||
@@ -64,11 +68,24 @@ public class StudioKeysFileCheck {
|
||||
String currentVersion = System.getProperty(JAVA_VERSION_PROP);
|
||||
JavaVersion cv = new JavaVersion(currentVersion);
|
||||
if (cv.compareTo(JAVA_VERSION_MINIMAL) < 0) {
|
||||
RuntimeException e = new RuntimeException(
|
||||
VersionException e = new VersionException(VersionException.ERR_JAVA_VERSION_UPGRADE_REQUIRED,
|
||||
"Java upgrade required, minimal required java version is " + JAVA_VERSION_MINIMAL_STRING
|
||||
+ ", current version is " + currentVersion);
|
||||
LOGGER.error(e);
|
||||
LOGGER.error(e.getMessage(), e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
JavaVersion currentMajor = new JavaVersion(String.valueOf(cv.getMajor()));
|
||||
if (currentMajor.compareTo(JAVA_VERSION_MAXIMUM) > 0) {
|
||||
VersionException e = new VersionException(VersionException.ERR_JAVA_VERSION_NOT_SUPPORTED,
|
||||
"The maximum Java version supported by Studio is " + JAVA_VERSION_MAXIMUM_STRING
|
||||
+ ". Your current version is " + currentVersion);
|
||||
LOGGER.error(e.getMessage(), e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getJavaVersion() {
|
||||
return System.getProperty(JAVA_VERSION_PROP);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2023 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.utils;
|
||||
|
||||
/**
|
||||
* @author PCW created on Nov 20, 2023
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class VersionException extends RuntimeException {
|
||||
|
||||
public static final int ERR_JAVA_VERSION_UPGRADE_REQUIRED = 0;
|
||||
|
||||
public static final int ERR_JAVA_VERSION_NOT_SUPPORTED = 1;
|
||||
|
||||
private int errID;
|
||||
|
||||
public VersionException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
public VersionException(int errID, String msg) {
|
||||
this(msg);
|
||||
this.errID = errID;
|
||||
}
|
||||
|
||||
public int getErrID() {
|
||||
return this.errID;
|
||||
}
|
||||
|
||||
public boolean requireUpgrade() {
|
||||
return this.errID == ERR_JAVA_VERSION_UPGRADE_REQUIRED;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user