Search in sources :

Example 1 with IssuesRoot

use of boa.types.Issues.IssuesRoot in project compiler by boalang.

the class BoaAstIntrinsics method getissues.

/**
	 * Given an IssueRepository, return the issues.
	 *
	 * @param f the IssueRepository to get issues for
	 * @return the issues list, or an empty list on any sort of error
	 */
@FunctionSpec(name = "getissues", returnType = "IssuesRoot", formalParameters = { "IssueRepository" })
public static IssuesRoot getissues(final IssueRepository f) {
    if (issuesMap == null)
        openIssuesMap();
    try {
        final BytesWritable value = new BytesWritable();
        if (issuesMap.get(new Text(f.getKey()), value) != null) {
            final CodedInputStream _stream = CodedInputStream.newInstance(value.getBytes(), 0, value.getLength());
            final IssuesRoot root = IssuesRoot.parseFrom(_stream);
            return root;
        }
    } catch (final InvalidProtocolBufferException e) {
        e.printStackTrace();
    } catch (final IOException e) {
        e.printStackTrace();
    } catch (final RuntimeException e) {
        e.printStackTrace();
    } catch (final Error e) {
        e.printStackTrace();
    }
    System.err.println("error with issues: " + f.getKey());
    return emptyIssues;
}
Also used : CodedInputStream(com.google.protobuf.CodedInputStream) IssuesRoot(boa.types.Issues.IssuesRoot) InvalidProtocolBufferException(com.google.protobuf.InvalidProtocolBufferException) BytesWritable(org.apache.hadoop.io.BytesWritable) Text(org.apache.hadoop.io.Text) IOException(java.io.IOException)

Aggregations

IssuesRoot (boa.types.Issues.IssuesRoot)1 CodedInputStream (com.google.protobuf.CodedInputStream)1 InvalidProtocolBufferException (com.google.protobuf.InvalidProtocolBufferException)1 IOException (java.io.IOException)1 BytesWritable (org.apache.hadoop.io.BytesWritable)1 Text (org.apache.hadoop.io.Text)1