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

Discussion in 'Java' started by Albretch Mueller, Dec 26, 2009.

  1. Albretch Mueller, Dec 26, 2009
    #1
    1. Advertising

  2. In article
    <>,
    Albretch Mueller <> wrote:

    > 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?

    [...]

    --
    John B. Matthews
    trashgod at gmail dot com
    <http://sites.google.com/site/drjohnbmatthews>
     
    John B. Matthews, Dec 26, 2009
    #2
    1. Advertising

  3. John B. Matthews wrote:
    > 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
     
    Albretch Mueller, Dec 26, 2009
    #3
  4. In article
    <>,
    Albretch Mueller <> wrote:

    [...]
    > 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.

    --
    John B. Matthews
    trashgod at gmail dot com
    <http://sites.google.com/site/drjohnbmatthews>
     
    John B. Matthews, Dec 26, 2009
    #4
  5. Albretch Mueller

    Roedy Green Guest

    On Sat, 26 Dec 2009 06:25:08 -0800 (PST), Albretch Mueller
    <> wrote, quoted or indirectly quoted someone who
    said :

    > 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.

    --
    Roedy Green Canadian Mind Products
    http://mindprod.com
    If you give someone a program, you will frustrate them for a day; if you teach them how to program, you will frustrate them for a lifetime.
     
    Roedy Green, Dec 28, 2009
    #5
  6. Albretch Mueller

    Roedy Green Guest

    On Fri, 25 Dec 2009 21:10:10 -0800 (PST), Albretch Mueller
    <> wrote, quoted or indirectly quoted someone who
    said :

    >~
    > "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.
    --
    Roedy Green Canadian Mind Products
    http://mindprod.com
    If you give someone a program, you will frustrate them for a day; if you teach them how to program, you will frustrate them for a lifetime.
     
    Roedy Green, Dec 28, 2009
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page