Skip to content

Commit

Permalink
Merge branch 'feature/upgrade-22'
Browse files Browse the repository at this point in the history
  • Loading branch information
Yasin Dilekçi committed Oct 26, 2023
2 parents d38db91 + 326f597 commit d4e1939
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 21 deletions.
20 changes: 15 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>nl.isaac.dotcms.plugin.advancedsearch</groupId>
<artifactId>isaac-dotcms-advancedsearch</artifactId>
<version>5.3.8.10-1</version>
<version>22.03.7-1</version>
<packaging>bundle</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -46,10 +46,10 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<version>3.11.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
</plugins>
Expand Down Expand Up @@ -90,6 +90,7 @@
<Embed-Dependency>*;scope=compile|runtime;inline=false</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
<Data-Files>conf,ext</Data-Files>
<_noee>true</_noee> <!-- For some reason the Require-Capability breaks the plugin deployment in Java 11-->
</instructions>
</configuration>
</execution>
Expand Down Expand Up @@ -151,13 +152,22 @@
<dependency>
<groupId>com.dotcms</groupId>
<artifactId>dotcms</artifactId>
<version>5.3.8.10</version>
<version>22.03.7</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
</exclusion>
<!-- Exclude the following otherwise 22.03.7 will not build -->
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-ri</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/nl/isaac/dotcms/searcher/dao/FolderDAO.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public List<Folder> 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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -90,21 +91,17 @@ public static Collection<SearchableAttribute> 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) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package nl.isaac.dotcms.util.osgi;


import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
Expand Down Expand Up @@ -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);
Expand All @@ -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;
}
}
Expand All @@ -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);
Expand Down Expand Up @@ -362,7 +362,7 @@ protected void addPreHook(Class<? extends ContentletAPIPreHook> 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() {
Expand Down Expand Up @@ -464,10 +464,10 @@ protected void addJob(BundleContext context, Class<? extends Job> 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);
}

}
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit d4e1939

Please sign in to comment.