Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPointerException when run getCookieNamePrefix #248

Open
silloy opened this issue Apr 25, 2024 · 1 comment
Open

NullPointerException when run getCookieNamePrefix #248

silloy opened this issue Apr 25, 2024 · 1 comment

Comments

@silloy
Copy link

silloy commented Apr 25, 2024

I extend the ProxyServlet

public class QProxyServlet extends ProxyServlet {

    @Override
    public void init() throws ServletException {
        super.init();
    }

    @Override
    protected void initTarget() {
    }

    @Override
    protected HttpResponse doExecute(HttpServletRequest servletRequest, HttpServletResponse servletResponse, HttpRequest proxyRequest) throws IOException {
        return super.doExecute(servletRequest, servletResponse, proxyRequest);
    }

    @Override
    protected String getConfigParam(String key) {
        return null;
    }

    public static String getHostAttrName() {
        return ATTR_TARGET_HOST;
    }

    @Override
    public HttpHost getTargetHost(HttpServletRequest request) {
        return super.getTargetHost(request);
    }

    @Override
    public String getTargetUri(HttpServletRequest request) {
        return request.getServletPath();
    }
}

When I initiate a request, the following exception occurs:

java.lang.NullPointerException: null
        at org.mitre.dsmiley.httpproxy.ProxyServlet.getCookieNamePrefix(ProxyServlet.java:655)
        at org.mitre.dsmiley.httpproxy.ProxyServlet.getProxyCookieName(ProxyServlet.java:611)
        at org.mitre.dsmiley.httpproxy.ProxyServlet.createProxyCookie(ProxyServlet.java:591)
        at org.mitre.dsmiley.httpproxy.ProxyServlet.copyProxyCookie(ProxyServlet.java:578)
        at org.mitre.dsmiley.httpproxy.ProxyServlet.copyResponseHeader(ProxyServlet.java:562)
        at org.mitre.dsmiley.httpproxy.ProxyServlet.copyResponseHeaders(ProxyServlet.java:547)
        at org.mitre.dsmiley.httpproxy.ProxyServlet.service(ProxyServlet.java:377)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:733)

Following up on this exception, I found that sevletConfig is empty, but my service has been running on the Linux server for a while. Today, a request suddenly caused this exception, and other requests were normal.

@silloy
Copy link
Author

silloy commented Apr 25, 2024

The characteristic of an errored request is that the request body and return are relatively large.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant