private void init(Project p) { if (!alreadyInit) { this.regexp = FACTORY.newRegexp(p); alreadyInit = true; } } private void setPattern() {
/*** * Create a new regular expression matcher instance. * * @param p Project whose ant.regexp.regexpimpl property will be used. * @return the matcher instance * @throws BuildException on error */ public Regexp newRegexp(Project p) throws BuildException { String systemDefault; if (p == null) { systemDefault = System.getProperty(MagicNames.REGEXP_IMPL); } else { systemDefault = p.getProperty(MagicNames.REGEXP_IMPL); } if (systemDefault != null) { return createRegexpInstance(systemDefault); // TODO should we silently catch possible exceptions and try to // load a different implementation? } return new Jdk14RegexpRegexp(); }
/*** * Create a new regular expression matcher instance. * @return the matcher instance * @throws BuildException on error */ public Regexp newRegexp() throws BuildException { return newRegexp(null); }