[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [smila-dev] RE: Exception as control flow... nono
|
Hi Georg,
I modified blackboard so that exception as control flow is not used
anymore in invalidate() method.
Regarding exceptions in tests, it seems to be intended behavior, there
are such comments in some tests (not in every that use invalidate in
such way though):
_log.info("Invalidating and re-creating test record on blackboard.");
_log.info("This may cause an exception to be logged that can be
safely ignored.");
_blackboard.invalidate(id);
(it's a quote from APipeletTest, createBlackboardRecord method).
Thanks,
Dmitry
August Georg Schmidt wrote:
If this is a wanted behavior. Why does it happen during unit test
execution?
*From:* smila-dev-bounces@xxxxxxxxxxx
[mailto:smila-dev-bounces@xxxxxxxxxxx] *On Behalf Of *August Georg Schmidt
*Sent:* Dienstag, 14. Oktober 2008 19:55
*To:* Smila project developer mailing list
*Subject:* [smila-dev] Exception as control flow... nono
Hi Guys,
i have seen strange warning within our logs (during test execution)
2008-10-14 17:54:43,071 [ODEServerImpl-7] INFO
bpel.ProcessingServiceManager -
SimpleMimeTypeIdentifierPipeline/extensionActivity-activity-line-35:
invoking service SimpleMimeTypeIdentifier, processing request -> request
2008-10-14 17:54:43,078 [main] WARN impl.BlackboardServiceImpl -
Error while invalidating record: Record with idHash =
75264fad2731bfe3eff94ffd92c6ff749036fc2526f85c2615cd18695e4bf is not
loaded in the blackboard.
2008-10-14 17:54:43,085 [ODEServerImpl-8] INFO
bpel.ProcessingServiceManager -
SimpleMimeTypeIdentifierPipeline/extensionActivity-activity-line-35:
invoking service SimpleMimeTypeIdentifier, processing request -> request
2008-10-14 17:54:43,089 [main] WARN impl.BlackboardServiceImpl -
Error while invalidating record: Record with idHash =
367e113d1d9529bbda1a2e8cc5a16eadbb9eb467be375f1fbdde57393dc347 is not
loaded in the blackboard.
2008-10-14 17:54:43,092 [ODEServerImpl-9] INFO
bpel.ProcessingServiceManager -
SimpleMimeTypeIdentifierPipeline/extensionActivity-activity-line-35:
invoking service SimpleMimeTypeIdentifier, processing request -> request
2008-10-14 17:54:43,098 [main] WARN impl.BlackboardServiceImpl -
Error while invalidating record: Record with idHash =
b46bfb67fe1433714dcdc414665f99b71d4d297db883c9cedccad31e5921 is not
loaded in the blackboard.
I have found the usage of exceptions as control flow. I am 100% sure
you know better. This approach cost lot of performance.
/**
* {@inheritDoc}
*/
*public* *void* invalidate(*final* Id id) {
// *TODO*: unlock the record in database.
*try* {
_xssConnection.getDocument(id.getIdHash());
} *catch* (*final* XssException exception) {
*if*
(XssExceptionType./DOCUMENT_NOT_FOUND/.equals(exception.getXssExceptionType()))
{
*try* {
*final* Record record = getCachedRecord(id);
*if* (record.hasAttachments()) {
*for* (*final* Iterator<String> attachmentNames =
record.getAttachmentNames(); attachmentNames.hasNext();) {
*final* String attachmentName = attachmentNames.next();
_binaryStorage.delete(getAttachmentId(id, attachmentName));
}
}
} *catch* (*final* BlackboardAccessException
blackboardException) {
_log.warn("Error while invalidating record: " +
blackboardException.getMessage());
} *catch* (*final* BinaryStorageException bsex) {
*if* (_log.isErrorEnabled()) {
_log.error("Could not invalidate/delete the
attachment-file from binary storage for record having id :"
+ id.getIdHash() + " - " + bsex.getMessage());
}
}
}
} *finally* {
_recordMap.remove(id);
}
}
The issue is generated by calling the getCachedRecord() Method
/**
* Returns the record by id.
*
* *@param* id
* the id
*
* *@return* the record
*
* *@throws* BlackboardAccessException
* the blackboard access exception
*/
*private* Record getCachedRecord(*final* Id id) *throws*
BlackboardAccessException {
*if* (!_recordMap.containsKey(id)) {
*throw* *new* BlackboardAccessException("Record with idHash = "
+ id.getIdHash()
+ " is not loaded in the blackboard.");
}
*return* _recordMap.get(id);
}
I do not want to make this change by myself, because I have not made
this implementation. Could you please improve this point.
Thanks,
Georg
------------------------------------------------------------------------
_______________________________________________
smila-dev mailing list
smila-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/smila-dev