if (tokens.length > 0 && tokens[0].length() == 0) { String[] tokensTemp = new String[tokens.length - 1]; for (int i = 1; i < tokens.length; i++) { tokensTemp[i - 1] = tokens[i]; } tokens = tokensTemp; }
    public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException,            ServletException {        HttpServletRequest request = (HttpServletRequest) req;        HttpServletResponse response = (HttpServletResponse) res;        String uri = request.getRequestURI();        String context = request.getContextPath();        String newURI = uri.replaceFirst(app, "");        String[] tokens = newURI.split("/");        try {            if (tokens.length != 1 || !isDegree(tokens[0])) {                chain.doFilter(request, response);                return;            }        } catch (FenixServiceException e2) {            throw new ServletException(e2);        }        StringBuffer forwardURI = new StringBuffer(context);        String degreeCode = tokens[0];        Integer degreeId;        try {            degreeId = getDegreeId(degreeCode);        } catch (FenixServiceException e) {            throw new ServletException(e);        }        if (degreeId != null) {            try {                InfoExecutionPeriod infoExecutionPeriod = getCurrentExecutionPeriod();                if (infoExecutionPeriod != null) {                    Integer executionPeriodId = infoExecutionPeriod.getIdInternal();                    forwardURI.append(forwardDegreeDescription);                    forwardURI.append(executionPeriodId);                    forwardURI.append("&degreeID=");                    forwardURI.append(degreeId);                } else {                    forwardURI.append(notFoundURI);                }            } catch (FenixServiceException e1) {                throw new ServletException(e1);            }        } else {            forwardURI.append(notFoundURI);        }        response.sendRedirect(forwardURI.toString());    }