if (errorType == null) {
if (errorType != null) { context.put("errorMessage", bundle.getString("error_"+errorType)); context.put("errorDescription", bundle.getString("error_"+errorType+"_desc")); }  else {
    private Template genLoginTemplate(HttpServletRequest request, HttpServletResponse response, Context context, String sessionID, String errorType) throws ParseErrorException, ResourceNotFoundException, MissingResourceException, Exception {        String bundleName = "login";        String acceptLanguage = request.getHeader("Accept-Language");        ResourceBundle bundle = null;        ResourceBundle fallback = null;        // nn, no;q=0.80, nb;q=0.60, en-us;q=0.40, en;q=0.20        StringTokenizer tokenizer = new StringTokenizer(acceptLanguage, ",");        Locale locale = null;        // Find fallback resource bundle.        try {            fallback = ResourceBundle.getBundle(bundleName, new Locale("bogus"));        }        catch (MissingResourceException e) {            // No fallback        }                    /* Parse Accept-Language and find matching resource bundle */        while (tokenizer.hasMoreTokens()) {            String lang = tokenizer.nextToken();            int index;            // Languages are devided by ";"            if ((index = lang.indexOf(";")) != -1) {                lang = lang.substring(0, index);            }            lang = lang.trim();            // Language and country is devided by "-" (optional)            if ((index = lang.indexOf("-")) != -1) {                lang = lang.substring(0, index);            }                                    locale = new Locale(lang);            bundle = ResourceBundle.getBundle(bundleName, locale);            // Abort search if a bundle (not fallback) is found            if (bundle != fallback)                 break;            // About search if the fallback bundle is actually requested            else if (bundle == fallback && locale.getLanguage().equals(Locale.getDefault().getLanguage()))                break;        }        // Should never happen, but just in case.        if (bundle == null)            bundle = ResourceBundle.getBundle(bundleName, new Locale("no"));        // Set template-variables from properties        for (Enumeration e = bundle.getKeys(); e.hasMoreElements();) {            String value = (String) e.nextElement();            context.put(value, bundle.getString(value));        }                // If no error then reset error messages        if (errorType == null) {            context.remove("errorMessage");            context.remove("errorDescription");        }             // If no sessionID then remove loginURL        if (sessionID != null)             context.put("loginURL", loginURL+"?id="+sessionID);                else             context.remove("loginURL");        return getTemplate("login.vtl");    }