Define a variable and set it to a default value if something goes wrong during definition

All you need is some regular Java/Groovy code:

def jenkinsBuild = System.getenv("BUILD_NUMBER") ?: "0"

The code above uses Groovy's "elvis" operator, and is a shorthand for the following code, which uses Java's ternary operator:

def buildNumber = System.getenv("BUILD_NUMBER")
def jenkinsBuild = buildNumber != null ? buildNumber : "0"

Here's the answer to using a Java plain object (JDK8):

public class Sample {

    private String region;
    private String fruit;

    public Sample() {
        region = System.getenv().getOrDefault("REGION", null);
        fruit = System.getenv().getOrDefault("FRUIT", "apple");
    }
}