portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pau...@apache.org
Subject cvs commit: jakarta-jetspeed/docs/site changes.html
Date Sun, 15 Sep 2002 14:26:19 GMT
paulsp      2002/09/15 07:26:19

  Modified:    xdocs    changes.xml
               src/java/org/apache/jetspeed/services/registry
                        CastorRegistryService.java
               docs/site changes.html
  Log:
  .xreg files are now read and written in UTF-8 encoding
  PR: 10484
  Submitted by:	Shinsuke (shinsuke at yahoo.co.jp)
  
  Revision  Changes    Path
  1.76      +5 -2      jakarta-jetspeed/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/xdocs/changes.xml,v
  retrieving revision 1.75
  retrieving revision 1.76
  diff -u -r1.75 -r1.76
  --- changes.xml	15 Sep 2002 00:49:54 -0000	1.75
  +++ changes.xml	15 Sep 2002 14:26:19 -0000	1.76
  @@ -23,7 +23,10 @@
   </li>
   -->
   <li>
  - Update - 2002/09/14 - Updated Commons-Collections to v2.0 (PS)
  +  Fix - Bug # 10484 - 2002/09/15 - .xreg file are now read and written in UTF-8 encoding
(PS) Thanks to Shinsuke.
  +</li>
  +<li>
  +  Update - 2002/09/14 - Updated Commons-Collections to v2.0 (PS)
   </li>
   <li>
     Add - Bug # 11736 - 2002/09/13 - Implemented automatic password expiration feature, disabled
by default (MO)
  
  
  
  1.18      +13 -12    jakarta-jetspeed/src/java/org/apache/jetspeed/services/registry/CastorRegistryService.java
  
  Index: CastorRegistryService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/registry/CastorRegistryService.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- CastorRegistryService.java	4 Jul 2002 00:01:09 -0000	1.17
  +++ CastorRegistryService.java	15 Sep 2002 14:26:19 -0000	1.18
  @@ -72,12 +72,14 @@
   import org.apache.xml.serialize.Serializer;
   import org.apache.xml.serialize.XMLSerializer;
   import org.apache.xml.serialize.OutputFormat;
  +import org.w3c.dom.*;
   
   //java stuff
   import java.util.*;
   import java.io.*;
   import java.net.*;
   import javax.servlet.ServletConfig;
  +import javax.xml.parsers.*;
   
   /**
    * <p>This is an implementation of the <code>RegistryService</code>
  @@ -490,12 +492,15 @@
        */
       public void loadFragment(String file)
       {
  -        FileReader reader = null;
           try
           {
  +            DocumentBuilderFactory dbfactory = DocumentBuilderFactory.newInstance();
  +            DocumentBuilder builder = dbfactory.newDocumentBuilder();
  +
  +            Document d = builder.parse(file);
  +
               Unmarshaller unmarshaller = new Unmarshaller(this.mapping);
  -            reader = new FileReader(file);
  -            RegistryFragment fragment = (RegistryFragment)unmarshaller.unmarshal(reader);
  +            RegistryFragment fragment = (RegistryFragment)unmarshaller.unmarshal((Node)d);
   
               // if we get here, we successfully loaded the new fragment            
               updateFragment(file, fragment);
  @@ -505,10 +510,6 @@
           {
               Log.error( "Could not unmarshal: " + file, t );
           }
  -        finally
  -        {
  -            try { reader.close(); } catch (Exception e) {};
  -        }
           
       }
       
  @@ -522,7 +523,6 @@
       public void createFragment(String name, Reader reader, boolean persistent)
       {
           String file = new File( directory, name+extension ).getAbsolutePath();
  -        FileWriter writer = null;
           try
           {
               Unmarshaller unmarshaller = new Unmarshaller(this.mapping);
  @@ -542,7 +542,6 @@
           finally
           {
               try { reader.close(); } catch (Exception e) {};
  -            try { writer.close(); } catch (Exception e) {};
           }
           
           // refresh all regsitries to take the new entries into account
  @@ -554,14 +553,16 @@
        * @param file the absolute file path storing this fragment
        */
       public void saveFragment(String file) {
  -        FileWriter writer = null;
  +        OutputStreamWriter writer = null;
  +        String encoding = new String("UTF-8");
           RegistryFragment fragment = (RegistryFragment)fragments.get(file);
           
           if (fragment != null)
           {
               try
               {
  -                writer = new FileWriter(file);
  +                writer = new OutputStreamWriter(new FileOutputStream(file),encoding);
  +                format.setEncoding(encoding);
                   Serializer serializer = new XMLSerializer(writer, format);            
   
                   Marshaller marshaller = new Marshaller(serializer.asDocumentHandler());
                   marshaller.setMapping(this.mapping);
  
  
  
  1.58      +4 -1      jakarta-jetspeed/docs/site/changes.html
  
  Index: changes.html
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/docs/site/changes.html,v
  retrieving revision 1.57
  retrieving revision 1.58
  diff -u -r1.57 -r1.58
  --- changes.html	15 Sep 2002 00:49:54 -0000	1.57
  +++ changes.html	15 Sep 2002 14:26:19 -0000	1.58
  @@ -129,7 +129,10 @@
   </li>
   -->
   <li>
  - Update - 2002/09/14 - Updated Commons-Collections to v2.0 (PS)
  +  Fix - Bug # 10484 - 2002/09/15 - .xreg file are now read and written in UTF-8 encoding
(PS) Thanks to Shinsuke.
  +</li>
  +<li>
  +  Update - 2002/09/14 - Updated Commons-Collections to v2.0 (PS)
   </li>
   <li>
     Add - Bug # 11736 - 2002/09/13 - Implemented automatic password expiration feature, disabled
by default (MO)
  
  
  

--
To unsubscribe, e-mail:   <mailto:jetspeed-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:jetspeed-dev-help@jakarta.apache.org>


Mime
View raw message