<commit_before>
package org.gridsphere.portlets.core.date;

import org.gridsphere.portlet.*;
import org.gridsphere.portlet.PortletException;
import org.gridsphere.portlet.PortletRequest;
import org.gridsphere.portlet.PortletResponse;
import org.gridsphere.portlet.impl.AbstractPortlet;

import java.io.IOException;
import java.util.Calendar;
import java.util.TimeZone;
import java.util.Locale;
import java.text.DateFormat;


public class DatePortlet extends AbstractPortlet {

    public void doView(PortletRequest request, PortletResponse response) throws PortletException, IOException {
        Locale locale;
        TimeZone tz;
        User user = request.getUser();
        if (user != null) {
            String tzStr = (String)user.getAttribute(User.TIMEZONE);
            tz = TimeZone.getTimeZone(tzStr);
        } else {
            tz = TimeZone.getDefault();
        }
        locale = request.getLocale();
        if (locale==null) {
            locale = Locale.getDefault();
        }
        Calendar date = Calendar.getInstance(tz, locale);
        DateFormat uformater = DateFormat.getDateInstance(DateFormat.LONG, locale);
        uformater.setCalendar(date);
        request.setAttribute("date", uformater.format(date.getTime()));
        getPortletConfig().getContext().include("/jsp/date/date.jsp", request, response);
    }

}<commit_msg>fixed NPE in DatePortlet<commit_after>
package org.gridsphere.portlets.core.date;

import org.gridsphere.portlet.*;
import org.gridsphere.portlet.PortletException;
import org.gridsphere.portlet.PortletRequest;
import org.gridsphere.portlet.PortletResponse;
import org.gridsphere.portlet.impl.AbstractPortlet;

import java.io.IOException;
import java.util.Calendar;
import java.util.TimeZone;
import java.util.Locale;
import java.text.DateFormat;


public class DatePortlet extends AbstractPortlet {

    public void doView(PortletRequest request, PortletResponse response) throws PortletException, IOException {
        Locale locale;
        TimeZone tz;
        String tzStr = null;
        User user = request.getUser();
        if (user != null) {
            tzStr = (String)user.getAttribute(User.TIMEZONE);
        }
        if (tzStr != null) {
            tz = TimeZone.getTimeZone(tzStr);
        } else {
            tz = TimeZone.getDefault();
        }
        locale = request.getLocale();
        if (locale == null) {
            locale = Locale.getDefault();
        }
        Calendar date = Calendar.getInstance(tz, locale);
        DateFormat uformater = DateFormat.getDateInstance(DateFormat.LONG, locale);
        uformater.setCalendar(date);
        request.setAttribute("date", uformater.format(date.getTime()));
        getPortletConfig().getContext().include("/jsp/date/date.jsp", request, response);
    }

}
{'fraction_non_alphanumeric': 0.10944206008583691, 'fraction_numerical': 0.0, 'mean_word_length': 3.1560178306092124, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2009928', 'n_tokens_mistral': 806, 'n_tokens_neox': 783, 'n_words': 159}