Win a copy of Microservices Testing (Live Project) this week in the Spring forum!

Stephanie Smith

+ Follow
since Jun 28, 2001
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Stephanie Smith

I have a String that is delimited by commas

Value1, value2 , value3

However i want to be able to allow a value that has a comma. So it would have to be escaped.....perahps

value1, value2, value3, value4\,HasAComma

Is there a way to use String.split() to parse this such that the returned values


Thanks for any advice. wasn't sure if this could be accomplished via a regular expression or not.
11 years ago
I want to generate unique names.
The VMID object is unique within a jvm.
I create the VMID, and then pass the bytes into CRC32 and convert to hex string.

Should this generated hex string be unique within like 100,000 iterations of creating a name? how likely are duplicates?
I have tested it with over 700K iterations (of creating VMID, passing into CRC32 and converting to hex string) with no duplicates but wanted to know if duplicates were possible.

Thanks for any advice.
14 years ago
What is the best way to compare two binary files in java?
SHould I just read in the files using streams and compare each byte?

Or should I use checksums? Is one better than the other?
15 years ago
In the JMX example, it starts a Server application.
Basically it initiates the MBeanServer, creates the ConnectorServer
and then starts the connector and that is it as far as the code goes.

Why does the server application not exit but continue to run? Is that because the RMI connector server is listening for incoming connections?
Is another thread created to do this?

// Create an RMI connector server
System.out.println("\nCreate an RMI connector server");
JMXServiceURL url = new JMXServiceURL(
JMXConnectorServer cs =
JMXConnectorServerFactory.newJMXConnectorServer(url, env, mbs);

// Start the RMI connector server
System.out.println("\nStart the RMI connector server");
System.out.println("\nRMI connector server successfully started");
System.out.println("\nWaiting for incoming connections...");
16 years ago
I am using a JMX RMI connector.

When I try to connect, I am getting a AccessControlException
access: access denied ( connect,resolve)

I am using a SecurityManager and I have a policy file. I am only granting permissions to those needed.

The only way I can get this to work is to grant everyone this

grant {
permission "*:1024-65535", "connect,accept,resolve";


My QUestion is this:
If I try to grant this to a specific codebase or principal, i always get the exception. Is it required that this SocketPermission be granted to everyone?

As an fyi, here is the traceback to give you some context,

access: access denied ( connect,resolve)
java.lang.Exception: Stack trace
at java.lang.Thread.dumpStack(
at java.lang.SecurityManager.checkPermission(
at java.lang.SecurityManager.checkConnect(
at sun.rmi.transport.tcp.TCPChannel.checkConnectPermission(
at sun.rmi.transport.tcp.TCPChannel.newConnection(
at sun.rmi.server.UnicastRef.invoke(
at com.sun.jmx.remote.internal.PRef.invoke(Unknown Source)
at Source)
at StandAloneMBeanServer2.doesItExist(
at StandAloneMBeanServer2.main(

ccess: domain that failed ProtectionDomain (null <no certificates>
<no principals> (
( localhost:1024- listen,resolve)
(java.util.PropertyPermission java.version read)
(java.util.PropertyPermission read)
(java.util.PropertyPermission java.vm.vendor read)
(java.util.PropertyPermission read)
(java.util.PropertyPermission java.vendor.url read)
(java.util.PropertyPermission java.vm.specification.vendor read)
(java.util.PropertyPermission java.specification.vendor read)
(java.util.PropertyPermission os.version read)
(java.util.PropertyPermission read)
(java.util.PropertyPermission java.class.version read)
(java.util.PropertyPermission file.separator read)
(java.util.PropertyPermission java.vm.version read)
(java.util.PropertyPermission os.arch read)
(java.util.PropertyPermission read)
(java.util.PropertyPermission java.vm.specification.version read)
(java.util.PropertyPermission java.specification.version read)
(java.util.PropertyPermission java.vendor read)
(java.util.PropertyPermission path.separator read)
(java.util.PropertyPermission line.separator read)
( C:/j2sdk1.4.2_05/Jre/lib/ext/x86/QProfJ.dll read)
(java.lang.RuntimePermission loadLibrary.QProfJ)
(java.lang.RuntimePermission stopThread)
16 years ago
I would like to have one xsl stylesheet that can be used
to create text, html or xml output. Is there a way to
conditionally set the <xsl utput method=""> method attribute
based on an input parameter?

Or will I just need to create three different xsl stylesheets and use the appropriate one, depending on what the desired output method is?
I create a URL with this constructor and it works fine:
URL u = new URL("ftp", "localhost", 21, "\\channels");
I then invoke u.toString() and it prints out
So this makes it appear that using the "\" is valid and the URL is valid.
If I then try to create a second URL with this string:
URL u2 = new URL(u.toString());
it fails with For input string: "21\channels"

So my question is, why does this second one fail and the first one succeed? thanks
If I use File.createTempFile(), does it
make sure that the file does not already
exist before it creates the file?
Or do I need to provide some uniqueness
with the suffix/prefix info I provide?
19 years ago
I have a text file object where the constructor
takes an input stream. The interface has a
getReader() call that returns the reader
for this text file object.
In my implementation, if I just return a reader
using this input stream like:
return new InputStreamReader(inputStream);
Then its a one time use implementation. The first
call returns the reader. Its read until end of stream. The calling application closes the reader
and so it can't call getReader() a second time.
Any ideas on how the implementation can make
this stream re-usable? So it can be used more
than one time?
19 years ago
I am trying to delete a file using the FTP protocol. I was looking at the URL class but there doesn't appear to be a way to do I have to write an ftp client in order to perform this deletion using ftp?
thanks steph
The http protocol supports a delete command but I do not see this supported by the URL class.
Any suggestions on how I can delete a file using the HTTP protocol from within java?
thanks steph
User error. THis works as expected by just calling setAttributeNS() multiple times.
I would like to define multiple namespaces
in my root element (using DOM).
I tried this, but when I excecute this
code, only the first declaration exists
in the serialized xml document:
root.setAttributeNS("", "xmlns:a", "");
root.setAttributeNS("", "xmlns:b", "");
How can this be done? thanks
UTF-8 is the default, but in this
case I'm using a StringWriter as well.
So when I get the String representation its
in just wondering
if there was a conversion
there between utf-8 and unicode.
Thanks for your help! -steph
I have seen this documented as a way to convert
the XML document to a String:
StringWriter sw = new StringWriter();
XMLSerializer ser = new XMLSerializer(sw, new OutputFormat());
String s= sw.getBuffer().toString();

Does this actually convert the XML (in UTF-8)
to Unicode?