Re: 10.4 and new File now longer works for uploading a file
Re: 10.4 and new File now longer works for uploading a file
- Subject: Re: 10.4 and new File now longer works for uploading a file
- From: Chuck Hill <email@hidden>
- Date: Tue, 26 Jul 2005 09:49:54 -0700
On a tangent...
NSForwardException is a subclass of NSRuntimeException and so not
checked and not required to be declared. It can be useful when you
want to avoid having to declare a checked exception in a whole chain
of methods. If it is going that far, you probably don't care about
it anyway. You can convert a checked exception into an unchecked one
like this;
try {
// Some code that can throw checked exception
}
catch (IOException e) { // for example
throw new NSForwardException(e); // Wraps checked exception in
unchecked exception
}
Chuck
On Jul 26, 2005, at 12:07 AM, Helge Städtler wrote:
I wonder if this code you pasted here really ever compiled...
because you
will at least have to declare in the method "uploadFile" some
statement like
"throws Exception" right, or does NSForwardException not need this
statement
(do not know this at the moment exactly)?
I would just have a closer look to the stacktrace of the exceptions
thrown.
Maybe you have a permissionsproblem.
having <drwxrwx--x 27 baiss admin 918 Jul 22 13:53 Flyers>
may work well for development if user "baiss" is opening xCode. but in
deployment if the "appserv"-user is running the application this
may become
a problem. generally WO apps in deployment seem to run with the
rights by
whom "wotaskd" is owned. so if "root" is owner of "wotaskd" it will
run with
root-rights and in this case ANY permission-problem will disappear
(downside: you will have to know what you do, but this is valid
anyway...).
for me it strongly looks like a permissions problem (new server = new
users/setup)... try uploading to the /tmp/ - directory this is in
any case
accessable.
regards,
helge
Am 26.07.2005 0:16 Uhr schrieb "Baiss Eric Magnusson" unter
<email@hidden>
/ On 26.07.2005 0:16 Uhr "Baiss Eric Magnusson" wrote using address
<email@hidden>:
I have the following code which used to work...
public WOComponent uploadFile() {
if ( actualFilePath == null || actualFilePath.length() <= 0) {
throw new NSForwardException( new Exception
("actualFilePath was null, or there were zero bytes in the file, when
the uploadFile button was clicked. "), "uploadFile" );
}
try {
File uploadedFile = new File( actualFilePath );
bytesWritten = uploadedFile.length();
if ( bytesWritten <= 0 ) {
throw new NSForwardException( new Exception
("bytesWritten is zero or less. To-> " + actualFilePath), " ***
uploadFile ***" );
}
} catch ( Exception e ) {
throw new NSForwardException( e, "An exception was
thrown when trying to <uploadFile>. " + e.toString() );
}
return null;
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40global-village.net
This email sent to email@hidden
--
Practical WebObjects - a book for intermediate WebObjects developers
who want to increase their overall knowledge of WebObjects, or those
who are trying to solve specific application development problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden