// Path: src/main/java/com/damnhandy/uri/template/MalformedUriTemplateException.java
// public class MalformedUriTemplateException extends RuntimeException
// {
// 
//    /** The serialVersionUID */
//    private static final long serialVersionUID = 5883174281977078450L;
// 
//    private final int location;
//    /**
//     * Create a new UriTemplateParseException.
//     *
//     * @param message
//     * @param cause
//     */
//    public MalformedUriTemplateException(String message, final int location, Throwable cause)
//    {
//       super(message, cause);
//       this.location = location;
//    }
// 
//    /**
//     * Create a new UriTemplateParseException.
//     *
//     * @param message
//     */
//    public MalformedUriTemplateException(String message, int location)
//    {
//       super(message);
//       this.location = location;
//    }
// 
//    public int getLocation()
//    {
//       return this.location;
//    }
// }


import com.damnhandy.uri.template.MalformedUriTemplateException;
import java.io.Serializable;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
        variableName = getValue();

        if (modifier != Modifier.NONE)
        {
            if (modifier == Modifier.PREFIX)
            {
                String[] values = getValue().split(Modifier.PREFIX.getValue());
                variableName = values[0];
            }
            // Strip the '*' from the variable name if it's presnet on the variable
            // name. Note that in the case of the UriTemplateBuilder, the VarSpec
            // is not responsible for rendering the '*' on the generated template
            // output as that is done in the UriTemplateBuilder
            if (modifier == Modifier.EXPLODE && getValue().lastIndexOf('*') != -1)
            {
                variableName = getValue().substring(0, getValue().length() - 1);
            }
        }
        // Double check if the name has an explode modifier. This could happen
        // using one of the template builder APIs. If the ends with '*'
        // strip it and set the modifier to EXPLODE
        else if (variableName.lastIndexOf('*') != -1)
        {
            variableName = getValue().substring(0, getValue().length() - 1);
            modifier = Modifier.EXPLODE;
        }
        // Validation needs to happen after strip out the modifier or prefix
        Matcher matcher = VARNAME_REGEX.matcher(variableName);
        if (!matcher.matches())
        {
// Path: src/main/java/com/damnhandy/uri/template/MalformedUriTemplateException.java
// public class MalformedUriTemplateException extends RuntimeException
// {
// 
//    /** The serialVersionUID */
//    private static final long serialVersionUID = 5883174281977078450L;
// 
//    private final int location;
//    /**
//     * Create a new UriTemplateParseException.
//     *
//     * @param message
//     * @param cause
//     */
//    public MalformedUriTemplateException(String message, final int location, Throwable cause)
//    {
//       super(message, cause);
//       this.location = location;
//    }
// 
//    /**
//     * Create a new UriTemplateParseException.
//     *
//     * @param message
//     */
//    public MalformedUriTemplateException(String message, int location)
//    {
//       super(message);
//       this.location = location;
//    }
// 
//    public int getLocation()
//    {
//       return this.location;
//    }
// }


// Path: src/main/java/com/damnhandy/uri/template/impl/VarSpec.java
import com.damnhandy.uri.template.MalformedUriTemplateException;
import java.io.Serializable;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

        variableName = getValue();

        if (modifier != Modifier.NONE)
        {
            if (modifier == Modifier.PREFIX)
            {
                String[] values = getValue().split(Modifier.PREFIX.getValue());
                variableName = values[0];
            }
            // Strip the '*' from the variable name if it's presnet on the variable
            // name. Note that in the case of the UriTemplateBuilder, the VarSpec
            // is not responsible for rendering the '*' on the generated template
            // output as that is done in the UriTemplateBuilder
            if (modifier == Modifier.EXPLODE && getValue().lastIndexOf('*') != -1)
            {
                variableName = getValue().substring(0, getValue().length() - 1);
            }
        }
        // Double check if the name has an explode modifier. This could happen
        // using one of the template builder APIs. If the ends with '*'
        // strip it and set the modifier to EXPLODE
        else if (variableName.lastIndexOf('*') != -1)
        {
            variableName = getValue().substring(0, getValue().length() - 1);
            modifier = Modifier.EXPLODE;
        }
        // Validation needs to happen after strip out the modifier or prefix
        Matcher matcher = VARNAME_REGEX.matcher(variableName);
        if (!matcher.matches())
        {
            throw new MalformedUriTemplateException("The variable name " + variableName + " contains invalid characters", position);