Project

General

Profile

Bug #7211

Metacat sets a wrong default value for the deploy path during the totally fresh installation

Added by Jing Tao about 2 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
metacat
Target version:
Start date:
10/03/2017
Due date:
% Done:

0%

Estimated time:
Bugzilla-Id:

Description

Matt reported: I’ve noticed that when run from scratch, the metacat /admin utility seems to tack the /webapps/metacat onto the deployDir property, and I always have to change it. SO I think that is an admin utility bug on a totally clean deployment (i.e., with no backup directory in place).
so, this arises with clean deploys from docker and the like.


Related issues

Has duplicate Metacat - Bug #7214: Metacat overwrites the deployDir propertyClosed10/04/2017

History

#1 Updated by Jing Tao about 2 years ago

I can't reproduce the bug. In mn-demo-5, I removed/backed up /var/metacat directory. So during the configuration, I was asked to input the backup directory. I created the /var/metacat directory and input /var/metadata/.metadata as the backup directory. However, my configuration still showed the deploy directory is "/var/lib/tomcat7/webapps", there is no extra "metacat". Please see the attachment.

I also looked at code:

public static String discoverDeployDir(HttpServletRequest request) {
        ServletContext servletContext = request.getSession()
                .getServletContext();
        String realPath = servletContext.getRealPath(".");
        String contextPath = request.getContextPath();

        Pattern pattern = Pattern.compile(contextPath + "/\\.$");
        Matcher matcher = pattern.matcher(realPath);

        if (matcher.find()) {
            realPath = matcher.replaceFirst("");
        }
        return realPath;
    }

This method guess the deploy directory base on the request object. It shouldn't have the extra "metacat" if the context value is correctly detected.

#2 Updated by Jing Tao about 2 years ago

  • Has duplicate Bug #7214: Metacat overwrites the deployDir property added

#3 Updated by Jing Tao about 2 years ago

  • Status changed from New to Closed

The issue turns out to be Tomcat 8 has change the format of current path.
In Tomcat 7, it was /opt/local/share/java/tomcat7/webapps/metacat/.
But in Tomcat 8, it is /opt/local/share/java/tomcat8/webapps/metacat
So the fancy pattern match doesn't work.

Since we just want to remove the context part, I used the old lastIndexOf and substring method in the String class. It worked well.

#4 Updated by Jing Tao about 2 years ago

The fix has been committed to both 2.8 branch and trunk.

#5 Updated by Jing Tao almost 2 years ago

  • Target version changed from 2.9.0 to 2.8.6

Also available in: Atom PDF