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

Issue #6354 - OSGI manifest for slf4j-api packages lower limit should be 1.7 #6381

Merged
merged 4 commits into from
Jun 10, 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
9 changes: 0 additions & 9 deletions demos/demo-jetty-webapp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,6 @@
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-slf4j-impl</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlets</artifactId>
Expand Down
22 changes: 7 additions & 15 deletions demos/demo-jetty-webapp/src/main/java/com/acme/ChatServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,12 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

// Simple asynchronous Chat room.
// This does not handle duplicate usernames or multiple frames/tabs from the same browser
// Some code is duplicated for clarity.
@SuppressWarnings("serial")
public class ChatServlet extends HttpServlet
{
private static final Logger LOG = LoggerFactory.getLogger(ChatServlet.class);

private long asyncTimeout = 10000;

@Override
Expand All @@ -63,7 +58,7 @@ class Member implements AsyncListener
@Override
public void onTimeout(AsyncEvent event) throws IOException
{
LOG.debug("resume request");
getServletContext().log("resume request");
AsyncContext async = _async.get();
if (async != null && _async.compareAndSet(async, null))
{
Expand Down Expand Up @@ -102,10 +97,10 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)
String message = request.getParameter("message");
String username = request.getParameter("user");

LOG.debug("doPost called. join={},message={},username={}", join, message, username);
getServletContext().log("doPost called. join=" + join + " message=" + message + " username=" + username);
if (username == null)
{
LOG.debug("no parameter user set, sending 503");
getServletContext().log("no parameter user set, sending 503");
response.sendError(503, "user==null");
return;
}
Expand All @@ -125,14 +120,14 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)
{
synchronized (member)
{
LOG.debug("Queue size: {}", member._queue.size());
getServletContext().log("Queue size: " + member._queue.size());
if (!member._queue.isEmpty())
{
sendSingleMessage(response, member);
}
else
{
LOG.debug("starting async");
getServletContext().log("starting async");
AsyncContext async = request.startAsync();
async.setTimeout(asyncTimeout);
async.addListener(member);
Expand All @@ -147,7 +142,7 @@ private Member getMember(String username, Map<String, Member> room)
Member member = room.get(username);
if (member == null)
{
LOG.debug("user: {} in room: {} doesn't exist. Creating new user.", username, room);
getServletContext().log("user: " + username + " in room: " + room + " doesn't exist. Creating new user.");
member = new Member(username);
room.put(username, member);
}
Expand All @@ -159,7 +154,7 @@ private Map<String, Member> getRoom(String path)
Map<String, Member> room = _rooms.get(path);
if (room == null)
{
LOG.debug("room: {} doesn't exist. Creating new room.", path);
getServletContext().log("room: " + path + " doesn't exist. Creating new room.");
room = new HashMap<>();
_rooms.put(path, room);
}
Expand Down Expand Up @@ -192,7 +187,6 @@ private void sendSingleMessage(HttpServletResponse response, Member member) thro

private void sendMessageToAllMembers(String message, String username, Map<String, Member> room)
{
LOG.debug("Sending message: {} from: {}", message, username);
for (Member m : room.values())
{
synchronized (m)
Expand All @@ -202,10 +196,8 @@ private void sendMessageToAllMembers(String message, String username, Map<String

// wakeup member if polling
AsyncContext async = m._async.get();
LOG.debug("Async found: {}", async);
if (async != null & m._async.compareAndSet(async, null))
{
LOG.debug("dispatch");
async.dispatch();
}
}
Expand Down
8 changes: 3 additions & 5 deletions demos/demo-jetty-webapp/src/main/java/com/acme/Dump.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@
import javax.servlet.http.HttpServletResponseWrapper;
import javax.servlet.http.Part;

import org.slf4j.LoggerFactory;

/**
* Dump Servlet Request.
*/
Expand Down Expand Up @@ -116,7 +114,7 @@ public void doGet(final HttpServletRequest request, final HttpServletResponse re
}
catch (ServletException e)
{
getServletContext().log(e.toString());
getServletContext().log("Login fail", e);
}
}

Expand Down Expand Up @@ -341,12 +339,12 @@ public void run()
}
catch (IOException e2)
{
LoggerFactory.getLogger(Dump.class).trace("IGNORED", e2);
getServletContext().log("Write fail", e2);
}
}
catch (IOException e)
{
LoggerFactory.getLogger(Dump.class).trace("IGNORED", e);
getServletContext().log("Output fail", e);
}
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,12 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Dump Servlet Request.
*/
@SuppressWarnings("serial")
public class SecureModeServlet extends HttpServlet
{
private static final Logger LOG = LoggerFactory.getLogger(SecureModeServlet.class);

@Override
public void init(ServletConfig config) throws ServletException
{
Expand Down Expand Up @@ -116,7 +111,7 @@ private void runLoggingChecks(ServletOutputStream out) throws Exception
try
{
out.println("check ability to log<br/>");
LOG.info("testing logging");
getServletContext().log("testing logging");
out.println("status: <b>SUCCESS - expected</b><br/>");
}
catch (SecurityException e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* TestFilter.
*
Expand All @@ -39,8 +36,6 @@
*/
public class TestFilter implements Filter
{
private static final Logger LOG = LoggerFactory.getLogger(TestFilter.class);

private boolean _remote;
private ServletContext _context;
private final Set<String> _allowed = new HashSet<String>();
Expand All @@ -54,7 +49,7 @@ public void init(FilterConfig filterConfig) throws ServletException
_allowed.add("/jetty_banner.gif");
_allowed.add("/remote.html");

LOG.debug("TestFilter#remote=" + _remote);
filterConfig.getServletContext().log("TestFilter#remote=" + _remote);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion jetty-alpn/jetty-alpn-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</goals>
<configuration>
<instructions>
<Import-Package>org.eclipse.jetty.alpn;resolution:=optional,*</Import-Package>
<Import-Package>${osgi.slf4j.import.packages},org.eclipse.jetty.alpn;resolution:=optional,*</Import-Package>
<Require-Capability>osgi.extender; filter:="(osgi.extender=osgi.serviceloader.processor)";resolution:=optional, osgi.serviceloader; filter:="(osgi.serviceloader=org.eclipse.jetty.io.ssl.ALPNProcessor$Client)";resolution:=optional;cardinality:=multiple</Require-Capability>
</instructions>
</configuration>
Expand Down
2 changes: 1 addition & 1 deletion jetty-alpn/jetty-alpn-conscrypt-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<configuration>
<instructions>
<Bundle-Description>Conscrypt Client ALPN</Bundle-Description>
<Import-Package>org.conscrypt;version="${conscrypt.version}",*</Import-Package>
<Import-Package>${osgi.slf4j.import.packages},org.conscrypt;version="${conscrypt.version}",*</Import-Package>
<Export-Package>*</Export-Package>
<Require-Capability>osgi.extender; filter:="(osgi.extender=osgi.serviceloader.registrar)";resolution:=optional</Require-Capability>
<Provide-Capability>osgi.serviceloader; osgi.serviceloader=org.eclipse.jetty.io.ssl.ALPNProcessor$Client</Provide-Capability>
Expand Down
2 changes: 1 addition & 1 deletion jetty-alpn/jetty-alpn-conscrypt-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
<configuration>
<instructions>
<Bundle-Description>Conscrypt ALPN</Bundle-Description>
<Import-Package>org.conscrypt;version="${conscrypt.version}",*</Import-Package>
<Import-Package>${osgi.slf4j.import.packages},org.conscrypt;version="${conscrypt.version}",*</Import-Package>
<Require-Capability>osgi.extender; filter:="(osgi.extender=osgi.serviceloader.registrar)";resolution:=optional</Require-Capability>
<Provide-Capability>osgi.serviceloader;osgi.serviceloader=org.eclipse.jetty.io.ssl.ALPNProcessor$Server</Provide-Capability>
<_nouses>true</_nouses>
Expand Down
2 changes: 1 addition & 1 deletion jetty-annotations/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<extensions>true</extensions>
<configuration>
<instructions>
<Import-Package>org.objectweb.asm;version="5",*</Import-Package>
<Import-Package>${osgi.slf4j.import.packages},org.objectweb.asm;version="5",*</Import-Package>
<Require-Capability>osgi.serviceloader; filter:="(osgi.serviceloader=javax.servlet.ServletContainerInitializer)";resolution:=optional;cardinality:=multiple, osgi.extender; filter:="(osgi.extender=osgi.serviceloader.processor)";resolution:=optional
</Require-Capability>
</instructions>
Expand Down
2 changes: 1 addition & 1 deletion jetty-jndi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<extensions>true</extensions>
<configuration>
<instructions>
<Import-Package>javax.mail.*;resolution:=optional,*</Import-Package>
<Import-Package>${osgi.slf4j.import.packages},javax.mail.*;resolution:=optional,*</Import-Package>
</instructions>
</configuration>
</plugin>
Expand Down
47 changes: 23 additions & 24 deletions jetty-osgi/jetty-osgi-boot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,30 +71,29 @@
<Bundle-SymbolicName>org.eclipse.jetty.osgi.boot;singleton:=true</Bundle-SymbolicName>
<Bundle-Activator>org.eclipse.jetty.osgi.boot.JettyBootstrapActivator</Bundle-Activator>
<DynamicImport-Package>org.eclipse.jetty.*;version="[$(version;===;${parsedVersion.osgiVersion}),$(version;+;${parsedVersion.osgiVersion}))"</DynamicImport-Package>
<Import-Package>javax.mail;version="1.4.0";resolution:=optional,
javax.mail.event;version="1.4.0";resolution:=optional,
javax.mail.internet;version="1.4.0";resolution:=optional,
javax.mail.search;version="1.4.0";resolution:=optional,
javax.mail.util;version="1.4.0";resolution:=optional,
javax.servlet;version="[$(version;==;${servlet.api.version}),$(version;+;${servlet.api.version}))",
javax.servlet.http;version="[$(version;==;${servlet.api.version}),$(version;+;${servlet.api.version}))",
javax.transaction;version="1.1.0";resolution:=optional,
javax.transaction.xa;version="1.1.0";resolution:=optional,
org.objectweb.asm;version="$(version;=;${asm.version})";resolution:=optional,
org.osgi.framework,
org.osgi.service.cm;version="1.4.0",
org.osgi.service.event;version="1.4.0",
org.osgi.service.packageadmin,
org.osgi.service.startlevel;version="1.0.0",
org.osgi.service.url;version="1.0.0",
org.osgi.util.tracker;version="1.3.0",
org.slf4j;resolution:=optional,
org.slf4j.spi;resolution:=optional,
org.slf4j.helpers;resolution:=optional,
org.xml.sax,
org.xml.sax.helpers,
org.eclipse.jetty.annotations;resolution:=optional,
*
<Import-Package>
${osgi.slf4j.import.packages},
javax.mail;version="1.4.0";resolution:=optional,
javax.mail.event;version="1.4.0";resolution:=optional,
javax.mail.internet;version="1.4.0";resolution:=optional,
javax.mail.search;version="1.4.0";resolution:=optional,
javax.mail.util;version="1.4.0";resolution:=optional,
javax.servlet;version="[$(version;==;${servlet.api.version}),$(version;+;${servlet.api.version}))",
javax.servlet.http;version="[$(version;==;${servlet.api.version}),$(version;+;${servlet.api.version}))",
javax.transaction;version="1.1.0";resolution:=optional,
javax.transaction.xa;version="1.1.0";resolution:=optional,
org.objectweb.asm;version="$(version;=;${asm.version})";resolution:=optional,
org.osgi.framework,
org.osgi.service.cm;version="1.4.0",
org.osgi.service.event;version="1.4.0",
org.osgi.service.packageadmin,
org.osgi.service.startlevel;version="1.0.0",
org.osgi.service.url;version="1.0.0",
org.osgi.util.tracker;version="1.3.0",
org.xml.sax,
org.xml.sax.helpers,
org.eclipse.jetty.annotations;resolution:=optional,
*
</Import-Package>
<Require-Capability>
osgi.extender; filter:="(osgi.extender=osgi.serviceloader.registrar)"
Expand Down
13 changes: 12 additions & 1 deletion jetty-osgi/test-jetty-osgi-context/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,18 @@
compilation time. -->
<_nouses>true</_nouses>
<Import-Package>
javax.servlet;version="[3.1,4.1)", javax.servlet.resources;version="[3.1,4.1)", org.osgi.framework, org.osgi.service.cm;version="1.2.0", org.osgi.service.packageadmin, org.osgi.service.startlevel;version="1.0.0", org.osgi.service.url;version="1.0.0", org.osgi.util.tracker;version="1.3.0", org.slf4j;resolution:=optional, org.slf4j.spi;resolution:=optional, org.slf4j.helpers;resolution:=optional, org.xml.sax, org.xml.sax.helpers, *
${osgi.slf4j.import.packages},
javax.servlet;version="[3.1,4.1)",
javax.servlet.resources;version="[3.1,4.1)",
org.osgi.framework,
org.osgi.service.cm;version="1.2.0",
org.osgi.service.packageadmin,
org.osgi.service.startlevel;version="1.0.0",
org.osgi.service.url;version="1.0.0",
org.osgi.util.tracker;version="1.3.0",
org.xml.sax,
org.xml.sax.helpers,
*
</Import-Package>
<DynamicImport-Package>org.eclipse.jetty.*;version="[$(version;==;${parsedVersion.osgiVersion}),$(version;+;${parsedVersion.osgiVersion}))"</DynamicImport-Package>
</instructions>
Expand Down
13 changes: 12 additions & 1 deletion jetty-osgi/test-jetty-osgi-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,18 @@
compilation time. -->
<_nouses>true</_nouses>
<Import-Package>
javax.servlet;version="[3.1,4.1)", javax.servlet.resources;version="[3.1,4.1)", org.osgi.framework, org.osgi.service.cm;version="1.2.0", org.osgi.service.packageadmin, org.osgi.service.startlevel;version="1.0.o", org.osgi.service.url;version="1.0.0", org.osgi.util.tracker;version="1.3.0", org.slf4j;resolution:=optional, org.slf4j.spi;resolution:=optional, org.slf4j.helpers;resolution:=optional, org.xml.sax, org.xml.sax.helpers, *
${osgi.slf4j.import.packages},
javax.servlet;version="[3.1,4.1)",
javax.servlet.resources;version="[3.1,4.1)",
org.osgi.framework,
org.osgi.service.cm;version="1.2.0",
org.osgi.service.packageadmin,
org.osgi.service.startlevel;version="1.0.0",
org.osgi.service.url;version="1.0.0",
org.osgi.util.tracker;version="1.3.0",
org.xml.sax,
org.xml.sax.helpers,
*
</Import-Package>
<DynamicImport-Package>org.eclipse.jetty.*;version="[$(version;==;${parsedVersion.osgiVersion}),$(version;+;${parsedVersion.osgiVersion}))"</DynamicImport-Package>
</instructions>
Expand Down
12 changes: 12 additions & 0 deletions jetty-osgi/test-jetty-osgi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,18 @@
</dependency>

<!-- Jetty OSGi Deps -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.30</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.30</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-slf4j-impl</artifactId>
Expand Down
Loading