Properties.list(System.err) not listing strings?

J

John B. Matthews

Albretch Mueller said:
Hi,
~
I just have a short one liner with the sha sum of a file, but
Properties.list(System.err) is not actually listing it. On the API:
~
http://java.sun.com/javase/6/docs/api/java/util/Properties.html
~
it just says:
~
"Prints this property list out to the specified output stream.
This method is useful for debugging."

I was mildly surprised to see list() elide long lines with "...",
for exampleSystem.getProperties(), excerpted:

sun.arch.data.model=32
java.home=/System/Library/Frameworks/JavaVM.fra...
java.specification.vendor=Sun Microsystems Inc.

In any case, store(System.out, null) shows the full property.
Any chance your file has non-native line endings?

[...]
 
A

Albretch Mueller

John said:
Any chance your file has non-native line endings?
~
Well, no. It is not about any file. Actually the value I set is just
a 64 byte long string with the base 16 SHA-256 signature of a file
~
It beats me why sun doesn't just list what is in the prop file as
they specify.
~
java.util.Properties().getProperty("aPropName")
~
does give you what you ask for but I think that "list" unconcistency
is some bug or oversight on sun's side. They should fix that
~
lbrtchx
 
J

John B. Matthews

[...]
It beats me why sun doesn't just list what is in the prop file as
they specify.
~
java.util.Properties().getProperty("aPropName")
~
does give you what you ask for but I think that "list" unconcistency
is some bug or oversight on sun's side. They should fix that

I can see the virtue of a utility method that truncates long lines for
readability or economy. If it's a feature, they might document it a
little better.
 
R

Roedy Green

Well, no. It is not about any file. Actually the value I set is just
a 64 byte long string with the base 16 SHA-256 signature of a file
~
It beats me why sun doesn't just list what is in the prop file as
they specify.
~

http://mindprod.com/jgloss/properties.html

A Properties object is like an enhanced HashSet/Hashtable. It is just
a list of keys and values held totally in RAM. You can save/restore
the list to a text file.

System.getProperties() gets you a special Properties object that
contains various configuration information.

If you only have one value, it does not make any sense to be using a
Properties (plural) object.
 
R

Roedy Green

~
"Prints this property list out to the specified output stream. This
method is useful for debugging."
~

you probably want to be using store/load not list. List is a
debugging tool.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top