BF [ 2736995 ] - toURL() in java.io.File has been deprecated
This commit is contained in:
parent
4e48dd6b54
commit
e3eca6fdb1
|
@ -19,7 +19,7 @@ package org.compiere.model;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.net.URL;
|
import java.net.URI;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
@ -33,6 +33,7 @@ import org.compiere.util.DB;
|
||||||
* Product Download Model
|
* Product Download Model
|
||||||
* @author Jorg Janke
|
* @author Jorg Janke
|
||||||
* @version $Id: MProductDownload.java,v 1.2 2006/07/30 00:51:03 jjanke Exp $
|
* @version $Id: MProductDownload.java,v 1.2 2006/07/30 00:51:03 jjanke Exp $
|
||||||
|
* @author Michael Judd BF [ 2736995 ] - toURL() in java.io.File has been deprecated
|
||||||
*/
|
*/
|
||||||
public class MProductDownload extends X_M_ProductDownload
|
public class MProductDownload extends X_M_ProductDownload
|
||||||
{
|
{
|
||||||
|
@ -169,22 +170,22 @@ public class MProductDownload extends X_M_ProductDownload
|
||||||
* @param directory optional directory
|
* @param directory optional directory
|
||||||
* @return url
|
* @return url
|
||||||
*/
|
*/
|
||||||
public URL getDownloadURL (String directory)
|
public URI getDownloadURL (String directory)
|
||||||
{
|
{
|
||||||
String dl_url = getDownloadURL();
|
String dl_url = getDownloadURL();
|
||||||
if (dl_url == null || !isActive())
|
if (dl_url == null || !isActive())
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
URL url = null;
|
URI url = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (dl_url.indexOf ("://") != -1)
|
if (dl_url.indexOf ("://") != -1)
|
||||||
url = new URL (dl_url);
|
url = new URI (dl_url);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
File f = getDownloadFile (directory);
|
File f = getDownloadFile (directory);
|
||||||
if (f != null)
|
if (f != null)
|
||||||
url = f.toURL ();
|
url = f.toURI ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -239,8 +240,8 @@ public class MProductDownload extends X_M_ProductDownload
|
||||||
{
|
{
|
||||||
if (dl_url.indexOf ("://") != -1)
|
if (dl_url.indexOf ("://") != -1)
|
||||||
{
|
{
|
||||||
URL url = new URL (dl_url);
|
URI url = new URI (dl_url);
|
||||||
in = url.openStream();
|
in = url.toURL().openStream();
|
||||||
}
|
}
|
||||||
else // file
|
else // file
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,7 +32,7 @@ import java.awt.image.BufferedImage;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.net.MalformedURLException;
|
import java.net.URI;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
@ -46,6 +46,7 @@ import com.sun.image.codec.jpeg.JPEGImageDecoder;
|
||||||
*
|
*
|
||||||
* @author Jorg Janke
|
* @author Jorg Janke
|
||||||
* @version $Id: AdempiereUtils.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $
|
* @version $Id: AdempiereUtils.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $
|
||||||
|
* @author Michael Judd BF [ 2736995 ] - toURL() in java.io.File has been deprecated
|
||||||
*/
|
*/
|
||||||
public class CompiereUtils
|
public class CompiereUtils
|
||||||
{
|
{
|
||||||
|
@ -55,7 +56,7 @@ public class CompiereUtils
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fill Background with Color.
|
* Fill Background with Color.
|
||||||
* (Ususlly called from update methods)
|
* (Usually called from update methods)
|
||||||
*
|
*
|
||||||
* @param g2D Graphics
|
* @param g2D Graphics
|
||||||
* @param c Component
|
* @param c Component
|
||||||
|
@ -242,10 +243,10 @@ public class CompiereUtils
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
File file = new File(path);
|
File file = new File(path);
|
||||||
URL url = file.toURL();
|
URI url = file.toURI();
|
||||||
image = loadImage(url);
|
image = loadImage(url.toString());
|
||||||
}
|
}
|
||||||
catch (MalformedURLException e)
|
catch (SecurityException e)
|
||||||
{
|
{
|
||||||
log.severe("Path= " + path + " - " + e.getMessage());
|
log.severe("Path= " + path + " - " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
@ -315,10 +316,10 @@ public class CompiereUtils
|
||||||
BufferedImage image = null;
|
BufferedImage image = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
URL url = file.toURL();
|
URI url = file.toURI();
|
||||||
image = loadBufferedImage(url, imageType);
|
image = loadBufferedImage(url.toString(), imageType);
|
||||||
}
|
}
|
||||||
catch (MalformedURLException e)
|
catch (SecurityException e)
|
||||||
{
|
{
|
||||||
log.severe("File: " + file + " - " + e.getMessage());
|
log.severe("File: " + file + " - " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
@ -342,10 +343,10 @@ public class CompiereUtils
|
||||||
BufferedImage image = null;
|
BufferedImage image = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
URL url = file.toURL();
|
URI url = file.toURI();
|
||||||
image = loadBufferedImage(url, imageType);
|
image = loadBufferedImage(url.toString(), imageType);
|
||||||
}
|
}
|
||||||
catch (MalformedURLException e)
|
catch (SecurityException e)
|
||||||
{
|
{
|
||||||
log.severe("Path: " + path + " - " + e.getMessage());
|
log.severe("Path: " + path + " - " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.compiere.process;
|
package org.compiere.process;
|
||||||
|
|
||||||
import java.net.URL;
|
import java.net.URI;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
|
@ -37,6 +37,7 @@ import org.compiere.util.EMail;
|
||||||
*
|
*
|
||||||
* @author Jorg Janke
|
* @author Jorg Janke
|
||||||
* @version $Id: AssetDelivery.java,v 1.2 2006/07/30 00:51:02 jjanke Exp $
|
* @version $Id: AssetDelivery.java,v 1.2 2006/07/30 00:51:02 jjanke Exp $
|
||||||
|
* @author Michael Judd BF [ 2736995 ] - toURL() in java.io.File has been deprecated
|
||||||
*/
|
*/
|
||||||
public class AssetDelivery extends SvrProcess
|
public class AssetDelivery extends SvrProcess
|
||||||
{
|
{
|
||||||
|
@ -274,7 +275,7 @@ public class AssetDelivery extends SvrProcess
|
||||||
{
|
{
|
||||||
for (int i = 0; i < pdls.length; i++)
|
for (int i = 0; i < pdls.length; i++)
|
||||||
{
|
{
|
||||||
URL url = pdls[i].getDownloadURL(m_client.getDocumentDir());
|
URI url = pdls[i].getDownloadURL(m_client.getDocumentDir());
|
||||||
if (url != null)
|
if (url != null)
|
||||||
email.addAttachment(url);
|
email.addAttachment(url);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ package org.compiere.util;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.net.URL;
|
import java.net.URI;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
|
@ -62,6 +62,7 @@ import com.sun.mail.smtp.SMTPMessage;
|
||||||
*
|
*
|
||||||
* @author Jorg Janke
|
* @author Jorg Janke
|
||||||
* @version $Id: EMail.java,v 1.4 2006/07/30 00:54:35 jjanke Exp $
|
* @version $Id: EMail.java,v 1.4 2006/07/30 00:54:35 jjanke Exp $
|
||||||
|
* @author Michael Judd BF [ 2736995 ] - toURL() in java.io.File has been deprecated
|
||||||
*/
|
*/
|
||||||
public final class EMail implements Serializable
|
public final class EMail implements Serializable
|
||||||
{
|
{
|
||||||
|
@ -799,9 +800,9 @@ public final class EMail implements Serializable
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add url based file Attachment
|
* Add url based file Attachment
|
||||||
* @param url url content to attach
|
* @param uri url content to attach
|
||||||
*/
|
*/
|
||||||
public void addAttachment (URL url)
|
public void addAttachment (URI url)
|
||||||
{
|
{
|
||||||
if (url == null)
|
if (url == null)
|
||||||
return;
|
return;
|
||||||
|
@ -894,10 +895,10 @@ public final class EMail implements Serializable
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (attachment instanceof URL)
|
else if (attachment instanceof URI)
|
||||||
{
|
{
|
||||||
URL url = (URL)attachment;
|
URI url = (URI)attachment;
|
||||||
ds = new URLDataSource (url);
|
ds = new URLDataSource (url.toURL());
|
||||||
}
|
}
|
||||||
else if (attachment instanceof DataSource)
|
else if (attachment instanceof DataSource)
|
||||||
ds = (DataSource)attachment;
|
ds = (DataSource)attachment;
|
||||||
|
|
Loading…
Reference in New Issue