Changeset 1639


Ignore:
Timestamp:
02/26/2008 01:33:24 PM (7 years ago)
Author:
mosipov
Message:

CLOSED - #1921: [XmlResponse] add static fields

Location:
FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/connector/ConnectorServlet.java

    r1636 r1639  
    5454 * directory. The allowed commands are:
    5555 * <ul>
    56  * <li>GetFolders: Retrive the list of directory under the current folder
     56 * <li>GetFolders: Retrive the list of directory under the current folder
    5757 * <li>GetFoldersAndFiles: Retrive the list of files and directory under the current folder
    5858 * <li>CreateFolder: Create a new directory under the current folder
     
    123123
    124124                if (!SessionDataHandler.isEnabledForFileBrowsing(request)) {
    125                         xr.setError(1, "The current user isn't authorized for file browsing!");
     125                        xr.setError(XmlResponse.EN_ERROR, XmlResponse.CM_NOT_AUTHORIZED);
    126126                } else if (commandStr.equals("GetFolders")) {
    127127                        xr.setFolders(currentDir);
     
    132132                        String newFolderStr = request.getParameter("NewFolderName");
    133133                        File newFolder = new File(currentDir, newFolderStr);
    134                         int errorNumber = 110;
     134                        int errorNumber = XmlResponse.EN_UKNOWN;
    135135
    136136                        if (newFolder.exists()) {
    137                                 errorNumber = 101;
     137                                errorNumber = XmlResponse.EN_ALREADY_EXISTS;
    138138                        } else {
    139139                                try {
    140                                         errorNumber = (newFolder.mkdir()) ? 0 : 102;
    141                                 } catch (SecurityException sex) {
    142                                         errorNumber = 103;
     140                                        errorNumber = (newFolder.mkdir()) ? XmlResponse.EN_OK : XmlResponse.EN_INVALID;
     141                                } catch (SecurityException e) {
     142                                        errorNumber = XmlResponse.EN_SECURITY_ERROR;
    143143                                }
    144144                        }
  • FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/response/XmlResponse.java

    r1585 r1639  
    4949        private Element foldersElement;
    5050        private Element filesElement;
     51       
     52        /** Error number OK */
     53        public static final int EN_OK = 0;
     54       
     55        /** Error number ERROR */
     56        public static final int EN_ERROR = 1;
     57
     58        /** Error number ALREADY EXISTS */
     59        public static final int EN_ALREADY_EXISTS = 101;
     60
     61        /** Error number INVALID */
     62        public static final int EN_INVALID = 102;
     63
     64        /** Error number SECURITY ERROR */
     65        public static final int EN_SECURITY_ERROR = 103;
     66
     67        /** Error number UNKNOWN ERROR */
     68        public static final int EN_UKNOWN = 110;
     69
     70        /** Error message NOT AUTHORIZED FOR BROWSING */
     71        public static final String CM_NOT_AUTHORIZED = "The current user isn't authorized for file browsing!";
    5172
    5273        /**
Note: See TracChangeset for help on using the changeset viewer.
© 2003 – 2012 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy