Changeset 5176


Ignore:
Timestamp:
05/12/14 11:11:33 (10 years ago)
Author:
Twan Goosen
Message:

unit test for url from string model

Location:
vlo/trunk/vlo-web-app/src
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • vlo/trunk/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/model/UrlFromStringModel.java

    r4669 r5176  
    1919import java.io.File;
    2020import java.net.MalformedURLException;
     21import java.net.URISyntaxException;
    2122import java.net.URL;
    2223import org.apache.wicket.model.IModel;
    2324
    2425/**
     26 * Model that wraps a model providing a file location and returns a URL for this
     27 * location via {@link #getObject() }
    2528 *
    2629 * @author twagoo
     
    3033    private final IModel<String> model;
    3134
     35    /**
     36     *
     37     * @param model model that provides a file location
     38     */
    3239    public UrlFromStringModel(IModel<String> model) {
    3340        this.model = model;
     
    5259            model.setObject(null);
    5360        } else {
    54             model.setObject(object.toString());
     61            try {
     62                model.setObject(new File(object.toURI()).getAbsolutePath());
     63            } catch (URISyntaxException ex) {
     64                throw new RuntimeException(ex);
     65            }
    5566        }
    5667    }
Note: See TracChangeset for help on using the changeset viewer.