Ignore:
Timestamp:
Apr 20, 2011, 5:17:02 AM (13 years ago)
Author:
anthony43
Message:

huge refactoring to introduce JiwigoException : a generic exception encapsulating low level exceptions (IOException, ProxyAuthentication, etc...)
The aim is to have, on the consumer side, just one exception to catch them all.
this refactoring may need a code review to check the changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/dao/impl/CommentDaoImpl.java

    r9919 r10505  
    1616import fr.mael.jiwigo.transverse.enumeration.MethodsEnum;
    1717import fr.mael.jiwigo.transverse.exception.FileAlreadyExistsException;
     18import fr.mael.jiwigo.transverse.exception.JiwigoException;
    1819import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
    1920import fr.mael.jiwigo.transverse.session.SessionManager;
     
    5253     * @throws ProxyAuthenticationException
    5354     */
    54     public List<Comment> list(Integer idImage) throws IOException, ProxyAuthenticationException {
    55         Document doc = (sessionManager.executeReturnDocument(MethodsEnum.GET_INFO.getLabel(), "image_id", String
    56                 .valueOf(idImage), "comments_per_page", "100"));
     55    public List<Comment> list(Integer idImage) throws JiwigoException {
     56        Document doc = (sessionManager.executeReturnDocument(MethodsEnum.GET_INFO.getLabel(), "image_id",
     57                String.valueOf(idImage), "comments_per_page", "100"));
    5758        Element elementImage = (Element) doc.getDocumentElement().getElementsByTagName("image").item(0);
    5859        Element elementComments = (Element) elementImage.getElementsByTagName("comments").item(0);
     
    8182     * @throws ProxyAuthenticationException
    8283     */
    83     public String getKey(Integer idImage) throws IOException, ProxyAuthenticationException {
    84         Document doc = (sessionManager.executeReturnDocument(MethodsEnum.GET_INFO.getLabel(), "image_id", String
    85                 .valueOf(idImage)));
     84    public String getKey(Integer idImage) throws JiwigoException {
     85        Document doc = (sessionManager.executeReturnDocument(MethodsEnum.GET_INFO.getLabel(), "image_id",
     86                String.valueOf(idImage)));
    8687        //      String key = doc.getRootElement().getChild("image").getChild("comment_post").getAttributeValue("key");
    8788        Element elementImage = (Element) doc.getDocumentElement().getElementsByTagName("image").item(0);
     
    9798     * @throws ProxyAuthenticationException
    9899     */
    99     public boolean create(Comment commentaire) throws IOException, ProxyAuthenticationException {
     100    public boolean create(Comment commentaire) throws JiwigoException {
    100101        String key = getKey(commentaire.getImageId());
    101102        try {
Note: See TracChangeset for help on using the changeset viewer.