Ignore:
Timestamp:
Mar 27, 2011, 1:03:05 PM (13 years ago)
Author:
mlg
Message:

Adds a better Exception management
new Exception : FileAlreadyExistsException.

File:
1 edited

Legend:

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

    r9879 r9893  
    33import java.io.File;
    44import java.io.IOException;
     5import java.security.NoSuchAlgorithmException;
    56import java.util.ArrayList;
    67import java.util.HashMap;
     
    1314import fr.mael.jiwigo.om.Image;
    1415import fr.mael.jiwigo.transverse.enumeration.MethodsEnum;
     16import fr.mael.jiwigo.transverse.exception.FileAlreadyExistsException;
    1517import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
    1618import fr.mael.jiwigo.transverse.exception.WrongChunkSizeException;
     
    133135     * @param image the image to create
    134136     * @return true if the creation of the image was the successful
     137     * @throws IOException
     138     * @throws NoSuchAlgorithmException
     139     * @throws WrongChunkSizeException
    135140     * @throws Exception
    136141     */
    137142    //TODO ne pas continuer si une des reponses precedentes est negative
    138     public boolean create(Image image, Double chunkSize) throws Exception {
     143    public boolean create(Image image, Double chunkSize) throws FileAlreadyExistsException, IOException,
     144            ProxyAuthenticationException, NoSuchAlgorithmException, WrongChunkSizeException {
    139145        //thumbnail converted to base64
    140146        BASE64Encoder base64 = new BASE64Encoder();
     
    201207        Document doc = sessionManager.executeReturnDocument(MethodsEnum.SET_INFO.getLabel(), "image_id", String
    202208                .valueOf(imageId), "tag_ids", tagId);
    203         return Tools.checkOk(doc);
     209        try {
     210            return Tools.checkOk(doc);
     211        } catch (FileAlreadyExistsException e) {
     212            LOG.error(Tools.getStackTrace(e));
     213            return false;
     214        }
    204215
    205216    }
Note: See TracChangeset for help on using the changeset viewer.