Skip to content
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import java.util.List;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.stream.Collectors;

import static org.jahia.modules.javascript.modules.engine.jshandler.JavascriptProtocolConnection.BUNDLE_HEADER_JAVASCRIPT_INIT_SCRIPT;

Expand Down Expand Up @@ -100,14 +99,14 @@ public void bundleChanged(BundleEvent event) {
}
}
} catch (Exception e) {
logger.error("Cannot handle event {}", event.toString(), e);
logger.error("Cannot handle event {}", event, e);
}
}

public List<Bundle> getJavascriptModules() {
return Arrays.stream(engine.getBundleContext().getBundles())
.filter(bundle -> bundle.getState() == Bundle.ACTIVE && isJavascriptModule(bundle))
.collect(Collectors.toList());
.toList();
}

public boolean isJavascriptModule(Bundle bundle) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

public class MockBodyContent extends BodyContent {

private MockJspWriter writer;
private final MockJspWriter writer;


public MockBodyContent(MockJspWriter writer) {
Expand All @@ -25,10 +25,10 @@ public String getString() {
return writer.getString();
}

public void writeOut(Writer writer) throws IOException {
public void writeOut(Writer writer) {
// not used
}


//---------------------------------------------------------------------
// Delegating implementations of JspWriter's abstract methods
//---------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.io.Writer;

/**
* Mock implementation of the {@link javax.servlet.jsp.JspWriter} class.
Expand Down Expand Up @@ -48,7 +47,7 @@ private void init() {
this.targetWriter = new PrintWriter(this.originalWriter);
}

protected PrintWriter getTargetWriter() throws IOException {
protected PrintWriter getTargetWriter() {
return this.targetWriter;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public Object findAttribute(String name) {
} else if (this.renderContext.getRequest().getSession().getAttribute(name) != null) {
return this.renderContext.getRequest().getSession().getAttribute(name);
} else {
return this.appAttr.containsKey(name) ? this.appAttr.get(name) : null;
return this.appAttr.getOrDefault(name, null);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ private ProxyObject recursiveProxyMap(Map<String, Object> mapToProxy) {
return recursiveProxyMap((Map<String, Object>) o);
}
return o;
}).collect(Collectors.toList())));
}).toList()));
}
}
return ProxyObject.fromMap(mapToProxy);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ public class GraalVMEngine {
private static final Logger logger = LoggerFactory.getLogger(GraalVMEngine.class);

public static final String JS = "js";
private static final String UNKNOWN_SYS_PROP = "Unknown";

/**
* Mimetype used by Graal to identify ESM source code.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
public class JSFileSystem implements FileSystem {
private static final String ROOT_JS_LIBS_DIR = "/META-INF/js/libs/";

final private BundleContext bundleContext;
private final BundleContext bundleContext;

JSFileSystem(BundleContext bundleContext) {
this.bundleContext = bundleContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ private static Map<String, Object> toJSNodeProperties(Node node, boolean include
jsProperties.put(property.getName(),
Arrays.stream(property.getValues())
.map(ThrowingFunction.unchecked(value -> toJSNodePropertyValue(property, value)))
.collect(Collectors.toList()));
.toList());
} else {
jsProperties.put(property.getName(), toJSNodePropertyValue(property, property.getValue()));
}
Expand Down Expand Up @@ -225,7 +225,7 @@ private static void toVirtualNodeProperty(JCRNodeWrapper node, String propertyNa
if (epd != null && epd.isMultiple()) {
if (value instanceof List && ((List) value).size() > 0) {
List<?> values = (List<?>) value;
List<String> stringList = values.stream().map(Object::toString).collect(Collectors.toUnmodifiableList());
List<String> stringList = values.stream().map(Object::toString).toList();
node.setProperty(propertyName, stringList.toArray(new String[stringList.size()]));
} else {
node.setProperty(propertyName, ((String) value).split(" "));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import org.osgi.framework.Bundle;

import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class Registry {
Expand Down Expand Up @@ -48,7 +47,7 @@ public List<Map<String, Object>> find(Map<String, Object> filter, String orderBy
Comparator.nullsFirst(Comparator.reverseOrder())));
}

return filtered.collect(Collectors.toList());
return filtered.toList();
}

public void add(String type, String key, Map<String, Object>... arguments) {
Expand Down
Loading