Changeset 295

Show
Ignore:
Timestamp:
03/20/06 00:38:10
Author:
douglm
Message:

Fix jboss build so it works again.

Fix a couple of synchronization bugs shown up during jboss tests

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/calendar3/appcommon/src/org/bedework/appcommon/DateTimeFormatter.java

    r278 r295  
    8585  private GregorianCalendar cal; 
    8686 
    87   private static HashMap formattersTbl = new HashMap(); 
     87  private static volatile HashMap formattersTbl = new HashMap(); 
    8888 
    8989  /* What we store in the table */ 
     
    224224   * @return String    month name for this object 
    225225   */ 
    226   public synchronized String getMonthName() { 
     226  public String getMonthName() { 
    227227    Formatters fmt = getFormatters(); 
    228228    FieldPosition f = new FieldPosition(DateFormat.MONTH_FIELD); 
    229     StringBuffer s = fmt.longDateFormatter.format(cal.getTime(), new StringBuffer(), f); 
    230     return s.substring(f.getBeginIndex(), f.getEndIndex()); 
     229    synchronized (fmt) { 
     230      StringBuffer s = fmt.longDateFormatter.format(cal.getTime(), new StringBuffer(), f); 
     231      return s.substring(f.getBeginIndex(), f.getEndIndex()); 
     232    } 
    231233  } 
    232234 
     
    410412   *            represented by this object. 
    411413   */ 
    412   public synchronized String getDateString() { 
     414  public String getDateString() { 
    413415    Formatters fmt = getFormatters(); 
    414     return fmt.shortDateFormatter.format(cal.getTime()); 
     416 
     417    synchronized (fmt) { 
     418      return fmt.shortDateFormatter.format(cal.getTime()); 
     419    } 
    415420  } 
    416421 
     
    420425   *            represented by this object. 
    421426   */ 
    422   public synchronized String getLongDateString() { 
     427  public String getLongDateString() { 
    423428    Formatters fmt = getFormatters(); 
    424     return fmt.longDateFormatter.format(cal.getTime()); 
     429 
     430    synchronized (fmt) { 
     431      return fmt.longDateFormatter.format(cal.getTime()); 
     432    } 
    425433  } 
    426434 
     
    431439   *            If there is no time, returns a zero length string. 
    432440   */ 
    433   public synchronized String getTimeString() { 
     441  public String getTimeString() { 
    434442    Formatters fmt = getFormatters(); 
    435     return fmt.shortTimeFormatter.format(cal.getTime()); 
     443 
     444    synchronized (fmt) { 
     445      return fmt.shortTimeFormatter.format(cal.getTime()); 
     446    } 
    436447  } 
    437448 
     
    439450    Locale loc = calInfo.getLocale(); 
    440451     
    441     Formatters fmt = (Formatters)formattersTbl.get(loc); 
    442      
    443     if (fmt == null) { 
    444       fmt = new Formatters(loc); 
    445       formattersTbl.put(loc, fmt); 
    446     } 
    447      
    448     return fmt; 
     452    return getFormatters(loc); 
    449453  } 
    450454 
    451455  private static Formatters getFormatters(Locale loc) { 
    452     Formatters fmt = (Formatters)formattersTbl.get(loc); 
    453      
    454     if (fmt == null) { 
    455       fmt = new Formatters(loc); 
    456       formattersTbl.put(loc, fmt); 
    457     } 
    458      
    459     return fmt; 
     456    synchronized (formattersTbl) { 
     457      Formatters fmt = (Formatters)formattersTbl.get(loc); 
     458       
     459      if (fmt == null) { 
     460        fmt = new Formatters(loc); 
     461        formattersTbl.put(loc, fmt); 
     462      } 
     463     
     464      return fmt; 
     465    } 
    460466  } 
    461467} 
  • trunk/calendar3/calEnv/src/org/bedework/calenv/CalEnv.java

    r293 r295  
    5656      "/properties/calendar/env.properties"; 
    5757 
    58   private static Properties pr; 
     58  private static volatile Properties pr; 
    5959 
    6060  private static volatile Integer lockit = new Integer(0); 
  • trunk/calendar3/deployment/build.xml

    r293 r295  
    119119         inheritrefs="true" target="build.configured" /> 
    120120 
    121     <build.configured.apps kind="webapp" /> 
     121    <property name="org.bedework.deploy.kind" value="webapp" /> 
     122    <antcall target="build.configured.apps" inheritrefs="true" /> 
    122123  </target> 
    123124 
    124125  <target name="build.portal.apps" if="org.bedework.global.portal.platform" > 
    125     <build.configured.apps kind="${org.bedework.global.portal.platform}" /> 
     126    <property name="org.bedework.deploy.kind" 
     127              value="${org.bedework.global.portal.platform}" /> 
     128    <antcall target="build.configured.apps" inheritrefs="true" /> 
    126129  </target> 
    127130 
    128131  <target name="build.j2ee.apps" if="org.bedework.global.j2ee.platform" > 
    129     <build.configured.apps kind="${org.bedework.global.j2ee.platform}" /> 
     132    <property name="org.bedework.deploy.kind" 
     133              value="${org.bedework.global.j2ee.platform}" /> 
     134    <antcall target="build.configured.apps" inheritrefs="true" /> 
    130135  </target> 
    131136 
     
    161166  <target name="deploy.standalone.apps" if="org.bedework.global.build.standalone.app" > 
    162167    <property name="org.bedework.deploy.kind" value="webapp" /> 
    163     <antcall target="deploy.apps.target" inheritrefs="true" /> 
     168    <antcall target="deploy.apps" inheritrefs="true" /> 
    164169  </target> 
    165170 
    166171  <target name="deploy.portal.apps" if="org.bedework.global.portal.platform" > 
    167     <deploy.apps kind="${org.bedework.global.portal.platform}" /> 
     172    <property name="org.bedework.deploy.kind" 
     173              value="${org.bedework.global.portal.platform}" /> 
     174    <antcall target="deploy.apps" inheritrefs="true" /> 
    168175  </target> 
    169176 
    170177  <target name="deploy.j2ee.apps" if="org.bedework.global.j2ee.platform" > 
    171     <deploy.apps kind="${org.bedework.global.j2ee.platform}" /> 
     178    <property name="org.bedework.deploy.kind" 
     179              value="${org.bedework.global.j2ee.platform}" /> 
     180    <antcall target="deploy.apps" inheritrefs="true" /> 
    172181  </target> 
    173182 
     
    196205       this component. 
    197206       ================================================================= --> 
    198   <macrodef name="build.configured.apps"> 
    199       <attribute name="kind" /> 
    200     <sequential> 
    201       <!-- ======================= webadmin ================= --> 
    202       <ant antfile="${org.bedework.deployment.base}/webadmin/@{kind}/build.xml" 
    203            inheritrefs="true" target="build.configured" /> 
    204  
    205       <!-- ======================= pubevents ================= --> 
    206       <ant antfile="${org.bedework.deployment.base}/webpublic/@{kind}/build.xml" 
    207            inheritrefs="true" target="build.configured" /> 
    208  
    209       <!-- ======================= personal ================= --> 
    210       <ant antfile="${org.bedework.deployment.base}/webuser/@{kind}/build.xml" 
    211            inheritrefs="true" target="build.configured" /> 
    212  
    213       <!-- ======================= caldav - public ================= --> 
    214       <ant antfile="${org.bedework.deployment.base}/publiccaldav/@{kind}/build.xml" 
    215            inheritrefs="true" target="build.configured" /> 
    216  
    217       <!-- ======================= caldav - user ================= --> 
    218       <ant antfile="${org.bedework.deployment.base}/usercaldav/@{kind}/build.xml" 
    219            inheritrefs="true" target="build.configured" /> 
    220  
    221       <!-- ======================= termination tasks ================= --> 
    222       <ant antfile="${org.bedework.deployment.base}/termination/@{kind}/build.xml" 
    223            inheritrefs="true" target="build.configured" /> 
    224     </sequential> 
    225   </macrodef> 
    226  
    227   <target name="deploy.apps.target"> 
     207  <target name="build.configured.apps"> 
    228208    <forEachApp names="${org.bedework.install.app.names}" 
    229209                types="${org.bedework.install.app.types}" 
     
    236216 
    237217        <ant antfile="${org.bedework.deployment.base}/${org.bedework.deploy.type}/${org.bedework.deploy.kind}/build.xml" 
     218             inheritrefs="true" target="build.configured" > 
     219          <propertyset refid="app-properties" /> 
     220        </ant> 
     221      </sequential> 
     222    </forEachApp> 
     223 
     224    <!-- ======================= termination tasks ================= --> 
     225    <ant antfile="${org.bedework.deployment.base}/termination/${org.bedework.deploy.kind}/build.xml" 
     226         inheritrefs="true" target="build.configured" /> 
     227  </target> 
     228 
     229  <target name="deploy.apps"> 
     230    <forEachApp names="${org.bedework.install.app.names}" 
     231                types="${org.bedework.install.app.types}" 
     232                prefix="org.bedework.deploy"> 
     233      <sequential> 
     234        <propertyset id="app-properties"> 
     235          <propertyref prefix="org.bedework.app.${org.bedework.deploy.name}"/> 
     236          <globmapper from="org.bedework.app.${org.bedework.deploy.name}.*" to="propval.app.*"/> 
     237        </propertyset> 
     238 
     239        <ant antfile="${org.bedework.deployment.base}/${org.bedework.deploy.type}/${org.bedework.deploy.kind}/build.xml" 
    238240             inheritrefs="true" target="deploy" > 
    239241          <propertyset refid="app-properties" /> 
     
    241243      </sequential> 
    242244    </forEachApp> 
    243   </target> 
    244  
    245   <macrodef name="deploy.apps"> 
    246       <attribute name="kind" /> 
    247     <sequential> 
    248       <forEachApp names="${org.bedework.install.app.names}" 
    249                   types="${org.bedework.install.app.types}" 
    250                   prefix="org.bedework.deploy"> 
    251         <sequential> 
    252           <property name="prefix" value="org.bedework.${org.bedework.deploy.type}" /> 
    253           <propertyset id="app-properties"> 
    254             <propertyref prefix="${prefix}"/> 
    255             <globmapper from="${prefix}*" to="propval*"/> 
    256           </propertyset> 
    257         </sequential> 
    258       </forEachApp> 
    259  
    260       <!-- ======================= webadmin ================= --> 
    261       <ant antfile="${org.bedework.deployment.base}/webadmin/@{kind}/build.xml" 
    262            inheritrefs="true" target="deploy" /> 
    263  
    264       <!-- ======================= pubevents ================= --> 
    265       <ant antfile="${org.bedework.deployment.base}/webpublic/@{kind}/build.xml" 
    266            inheritrefs="true" target="deploy" /> 
    267  
    268       <!-- ======================= personal ================= --> 
    269       <ant antfile="${org.bedework.deployment.base}/webuser/@{kind}/build.xml" 
    270            inheritrefs="true" target="deploy" /> 
    271  
    272       <!-- ======================= caldav - public ================= --> 
    273       <ant antfile="${org.bedework.deployment.base}/publiccaldav/@{kind}/build.xml" 
    274            inheritrefs="true" target="deploy" /> 
    275  
    276       <!-- ======================= caldav - user ================= --> 
    277       <ant antfile="${org.bedework.deployment.base}/usercaldav/@{kind}/build.xml" 
    278            inheritrefs="true" target="deploy" /> 
    279  
    280       <!-- ======================= termination tasks ================= --> 
    281       <ant antfile="${org.bedework.deployment.base}/termination/@{kind}/build.xml" 
    282            inheritrefs="true" target="deploy" /> 
    283     </sequential> 
    284   </macrodef> 
     245 
     246    <!-- ======================= termination tasks ================= --> 
     247    <ant antfile="${org.bedework.deployment.base}/termination/${org.bedework.deploy.kind}/build.xml" 
     248         inheritrefs="true" target="deploy" /> 
     249  </target> 
    285250</project> 
  • trunk/calendar3/deployment/termination/jboss/build.xml

    r293 r295  
    1010 
    1111    <property name="app.ear.file" 
    12               location="${dist.home}/${propval.app.ear.name}.ear" /> 
     12              location="${dist.home}/${org.bedework.global.ear.name}.ear" /> 
    1313    <property name="app.resources.dir" 
    1414              location="${this.dir}/../webapp/resources" /> 
  • trunk/calendar3/icalendar/src/org/bedework/icalendar/IcalTranslator.java

    r270 r295  
    6565import net.fortuna.ical4j.data.CalendarParserImpl; 
    6666import net.fortuna.ical4j.data.ParserException; 
     67import net.fortuna.ical4j.data.UnfoldingReader; 
    6768//import net.fortuna.ical4j.data.UnfoldingReader; 
    6869import net.fortuna.ical4j.model.Calendar; 
     
    273274      CalendarBuilder bldr = new CalendarBuilder(new CalendarParserImpl()); 
    274275 
     276      UnfoldingReader ufrdr = new UnfoldingReader(new StringReader(val), true); 
     277       
    275278      //return fromIcal(cal, bldr.build(new UnfoldingReader(new StringReader(val)))); 
    276       return fromIcal(cal, bldr.build(new StringReader(val), true)); 
     279      return fromIcal(cal, bldr.build(ufrdr)); 
    277280    } catch (ParserException pe) { 
    278281      if (debug) { 
     
    300303 
    301304      //return fromIcal(cal, bldr.build(new UnfoldingReader(rdr))); 
    302       return fromIcal(cal, bldr.build(rdr, true)); 
     305      return fromIcal(cal, bldr.build(new UnfoldingReader(rdr, true))); 
    303306    } catch (ParserException pe) { 
    304307      if (debug) { 
     
    359362      CalendarBuilder bldr = new CalendarBuilder(new CalendarParserImpl()); 
    360363 
    361       return bldr.build(new StringReader(val), true); 
     364      UnfoldingReader ufrdr = new UnfoldingReader(new StringReader(val), true); 
     365       
     366      return bldr.build(ufrdr); 
    362367    } catch (Throwable t) { 
    363368      throw new CalFacadeException(t); 
     
    379384      CalendarBuilder bldr = new CalendarBuilder(new CalendarParserImpl()); 
    380385 
    381       Calendar cal = bldr.build(new StringReader(val), true); 
     386      UnfoldingReader ufrdr = new UnfoldingReader(new StringReader(val), true); 
     387       
     388      Calendar cal = bldr.build(ufrdr); 
    382389      Vector evs = new Vector(); 
    383390