Return-Path: Delivered-To: apmail-db-ojb-dev-archive@www.apache.org Received: (qmail 25641 invoked from network); 4 Mar 2005 13:32:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 4 Mar 2005 13:32:29 -0000 Received: (qmail 76968 invoked by uid 500); 4 Mar 2005 13:32:29 -0000 Delivered-To: apmail-db-ojb-dev-archive@db.apache.org Received: (qmail 76926 invoked by uid 500); 4 Mar 2005 13:32:28 -0000 Mailing-List: contact ojb-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "OJB Developers List" Reply-To: "OJB Developers List" Delivered-To: mailing list ojb-dev@db.apache.org Received: (qmail 76912 invoked by uid 99); 4 Mar 2005 13:32:28 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (hermes.apache.org: local policy) Received: from pointer.webappcabaret.net (HELO pointer.webappcabaret.net) (209.11.152.125) by apache.org (qpsmtpd/0.28) with ESMTP; Fri, 04 Mar 2005 05:32:27 -0800 Received: (qmail 19154 invoked by uid 98); 4 Mar 2005 05:32:23 -0800 Received: from unknown (HELO ?192.168.1.100?) (brianm@chariotsolutions.com@127.0.0.1) by localhost with SMTP; 4 Mar 2005 05:32:23 -0800 Mime-Version: 1.0 (Apple Message framework v619.2) In-Reply-To: <4228282C.4040201@surfeu.fi> References: <4228282C.4040201@surfeu.fi> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <4d4c6f77de262a1ca93d1e3ed690e12a@apache.org> Content-Transfer-Encoding: 7bit From: Brian McCallister Subject: Re: Repository descriptors may lock web app jars Date: Fri, 4 Mar 2005 08:32:22 -0500 To: "OJB Developers List" X-Mailer: Apple Mail (2.619.2) X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Checked in to OJB_1_0_RELEASE and HEAD, thank you! Should be in 1.0.2 any day now (when I get tests passing on postgres ;-) -Brian On Mar 4, 2005, at 4:19 AM, Ilkka Priha wrote: > Hello, > > The locked jar problem with OJB.properties can also be caused by > repository descriptors embedded in jar archives. The problem is caused > by RepositoryPersistor passing a URL path to InputSource without > disabling caching in the corresponding URL connection. The patch is > attached below. > > -- Ilkka > > PS. The public DTD address > "http://db.apache.org/ojb/dtds/1.0/repository.dtd" mentioned in > repository.xml comments doesn't seem to work, but > "http://db.apache.org/ojb/repository.dtd" is currently accessible. > > > Index: RepositoryPersistor.java > =================================================================== > RCS file: > /home/cvspublic/db-ojb/src/java/org/apache/ojb/broker/metadata/ > RepositoryPersistor.java,v > retrieving revision 1.24.2.1 > diff -u -r1.24.2.1 RepositoryPersistor.java > --- RepositoryPersistor.java 11 Nov 2004 13:57:42 -0000 1.24.2.1 > +++ RepositoryPersistor.java 4 Mar 2005 09:09:34 -0000 > @@ -27,6 +27,7 @@ > import java.io.PrintWriter; > import java.net.MalformedURLException; > import java.net.URL; > +import java.net.URLConnection; > import java.util.Date; > > import org.apache.commons.lang.SerializationUtils; > @@ -258,13 +259,33 @@ > arminw: > strange, when using 'url.openStream()' argument repository > could not be parsed > + ipriha: > + parser needs a base url to find referenced entities. > */ > // InputSource source = new InputSource(url.openStream()); > > - String pathName = url.toString(); > + String pathName = url.toExternalForm(); > log.info("Building repository from :" + pathName); > InputSource source = new InputSource(pathName); > - return readMetadataFromXML(source, targetRepository); > + URLConnection conn = url.openConnection(); > + conn.setUseCaches(false); > + conn.connect(); > + InputStream in = conn.getInputStream(); > + source.setByteStream(in); > + try > + { > + return readMetadataFromXML(source, targetRepository); > + } > + finally > + { > + try > + { > + in.close(); > + } > + catch (IOException x) > + { > + } > + } > } > > /** > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org > For additional commands, e-mail: ojb-dev-help@db.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org For additional commands, e-mail: ojb-dev-help@db.apache.org