#2357: PropertiesLoader Exception when undeploying a webapp using FCKeditor.Java
Integration
----------------------------+-----------------------------------------------
  Reporter:  SinuS          |       Owner:  mosipov             
      Type:  Bug            |      Status:  assigned            
  Priority:  Normal         |   Milestone:  FCKeditor.Java 2.4.1
 Component:  Server : Java  |     Version:  FCKeditor.Java 2.4  
Resolution:                 |    Keywords:  Confirmed           
----------------------------+-----------------------------------------------

Old description:

> Hello[[BR]]
> I think PropertiesLoader must be changed to something like this:[[BR]]
> [[BR]]
>

> {{{
> package net.fckeditor.handlers;
> import java.io.BufferedInputStream;
> import java.io.IOException;
> import java.io.InputStream;
> import java.util.Properties;
> import org.slf4j.Logger;
> import org.slf4j.LoggerFactory;
>
> public class PropertiesLoader {
>         private static final Logger logger =
> LoggerFactory.getLogger(PropertiesLoader.class);
>         private static Properties properties = new Properties();
>         static {
>                 try {
>                         InputStream in
> =PropertiesLoader.class.getResourceAsStream("default.properties");
>                         if(null == in) {
>                                 logger.warn("Can't find default
> properties!");
>                         } else {
>                                 properties.load(new
> BufferedInputStream(in));
>                                 logger.info("Default's properties loaded
> successfully!");
>                                 in.close();
>                         }
>                 } catch (IOException e) {
>                         logger.error("Error while loading default
> properties!", e);
>                         throw new RuntimeException("Can't load default
> properties!", e);
>                 } catch (NullPointerException e) {
>                         logger.error("Error while loading default
> properties!", e);
>                         throw new RuntimeException("Can't load default
> properties!", e);
>                 }
>                 try {
>                         InputStream in =
> PropertiesLoader.class.getResourceAsStream("/fckeditor.properties");
>                         if (null == in) {
>                                 logger.warn("Can't find user
> properties!");
>                         } else {
>                                 properties.load(new
> BufferedInputStream(in));
>                                 logger.info("User's properties loaded
> successfully!");
>                                 in.close();
>                         }
>                 } catch (IOException e) {
>                         logger.error("Error while loading user
> properties!", e);
>                         throw new RuntimeException("Can't load user
> properties!", e);
>                 } catch (NullPointerException e) {
>                         logger.error("Error while loading user
> properties!"+ e);
>                         throw new RuntimeException("Can't load user
> properties!", e);
>                 }
>         }
>         public static String getProperty(final String key) {
>                 return properties.getProperty(key);
>         }
>
>         public static void setProperty(final String key, final String
> value) {
>                 properties.setProperty(key, value);
>         }
> }
>

> }}}
>
> [[BR]] [[BR]]
>
> I just added '''in.close()''' because
> ''PropertiesLoader.class.getResourceAsStream'' throws an exception when i
> undeploy my webapps on glassfish ;)

New description:

 Hello[[BR]]
 I think PropertiesLoader must be changed to something like this:[[BR]]
 [[BR]]


 {{{
 package net.fckeditor.handlers;
 import java.io.BufferedInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.Properties;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

 public class PropertiesLoader {
         private static final Logger logger =
 LoggerFactory.getLogger(PropertiesLoader.class);
         private static Properties properties = new Properties();
         static {
                 try {
                         InputStream in
 =PropertiesLoader.class.getResourceAsStream("default.properties");
                         if(null == in) {
                                 logger.warn("Can't find default
 properties!");
                         } else {
                                 properties.load(new
 BufferedInputStream(in));
                                 logger.info("Default's properties loaded
 successfully!");
                                 in.close();
                         }
                 } catch (IOException e) {
                         logger.error("Error while loading default
 properties!", e);
                         throw new RuntimeException("Can't load default
 properties!", e);
                 } catch (NullPointerException e) {
                         logger.error("Error while loading default
 properties!", e);
                         throw new RuntimeException("Can't load default
 properties!", e);
                 }
                 try {
                         InputStream in =
 PropertiesLoader.class.getResourceAsStream("/fckeditor.properties");
                         if (null == in) {
                                 logger.warn("Can't find user
 properties!");
                         } else {
                                 properties.load(new
 BufferedInputStream(in));
                                 logger.info("User's properties loaded
 successfully!");
                                 in.close();
                         }
                 } catch (IOException e) {
                         logger.error("Error while loading user
 properties!", e);
                         throw new RuntimeException("Can't load user
 properties!", e);
                 } catch (NullPointerException e) {
                         logger.error("Error while loading user
 properties!"+ e);
                         throw new RuntimeException("Can't load user
 properties!", e);
                 }
         }
         public static String getProperty(final String key) {
                 return properties.getProperty(key);
         }

         public static void setProperty(final String key, final String
 value) {
                 properties.setProperty(key, value);
         }
 }


 }}}

 [[BR]] [[BR]]

 I just added '''in.close()''' because
 ''PropertiesLoader.class.getResourceAsStream'' throws an exception when i
 undeploy my webapps on glassfish ;)

--

Comment(by mosipov):

 Branch 2.4.x merged with trunk in [2534]

-- 
Ticket URL: <http://dev.fckeditor.net/ticket/2357#comment:>
FCKeditor <http://www.fckeditor.net/>
The text editor for Internet
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
FCKeditor-Trac mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fckeditor-trac

Reply via email to