import javax.ejb.EJB;
import javax.enterprise.event.Event;
import javax.enterprise.inject.Any;
+import javax.faces.FacesException;
import javax.faces.view.ViewScoped;
import javax.faces.view.facelets.FaceletException;
import javax.inject.Inject;
// Is product i18n key already used?
if (this.productListController.isProductI18nKeyAdded(this.getProductI18nKey())) {
// Then throw exception
- throw new FaceletException("Product i18n key " + this.getProductI18nKey() + " already added.");
+ throw new FacesException(MessageFormat.format("Product i18n key {0} already added.", this.getProductI18nKey()));
}
// Create current product instance
updatedProduct = this.adminProductBean.addGenericProduct(product);
} catch (final ProductAlreadyAddedException ex) {
// Continue to throw
- throw new FaceletException(ex);
+ throw new FacesException(ex);
}
// Fire event
updatedProduct = this.adminProductBean.updateProductData(newProduct);
} catch (final ProductNotFoundException ex) {
// Throw again
- throw new FaceletException(ex);
+ throw new FacesException(ex);
}
// Fire event
import javax.enterprise.context.RequestScoped;
import javax.enterprise.event.Event;
import javax.enterprise.inject.Any;
+import javax.faces.FacesException;
import javax.faces.view.facelets.FaceletException;
import javax.inject.Inject;
import javax.inject.Named;
// Is i18n key already used?
if (this.categoryListController.isCategoryI18nKeyAdded(this.getCategoryI18nKey())) {
// Throw exception
- throw new FaceletException("Category i18n key " + this.getCategoryI18nKey() + " is already used.");
+ throw new FacesException("Category i18n key " + this.getCategoryI18nKey() + " is already used.");
}
// Create category
updatedCategory = this.categoryBean.addProductCategory(category);
} catch (final CategoryAlreadyAddedException ex) {
// Continue to throw
- throw new FaceletException(ex);
+ throw new FacesException(ex);
}
// Fire event