× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.




Try the following, it must throw an exception for every action.

We did like this

boolean result = false;

try {
action to perform
set result to true (if action perform success)

} catch (PropertyVetoException e) {
logger.error("iSeries call failed: " + e.getMessage());
throw new ExceptionFortisiMarket("iSeries call failed", null, e);
} catch (AS400SecurityException e) {
logger.error("iSeries call failed: " + e.getMessage());
throw new ExceptionFortisiMarket("iSeries call failed", null, e);
} catch (ErrorCompletingRequestException e) {
logger.error("iSeries call failed: " + e.getMessage());
throw new ExceptionFortisiMarket("iSeries call failed", null, e);
} catch (IOException e) {
logger.error("iSeries call failed: " + e.getMessage());
throw new ExceptionFortisiMarket("iSeries call failed", null, e);
} catch (InterruptedException e) {
logger.error("iSeries call failed: " + e.getMessage());
throw new ExceptionFortisiMarket("iSeries call failed", null, e);
} catch (ObjectDoesNotExistException e) {
logger.error("iSeries call failed: " + e.getMessage());
throw new ExceptionFortisiMarket("iSeries call failed", null, e);
} catch (ParseException e) {
logger.error("iSeries call failed: " + e.getMessage());
throw new ExceptionFortisiMarket("iSeries call failed", null, e);
}

logger.info("call to iseries " + result);

return result;
}

Regards,
Murali

-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-bounces@xxxxxxxxxxxx] On Behalf Of Blalock, Bill
Sent: 26 October 2009 18:40
To: Java Programming on and around the iSeries / AS400
Subject: Showing root cause of error for Java tool box class which doesn't throw an exception

Hi all..



Does anyone have ideas how Java can report an error for a Java toolbox class when it doesn't throw an exception? Is there any way to programmatically dig out the cause when a method returns a value indicating the underlying i5 operation failed, but doesn't throw an error?



This code run on a windows server, it sets up the File objects to copy a jpg image from the Windows server to an i5.



// ensure that parent dir of dest file exists!

IFSFile parent = new IFSFile(sys, parentPath);

if (!parent.exists()) {

parent.mkdirs();

}



try {

in = new FileInputStream(sourceFile);

} catch( IOException e ) {

throw new Exception ( "Problem with input file, \""+sourceFile.getAbsolutePath()+"\" " + e.getMessage() );

}

try {

out = new IFSFileOutputStream(destFile);

} catch( IOException e ) {

throw new Exception ( "Problem with output file, \""+destFile.getAbsolutePath()+"\" " + e.getMessage() );

}



Today the IFSFileOutputStream(destFile) started to throw errors.



The problem is caused by IFSFile.mkdirs() failing. It fails silently, returning false.



I could change the code to:



if (!parent.exists()) {

if( !parent.mkdirs() ) {

throw new Exception("Unable to create parent folder, \""+parent.getAbsolutePath()+"\" ) ;

}

}



That would notify the caller of the method that a failure took place, but not the cause of the failure. parentPath is validated before the execution gets this far so IFSFile.mkdirs() shouldn't fail in the first place.



The failure is being caused by CPE3474, our IT department is working on that.



I'd like to do something like this to report why IFSFile.mkdirs()
failed:



if (!parent.exists()) {

if( !parent.mkdirs() ) {

// do something to dig out cause of error

throw new Exception("Unable to create parent folder, \""+parent.getAbsolutePath()+"\ caused by " + cause_of_error);

}

}



Any ideas what to replace the // do something... comment with?



Thanks

Bill Blalock

















_____________

The information contained in this message is proprietary and/or confidential. If you are not the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, please be aware that any message addressed to our domain is subject to archiving and review by persons other than the intended recipient. Thank you.
_____________
--
This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/java400-l.



Consider the environment and think before you print this email.

Registered Address: Fortis House Tollgate Eastleigh Hampshire SO53 3YA Registered Number: 354568 England
Authorised and regulated by the Financial Services Authority

This e-mail together with any attachments are intended for the addressee only and may be private and confidential. If you are not the intended recipient, or the person responsible for delivering it to the intended recipient, you must not open any attachments, or copy, disclose, distribute, retain or use this e-mail, including any attachments, in any way whatsoever; please return it to us immediately using the reply facility on e-mail.

Consider the environment and think before you print this email.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.