diff --git a/pom.xml b/pom.xml index 19794f2..92ecc7c 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 nl.isaac.dotcms.plugin.advancedsearch isaac-dotcms-advancedsearch - 5.3.8.10-1 + 22.03.7-1 bundle UTF-8 @@ -46,10 +46,10 @@ org.apache.maven.plugins maven-compiler-plugin - 3.7.0 + 3.11.0 - 1.8 - 1.8 + 11 + 11 @@ -90,6 +90,7 @@ *;scope=compile|runtime;inline=false true conf,ext + <_noee>true @@ -151,13 +152,22 @@ com.dotcms dotcms - 5.3.8.10 + 22.03.7 provided org.mockito mockito-core + + + com.fasterxml.jackson.core + jackson-databind + + + com.sun.xml.ws + jaxws-ri + diff --git a/src/main/java/nl/isaac/dotcms/searcher/dao/FolderDAO.java b/src/main/java/nl/isaac/dotcms/searcher/dao/FolderDAO.java index 33b1dd0..a00d880 100644 --- a/src/main/java/nl/isaac/dotcms/searcher/dao/FolderDAO.java +++ b/src/main/java/nl/isaac/dotcms/searcher/dao/FolderDAO.java @@ -30,7 +30,7 @@ public List getAllFolders(Host host) { try { folders.addAll(APILocator.getFolderAPI().findFoldersByHost(host, systemUser, false)); - } catch (DotHibernateException | DotSecurityException e) { + } catch (DotSecurityException e) { Logger.warn(this.getClass().getName(), "Error while getting all folders", e); } diff --git a/src/main/java/nl/isaac/dotcms/searcher/util/SearchableAttributesUtil.java b/src/main/java/nl/isaac/dotcms/searcher/util/SearchableAttributesUtil.java index 7c61b98..22b87e7 100644 --- a/src/main/java/nl/isaac/dotcms/searcher/util/SearchableAttributesUtil.java +++ b/src/main/java/nl/isaac/dotcms/searcher/util/SearchableAttributesUtil.java @@ -7,6 +7,7 @@ import java.util.List; import java.util.Map; +import com.dotcms.storage.model.Metadata; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; @@ -90,21 +91,17 @@ public static Collection getFileAttributes(Contentlet fileC return searchableAttributes; } - if (StringUtils.isBlank(file.getMetaData())) { - return searchableAttributes; - } - - JsonObject metaData = null; + Metadata metaData = null; try { - metaData = new JsonParser().parse(file.getMetaData()).getAsJsonObject(); + metaData = file.getMetadata(); } catch (Throwable t) { Logger.warn(SearchableAttributesUtil.class.getName(), "Can't parse metadata of " + file.getPath() + file.getFileName()); } // ContentType returns: "text/plain; charset=ISO-8859-1" - if (metaData != null && metaData.has("contentType")) { - String contentTypeWithCharacterSet = metaData.get("contentType").getAsString(); + if (metaData != null && metaData.getContentType() != null) { + String contentTypeWithCharacterSet = metaData.getContentType(); String[] contentTypeWithCharacterSetArray = contentTypeWithCharacterSet.split(";"); if (contentTypeWithCharacterSetArray.length > 0) { diff --git a/src/main/java/nl/isaac/dotcms/util/osgi/ExtendedGenericBundleActivator.java b/src/main/java/nl/isaac/dotcms/util/osgi/ExtendedGenericBundleActivator.java index b676e46..ed68ab6 100644 --- a/src/main/java/nl/isaac/dotcms/util/osgi/ExtendedGenericBundleActivator.java +++ b/src/main/java/nl/isaac/dotcms/util/osgi/ExtendedGenericBundleActivator.java @@ -1,6 +1,5 @@ package nl.isaac.dotcms.util.osgi; - import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -81,7 +80,7 @@ public abstract class ExtendedGenericBundleActivator extends GenericBundleActiva } else { DOTCMS_HOME = userDir; } - Logger.debug(ExtendedGenericBundleActivator.class, "DOTCMS_HOME: " + DOTCMS_HOME); + Logger.debug(ExtendedGenericBundleActivator.class.getName(), "DOTCMS_HOME: " + DOTCMS_HOME); } public abstract void init(BundleContext context); @@ -95,7 +94,7 @@ final public void start(BundleContext context) throws Exception { init(context); Logger.info(this.getClass().getName(), "Started " + context.getBundle().getSymbolicName()); } catch (Throwable t) { - Logger.error(this, "Initialization of plugin: " + context.getBundle().getSymbolicName() + " failed with error:", t); + Logger.error(this.getClass().getName(), "Initialization of plugin: " + context.getBundle().getSymbolicName() + " failed with error:", t); throw t; } } @@ -114,6 +113,7 @@ protected void addMonitoringServlet(BundleContext context) throws Exception { } protected void addViewTool(BundleContext context, Class viewtoolClass, String key, ViewToolScope scope) { + Logger.info(this.getClass().getName(), "Add ViewTool " + key + " (extra log line in shared utils)"); OSGiSafeServletToolInfo viewtool = new OSGiSafeServletToolInfo(); viewtool.setClassname(viewtoolClass); viewtool.setKey(key); @@ -362,7 +362,7 @@ protected void addPreHook(Class prehook) throws protected void addRestService(BundleContext context, final Class clazz) { final Class thisClass = this.getClass(); - Logger.info(thisClass, "Added REST service " + clazz.getSimpleName()); + Logger.info(thisClass.getName(), "Added REST service " + clazz.getSimpleName()); RestServiceUtil.addResource(clazz); cleanupFunctions.add(new Runnable() { @@ -464,10 +464,10 @@ protected void addJob(BundleContext context, Class clazz, String Logger.info(this.getClass().getName(), "Scheduled job " + jobName + ", next trigger is on " + date); } catch (ParseException e) { - Logger.error(this, "Cron expression '" + cronExpression + "' has an exception. Throwing IllegalArgumentException", e); + Logger.error(this.getClass().getName(), "Cron expression '" + cronExpression + "' has an exception. Throwing IllegalArgumentException", e); throw new IllegalArgumentException(e); } catch (SchedulerException e) { - Logger.error(this, "Unable to schedule job " + jobName, e); + Logger.error(this.getClass().getName(), "Unable to schedule job " + jobName, e); } } @@ -566,7 +566,7 @@ private void backupOriginalFile(URL resourceURL) throws IOException { File originalFile = new File(DOTCMS_HOME + File.separator + resourceURL.getPath().substring(6)); if (backupFile.exists()) { - Logger.debug(this, "Backup already created earlier, so we don't create a new one"); + Logger.debug(this.getClass().getName(), "Backup already created earlier, so we don't create a new one"); } else { backupFile.getParentFile().mkdirs(); copyFile(originalFile.toURI().toURL(), backupFile);