Example usage for org.apache.commons.lang3 StringUtils startsWith

List of usage examples for org.apache.commons.lang3 StringUtils startsWith

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringUtils startsWith.

Prototype

public static boolean startsWith(final CharSequence str, final CharSequence prefix) 

Source Link

Document

Check if a CharSequence starts with a specified prefix.

null s are handled without exceptions.

Usage

From source file:lolth.autohome.buy.AutohomeBuyInfoListTaskFetch.java

@Override
protected void parsePage(Document doc, FetchTask task) throws Exception {
    Elements lis = doc.select("li.price-item");

    for (Element li : lis) {
        AutohomeBuyInfoBean bean = new AutohomeBuyInfoBean();
        bean.setUrl(task.getUrl());/*from w w  w.ja  v  a2 s  .c  o  m*/
        bean.setForumId(task.getExtra());

        // post id
        Elements id = li.select("div.price-share a.share");
        if (!id.isEmpty()) {
            String idStr = id.first().attr("data-target");
            idStr = StringUtils.substringAfterLast(idStr, "_");
            if (StringUtils.isBlank(idStr)) {
                continue;
            }

            bean.setId(idStr);
        }

        // 
        Elements user = li.select("div.user-name a");
        if (!user.isEmpty()) {
            String userUrl = user.first().absUrl("href");
            String userId = StringUtils.substringAfterLast(userUrl, "/");
            String userName = user.first().text();

            bean.setUserId(userId);
            bean.setUserUrl(userUrl);
            bean.setUserName(userName);
        }

        // ?
        Elements postTime = li.select("div.user-name span");
        if (!postTime.isEmpty()) {
            bean.setPostTime(StringUtils.trim(StringUtils.substringBefore(postTime.first().text(), "?")));
        }

        Elements dataLis = li.select("div.price-item-bd li");
        for (Element dataLi : dataLis) {
            String data = dataLi.text();

            if (StringUtils.startsWith(data, "")) {
                bean.setCar(StringUtils.trim(StringUtils.substringAfter(data, "")));
            }

            if (StringUtils.startsWith(data, "")) {
                bean.setPrice(StringUtils.trim(StringUtils.substringAfter(data, "")));
            }

            if (StringUtils.startsWith(data, "")) {
                bean.setGuidePrice(StringUtils.trim(StringUtils.substringAfter(data, "")));
            }

            if (StringUtils.startsWith(data, "?")) {
                bean.setTotalPrice(StringUtils.trim(StringUtils.substringAfter(data, "")));
            }

            if (StringUtils.startsWith(data, "")) {
                bean.setPurchaseTax(StringUtils.trim(StringUtils.substringAfter(data, "")));
            }

            if (StringUtils.startsWith(data, "?")) {
                bean.setCommercialInsurance(StringUtils.trim(StringUtils.substringAfter(data, "")));
            }

            if (StringUtils.startsWith(data, "")) {
                bean.setVehicleUseTax(StringUtils.trim(StringUtils.substringAfter(data, "")));
            }
            if (StringUtils.startsWith(data, "")) {
                bean.setCompulsoryInsurance(StringUtils.trim(StringUtils.substringAfter(data, "")));
            }
            if (StringUtils.startsWith(data, "")) {
                bean.setLicenseFee(StringUtils.trim(StringUtils.substringAfter(data, "")));
            }
            if (StringUtils.startsWith(data, "?")) {
                bean.setPromotion(StringUtils.trim(StringUtils.substringAfter(data, "")));
            }
            if (StringUtils.startsWith(data, "")) {
                bean.setBuyTime(StringUtils.trim(StringUtils.substringAfter(data, "")));
            }
            if (StringUtils.startsWith(data, "")) {
                String area = StringUtils.trim(StringUtils.substringAfter(data, ""));
                String[] pAndC = StringUtils.splitByWholeSeparator(area, ",", 2);

                if (pAndC.length == 1) {
                    bean.setBuyProvince(pAndC[0]);
                    bean.setBuyCity(pAndC[0]);
                }

                if (pAndC.length == 2) {
                    bean.setBuyProvince(pAndC[0]);
                    bean.setBuyCity(pAndC[1]);
                }

            }
            if (StringUtils.startsWith(data, "")) {
                Elements level = dataLi.select("span.level");
                // 
                if (!level.isEmpty()) {
                    bean.setSellerComment(level.first().text());
                }

                // ?
                Elements seller = dataLi.select("a.title");
                if (!seller.isEmpty()) {
                    String sellerUrl = seller.first().absUrl("href");
                    String sellerName = seller.first().text();
                    String sellerId = StringUtils.substringAfterLast(sellerUrl, "/");

                    bean.setSellerId(sellerId);
                    bean.setSellerName(sellerName);
                    bean.setSellerUrl(sellerUrl);
                }

                // ?
                Elements sellerPhone = dataLi.select("em.phone-num");
                if (!sellerPhone.isEmpty()) {
                    bean.setSellerPhone(sellerPhone.first().text());
                }

                // ?
                // Elements sellerAddress = dataLi.select("em.phone-num");

            }
            if (StringUtils.startsWith(data, "?")) {
                bean.setBuyFeeling(StringUtils.trim(StringUtils.substringAfter(data, "")));
            }
        }

        log.debug("Bean : {}", bean);

        bean.persistOnNotExist();
    }
}

From source file:io.wcm.caravan.pipeline.extensions.hal.crawler.LinkExtractors.java

/**
 * Returns all relations and links provided by the {@code delegate}d {@link LinkExtractor} where the URI starts with
 * the given prefix./*from  w  w w . jav  a2s.  c o m*/
 * @param prefix URI prefix
 * @param delegate Delegated link extractor
 * @return Link extractor for prefixed URIs
 */
public static LinkExtractor filterByPrefix(String prefix, LinkExtractor delegate) {
    return new LinkExtractor() {

        @Override
        public String getId() {
            return "ONLY-STARTING-WITH('" + prefix + "', " + delegate.getId() + ")";
        }

        @Override
        public ListMultimap<String, Link> extract(HalResource hal) {

            ListMultimap<String, Link> fromDelegate = delegate.extract(hal);
            Builder<String, Link> builder = ImmutableListMultimap.builder();
            fromDelegate.entries().stream()
                    .filter(entry -> StringUtils.startsWith(entry.getValue().getHref(), prefix))
                    .forEach(entry -> builder.put(entry));
            return builder.build();

        }
    };
}

From source file:com.erudika.scoold.utils.ScooldRequestInterceptor.java

@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
        ModelAndView modelAndView) throws Exception {

    if (modelAndView == null || StringUtils.startsWith(modelAndView.getViewName(), "redirect:")) {
        return; // skip if redirect
    }/*from  w  ww. java2s  . co  m*/

    /*============================*
     * COMMON MODEL FOR ALL PAGES *
     *============================*/

    // Misc
    modelAndView.addObject("HOMEPAGE", HOMEPAGE);
    modelAndView.addObject("APPNAME", Config.APP_NAME);
    modelAndView.addObject("CDN_URL", CDN_URL);
    modelAndView.addObject("DESCRIPTION", Config.getConfigParam("meta_description", ""));
    modelAndView.addObject("KEYWORDS", Config.getConfigParam("meta_keywords", ""));
    modelAndView.addObject("IN_PRODUCTION", Config.IN_PRODUCTION);
    modelAndView.addObject("IN_DEVELOPMENT", !Config.IN_PRODUCTION);
    modelAndView.addObject("MAX_ITEMS_PER_PAGE", Config.MAX_ITEMS_PER_PAGE);
    modelAndView.addObject("SESSION_TIMEOUT_SEC", Config.SESSION_TIMEOUT_SEC);
    modelAndView.addObject("TOKEN_PREFIX", TOKEN_PREFIX);
    modelAndView.addObject("FB_APP_ID", Config.FB_APP_ID);
    modelAndView.addObject("GMAPS_API_KEY", Config.getConfigParam("gmaps_api_key", ""));
    modelAndView.addObject("GOOGLE_CLIENT_ID", Config.getConfigParam("google_client_id", ""));
    modelAndView.addObject("GOOGLE_ANALYTICS_ID", Config.getConfigParam("google_analytics_id", ""));
    modelAndView.addObject("includeHighlightJS", Config.getConfigBoolean("code_highlighting_enabled", true));
    modelAndView.addObject("isAjaxRequest", utils.isAjaxRequest(request));
    modelAndView.addObject("reportTypes", ReportType.values());
    modelAndView.addObject("returnto", StringUtils.removeStart(request.getRequestURI(), CONTEXT_PATH));
    // Configurable constants
    modelAndView.addObject("MAX_TEXT_LENGTH", MAX_TEXT_LENGTH);
    modelAndView.addObject("MAX_TAGS_PER_POST", MAX_TAGS_PER_POST);
    modelAndView.addObject("MAX_REPLIES_PER_POST", MAX_REPLIES_PER_POST);
    modelAndView.addObject("MAX_FAV_TAGS", MAX_FAV_TAGS);
    modelAndView.addObject("ANSWER_VOTEUP_REWARD_AUTHOR", ANSWER_VOTEUP_REWARD_AUTHOR);
    modelAndView.addObject("QUESTION_VOTEUP_REWARD_AUTHOR", QUESTION_VOTEUP_REWARD_AUTHOR);
    modelAndView.addObject("VOTEUP_REWARD_AUTHOR", VOTEUP_REWARD_AUTHOR);
    modelAndView.addObject("ANSWER_APPROVE_REWARD_AUTHOR", ANSWER_APPROVE_REWARD_AUTHOR);
    modelAndView.addObject("ANSWER_APPROVE_REWARD_VOTER", ANSWER_APPROVE_REWARD_VOTER);
    modelAndView.addObject("POST_VOTEDOWN_PENALTY_AUTHOR", POST_VOTEDOWN_PENALTY_AUTHOR);
    modelAndView.addObject("POST_VOTEDOWN_PENALTY_VOTER", POST_VOTEDOWN_PENALTY_VOTER);
    modelAndView.addObject("VOTER_IFHAS", VOTER_IFHAS);
    modelAndView.addObject("COMMENTATOR_IFHAS", COMMENTATOR_IFHAS);
    modelAndView.addObject("CRITIC_IFHAS", CRITIC_IFHAS);
    modelAndView.addObject("SUPPORTER_IFHAS", SUPPORTER_IFHAS);
    modelAndView.addObject("GOODQUESTION_IFHAS", GOODQUESTION_IFHAS);
    modelAndView.addObject("GOODANSWER_IFHAS", GOODANSWER_IFHAS);
    modelAndView.addObject("ENTHUSIAST_IFHAS", ENTHUSIAST_IFHAS);
    modelAndView.addObject("FRESHMAN_IFHAS", FRESHMAN_IFHAS);
    modelAndView.addObject("SCHOLAR_IFHAS", SCHOLAR_IFHAS);
    modelAndView.addObject("TEACHER_IFHAS", TEACHER_IFHAS);
    modelAndView.addObject("PROFESSOR_IFHAS", PROFESSOR_IFHAS);
    modelAndView.addObject("GEEK_IFHAS", GEEK_IFHAS);
    // Cookies
    modelAndView.addObject("localeCookieName", LOCALE_COOKIE);
    modelAndView.addObject("csrfCookieName", CSRF_COOKIE);
    // Paths
    modelAndView.addObject("imageslink", IMAGESLINK); // do not add context path prefix!
    modelAndView.addObject("scriptslink", SCRIPTSLINK); // do not add context path prefix!
    modelAndView.addObject("styleslink", STYLESLINK); // do not add context path prefix!
    modelAndView.addObject("peoplelink", CONTEXT_PATH + PEOPLELINK);
    modelAndView.addObject("profilelink", CONTEXT_PATH + PROFILELINK);
    modelAndView.addObject("searchlink", CONTEXT_PATH + SEARCHLINK);
    modelAndView.addObject("signinlink", CONTEXT_PATH + SIGNINLINK);
    modelAndView.addObject("signoutlink", CONTEXT_PATH + SIGNOUTLINK);
    modelAndView.addObject("aboutlink", CONTEXT_PATH + ABOUTLINK);
    modelAndView.addObject("privacylink", CONTEXT_PATH + PRIVACYLINK);
    modelAndView.addObject("termslink", CONTEXT_PATH + TERMSLINK);
    modelAndView.addObject("tagslink", CONTEXT_PATH + TAGSLINK);
    modelAndView.addObject("settingslink", CONTEXT_PATH + SETTINGSLINK);
    modelAndView.addObject("translatelink", CONTEXT_PATH + TRANSLATELINK);
    modelAndView.addObject("reportslink", CONTEXT_PATH + REPORTSLINK);
    modelAndView.addObject("adminlink", CONTEXT_PATH + ADMINLINK);
    modelAndView.addObject("votedownlink", CONTEXT_PATH + VOTEDOWNLINK);
    modelAndView.addObject("voteuplink", CONTEXT_PATH + VOTEUPLINK);
    modelAndView.addObject("questionlink", CONTEXT_PATH + QUESTIONLINK);
    modelAndView.addObject("questionslink", CONTEXT_PATH + QUESTIONSLINK);
    modelAndView.addObject("commentlink", CONTEXT_PATH + COMMENTLINK);
    modelAndView.addObject("postlink", CONTEXT_PATH + POSTLINK);
    modelAndView.addObject("revisionslink", CONTEXT_PATH + REVISIONSLINK);
    modelAndView.addObject("feedbacklink", CONTEXT_PATH + FEEDBACKLINK);
    modelAndView.addObject("languageslink", CONTEXT_PATH + LANGUAGESLINK);
    // Visual customization
    modelAndView.addObject("navbarFixedClass",
            Config.getConfigBoolean("fixed_nav", false) ? "navbar-fixed" : "none");
    modelAndView.addObject("showBranding", Config.getConfigBoolean("show_branding", true));
    modelAndView.addObject("logoUrl", Config.getConfigParam("logo_url", IMAGESLINK + "/logo.svg"));
    modelAndView.addObject("logoWidth", Config.getConfigInt("logo_width", 90));
    modelAndView.addObject("stylesheetUrl", Config.getConfigParam("stylesheet_url", STYLESLINK + "/style.css"));
    // Auth & Badges
    Profile authUser = (Profile) request.getAttribute(AUTH_USER_ATTRIBUTE);
    modelAndView.addObject("infoStripMsg",
            authUser == null ? Config.getConfigParam("welcome_message", "") : "");
    modelAndView.addObject("authenticated", authUser != null);
    modelAndView.addObject("canComment", utils.canComment(authUser, request));
    modelAndView.addObject("isMod", utils.isMod(authUser));
    modelAndView.addObject("isAdmin", utils.isAdmin(authUser));
    modelAndView.addObject("utils", Utils.getInstance());
    modelAndView.addObject("scooldUtils", utils);
    modelAndView.addObject("authUser", authUser);
    modelAndView.addObject("badgelist", utils.checkForBadges(authUser, request));
    modelAndView.addObject("request", request);
    // Spaces
    modelAndView.addObject("currentSpace",
            utils.getValidSpaceId(authUser, getCookieValue(request, SPACE_COOKIE)));
    // Language
    Locale currentLocale = utils.getCurrentLocale(utils.getLanguageCode(request), request);
    modelAndView.addObject("currentLocale", currentLocale);
    modelAndView.addObject("lang", utils.getLang(currentLocale));
    modelAndView.addObject("langDirection", utils.isLanguageRTL(currentLocale.getLanguage()) ? "RTL" : "LTR");
    // Pagination
    // check for AJAX pagination requests
    if (utils.isAjaxRequest(request) && (utils.param(request, "page") || utils.param(request, "page1")
            || utils.param(request, "page2"))) {
        modelAndView.setViewName("pagination"); // switch to page fragment view
    }
    // CSP, HSTS, etc, headers. See https://securityheaders.com
    utils.setSecurityHeaders(request, response);

    // default metadata for social meta tags
    if (!modelAndView.getModel().containsKey("title")) {
        modelAndView.addObject("title", Config.APP_NAME);
    }
    if (!modelAndView.getModel().containsKey("description")) {
        modelAndView.addObject("description", Config.getConfigParam("meta_description", ""));
    }
    if (!modelAndView.getModel().containsKey("ogimage")) {
        modelAndView.addObject("ogimage", IMAGESLINK + "/logowhite.png");
    }
}

From source file:org.zht.framework.filter.jcaptcha.JCaptchaFilter.java

public void doFilter(ServletRequest theRequest, ServletResponse theResponse, FilterChain chain)
        throws IOException, ServletException {
    // TODO Auto-generated method stub
    HttpServletRequest request = (HttpServletRequest) theRequest;
    HttpServletResponse response = (HttpServletResponse) theResponse;
    String servletPath = request.getServletPath();

    //?filterProcessesUrl??,??.
    if (StringUtils.startsWith(servletPath, filterProcessesUrl)) {
        boolean validated = validateCaptchaChallenge(request);
        if (validated) {
            chain.doFilter(request, response);
        } else {/*from  ww w. j  a  v  a2  s  . c o  m*/
            redirectFailureUrl(request, response);
        }
    } else {
        genernateCaptchaImage(request, response);
    }
}

From source file:io.treefarm.plugins.haxe.components.HaxeCompiler.java

public void compileHxml(MavenProject project, File hxml, File workingDirectory) throws Exception {
    List<String> args;
    int returnValue;

    // get the list of libs in the hxml        
    String haxelibToInstall;/*from www. j ava  2s.c om*/
    Set<String> haxelibsToInstall = new HashSet<String>();
    BufferedReader reader = new BufferedReader(new FileReader(hxml.getAbsolutePath()));
    String line = null;
    while ((line = reader.readLine()) != null) {
        haxelibToInstall = StringUtils.substringAfter(line, "-lib ");
        if (!StringUtils.startsWith(line, "#") && haxelibToInstall.length() > 0) {
            haxelibsToInstall.add(haxelibToInstall);
        }
    }

    // go through the list and if they are not installed, install them now
    Iterator<String> it = haxelibsToInstall.iterator();
    while (it.hasNext()) {
        haxelibToInstall = it.next();

        args = new ArrayList<String>();
        args.add("path");
        args.add(haxelibToInstall);
        returnValue = haxelib.execute(args);

        if (returnValue > 0) {
            args = new ArrayList<String>();
            args.add("install");
            args.add(haxelibToInstall);
            logger.info("Installing haxelib '" + haxelibToInstall + "'");
            returnValue = haxelib.execute(args, logger);
            if (returnValue > 0) {
                throw new Exception("Haxelib was installing '" + haxelibToInstall
                        + "', but has encountered an error and cannot proceed.");
            }
        }
    }

    // now that the libs are installed, compile the project
    args = new ArrayList<String>();
    args.add(hxml.getAbsolutePath());

    logger.info("Building '" + hxml.getName() + "'");
    returnValue = haxe.execute(args, workingDirectory);
    if (returnValue > 0) {
        throw new Exception("Haxe compiler was building '" + hxml.getName()
                + "', but has encountered an error and cannot proceed.");
    }
}

From source file:com.erudika.para.core.Tag.java

@Override
public final void setId(String id) {
    if (StringUtils.startsWith(id, prefix)) {
        setTag(id.replaceAll(prefix, ""));
        this.id = prefix.concat(getTag());
    } else if (id != null) {
        setTag(id);//  w w w .ja va  2  s.  c om
        this.id = prefix.concat(getTag());
    }
}

From source file:net.cloudkit.enterprises.infrastructure.commons.ExecuteTimeInterceptor.java

@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
        ModelAndView modelAndView) {//from ww  w  .j a  v  a  2 s  .  c  o  m
    Long startTime = (Long) request.getAttribute(EXECUTE_TIME_ATTRIBUTE_NAME);
    Object localObject;
    if (startTime == null) {
        localObject = request.getAttribute(START_TIME);
        Long endTime = Long.valueOf(System.currentTimeMillis());
        startTime = Long.valueOf(endTime.longValue() - ((Long) localObject).longValue());
        request.setAttribute(START_TIME, localObject);
    }
    if (modelAndView != null) {
        localObject = modelAndView.getViewName();
        if (!StringUtils.startsWith((String) localObject, redirect)) {
            modelAndView.addObject(EXECUTE_TIME_ATTRIBUTE_NAME, startTime);
        }
    }
    if (logger.isDebugEnabled()) {
        logger.debug("[" + handler + "] executeTime: " + startTime + "ms");
    }
}

From source file:com.erudika.para.storage.AWSFileStore.java

@Override
public String store(String path, InputStream data) {
    if (StringUtils.startsWith(path, "/")) {
        path = path.substring(1);//from www.jav a  2 s .c o m
    }
    if (StringUtils.isBlank(path) || data == null) {
        return null;
    }
    int maxFileSizeMBytes = Config.getConfigInt("para.s3.max_filesize_mb", 10);
    try {
        if (data.available() > 0 && data.available() <= (maxFileSizeMBytes * 1024 * 1024)) {
            ObjectMetadata om = new ObjectMetadata();
            om.setCacheControl("max-age=15552000, must-revalidate"); // 180 days
            if (path.endsWith(".gz")) {
                om.setContentEncoding("gzip");
                path = path.substring(0, path.length() - 3);
            }
            path = System.currentTimeMillis() + "." + path;
            PutObjectRequest por = new PutObjectRequest(bucket, path, data, om);
            por.setCannedAcl(CannedAccessControlList.PublicRead);
            por.setStorageClass(StorageClass.ReducedRedundancy);
            s3.putObject(por);
            return Utils.formatMessage(baseUrl, Config.AWS_REGION, bucket, path);
        }
    } catch (IOException e) {
        logger.error(null, e);
    } finally {
        try {
            data.close();
        } catch (IOException ex) {
            logger.error(null, ex);
        }
    }
    return null;
}

From source file:com.glaf.jbpm.web.springmvc.MxJbpmProcessTreeController.java

@RequestMapping("/json")
public ModelAndView json(HttpServletRequest request) {
    RequestUtils.setRequestParameterToAttribute(request);
    String node = request.getParameter("node");
    String process_name = null;/*w ww . j a  v  a2  s  .  c  o m*/
    String processDefinitionId = null;
    if (StringUtils.isNotEmpty(node)) {
        if (StringUtils.startsWith(node, "x_pdid:")) {
            processDefinitionId = StringUtils.replace(node, "x_pdid:", "");
        } else if (StringUtils.startsWith(node, "x_pdname:")) {
            process_name = StringUtils.replace(node, "x_pdname:", "");
        }
    }
    logger.debug("process_name:" + process_name);
    logger.debug("processDefinitionId:" + processDefinitionId);
    List<ProcessDefinition> result = null;
    GraphSession graphSession = null;
    JbpmContext jbpmContext = null;
    try {
        jbpmContext = ProcessContainer.getContainer().createJbpmContext();
        graphSession = jbpmContext.getGraphSession();
        if (StringUtils.isNotEmpty(process_name)) {
            result = graphSession.findAllProcessDefinitionVersions(process_name);
        } else {
            result = graphSession.findAllProcessDefinitions();
        }
        if (StringUtils.isNotEmpty(processDefinitionId) && StringUtils.isNumeric(processDefinitionId)) {
            ProcessDefinition pd = graphSession.getProcessDefinition(Long.parseLong(processDefinitionId));
            if (pd != null) {
                Map<String, Task> tasks = pd.getTaskMgmtDefinition().getTasks();
                if (tasks != null) {
                    List<Task> rows = new java.util.ArrayList<Task>();
                    Iterator<Task> iterator = tasks.values().iterator();
                    while (iterator.hasNext()) {
                        Task task = iterator.next();
                        rows.add(task);
                    }
                    request.setAttribute("tasks", rows);
                    request.setAttribute("processDefinition", pd);
                }
            }
        }
        request.setAttribute("rows", result);
    } catch (Exception ex) {
        logger.debug(ex);
    } finally {
        Context.close(jbpmContext);
    }

    String jx_view = request.getParameter("jx_view");

    if (StringUtils.isNotEmpty(jx_view)) {
        return new ModelAndView(jx_view);
    }

    String x_view = ViewProperties.getString("jbpm_tree.json");
    if (StringUtils.isNotEmpty(x_view)) {
        return new ModelAndView(x_view);
    }

    return new ModelAndView("/jbpm/tree/json");
}

From source file:com.conversantmedia.mapreduce.tool.annotation.handler.TableInputAnnotationHandler.java

protected Scan getScan(TableInput tableInput) {
    Scan scan = new Scan();
    String scanProperty = tableInput.scanProperty();
    if (StringUtils.isNotBlank(scanProperty)) {
        if (!StringUtils.startsWith(scanProperty, "${")) {
            scanProperty = "${" + scanProperty + "}";
        }/*  w w  w . ja va 2 s.  c  o m*/
        try {
            scan = (Scan) this.evaluateExpression(scanProperty);
        } catch (Exception e) { // ignore and use default
        }
    }
    return scan;
}