public static CompressionType fromValue(String value) {
        if (value == null || "".equals(value)) {
            throw new IllegalArgumentException("Value cannot be null or empty!");
        }

        for (CompressionType enumEntry : CompressionType.values()) {
            if (enumEntry.toString().equals(value)) {
                return enumEntry;
            }
        }

        throw new IllegalArgumentException("Cannot create enum from " + value + " value!");
    }
Use this in place of valueOf.

@param value real value
@return enum corresponding to the value
aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/model/CompressionType.java