[ grinder-Bugs-2515621 ] grinder.jvm.classpath should be relaxed about separators

"SourceForge.net" <[email protected]>
Newsgroups gmane.comp.java.grinder.devel
Message-ID <[email protected]>
Bugs item #2515621, was opened at 2009-01-17 12:37
Message generated for change (Settings changed) made by philipa
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=118598&aid=2515621&group_id=18598

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
>Category: Core engine
Group: None
>Status: Pending
>Resolution: Rejected
Priority: 3
Private: No
Submitted By: Philip Aston (philipa)
Assigned to: Philip Aston (philipa)
Summary: grinder.jvm.classpath should be relaxed about separators

Initial Comment:
Chris Clohosy wrote:
> In my grinder properties file I'm setting various jars in the
> grinder.jvm.classpath property. I was wondering if there was a
> generic way of filling in this property so the same property file
> could be used on both Unix and Windows. At the moment to get it to
> run on Windows I'm having to use '\\' directory separators; I
> noticed that when I tried to use '/' it literally carries this
> through to the DOS command line, which Windows does not understand.
>  
> If there isn't a way, would it be possible to add functionality to
> convert '/' and ':' to the OS specific character like Ant does?


----------------------------------------------------------------------

>Comment By: Philip Aston (philipa)
Date: 2010-01-07 13:05

Message:
I've reconsidered this, and decided not to implement it.

Naively doing such things as colons to semi-colons would break other parts
of the path (e.g. windows "C:\" drive specifications), and however careful
I was I would very likely break things for esoteric filesystems such as
(netware.

Instead, I think the simplistic approach of passing the literal text
through is best. You can always override the property for specific agents
on the command line.

----------------------------------------------------------------------

Comment By: Philip Aston (philipa)
Date: 2009-01-17 12:39

Message:
Answer from Scott Pack:

> The problem is that the 'additonalClasspath' variable in
> 'net.grinder.engine.agent.WorkerProcessCommandLine.java' is never
> parsed based upon the OS the agent is running on. I wrote a method
> to fix that:
>
>     protected void makePlatformClasspath() {
>         String os = System.getProperty("os.name");
>
>         String classpath =
properties.getProperty("grinder.jvm.classpath");
>             if (os.equals("Linux") || os.equals("Unix") ||
os.equals("Macintosh")) {
>                 classpath = classpath.replace(';', ':');
>             } else if (os.equals("Windows")) {
>                 classpath = classpath.replace(':', ';');
>             }
>             properties.setProperty("grinder.jvm.classpath", classpath);
>     }
>
> and plugged that in to the class, and processed the
> additionalClasspath using this method.


This is better:

    final String s = System.getProperty("path.separator");
    final String classpath =
properties.getProperty("grinder.jvm.classpath");
    classpath.replace(";", s);
    classpath.replace(":", s)
    properties.setProperty("grinder.jvm.classpath", classpath);

Not sure we need to change "/" to "\" - Java on windows should grok /
successfully.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=118598&aid=2515621&group_id=18598

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.