File excalibur-java7.patch of Package excalibur
---
components/sourceresolve/src/java/org/apache/excalibur/source/impl/FTPSource.java | 97 +++++++++-
containerkit/instrument/mgr-http/src/java/org/apache/excalibur/instrument/manager/http/FavIconHandler.java | 4
containerkit/instrument/mgr-http/src/java/org/apache/excalibur/instrument/manager/http/SampleChartHandler.java | 9
containerkit/logkit/src/java/org/apache/log/Logger.java | 2
containerkit/logkit/src/java/org/apache/log/output/db/DefaultDataSource.java | 6
5 files changed, 99 insertions(+), 19 deletions(-)
Index: excalibur-src-r508111-15022007/containerkit/logkit/src/java/org/apache/log/Logger.java
===================================================================
--- excalibur-src-r508111-15022007.orig/containerkit/logkit/src/java/org/apache/log/Logger.java 2012-06-20 15:44:46.357808828 +0200
+++ excalibur-src-r508111-15022007/containerkit/logkit/src/java/org/apache/log/Logger.java 2012-06-20 15:44:55.274808622 +0200
@@ -297,7 +297,7 @@
}
/**
- * Determine if messages of priority �will be logged.
+ * Determine if messages of priority will be logged.
* @param priority the priority
* @return true if messages will be logged
*/
Index: excalibur-src-r508111-15022007/containerkit/logkit/src/java/org/apache/log/output/db/DefaultDataSource.java
===================================================================
--- excalibur-src-r508111-15022007.orig/containerkit/logkit/src/java/org/apache/log/output/db/DefaultDataSource.java 2012-06-20 15:42:20.262812207 +0200
+++ excalibur-src-r508111-15022007/containerkit/logkit/src/java/org/apache/log/output/db/DefaultDataSource.java 2012-06-20 15:56:19.384792819 +0200
@@ -22,6 +22,8 @@
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+import java.util.logging.Logger;
import javax.sql.DataSource;
/**
@@ -121,4 +123,8 @@
public <T> T unwrap(Class<T> iface) throws SQLException {
throw new RuntimeException("Not implemented method unwrap()");
}
+
+ public Logger getParentLogger() throws SQLFeatureNotSupportedException {
+ throw new SQLFeatureNotSupportedException();
+ }
}
Index: excalibur-src-r508111-15022007/containerkit/instrument/mgr-http/src/java/org/apache/excalibur/instrument/manager/http/FavIconHandler.java
===================================================================
--- excalibur-src-r508111-15022007.orig/containerkit/instrument/mgr-http/src/java/org/apache/excalibur/instrument/manager/http/FavIconHandler.java 2007-02-12 05:06:06.000000000 +0100
+++ excalibur-src-r508111-15022007/containerkit/instrument/mgr-http/src/java/org/apache/excalibur/instrument/manager/http/FavIconHandler.java 2012-06-20 16:01:40.184785418 +0200
@@ -19,10 +19,6 @@
package org.apache.excalibur.instrument.manager.http;
-import com.sun.image.codec.jpeg.JPEGCodec;
-import com.sun.image.codec.jpeg.JPEGEncodeParam;
-import com.sun.image.codec.jpeg.JPEGImageEncoder;
-
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.BufferedInputStream;
Index: excalibur-src-r508111-15022007/containerkit/instrument/mgr-http/src/java/org/apache/excalibur/instrument/manager/http/SampleChartHandler.java
===================================================================
--- excalibur-src-r508111-15022007.orig/containerkit/instrument/mgr-http/src/java/org/apache/excalibur/instrument/manager/http/SampleChartHandler.java 2007-02-12 05:06:06.000000000 +0100
+++ excalibur-src-r508111-15022007/containerkit/instrument/mgr-http/src/java/org/apache/excalibur/instrument/manager/http/SampleChartHandler.java 2012-06-20 16:14:33.319767497 +0200
@@ -19,9 +19,7 @@
package org.apache.excalibur.instrument.manager.http;
-import com.sun.image.codec.jpeg.JPEGCodec;
-import com.sun.image.codec.jpeg.JPEGEncodeParam;
-import com.sun.image.codec.jpeg.JPEGImageEncoder;
+import javax.imageio.ImageIO;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
@@ -234,10 +232,7 @@
chart.paintComponent( g );
// Encode the BufferedImage as a JPEG image and write it to the output stream.
- JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder( os );
- JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam( bi );
- param.setQuality( 0.90f, true );
- encoder.encode( bi, param );
+ ImageIO.write(bi, "jpeg", os);
}
}
Index: excalibur-src-r508111-15022007/components/sourceresolve/src/java/org/apache/excalibur/source/impl/FTPSource.java
===================================================================
--- excalibur-src-r508111-15022007.orig/components/sourceresolve/src/java/org/apache/excalibur/source/impl/FTPSource.java 2007-01-04 09:25:51.000000000 +0100
+++ excalibur-src-r508111-15022007/components/sourceresolve/src/java/org/apache/excalibur/source/impl/FTPSource.java 2012-06-22 10:35:36.191241125 +0200
@@ -32,6 +32,7 @@
import org.apache.excalibur.source.SourceUtil;
import sun.net.ftp.FtpClient;
+import sun.net.ftp.FtpProtocolException;
/**
* Source implementation for the File Transfer Protocol.
@@ -197,7 +198,7 @@
{
return new FTPSourceOutputStream( this );
}
-
+
/**
* Creates an FtpClient and logs in the current user.
*/
@@ -259,18 +260,49 @@
/**
* Need to extend FtpClient in order to get to protected issueCommand
* and implement additional functionality.
+ *
+ * MV: don't enhance private sun.net.java class, use Fascade pattern
+ * as it deals better with API changes
*/
- private static class EnhancedFtpClient extends FtpClient
+ private static class EnhancedFtpClient
{
- private EnhancedFtpClient( String host ) throws IOException
+ private FtpClient _ftpclient;
+
+ private EnhancedFtpClient(String host) throws IOException
+ {
+ try {
+ _ftpclient = FtpClient.create(host);
+ } catch (FtpProtocolException fpe) {
+ throw new IOException("FtpProtocolException: " + fpe.getMessage());
+ }
+ }
+
+ void delete(final String path) throws IOException
+ {
+ try {
+ _ftpclient.deleteFile(path);
+ } catch (FtpProtocolException fpe) {
+ throw new IOException("FtpProtocolException: " + fpe.getMessage());
+ }
+ }
+
+ void login(String user, String password) throws IOException
{
- super( host );
+ try {
+ _ftpclient.login(user, password.toCharArray());
+ } catch (FtpProtocolException fpe) {
+ throw new IOException("FtpProtocolException: " + fpe.getMessage());
+ }
+
}
- void delete( final String path ) throws IOException
+ /**
+ * Close connection to the server
+ */
+ void closeServer() throws IOException
{
- issueCommand( "DELE " + path );
+ _ftpclient.close();
}
/**
@@ -278,7 +310,58 @@
*/
void mkdir( final String directoryName ) throws IOException
{
- issueCommand( "MKD " + directoryName );
+ try {
+ _ftpclient.makeDirectory(directoryName);
+ } catch (FtpProtocolException fpe) {
+ throw new IOException("FtpProtocolException: " + fpe.getMessage());
+ }
+ }
+
+ /**
+ * Change to a specific directory
+ */
+ void cd ( final String directoryName ) throws IOException
+ {
+ try {
+ _ftpclient.changeDirectory(directoryName);
+ } catch (FtpProtocolException fpe) {
+ throw new IOException("FtpProtocolException: " + fpe.getMessage());
+ }
+ }
+
+ /**
+ * Setup ascii transfer mode
+ */
+ void ascii () throws IOException
+ {
+ try {
+ _ftpclient.setType(FtpClient.TransferType.ASCII);
+ } catch (FtpProtocolException fpe) {
+ throw new IOException("FtpProtocolException: " + fpe.getMessage());
+ }
+ }
+
+ /**
+ * Setup binary transfer mode
+ */
+ void binary () throws IOException
+ {
+ try {
+ _ftpclient.setType(FtpClient.TransferType.BINARY);
+ } catch (FtpProtocolException fpe) {
+ throw new IOException("FtpProtocolException: " + fpe.getMessage());
+ }
+ }
+
+ /**
+ * Upload file using STOR command to server
+ */
+ OutputStream put(String name) throws IOException {
+ try {
+ return _ftpclient.putFileStream(name, false);
+ } catch (FtpProtocolException fpe) {
+ throw new IOException("FtpProtocolException: " + fpe.getMessage());
+ }
}
/**