Open chicoreus opened 7 years ago
Here's a potential fix:
diff --git a/src/main/java/org/yesworkflow/extract/DefaultExtractor.java b/src/main/java/org/yesworkflow/extract/DefaultExtractor.java
index 5e25c66..3bb96c9 100644
--- a/src/main/java/org/yesworkflow/extract/DefaultExtractor.java
+++ b/src/main/java/org/yesworkflow/extract/DefaultExtractor.java
@@ -319,7 +319,11 @@ public class DefaultExtractor implements Extractor {
break;
case IN: annotation = new In(id, sourceId, lineNumber, annotationString);
break;
- case LOG: annotation = new Log(id, sourceId, lineNumber, annotationString, (Out) primaryAnnotation);
+ case LOG: try {
+ annotation = new Log(id, sourceId, lineNumber, annotationString, (Out) primaryAnnotation);
+ } catch (ClassCastException cce) {
+ throw new YWMarkupException("A LOG annotation must follow an OUT annotation as its primaryAnnotation.");
+ }
break;
case OUT: annotation = new Out(id, sourceId, lineNumber, annotationString);
break;
Naïve use of @LOG would simply embedd it in an @BEGIN @END block where a logging statement occurs, however, @LOG appears to need to follow an @OUT annotation, having a bare @LOG which happens to follow a @IN statement results in a not immediately helpful exception:
Graceful failure in this case with a pertinent error message would help.
To reproduce: