zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From afine <...@git.apache.org>
Subject [GitHub] zookeeper pull request #238: ZOOKEEPER-2763: Utils.toCsvBuffer() omits leadi...
Date Tue, 06 Jun 2017 21:02:55 GMT
Github user afine commented on a diff in the pull request:

    --- Diff: src/java/main/org/apache/jute/Utils.java ---
    @@ -190,19 +190,32 @@ static String fromCSVString(String s) throws IOException {
    +     * convert byte array to a string in hex format
    -     * @param s 
    -     * @return 
    +     * @param barr
    +     * @return
    -    static String toXMLBuffer(byte barr[]) {
    --- End diff --
    Hi @alburthoffman -
    I have been trying to reproduce the issue that you described. A stack trace would be helpful
here. Do you know exactly which test was failing for you (as I don't think the logs for any
relevant jenkins job still exists)? I was able to get the whole test suite to pass with `DatatypeConverter.printHexBinary`.

    Although, if I do not add null check I can get `testJuteToString` to fail. 
    	at javax.xml.bind.DatatypeConverterImpl.printHexBinary(DatatypeConverterImpl.java:479)
    	at javax.xml.bind.DatatypeConverter.printHexBinary(DatatypeConverter.java:626)
    	at org.apache.jute.Utils.toHexString(Utils.java:203)
    	at org.apache.jute.Utils.toCSVBuffer(Utils.java:242)
    	at org.apache.jute.CsvOutputArchive.writeBuffer(CsvOutputArchive.java:100)
    	at org.apache.zookeeper.proto.SetDataRequest.toString(SetDataRequest.java:77)
    	at org.apache.zookeeper.server.ToStringTest.testJuteToString(ToStringTest.java:36)
    I was able to remedy this with a null check before the javax call. 
        private static String toHexString(byte barr[]) {
            if (barr == null) {
                return "";
            return javax.xml.bind.DatatypeConverter.printHexBinary(barr);
    Thanks for your patience on this.

If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.

View raw message