Merge branch 'master' of ssh://git.eclipse.org/gitroot/jetty/org.eclipse.jetty.project

This commit is contained in:
Greg Wilkins 2012-01-19 12:40:07 +11:00
commit 7cd887d48b
11 changed files with 114 additions and 71 deletions

View File

@ -163,6 +163,10 @@
<groupId>javax.mail</groupId> <groupId>javax.mail</groupId>
<artifactId>mail</artifactId> <artifactId>mail</artifactId>
</exclusion> </exclusion>
<exclusion>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
</exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency> <dependency>
@ -233,6 +237,11 @@
<artifactId>mail</artifactId> <artifactId>mail</artifactId>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<scope>compile</scope>
</dependency>
<dependency> <dependency>
<groupId>org.apache.geronimo.specs</groupId> <groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jaspic_1.0_spec</artifactId> <artifactId>geronimo-jaspic_1.0_spec</artifactId>

View File

@ -147,6 +147,10 @@
<groupId>javax.mail</groupId> <groupId>javax.mail</groupId>
<artifactId>mail</artifactId> <artifactId>mail</artifactId>
</exclusion> </exclusion>
<exclusion>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
</exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency> <dependency>
@ -217,6 +221,11 @@
<artifactId>mail</artifactId> <artifactId>mail</artifactId>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<scope>compile</scope>
</dependency>
<dependency> <dependency>
<groupId>org.apache.geronimo.specs</groupId> <groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jaspic_1.0_spec</artifactId> <artifactId>geronimo-jaspic_1.0_spec</artifactId>

View File

@ -96,6 +96,10 @@
<groupId>javax.mail</groupId> <groupId>javax.mail</groupId>
<artifactId>mail</artifactId> <artifactId>mail</artifactId>
</exclusion> </exclusion>
<exclusion>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
</exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency> <dependency>
@ -113,5 +117,10 @@
<artifactId>mail</artifactId> <artifactId>mail</artifactId>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -12,6 +12,7 @@
<jetty-orbit-url>http://download.eclipse.org/jetty/orbit</jetty-orbit-url> <jetty-orbit-url>http://download.eclipse.org/jetty/orbit</jetty-orbit-url>
<assembly-directory>target/distribution</assembly-directory> <assembly-directory>target/distribution</assembly-directory>
<eclipse-ecj-version>3.6</eclipse-ecj-version> <eclipse-ecj-version>3.6</eclipse-ecj-version>
<orbit-javax-activation-version>${javax-activation-version}.0.v201005080500</orbit-javax-activation-version>
<orbit-javax-annotation-version>1.0.0.v20100513-0750</orbit-javax-annotation-version> <orbit-javax-annotation-version>1.0.0.v20100513-0750</orbit-javax-annotation-version>
<orbit-javax-el-version>2.1.0.v201004190952</orbit-javax-el-version> <orbit-javax-el-version>2.1.0.v201004190952</orbit-javax-el-version>
<orbit-javax-mail-glassfish-version>${javax-mail-version}.v201005082020</orbit-javax-mail-glassfish-version> <orbit-javax-mail-glassfish-version>${javax-mail-version}.v201005082020</orbit-javax-mail-glassfish-version>
@ -68,6 +69,7 @@
<mkdir dir="${orbit-cache}" /> <mkdir dir="${orbit-cache}" />
<get dest="${orbit-cache}" verbose="true" skipexisting="true"> <get dest="${orbit-cache}" verbose="true" skipexisting="true">
<url url="${jetty-orbit-url}/javax.servlet_${orbit-javax-servlet-version}.jar" /> <url url="${jetty-orbit-url}/javax.servlet_${orbit-javax-servlet-version}.jar" />
<url url="${jetty-orbit-url}/javax.activation_${orbit-javax-activation-version}.jar" />
<url url="${jetty-orbit-url}/javax.annotation_${orbit-javax-annotation-version}.jar" /> <url url="${jetty-orbit-url}/javax.annotation_${orbit-javax-annotation-version}.jar" />
<url url="${jetty-orbit-url}/javax.mail.glassfish_${orbit-javax-mail-glassfish-version}.jar" /> <url url="${jetty-orbit-url}/javax.mail.glassfish_${orbit-javax-mail-glassfish-version}.jar" />
<url url="${jetty-orbit-url}/javax.el_${orbit-javax-el-version}.jar" /> <url url="${jetty-orbit-url}/javax.el_${orbit-javax-el-version}.jar" />

View File

@ -283,7 +283,7 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements AsyncEndPo
public void checkIdleTimestamp(long now) public void checkIdleTimestamp(long now)
{ {
long idleTimestamp=_idleTimestamp; long idleTimestamp=_idleTimestamp;
if (idleTimestamp!=0 && _maxIdleTime>0) if (idleTimestamp!=0 && _maxIdleTime>0)
{ {
long idleForMs=now-idleTimestamp; long idleForMs=now-idleTimestamp;
@ -640,7 +640,6 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements AsyncEndPo
catch (IOException e) catch (IOException e)
{ {
LOG.warn(e.toString()); LOG.warn(e.toString());
LOG.debug(e);
try{close();} try{close();}
catch(IOException e2){LOG.ignore(e2);} catch(IOException e2){LOG.ignore(e2);}
} }

View File

@ -42,7 +42,7 @@ import org.eclipse.jetty.util.thread.Timeout.Task;
*/ */
public class SslConnection extends AbstractConnection implements AsyncConnection public class SslConnection extends AbstractConnection implements AsyncConnection
{ {
static final Logger LOG=Log.getLogger("org.eclipse.jetty.io.nio.ssl"); private final Logger _logger = Log.getLogger("org.eclipse.jetty.io.nio.ssl");
private static final NIOBuffer __ZERO_BUFFER=new IndirectNIOBuffer(0); private static final NIOBuffer __ZERO_BUFFER=new IndirectNIOBuffer(0);
@ -182,11 +182,11 @@ public class SslConnection extends AbstractConnection implements AsyncConnection
while (progress) while (progress)
{ {
progress=false; progress=false;
// If we are handshook let the delegate connection // If we are handshook let the delegate connection
if (_engine.getHandshakeStatus()!=HandshakeStatus.NOT_HANDSHAKING) if (_engine.getHandshakeStatus()!=HandshakeStatus.NOT_HANDSHAKING)
progress=process(null,null); progress=process(null,null);
// handle the delegate connection // handle the delegate connection
AsyncConnection next = (AsyncConnection)_connection.handle(); AsyncConnection next = (AsyncConnection)_connection.handle();
if (next!=_connection && next!=null) if (next!=_connection && next!=null)
@ -195,7 +195,7 @@ public class SslConnection extends AbstractConnection implements AsyncConnection
progress=true; progress=true;
} }
LOG.debug("{} handle {} progress={}", _session, this, progress); _logger.debug("{} handle {} progress={}", _session, this, progress);
} }
} }
finally finally
@ -211,9 +211,10 @@ public class SslConnection extends AbstractConnection implements AsyncConnection
} }
catch(Throwable x) catch(Throwable x)
{ {
LOG.warn("onInputShutdown failed", x); _logger.warn("onInputShutdown failed", x);
try{_sslEndPoint.close();} try{_sslEndPoint.close();}
catch(IOException e2){LOG.ignore(e2);} catch(IOException e2){
_logger.ignore(e2);}
} }
} }
} }
@ -244,7 +245,7 @@ public class SslConnection extends AbstractConnection implements AsyncConnection
{ {
try try
{ {
LOG.debug("onIdleExpired {}ms on {}",idleForMs,this); _logger.debug("onIdleExpired {}ms on {}",idleForMs,this);
if (_endp.isOutputShutdown()) if (_endp.isOutputShutdown())
_sslEndPoint.close(); _sslEndPoint.close();
else else
@ -252,7 +253,7 @@ public class SslConnection extends AbstractConnection implements AsyncConnection
} }
catch (IOException e) catch (IOException e)
{ {
LOG.warn(e); _logger.warn(e);
super.onIdleExpired(idleForMs); super.onIdleExpired(idleForMs);
} }
} }
@ -271,7 +272,7 @@ public class SslConnection extends AbstractConnection implements AsyncConnection
{ {
// We need buffers to progress // We need buffers to progress
allocateBuffers(); allocateBuffers();
// if we don't have a buffer to put received data into // if we don't have a buffer to put received data into
if (toFill==null) if (toFill==null)
{ {
@ -284,7 +285,7 @@ public class SslConnection extends AbstractConnection implements AsyncConnection
{ {
// fill to the temporary unwrapBuffer // fill to the temporary unwrapBuffer
boolean progress=process(null,toFlush); boolean progress=process(null,toFlush);
// if we received any data, // if we received any data,
if (_unwrapBuf!=null && _unwrapBuf.hasContent()) if (_unwrapBuf!=null && _unwrapBuf.hasContent())
{ {
@ -315,7 +316,7 @@ public class SslConnection extends AbstractConnection implements AsyncConnection
while (progress) while (progress)
{ {
progress=false; progress=false;
// Do any real IO // Do any real IO
int filled=0,flushed=0; int filled=0,flushed=0;
try try
@ -335,7 +336,7 @@ public class SslConnection extends AbstractConnection implements AsyncConnection
} }
finally finally
{ {
LOG.debug("{} {} {} filled={}/{} flushed={}/{}",_session,this,_engine.getHandshakeStatus(),filled,_inbound.length(),flushed,_outbound.length()); _logger.debug("{} {} {} filled={}/{} flushed={}/{}",_session,this,_engine.getHandshakeStatus(),filled,_inbound.length(),flushed,_outbound.length());
} }
// handle the current hand share status // handle the current hand share status
@ -437,8 +438,8 @@ public class SslConnection extends AbstractConnection implements AsyncConnection
out_buffer.position(_outbound.putIndex()); out_buffer.position(_outbound.putIndex());
out_buffer.limit(out_buffer.capacity()); out_buffer.limit(out_buffer.capacity());
result=_engine.wrap(bbuf,out_buffer); result=_engine.wrap(bbuf,out_buffer);
if (LOG.isDebugEnabled()) if (_logger.isDebugEnabled())
LOG.debug("{} wrap {} {} consumed={} produced={}", _logger.debug("{} wrap {} {} consumed={} produced={}",
_session, _session,
result.getStatus(), result.getStatus(),
result.getHandshakeStatus(), result.getHandshakeStatus(),
@ -451,7 +452,7 @@ public class SslConnection extends AbstractConnection implements AsyncConnection
} }
catch(SSLException e) catch(SSLException e)
{ {
LOG.warn(String.valueOf(_endp), e); _logger.debug(String.valueOf(_endp), e);
_endp.close(); _endp.close();
throw e; throw e;
} }
@ -479,13 +480,13 @@ public class SslConnection extends AbstractConnection implements AsyncConnection
break; break;
case CLOSED: case CLOSED:
LOG.debug("wrap CLOSE {} {}",this,result); _logger.debug("wrap CLOSE {} {}",this,result);
if (result.getHandshakeStatus()==HandshakeStatus.FINISHED) if (result.getHandshakeStatus()==HandshakeStatus.FINISHED)
_endp.close(); _endp.close();
break; break;
default: default:
LOG.warn("{} wrap default {}",_session,result); _logger.debug("{} wrap default {}",_session,result);
throw new IOException(result.toString()); throw new IOException(result.toString());
} }
@ -513,8 +514,8 @@ public class SslConnection extends AbstractConnection implements AsyncConnection
in_buffer.limit(_inbound.putIndex()); in_buffer.limit(_inbound.putIndex());
result=_engine.unwrap(in_buffer,bbuf); result=_engine.unwrap(in_buffer,bbuf);
if (LOG.isDebugEnabled()) if (_logger.isDebugEnabled())
LOG.debug("{} unwrap {} {} consumed={} produced={}", _logger.debug("{} unwrap {} {} consumed={} produced={}",
_session, _session,
result.getStatus(), result.getStatus(),
result.getHandshakeStatus(), result.getHandshakeStatus(),
@ -527,7 +528,7 @@ public class SslConnection extends AbstractConnection implements AsyncConnection
} }
catch(SSLException e) catch(SSLException e)
{ {
LOG.warn(String.valueOf(_endp), e); _logger.debug(String.valueOf(_endp), e);
_endp.close(); _endp.close();
throw e; throw e;
} }
@ -549,7 +550,7 @@ public class SslConnection extends AbstractConnection implements AsyncConnection
break; break;
case BUFFER_OVERFLOW: case BUFFER_OVERFLOW:
LOG.debug("{} unwrap {} {}->{}",_session,result.getStatus(),_inbound.toDetailString(),buffer.toDetailString()); _logger.debug("{} unwrap {} {}->{}",_session,result.getStatus(),_inbound.toDetailString(),buffer.toDetailString());
break; break;
case OK: case OK:
@ -558,13 +559,13 @@ public class SslConnection extends AbstractConnection implements AsyncConnection
break; break;
case CLOSED: case CLOSED:
LOG.debug("unwrap CLOSE {} {}",this,result); _logger.debug("unwrap CLOSE {} {}",this,result);
if (result.getHandshakeStatus()==HandshakeStatus.FINISHED) if (result.getHandshakeStatus()==HandshakeStatus.FINISHED)
_endp.close(); _endp.close();
break; break;
default: default:
LOG.warn("{} wrap default {}",_session,result); _logger.debug("{} wrap default {}",_session,result);
throw new IOException(result.toString()); throw new IOException(result.toString());
} }
@ -613,7 +614,7 @@ public class SslConnection extends AbstractConnection implements AsyncConnection
{ {
synchronized (SslConnection.this) synchronized (SslConnection.this)
{ {
LOG.debug("{} ssl endp.oshut {}",_session,this); _logger.debug("{} ssl endp.oshut {}",_session,this);
_engine.closeOutbound(); _engine.closeOutbound();
_oshut=true; _oshut=true;
} }
@ -630,7 +631,7 @@ public class SslConnection extends AbstractConnection implements AsyncConnection
public void shutdownInput() throws IOException public void shutdownInput() throws IOException
{ {
LOG.debug("{} ssl endp.ishut!",_session); _logger.debug("{} ssl endp.ishut!",_session);
// We do not do a closeInput here, as SSL does not support half close. // We do not do a closeInput here, as SSL does not support half close.
// isInputShutdown works it out itself from buffer state and underlying endpoint state. // isInputShutdown works it out itself from buffer state and underlying endpoint state.
} }
@ -647,7 +648,7 @@ public class SslConnection extends AbstractConnection implements AsyncConnection
public void close() throws IOException public void close() throws IOException
{ {
LOG.debug("{} ssl endp.close",_session); _logger.debug("{} ssl endp.close",_session);
_endp.close(); _endp.close();
} }

View File

@ -5,7 +5,6 @@ import java.io.IOException;
import java.net.Socket; import java.net.Socket;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel; import java.nio.channels.SocketChannel;
import javax.net.ssl.SSLEngine; import javax.net.ssl.SSLEngine;
import javax.net.ssl.SSLEngineResult; import javax.net.ssl.SSLEngineResult;
import javax.net.ssl.SSLEngineResult.HandshakeStatus; import javax.net.ssl.SSLEngineResult.HandshakeStatus;
@ -22,7 +21,7 @@ import org.junit.Test;
public class SelectChannelEndPointSslTest extends SelectChannelEndPointTest public class SelectChannelEndPointSslTest extends SelectChannelEndPointTest
{ {
static SslContextFactory __sslCtxFactory=new SslContextFactory(); static SslContextFactory __sslCtxFactory=new SslContextFactory();
@BeforeClass @BeforeClass
public static void initSslEngine() throws Exception public static void initSslEngine() throws Exception
{ {
@ -32,7 +31,7 @@ public class SelectChannelEndPointSslTest extends SelectChannelEndPointTest
__sslCtxFactory.setKeyManagerPassword("keypwd"); __sslCtxFactory.setKeyManagerPassword("keypwd");
__sslCtxFactory.start(); __sslCtxFactory.start();
} }
@Override @Override
protected Socket newClient() throws IOException protected Socket newClient() throws IOException
{ {
@ -60,46 +59,46 @@ public class SelectChannelEndPointSslTest extends SelectChannelEndPointTest
super.testEcho(); super.testEcho();
} }
@Test @Test
@Override @Override
public void testShutdown() throws Exception public void testShutdown() throws Exception
{ {
// SSL does not do half closes // SSL does not do half closes
} }
@Test @Test
public void testTcpClose() throws Exception public void testTcpClose() throws Exception
{ {
// This test replaces SSLSocket() with a very manual SSL client // This test replaces SSLSocket() with a very manual SSL client
// so we can close TCP underneath SSL. // so we can close TCP underneath SSL.
SocketChannel client = SocketChannel.open(_connector.socket().getLocalSocketAddress()); SocketChannel client = SocketChannel.open(_connector.socket().getLocalSocketAddress());
client.socket().setSoTimeout(500); client.socket().setSoTimeout(500);
SocketChannel server = _connector.accept(); SocketChannel server = _connector.accept();
server.configureBlocking(false); server.configureBlocking(false);
_manager.register(server); _manager.register(server);
SSLEngine engine = __sslCtxFactory.newSslEngine(); SSLEngine engine = __sslCtxFactory.newSslEngine();
engine.setUseClientMode(true); engine.setUseClientMode(true);
engine.beginHandshake(); engine.beginHandshake();
ByteBuffer appOut = ByteBuffer.allocate(engine.getSession().getApplicationBufferSize()); ByteBuffer appOut = ByteBuffer.allocate(engine.getSession().getApplicationBufferSize());
ByteBuffer sslOut = ByteBuffer.allocate(engine.getSession().getPacketBufferSize()*2); ByteBuffer sslOut = ByteBuffer.allocate(engine.getSession().getPacketBufferSize()*2);
ByteBuffer appIn = ByteBuffer.allocate(engine.getSession().getApplicationBufferSize()); ByteBuffer appIn = ByteBuffer.allocate(engine.getSession().getApplicationBufferSize());
ByteBuffer sslIn = ByteBuffer.allocate(engine.getSession().getPacketBufferSize()*2); ByteBuffer sslIn = ByteBuffer.allocate(engine.getSession().getPacketBufferSize()*2);
boolean debug=SslConnection.LOG.isDebugEnabled(); boolean debug=false;
if (debug) System.err.println(engine.getHandshakeStatus()); if (debug) System.err.println(engine.getHandshakeStatus());
int loop=20; int loop=20;
while (engine.getHandshakeStatus()!=HandshakeStatus.NOT_HANDSHAKING) while (engine.getHandshakeStatus()!=HandshakeStatus.NOT_HANDSHAKING)
{ {
if (--loop==0) if (--loop==0)
throw new IllegalStateException(); throw new IllegalStateException();
if (engine.getHandshakeStatus()==HandshakeStatus.NEED_WRAP) if (engine.getHandshakeStatus()==HandshakeStatus.NEED_WRAP)
{ {
if (debug) System.err.printf("sslOut %d-%d-%d%n",sslOut.position(),sslOut.limit(),sslOut.capacity()); if (debug) System.err.printf("sslOut %d-%d-%d%n",sslOut.position(),sslOut.limit(),sslOut.capacity());
@ -133,16 +132,16 @@ public class SelectChannelEndPointSslTest extends SelectChannelEndPointTest
} }
if (engine.getHandshakeStatus()==HandshakeStatus.NEED_TASK) if (engine.getHandshakeStatus()==HandshakeStatus.NEED_TASK)
{ {
Runnable task; Runnable task;
while ((task=engine.getDelegatedTask())!=null) while ((task=engine.getDelegatedTask())!=null)
task.run(); task.run();
if (debug) System.err.println(engine.getHandshakeStatus()); if (debug) System.err.println(engine.getHandshakeStatus());
} }
} }
if (debug) System.err.println("\nSay Hello"); if (debug) System.err.println("\nSay Hello");
// write a message // write a message
appOut.put("HelloWorld".getBytes("UTF-8")); appOut.put("HelloWorld".getBytes("UTF-8"));
appOut.flip(); appOut.flip();
@ -164,11 +163,11 @@ public class SelectChannelEndPointSslTest extends SelectChannelEndPointTest
sslIn.compact(); sslIn.compact();
else else
sslIn.clear(); sslIn.clear();
appIn.flip(); appIn.flip();
String reply= new String(appIn.array(),appIn.arrayOffset(),appIn.remaining()); String reply= new String(appIn.array(),appIn.arrayOffset(),appIn.remaining());
appIn.clear(); appIn.clear();
Assert.assertEquals("HelloWorld",reply); Assert.assertEquals("HelloWorld",reply);
SelectorManager.LOG.info("javax.net.ssl.SSLException: Inbound closed... is expected soon"); SelectorManager.LOG.info("javax.net.ssl.SSLException: Inbound closed... is expected soon");

View File

@ -66,26 +66,26 @@
<dependency> <dependency>
<groupId>javax.mail</groupId> <groupId>javax.mail</groupId>
<artifactId>mail</artifactId> <artifactId>mail</artifactId>
<exclusions> <exclusions>
<exclusion> <exclusion>
<groupId>javax.activation</groupId> <groupId>javax.activation</groupId>
<artifactId>activation</artifactId> <artifactId>activation</artifactId>
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
</dependencies> </dependencies>
<profiles> <profiles>
<profile> <profile>
<id>below-jdk1.6</id> <id>below-jdk1.6</id>
<activation> <activation>
<jdk>!1.6</jdk> <jdk>(,1.6)</jdk>
</activation> </activation>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>javax.activation</groupId> <groupId>javax.activation</groupId>
<artifactId>activation</artifactId> <artifactId>activation</artifactId>
<version>${javax-activation-version}</version> <version>1.1</version>
</dependency> </dependency>
</dependencies> </dependencies>
</profile> </profile>
</profiles> </profiles>

View File

@ -14,6 +14,7 @@
<jetty-orbit-url>http://download.eclipse.org/jetty/orbit/</jetty-orbit-url> <jetty-orbit-url>http://download.eclipse.org/jetty/orbit/</jetty-orbit-url>
<assembly-directory>target/distribution</assembly-directory> <assembly-directory>target/distribution</assembly-directory>
<eclipse-ecj-version>3.6</eclipse-ecj-version> <eclipse-ecj-version>3.6</eclipse-ecj-version>
<orbit-javax-activation-version>${javax-activation-version}.0.v201005080500</orbit-javax-activation-version>
<orbit-javax-annotation-version>1.0.0.v20100513-0750</orbit-javax-annotation-version> <orbit-javax-annotation-version>1.0.0.v20100513-0750</orbit-javax-annotation-version>
<orbit-javax-el-version>2.1.0.v201004190952</orbit-javax-el-version> <orbit-javax-el-version>2.1.0.v201004190952</orbit-javax-el-version>
<orbit-javax-mail-glassfish-version>${javax-mail-version}.v201005082020</orbit-javax-mail-glassfish-version> <orbit-javax-mail-glassfish-version>${javax-mail-version}.v201005082020</orbit-javax-mail-glassfish-version>
@ -197,6 +198,7 @@
<mkdir dir="${orbit-cache}" /> <mkdir dir="${orbit-cache}" />
<get dest="${orbit-cache}" verbose="true" skipexisting="true"> <get dest="${orbit-cache}" verbose="true" skipexisting="true">
<url url="${jetty-orbit-url}/javax.servlet_${orbit-javax-servlet-version}.jar" /> <url url="${jetty-orbit-url}/javax.servlet_${orbit-javax-servlet-version}.jar" />
<url url="${jetty-orbit-url}/javax.activation_${orbit-javax-activation-version}.jar" />
<url url="${jetty-orbit-url}/javax.mail.glassfish_${orbit-javax-mail-glassfish-version}.jar" /> <url url="${jetty-orbit-url}/javax.mail.glassfish_${orbit-javax-mail-glassfish-version}.jar" />
<url url="${jetty-orbit-url}/javax.el_${orbit-javax-el-version}.jar" /> <url url="${jetty-orbit-url}/javax.el_${orbit-javax-el-version}.jar" />
<url url="${jetty-orbit-url}/javax.servlet.jsp_${orbit-javax-servlet-jsp-version}.jar" /> <url url="${jetty-orbit-url}/javax.servlet.jsp_${orbit-javax-servlet-jsp-version}.jar" />

View File

@ -4,11 +4,11 @@
// All rights reserved. This program and the accompanying materials // All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0 // are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution. // and Apache License v2.0 which accompanies this distribution.
// The Eclipse Public License is available at // The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html // http://www.eclipse.org/legal/epl-v10.html
// The Apache License v2.0 is available at // The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php // http://www.opensource.org/licenses/apache2.0.php
// You may elect to redistribute this code under either of these licenses. // You may elect to redistribute this code under either of these licenses.
// ======================================================================== // ========================================================================
package org.eclipse.jetty.util.log; package org.eclipse.jetty.util.log;
@ -19,20 +19,20 @@ import org.slf4j.helpers.MessageFormatter;
/** /**
* JettyAwareLogger is used to fix a FQCN bug that arises from how Jetty * JettyAwareLogger is used to fix a FQCN bug that arises from how Jetty
* Log uses an indirect slf4j implementation. * Log uses an indirect slf4j implementation.
* *
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=276670 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=276670
*/ */
class JettyAwareLogger implements org.slf4j.Logger class JettyAwareLogger implements org.slf4j.Logger
{ {
private static final int DEBUG = org.slf4j.spi.LocationAwareLogger.DEBUG_INT; private static final int DEBUG = org.slf4j.spi.LocationAwareLogger.DEBUG_INT;
private static final int ERROR = org.slf4j.spi.LocationAwareLogger.ERROR_INT; private static final int ERROR = org.slf4j.spi.LocationAwareLogger.ERROR_INT;
private static final int INFO = org.slf4j.spi.LocationAwareLogger.INFO_INT; private static final int INFO = org.slf4j.spi.LocationAwareLogger.INFO_INT;
private static final int TRACE = org.slf4j.spi.LocationAwareLogger.TRACE_INT; private static final int TRACE = org.slf4j.spi.LocationAwareLogger.TRACE_INT;
private static final int WARN = org.slf4j.spi.LocationAwareLogger.WARN_INT; private static final int WARN = org.slf4j.spi.LocationAwareLogger.WARN_INT;
private static final String FQCN = Slf4jLog.class.getName(); private static final String FQCN = Slf4jLog.class.getName();
private final org.slf4j.spi.LocationAwareLogger _logger; private final org.slf4j.spi.LocationAwareLogger _logger;
public JettyAwareLogger(org.slf4j.spi.LocationAwareLogger logger) public JettyAwareLogger(org.slf4j.spi.LocationAwareLogger logger)
{ {
_logger = logger; _logger = logger;
@ -586,26 +586,33 @@ class JettyAwareLogger implements org.slf4j.Logger
{ {
log(marker, ERROR, msg, null, t); log(marker, ERROR, msg, null, t);
} }
@Override @Override
public String toString() public String toString()
{ {
return _logger.toString(); return _logger.toString();
} }
private void log(Marker marker, int level, String msg, Object[] argArray, Throwable t) private void log(Marker marker, int level, String msg, Object[] argArray, Throwable t)
{ {
if (argArray == null) if (argArray == null)
{ {
// Simple SLF4J Message (no args) // Simple SLF4J Message (no args)
_logger.log(marker,FQCN,level,msg,null,t); _logger.log(marker, FQCN, level, msg, null, t);
} }
else else
{ {
// Don't assume downstream handles argArray properly. int loggerLevel = _logger.isTraceEnabled() ? TRACE :
// Do it the SLF4J way here to eliminate that as a bug. _logger.isDebugEnabled() ? DEBUG :
FormattingTuple ft = MessageFormatter.arrayFormat(msg,argArray); _logger.isInfoEnabled() ? INFO :
_logger.log(marker,FQCN,level,ft.getMessage(),null,t); _logger.isWarnEnabled() ? WARN : ERROR;
if (loggerLevel <= level)
{
// Don't assume downstream handles argArray properly.
// Do it the SLF4J way here to eliminate that as a bug.
FormattingTuple ft = MessageFormatter.arrayFormat(msg, argArray);
_logger.log(marker, FQCN, level, ft.getMessage(), null, t);
}
} }
} }
} }

View File

@ -11,6 +11,7 @@
<url>${jetty.url}</url> <url>${jetty.url}</url>
<packaging>pom</packaging> <packaging>pom</packaging>
<properties> <properties>
<javax-activation-version>1.1</javax-activation-version>
<javax-mail-version>1.4.1</javax-mail-version> <javax-mail-version>1.4.1</javax-mail-version>
<javax-servlet-jsp-version>2.1.v20100127</javax-servlet-jsp-version> <javax-servlet-jsp-version>2.1.v20100127</javax-servlet-jsp-version>
<javax-transaction-version>1.1.1</javax-transaction-version> <javax-transaction-version>1.1.1</javax-transaction-version>
@ -401,6 +402,11 @@
<artifactId>mail</artifactId> <artifactId>mail</artifactId>
<version>${javax-mail-version}</version> <version>${javax-mail-version}</version>
</dependency> </dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>${javax-activation-version}</version>
</dependency>
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit</artifactId> <artifactId>junit</artifactId>