For this, you can use CommonUtils.cleanPath(). But why do this?