Summary:
Added a LookaheadReader to the TJSONProtocol so it doesn't have to
rely on the transport to borrow.
Also added a check to a corner case and fixed up some comments and whitespace.
Reviewed By: mcslee
Test Plan: make check
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665491 13f79535-47bb-0310-9956-ffa450edef68
Summary: before it would complain and not exit. that's not right.
Reviewed By: eletuchy
Test Plan: DEATH ENSUES
Revert Plan: sounds reasonable
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665490 13f79535-47bb-0310-9956-ffa450edef68
Actually, it is not a typo. The original authors didn't convert one call
to get_java_package to get_csharp_namespace.
Tested by building Thrift.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665489 13f79535-47bb-0310-9956-ffa450edef68
Summary:
There were a few places where we were calling malloc/reallaoc/free without
including cstdlib (or stdlib.h). This is broken, but it worked because
other headers that we were including included stdlib.h. However, on a
platform where this wasn't true, it broke the Thrift build. This change
adds the proper includes. It also changes malloc to std::malloc (same
with realloc and free) in a few places, because that is the correct way
of doing it when you include cstdlib.
Reviewed By: mcslee
Test Plan: Compiled Thrift.
Revert Plan: ok
Other Notes:
This bug was noticed by a Thrudb user, and the patch was sent in by
Ross McFarland.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665487 13f79535-47bb-0310-9956-ffa450edef68
Summary:
Added another i32 test after the async test. If testAsync improperly
sends a response, then the i32 test will fail because the function
name won't match up, since it will be "off by one".
Test plan:
Tested cpp server and it works. Tested alterl server which
doesn't yet implement async void properly and verified failure
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665486 13f79535-47bb-0310-9956-ffa450edef68
Summary:
- testAsync takes a number of seconds to sleep. The test client makes sure
that the RPC returns in less than 0.2 seconds even though it asks the server
to sleep for 3 seconds.
- Implemented this test for C++ and Java.
Test Plan:
- ran cpp TestServer and TestClient and verified functionality
- tested cpp and java test server/client against each other - tests passed
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665484 13f79535-47bb-0310-9956-ffa450edef68
Summary:
This change adds a new and exciting protocol to Thrift. It uses
RFC-compliant JSON as the wire protocol and is fully human readable.
(once a little whitespace has been inserted.) Unlike the existing
JSON protocol for Java, which is intended to allow Thrift data to be
transferred to scripting languages, this protocol is lossless and fully
read-write. It was written by Chad Walters of Powerset and reviewed
by David Reiss.
Tested by running make check.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665482 13f79535-47bb-0310-9956-ffa450edef68
Summary:
The upcoming TJSONProtocol handles string and binary types quite differently.
This change makes that distinction in all parts of the C++ binding.
Java already distinguished between string and binary, but this change
also updates the Java skip method to skip over strings as binary
so we don't get encoding errors when skipping binary data.
Reviewed By: mcslee
Test Plan: make check
Revert Plan: ok
Other Notes:
I just pulled this out of Chad Walters' JSON patch.
The only other change was adding readBinary (or was it writeBinary)
to TDenseProtocol. Maybe inheriting from TBinaryProtocol wasn't a good idea.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665481 13f79535-47bb-0310-9956-ffa450edef68
Summary:
- Add a serialization test for forwards/backwards compatibility.
- Hook the Python tests up to "make check".
- Miscellaneous changes to the Python tests.
Reviewed By: mcslee
Test Plan: Ran the test.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665480 13f79535-47bb-0310-9956-ffa450edef68
Summary: introducing a $bin_accel variable in struct reader scope that
can be reference by the deserializers of each field
Reviewed By: dreiss, mcslee
Test Plan: regenerated a thrift service, compared before and after calls
Revert Plan: sure
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665478 13f79535-47bb-0310-9956-ffa450edef68
Summary: calls integer_to_list on the port
Reviewed By: dreiss
Test Plan: connected a client to non-running server. oh noes, exception.
Revert Plan: sure
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665475 13f79535-47bb-0310-9956-ffa450edef68
Summary:
./bootstrap.sh has been throwing warnings because we haven't kept
configure.ac up to date. This fixes that.
Reviewed By: mcslee
Test Plan: ./boostrap.sh
Revert Plan: ok
Other Notes:
Contributed by Dan Sully.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665474 13f79535-47bb-0310-9956-ffa450edef68
Summary: getTransport is now a method of Protocol. To flush the transport one does tflush (getTransport p) instead of pflush p. This is more like how it is done with other languages.
Reviewed By: dcorson
Test Plan: Ran thrifttest for haskell.
Revert: OK
DiffCamp Revision: 7515
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665473 13f79535-47bb-0310-9956-ffa450edef68
Summary:
References to "local reflections" in other thrift files were not given
namespace prefixes, give undefined symbol errors. This change
distinguishes between relfection names being generated for declarations
(not namespaced) and those that could be external references (namespaced).
Reviewed By: mcslee
Test Plan:
Got the following files to build and link correctly with -dense.
==> test1.thrift <==
cpp_namespace ns
enum foo { bar }
==> test2.thrift <==
include "test1.thrift"
enum dummy_enum_workaround { I_AM_A_WORKAROUND }
struct baz {
1: test1.foo qux
}
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665472 13f79535-47bb-0310-9956-ffa450edef68
Summary: Not AbstractMap or HashSet, etc. use Map, List, Set
Reviewed By: dreiss
Test Plan: Generate Java code and build java tests
Other Notes: Submitted by Seth Falcon
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665470 13f79535-47bb-0310-9956-ffa450edef68
Summary: Use comment trick in params that are unused to prevent warnings
Reviewed By: dreiss
Test Plan: Generate C++ code and compile -W -Wall
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665469 13f79535-47bb-0310-9956-ffa450edef68
Summary:
The problem was that in generate_local_reflection, we refused to
generate reflections for types defined in another program, including enums.
But in local_reflection_name, we treated enums like base types,
assuming that their reflections were always defined in this program.
One solution would be to treat enums like base types everywhere, and always
generate their reflections in the program where they were being used.
But this change takes the opposite approach. We now always
generate fingerprints for enums in the program in which they are defined,
even if they are not used there.
Reviewed By: mcslee
Test Plan:
Got the following files to build and link correctly with -dense.
dreiss@dreiss-vmware:reflection:thrift/test$ tail test[12].thrift
==> test1.thrift <==
enum foo { bar }
==> test2.thrift <==
include "test1.thrift"
struct baz {
1: test1.foo qux
}
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665468 13f79535-47bb-0310-9956-ffa450edef68
Summary:
- Expanded tabs to spaces where spaces were the norm.
- Deleted almost all trailing whitespace.
- Added newlines to the ends of a few files.
- Ran dos2unix on one file or two.
Reviewed By: mcslee
Test Plan: git diff -b
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665467 13f79535-47bb-0310-9956-ffa450edef68
Reviewed By: mcslee
Test Plan: Installed Mono and built it.
Revert Plan: ok
Other Notes:
Submitted by Ben Maurer.
Actually reviewed by Todd Berman.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665465 13f79535-47bb-0310-9956-ffa450edef68
Reviewed By: mcslee
Test Plan: Built it after a future revision.
Revert Plan: ok
Other Notes:
Submitted by Ben Maurer.
Actually reviewed by Todd Berman.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665464 13f79535-47bb-0310-9956-ffa450edef68
Reviewed By: mcslee
Test Plan: Built it after a future revision.
Revert Plan: ok
Other Notes:
Submitted by Ben Maurer.
Actually reviewed by Todd Berman.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665463 13f79535-47bb-0310-9956-ffa450edef68
Summary:
Some member variables were actually being treated as local variables.
Reviewed By: mcslee
Test Plan: None.
Revert Plan: ok
Other Notes:
Actually reviewed by Kevin Clark.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665462 13f79535-47bb-0310-9956-ffa450edef68
Summary:
There were some weird cases where the implicit conversion from
const char* to std::string was causing the wrong constructor to be called.
There wasn't really a clean workaround, so we're dropping the string
constructors.
Reviewed By: mcslee
Test Plan:
Ran the test.
Grepped around the /projects tree for uses that had to fixed,
and fixed them.
Revert Plan: ok
Other Notes:
This risk was pointed out by Ben Maurer.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665461 13f79535-47bb-0310-9956-ffa450edef68
Summary: Since the outer class is serializable, you'll want it on the inner member too. Though in general you shouldn't be using Java to serialize Thrift objects, as that misses the point and tosses version compatibility out the window.
Reviewed By: dreiss
Test Plan: Generate Java code
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665460 13f79535-47bb-0310-9956-ffa450edef68
Summary:
Forgot to mention in my last commit that the bulk of the change was
submitted by Nitay. Updating the CONTRIBUTORS file while I'm at it.
Reviewed By: mcslee
Test Plan: None.
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665459 13f79535-47bb-0310-9956-ffa450edef68
Summary:
Add a Makefile.am in the test directory that runs some of the test programs
when "make check" is executed. Also removed some obsolete comments.
Reviewed By: mcslee
Test Plan:
Ran make check, saw all tests pass.
Ran make install, saw no test programs installed.
Ran ./cleanup.sh, saw a pristine workspace.
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665458 13f79535-47bb-0310-9956-ffa450edef68
Summary:
This didn't get updated when the interface changed,
and the cast silenced the warning message. Stupid C.
Reviewed By: mcslee
Test Plan: Trust Chad Walters.
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665457 13f79535-47bb-0310-9956-ffa450edef68
Chad Walters is writing a JSON protocol for Thrift, but he wants
borrow to always succeed. That would be a pain to implement,
but here is a first step: borrow will almost always work with
TBufferedTransport.
Reviewed by: mcslee
Test Plan: Ran the DenseProtocol test and Zlib test, but more needs to be done.
Other Notes:
Also reviewed by Chad Walters, and maybe Ben Maurer.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665455 13f79535-47bb-0310-9956-ffa450edef68
Summary:
I don't know what I was thinking when I first wrote this.
It makes sense that the transport might not want to allocate its own memory,
so the protocol is expected to provide a buffer for the data.
However, if the transport already has the data buffered,
there is no need to memcpy it; it can just return a pointer into its buffer.
The new interface still requires the protocol to provide a buffer,
but allows the transport to return a pointer to an interal buffer.
In addition, I made len a pass-by-pointer parameter so that
the transport can return more than the requested data if it has it
available in its buffers.
Reviewed By: mcslee
Test Plan: Ran the DenseProtocol test and the Zlib test.
Revert Plan: ok
Other Notes:
Also got this reviewed by Chad Walters from Powerset.
Ben Maurer suggested making len a reference parameter.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665454 13f79535-47bb-0310-9956-ffa450edef68
Summary: Types from external files are not resolved until the program parse pass, not the include one. Therefore, only do full type validation once after all includes have been parsed and external type pointers resolved.
Reviewed By: aditya
Test Plan: build ServiceManager.thrift
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665452 13f79535-47bb-0310-9956-ffa450edef68
Summary: Throwing non-exceptions, though allowed in some languages, is a weird concept and causes problems in many places. Disallow it in the Thrift compiler and throw an informative error.
Reviewed By: dreiss
Test Plan: Generate a file with an int or something in a throws clause. Peep the nice informative compiler error.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665450 13f79535-47bb-0310-9956-ffa450edef68
Summary: Use std::vector::resize() method to default construct placeholder elements. Then grab references via operator[] to deserialize directly into the vector, instead of copy-constructing elements in.
Reviewed By: hzhao
Test Plan: test/cpp contains list serialization/deserialization checks
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665449 13f79535-47bb-0310-9956-ffa450edef68
Summary: Instead of copy-constructing map values into the map, alter the code such that we insert default-constructed elements into the map and then deserialize them by reference.
Reviewed By: hzhao
Test Plan: Ran the test in test/cpp which include serialization and deserialization of nested maps.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665448 13f79535-47bb-0310-9956-ffa450edef68
Summary: three related changes:
* for numeric types in tBinaryProtocol call effectful_write with binary(), not [char()]
* tBinaryProtocol:writeString now takes either [char()], iolist(), or binary() ... now you can use any of the three where a Thrift string is required
* tBufferedTransport now buffers by building an iolist() rather than Buffer++Data. zomg.
Reviewed By: eletuchy
Test Plan: everything seems to work as usual, and binary() works as expected
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665447 13f79535-47bb-0310-9956-ffa450edef68