Changeset 3060


Ignore:
Timestamp:
02/16/2009 10:24:19 PM (6 years ago)
Author:
mosipov
Message:

Fixed bad code marked by FindBugs

Location:
FCKeditor.Java/trunk/java-core/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/FCKeditor.java

    r2868 r3060  
    4444        private FCKeditorConfig config; 
    4545        private String instanceName; 
    46         private String value = new String(); 
     46        private String value = ""; 
    4747        private HttpServletRequest request; 
    4848 
  • FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/connector/impl/AbstractLocalFileSystemConnector.java

    r2868 r3060  
    6161public abstract class AbstractLocalFileSystemConnector implements Connector { 
    6262 
    63         protected static ServletContext servletContext; 
     63        protected ServletContext servletContext; 
    6464 
    6565        /* (non-Javadoc) 
  • FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/connector/impl/ContextConnector.java

    r2868 r3060  
    6161         */ 
    6262        public void init(final ServletContext servletContext) throws Exception { 
    63                 AbstractLocalFileSystemConnector.servletContext = servletContext; 
     63                this.servletContext = servletContext; 
    6464                String defaultAbsolutePath = getRealUserFilesAbsolutePath(PropertiesLoader 
    6565                                .getUserFilesPath()); 
  • FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/connector/impl/LocalConnector.java

    r2868 r3060  
    5353         */ 
    5454        public void init(final ServletContext servletContext) throws Exception { 
    55                 AbstractLocalFileSystemConnector.servletContext = servletContext; 
     55                this.servletContext = servletContext; 
    5656        } 
    5757 
  • FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/handlers/ConnectorHandler.java

    r2868 r3060  
    5050                                connector = (Connector) clazz.newInstance(); 
    5151                                logger.info("Connector initialized to {}", className); 
    52                         } catch (Exception e) { 
     52                        } catch (Throwable e) { 
    5353                                logger.error("Connector implementation {} could not be instantiated", className); 
    5454                                // TODO should be throw a RuntimeException here 
  • FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/handlers/LocalizedMessages.java

    r3031 r3060  
    126126                                        localeResolver = (LocaleResolver) clazz.newInstance(); 
    127127                                        logger.info("LocaleResolver initialized to {}", className); //$NON-NLS-1$ 
    128                                 } catch (Exception e) { 
     128                                } catch (Throwable e) { 
    129129                                        logger.error("LocaleResolver implementation {} could not be instantiated", className); //$NON-NLS-1$ 
    130130                                        // TODO should be throw a RuntimeException here 
  • FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/handlers/RequestCycleHandler.java

    r2870 r3060  
    5555                                userAction = (UserAction) clazz.newInstance(); 
    5656                                logger.info("UserAction initialized to {}", className); 
    57                         } catch (Exception e) { 
     57                        } catch (Throwable e) { 
    5858                                logger.error("UserAction implementation {} could not be instantiated", className); 
    5959                                // TODO should be throw a RuntimeException here 
     
    7070                                userPathBuilder = (UserPathBuilder) clazz.newInstance(); 
    7171                                logger.info("UserPathBuilder initialized to {}", className); 
    72                         } catch (Exception e) { 
     72                        } catch (Throwable e) { 
    7373                                logger.error("UserPathBuilder implementation {} could not be instantiated", className); 
    7474                                // TODO should be throw a RuntimeException here 
  • FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/tool/Compatibility.java

    r2868 r3060  
    4747                // IE 5.5+, check special keys like 'Opera' and 'mac', because there are some 
    4848                // other browsers, containing 'MSIE' in there agent string! 
    49                 if (userAgentStr.indexOf("opera") < 0 && userAgentStr.indexOf("mac") < 0) { 
    50                         if (getBrowserVersion(userAgentStr, ".*msie ([\\d]+.[\\d]+).*") >= 5.5f) 
    51                                 return true; 
    52                 } 
    53                  
     49                if (userAgentStr.indexOf("opera") < 0 
     50                                && userAgentStr.indexOf("mac") < 0 
     51                                && getBrowserVersion(userAgentStr, ".*msie ([\\d]+.[\\d]+).*") >= 5.5f) 
     52                        return true; 
     53                                 
    5454                // for all gecko based browsers 
    5555                if (getBrowserVersion(userAgentStr, ".*rv:([\\d]+.[\\d]+).*") > 1.7f) 
  • FCKeditor.Java/trunk/java-core/src/test/java/net/fckeditor/response/UploadResponseTest.java

    r2783 r3060  
    3232                UploadResponse actual = new UploadResponse( 
    3333                                UploadResponse.EN_INVALID_FILE_TYPE_ERROR); 
    34                 String expected = new String("<script type=\"text/javascript\">\n" 
     34                String expected = "<script type=\"text/javascript\">\n" 
    3535                                + "(function(){var d=document.domain;while (true){try{var A=window.parent.document.domain;break;}catch(e) {};d=d.replace(/.*?(?:\\.|$)/,'');if (d.length==0) break;try{document.domain=d;}catch (e){break;}}})();\n" 
    36                                 + "window.parent.OnUploadCompleted(202);\n</script>"); 
     36                                + "window.parent.OnUploadCompleted(202);\n</script>"; 
    3737                assertEquals(expected, actual.toString()); 
    3838        } 
     
    4141        public void fourArguments() throws Exception { 
    4242                UploadResponse actual = new UploadResponse(UploadResponse.EN_OK,"/fckeditor-java/userfiles/image/fredck.jpg"); 
    43                 String expected = new String("<script type=\"text/javascript\">\n" 
     43                String expected = "<script type=\"text/javascript\">\n" 
    4444                                + "(function(){var d=document.domain;while (true){try{var A=window.parent.document.domain;break;}catch(e) {};d=d.replace(/.*?(?:\\.|$)/,'');if (d.length==0) break;try{document.domain=d;}catch (e){break;}}})();\n" 
    45                                 + "window.parent.OnUploadCompleted(0,'/fckeditor-java/userfiles/image/fredck.jpg');\n</script>"); 
     45                                + "window.parent.OnUploadCompleted(0,'/fckeditor-java/userfiles/image/fredck.jpg');\n</script>"; 
    4646                assertEquals(expected, actual.toString()); 
    4747        } 
     
    5050        public void renamedFile() throws Exception { 
    5151                UploadResponse actual = new UploadResponse(UploadResponse.EN_FILE_RENAMED_WARNING,"/fckeditor-java/userfiles/image/hacked_php.txt","hacked_php.txt"); 
    52                 String expected = new String("<script type=\"text/javascript\">\n" 
     52                String expected = "<script type=\"text/javascript\">\n" 
    5353                                + "(function(){var d=document.domain;while (true){try{var A=window.parent.document.domain;break;}catch(e) {};d=d.replace(/.*?(?:\\.|$)/,'');if (d.length==0) break;try{document.domain=d;}catch (e){break;}}})();\n" 
    54                                 + "window.parent.OnUploadCompleted(201,'/fckeditor-java/userfiles/image/hacked_php.txt','hacked_php.txt');\n</script>"); 
     54                                + "window.parent.OnUploadCompleted(201,'/fckeditor-java/userfiles/image/hacked_php.txt','hacked_php.txt');\n</script>"; 
    5555                assertEquals(expected, actual.toString()); 
    5656        } 
     
    6060                UploadResponse actual = new UploadResponse(UploadResponse.EN_CUSTOM_ERROR); 
    6161                actual.setCustomMessage("some error"); 
    62                 String expected = new String("<script type=\"text/javascript\">\n" 
     62                String expected = "<script type=\"text/javascript\">\n" 
    6363                                + "(function(){var d=document.domain;while (true){try{var A=window.parent.document.domain;break;}catch(e) {};d=d.replace(/.*?(?:\\.|$)/,'');if (d.length==0) break;try{document.domain=d;}catch (e){break;}}})();\n" 
    64                                 + "window.parent.OnUploadCompleted(1,'','','some error');\n</script>"); 
     64                                + "window.parent.OnUploadCompleted(1,'','','some error');\n</script>"; 
    6565                assertEquals(expected, actual.toString()); 
    6666        } 
     
    7070        public void nullArguments() throws Exception { 
    7171                UploadResponse actual = new UploadResponse(UploadResponse.EN_CUSTOM_ERROR,null,null,null); 
    72                 String expected = new String("<script type=\"text/javascript\">\n" 
     72                String expected = "<script type=\"text/javascript\">\n" 
    7373                                + "(function(){var d=document.domain;while (true){try{var A=window.parent.document.domain;break;}catch(e) {};d=d.replace(/.*?(?:\\.|$)/,'');if (d.length==0) break;try{document.domain=d;}catch (e){break;}}})();\n" 
    74                                 + "window.parent.OnUploadCompleted(1,'','','');\n</script>"); 
     74                                + "window.parent.OnUploadCompleted(1,'','','');\n</script>"; 
    7575                assertEquals(expected, actual.toString()); 
    7676        } 
Note: See TracChangeset for help on using the changeset viewer.
© 2003 – 2012 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy