Use File.toURI() rather than build the URI by hand.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@500 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
mdb
2001-12-03 09:14:11 +00:00
parent 3644f1ef17
commit 5e756bac24
@@ -1,5 +1,5 @@
//
// $Id: DriverTask.java,v 1.2 2001/12/03 08:53:45 mdb Exp $
// $Id: DriverTask.java,v 1.3 2001/12/03 09:14:11 mdb Exp $
//
// viztool - a tool for visualizing collections of java classes
// Copyright (C) 2001 Michael Bayne
@@ -33,8 +33,6 @@ import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import org.apache.tools.ant.AntClassLoader;
@@ -195,20 +193,11 @@ public class DriverTask extends Task
// tell our printjob to print to a file
PrintRequestAttributeSet attrs =
new HashPrintRequestAttributeSet();
String outpath = _output.getPath();
try {
URI target = new URI("file:" + outpath);
attrs.add(new Destination(target));
} catch (URISyntaxException use) {
String errmsg = "Can't create URI for 'output' file path? " +
"[output=" + outpath + "].";
throw new BuildException(errmsg, use);
}
attrs.add(new Destination(_output.toURI()));
// invoke the printing process
try {
log("Generating visualization to '" + outpath + "'.");
log("Generating visualization to '" + _output.getPath() + "'.");
job.print(attrs);
} catch (PrinterException pe) {
throw new BuildException("Error printing visualization.", pe);