Return-Path: Delivered-To: apmail-jakarta-ant-dev-archive@jakarta.apache.org Received: (qmail 98928 invoked by uid 500); 12 Mar 2001 23:49:45 -0000 Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk Reply-To: ant-dev@jakarta.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list ant-dev@jakarta.apache.org Delivered-To: moderator for ant-dev@jakarta.apache.org Received: (qmail 20842 invoked from network); 12 Mar 2001 12:57:39 -0000 Message-ID: <3AACC789.1B4AA8FC@io-software.com> Date: Mon, 12 Mar 2001 13:56:42 +0100 From: Peter Holzwarth X-Mailer: Mozilla 4.76 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 To: bugzilla@apache.org CC: ant-dev@jakarta.apache.org Subject: Re: [Bug 904] Changed - Reading System Properties may return Objects References: <200103121148.DAA27783@nagoya-a.betaversion.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N Hi Stefan, we're using ant from within our ArcStyler IDE in-process. Inside our IDE, we're using the system properties to transport context information between classes that run within different class loaders. As an example, we're writing things like ---------------------------------- System.getProperties().put("myKey", new Integer(3)); ---------------------------------- This appears to be completely legal regarding the JDK. The getProperty() method implemented in the JDK simply ignores non-string values: ---------------------------------- public String getProperty(String key) { Object oval = super.get(key); String sval = (oval instanceof String) ? (String)oval : null; return ((sval == null) && (defaults != null)) ? defaults.getProperty(key) : sval; } ---------------------------------- This might be feasible for ant, too. Or, ant may use a toString() on the objects. Both make sense in some situations. However, the current behaviour of ant is that it throws a class cast exception, which shouldn't be. If you decide to interpret the semantics of the Properties class in a strict way, I would suggest writing ---------------------------------- String value = systemP.getProperty(name); ---------------------------------- instead of ---------------------------------- String value = (String) systemP.get(name); ---------------------------------- -- best regards, Peter. Interactive Objects Software GmbH ---- < iO > ---------------------------------------------------------- Interactive Objects Software GmbH (iO) phone (+49)-761-400 73-0 Baslerstr. 63, 79100 Freiburg, Germany fax (+49)-761-400 73-73 mailto:Peter.Holzwarth@io-software.com http://www.io-software.com ______________________________________________________________________ ArcStyler - the IT-Architectural IDE for J2EE/EJB -> free trial-version at http://www.ArcStyler.com -> recent Awards at http://www.ArcStyler.com/news bugzilla@apache.org wrote: > http://nagoya.apache.org/bugzilla/show_bug.cgi?id=904 > > *** shadow/904 Thu Mar 8 09:38:29 2001 > --- shadow/904.tmp.27780 Mon Mar 12 03:48:04 2001 > *************** > *** 5,11 **** > | Status: NEW Version: 1.2 | > | Resolution: Platform: All | > | Severity: Normal OS/Version: All | > ! | Priority: Component: Core | > +----------------------------------------------------------------------------+ > | Assigned To: ant-dev@jakarta.apache.org | > | Reported By: peter.holzwarth@io-software.com | > --- 5,11 ---- > | Status: NEW Version: 1.2 | > | Resolution: Platform: All | > | Severity: Normal OS/Version: All | > ! | Priority: High Component: Core | > +----------------------------------------------------------------------------+ > | Assigned To: ant-dev@jakarta.apache.org | > | Reported By: peter.holzwarth@io-software.com | > *************** > *** 31,34 **** > 207c207 > < String value = (String) systemP.get(name); > --- > ! > String value = systemP.get(name).toString(); > --- 31,41 ---- > 207c207 > < String value = (String) systemP.get(name); > --- > ! > String value = systemP.get(name).toString(); > ! > ! ------- Additional Comments From bodewig@apache.org 2001-03-12 03:48 ------- > ! Peter, could you please explain this a little more? > ! > ! System.getProperties returns a Properties instance, which by definition contains > ! keys and values of type String - nothing else. How would you insert Objects into > ! the system properties? --------------------------------------------------------------------- To unsubscribe, e-mail: ant-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: ant-dev-help@jakarta.apache.org