Richfaces, error if term has '/'

41 views Asked by At

I'm facing some kind of error related to richfaces / eclipse or something else... I'm using a predicate to make a conjunction for a search, all fields work great, in exception of one that has "/" on the text field, I'll put an example..

1- The search term is '1234' result ok... 2- The search term is '5678' result ok... (Only if I split term...) 3- The search term is '1234/5678'... page kinda blinks, no error nor result

If I try to debug, debugger stops for case 1 and 2, but won't stop in case 3..

Im using this code...

public Collection<FormTram> findForms(DataCons form) {
    final CriteriaBuilder cb = em.getCriteriaBuilder();
    final CriteriaQuery<FormTram> criteriaQuery = cb.createQuery(FormTram.class);
    final Root<FormTram> criteria = criteriaQuery.from(FormTram.class);
    Predicate conjunction = cb.conjunction();

    if (form.getIdOrder() != "") {
        String[] tokens = form.getIdOrder().split("/");
        for (String t : tokens){
            conjunction.getExpressions().add(cb.like(criteria.get("order").get("plOrder").get("idOrder").as(String.class), "%"+ t +"%"));
        }

    criteriaQuery.orderBy(cb.asc(criteria.get("idForm")));
    return em.createQuery(criteriaQuery).getResultList();
}

Edited to give more code, but I don't think it will make a difference.. This is not real code, just renamed some variables to give context. Will appreciate any help!

0

There are 0 answers