tds/src/main/java/thredds/server/dap4/Dap4Controller.java
@Override
    public String
    getResourcePath(DapRequest drq, String location)
            throws DapException
    {
        String realpath;
        if(TdsRequestedDataset.getDatasetManager() != null) {
            realpath = TdsRequestedDataset.getLocationFromRequestPath(location);
        } else {
            assert TdsRequestedDataset.getDatasetManager() == null;
            String prefix = drq.getResourceRoot();
            assert (prefix != null);
            realpath = DapUtil.canonjoin(prefix, location);
        }

        if (!TESTING) {
            if (!TdsRequestedDataset.resourceControlOk(drq.getRequest(), drq.getResponse(), realpath))
                throw new DapException("Not authorized: " + location)
                        .setCode(DapCodes.SC_FORBIDDEN);
        }
        File f = new File(realpath);
        if (!f.exists() || !f.canRead())
            throw new DapException("Not found: " + location)
                    .setCode(DapCodes.SC_NOT_FOUND);
        //ncfile = TdsRequestedDataset.getNetcdfFile(this.request, this.response, path);
        return realpath;
    }
@Override
    public String
    getResourcePath(DapRequest drq, String location)
            throws DapException
    {
        String realpath;
        if(TdsRequestedDataset.getDatasetManager() != null) {
            realpath = TdsRequestedDataset.getLocationFromRequestPath(location);
        } else {
            assert TdsRequestedDataset.getDatasetManager() == null;
            String prefix = drq.getResourceRoot();
            assert (prefix != null);
            realpath = DapUtil.canonjoin(prefix, location);
        }

        if (!TESTING) {
            if (!TdsRequestedDataset.resourceControlOk(drq.getRequest(), drq.getResponse(), realpath))
                throw new DapException("Not authorized: " + location)
                        .setCode(DapCodes.SC_FORBIDDEN);
        }
        File f = new File(realpath);
        if (!f.exists() || !f.canRead())
            throw new DapException("Not found: " + location)
                    .setCode(DapCodes.SC_NOT_FOUND);
        //ncfile = TdsRequestedDataset.getNetcdfFile(this.request, this.response, path);
        return realpath;
    }
to work under Intellij.