kidok / protobuf

Automatically exported from code.google.com/p/protobuf
0 stars 0 forks source link

Concerting ByteString to String #620

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Sending the Request using Python request
2. Receiving the BidRequest
3. Convert Request to string format

What is the expected output? What do you see instead?
IP and ID should be converted to string but not getting converted

Actual ID Value: [B@65abc63a
Expected O/P: "Mv\2005\000\017.\001\n\345\177\307X\200M8"

Actual IP Value: <ByteString@354a03e6 size=3>
Expected IP Value: 192.168.0.102

What version of the product are you using? On what operating system?

Operating System: Windows 2008 R2

Please provide any additional information below:

Original issue reported on code.google.com by veer...@gmail.com on 24 Mar 2014 at 3:26

GoogleCodeExporter commented 9 years ago
What's the proto definition and what's the code converting the message to 
string format?

Original comment by xiaof...@google.com on 24 Mar 2014 at 6:44

GoogleCodeExporter commented 9 years ago
attached is the protobuff file and below is the code for the conversion

public static String AdXRequest(Object O, Concept req) {
        String ps=null,Impmimes=null,VImpmimes=null;  
        int index=0;
        if (O instanceof byte[]){               

            byte[] by = (byte[]) O;
            try{
            BidRequest a = BidRequest.parseFrom(by);
            ps = a.toString();

            }catch(Exception e){
                ps = "exception on parseFrom::" + e.getStackTrace();
            }

        }else{
            ps = "Object is not a byte array.";
        }

Original comment by veer...@gmail.com on 24 Mar 2014 at 6:57

GoogleCodeExporter commented 9 years ago
What's the code that leads to your reported error:
Actual ID Value: [B@65abc63a
Expected O/P: "Mv\2005\000\017.\001\n\345\177\307X\200M8"

Actual IP Value: <ByteString@354a03e6 size=3>
Expected IP Value: 192.168.0.102

Original comment by xiaof...@google.com on 24 Mar 2014 at 8:33

GoogleCodeExporter commented 9 years ago
Hi,

I am not getting any error but not able to convert ID and IPAddress.

Let us say when i want to augment, basically by IP will be getting City,Zipcode 
and state details to verify the impression to bid.

Let me know if you need more info.

Thanks!!
Veera

Original comment by veer...@gmail.com on 25 Mar 2014 at 12:37