Ignore:
Timestamp:
2018-01-26T23:21:57+01:00 (21 months ago)
Author:
Don-vip
Message:

fix #15830 - Support (and autodetect) WMS 1.3.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/HttpClient.java

    r13179 r13358  
    6161    private boolean finishOnCloseOutput = true;
    6262
     63    // Pattern to detect Tomcat error message. Be careful with change of format:
     64    // CHECKSTYLE.OFF: LineLength
     65    // https://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/valves/ErrorReportValve.java?r1=1740707&r2=1779641&pathrev=1779641&diff_format=h
     66    // CHECKSTYLE.ON: LineLength
     67    private static final Pattern TOMCAT_ERR_MESSAGE = Pattern.compile(
     68        ".*<p><b>[^<]+</b>[^<]+</p><p><b>[^<]+</b> (?:<u>)?([^<]*)(?:</u>)?</p><p><b>[^<]+</b> (?:<u>)?[^<]*(?:</u>)?</p>.*",
     69        Pattern.CASE_INSENSITIVE);
     70
    6371    static {
    6472        CookieHandler.setDefault(new CookieManager());
     
    687695        }
    688696    }
     697
     698    /**
     699     * Returns a {@link Matcher} against predefined Tomcat error messages.
     700     * If it matches, error message can be extracted from {@code group(1)}.
     701     * @param data HTML contents to check
     702     * @return a {@link Matcher} against predefined Tomcat error messages
     703     * @since 13358
     704     */
     705    public static Matcher getTomcatErrorMatcher(String data) {
     706        return data != null ? TOMCAT_ERR_MESSAGE.matcher(data) : null;
     707    }
    689708}
Note: See TracChangeset for help on using the changeset viewer.