anon-iclr-submission/benchname-bug-localization huggingface dataset:
Repository: cqframework/clinical_quality_language
Issue: cql-formatter Main produces unusable output

I was playing around with the tools/cql-formatter project and noticed that when you run the main method, it produces unusable output.

```
$ ./cql-formatter dummy.cql
org.cqframework.cql.tools.formatter.CqlFormatterVisitor$FormatResult@2dff7085
```

The code either needs to implement toString on FormatResult or interrogate the FormatResult in main and handle as needed.

Changed files:
Src/java/tools/cql-formatter/src/main/java/org/cqframework/cql/tools/formatter/Main.java

diff --git a/Src/java/tools/cql-formatter/src/main/java/org/cqframework/cql/tools/formatter/Main.java b/Src/java/tools/cql-formatter/src/main/java/org/cqframework/cql/tools/formatter/Main.java
index 4e523ca5..33a8b491 100644
--- a/Src/java/tools/cql-formatter/src/main/java/org/cqframework/cql/tools/formatter/Main.java
+++ b/Src/java/tools/cql-formatter/src/main/java/org/cqframework/cql/tools/formatter/Main.java
@@ -19,6 +19,19 @@ public class Main {
             is = new FileInputStream(inputFile);
         }
 
-        System.out.print(CqlFormatterVisitor.getFormattedOutput(is));
+        try {
+            CqlFormatterVisitor.FormatResult result = CqlFormatterVisitor.getFormattedOutput(is);
+            if( result.getErrors() != null && result.getErrors().size() > 0 ) {
+                for( Exception ex : result.getErrors() ) {
+                    System.out.println( ex.getMessage() );
+                }
+            } else {
+                System.out.print( result.getOutput() );
+            }
+        } finally {
+            if( is != System.in ) {
+                try { is.close(); } catch( IOException iex ) { }
+            }
+        }
     }
 }