import re


def parse_java_source_file(distribution_java_class):
    """
    Parse a java source file and look for a VERSION constant.

    :param distribution_java_class: path of the java source file.
    :return: the version or None if no version is found
    """
    result = None
    with open(distribution_java_class, 'r') as source_file:
        for line in source_file:
            if "String VERSION" in line:
                parsing_result = re.match(
                    '(?:.*)public (?:final|static)? (?:final|static)? String VERSION(?:_56)? = "(.*)"', line)
                #     if re.search(r'public final static String VERSION = ".*";', line) is not None:
                result = None if parsing_result is None else parsing_result.group(1)
                if result is not None:
                    break
    return result