Commit Graph

1061 Commits

Author SHA1 Message Date
Christopher Piro
21c95a31ee [thrift] cleanup generated trailing whitespace in php
Summary: Verfolgenplaatze sind verboten!

Reviewed By: kder

Test Plan: no

Revert Plan: yes


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665569 13f79535-47bb-0310-9956-ffa450edef68
2008-03-12 04:28:43 +00:00
David Reiss
85c44c559b Add some generated files to .gitignore.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665568 13f79535-47bb-0310-9956-ffa450edef68
2008-03-11 21:41:47 +00:00
dweatherford
6b53bbb778 [thrift] Move readMessageEnd inside of else block for accelerated protocol
Summary: Otherwise, readMessageEnd will be performed twice; once in the extension and once in PHP-land. Since TBinaryProtocol readMessageEnd is a no-op this isn't a huge deal, but it's bad style.
Reviewed By: mcslee
Test Plan: Inspect generated php code
Revert: OK
TracCamp Project: Thrift
DiffCamp Revision: 9155


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665567 13f79535-47bb-0310-9956-ffa450edef68
2008-03-11 02:42:45 +00:00
dweatherford
840ca085fc [thrift] php thrift_protocol crash fixes
Summary: The convert_to_*_ex functions were being used improperly resulting
  in heap corruption in some cases; I just switched everything over to the
  non-ex versions since it shouldn't matter if I modify the value being
  serialized in place to coerce it to the proper type.

  Also fixed a potential crash for map, set, and list types when not passed
  an array, by first attempting an array conversion and then throwing a
  tprotocolexception if that doesn't succeed. (Actually, PHP might fatal there
  instead, it wasn't immediately clear from reading the code if that would
  be the case).

Reviewed by: marcel
Test plan: Ran under php-5.2.5, debug and release builds. No more heap corruption
  or memory leak complaints (the latter also a side effect of undesired zval
  reference separation).
Revert: only if you love SIGSEGV


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665566 13f79535-47bb-0310-9956-ffa450edef68
2008-03-08 05:51:24 +00:00
David Reiss
0e913a6381 Add an accessor for the I/O protocols of Thrift clients.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665565 13f79535-47bb-0310-9956-ffa450edef68
2008-03-07 20:28:31 +00:00
David Reiss
84e63abf2e Remove some trailing whitespace.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665564 13f79535-47bb-0310-9956-ffa450edef68
2008-03-07 20:12:28 +00:00
David Reiss
2c2dc67fd8 Add .gitignore file.
Ignore all generated files.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665563 13f79535-47bb-0310-9956-ffa450edef68
2008-03-07 20:12:25 +00:00
David Reiss
ea5e75af3b Add Java JSON protocol implementation.
Implement full-featured JSON protocol, low-level base-64 encode/decode
methods, and related tests.

Conflicts (resolved by dreiss):

	test/java/build.xml


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665562 13f79535-47bb-0310-9956-ffa450edef68
2008-03-07 20:12:20 +00:00
David Reiss
a7f879b81f Add Java memory buffer transport implementation.
Wraps a TByteArrayOutputStream.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665561 13f79535-47bb-0310-9956-ffa450edef68
2008-03-07 20:12:17 +00:00
David Reiss
80f6398b63 Add NOT_IMPLEMENTED exception code.
Preparation for Java JSON protocol implementation.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665560 13f79535-47bb-0310-9956-ffa450edef68
2008-03-07 20:12:13 +00:00
David Reiss
4a8f46ca0b Add more complete base64 testing for C++ JSON protocol.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665559 13f79535-47bb-0310-9956-ffa450edef68
2008-03-07 20:12:07 +00:00
dweatherford
9b945da3ca [thrift] ZTS fixes for thift_protocol extension
Summary: Now the threadsafe build compiles!
Reviewed by: mcslee
Test Plan: compiles, ship it
Revert: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665558 13f79535-47bb-0310-9956-ffa450edef68
2008-03-06 03:11:08 +00:00
lucas
f8f21e769e restore tags/1.0.0, we need these at least until fb9 is rolled everywhere
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665557 13f79535-47bb-0310-9956-ffa450edef68
2008-03-05 22:04:13 +00:00
David Reiss
a79e48874b TNonblockingServer: Fix wrong exception names
Reviewed By: dreiss

Test Plan: trivial :)

Revert: OK

DiffCamp Revision: 8789


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665556 13f79535-47bb-0310-9956-ffa450edef68
2008-03-05 07:51:47 +00:00
David Reiss
edde04804b Thrift: Add writePtr(), wroteBytes() to TMemoryBuffer
Summary: This adds the discussed interface to TMemoryBuffer, as follows:

         - writePtr(size) returns a ptr you can write (size) bytes to
         - wroteBytes() lets it know you wrote that many bytes

         To do this, I refactored an:
         - ensureCanWrite(size) private func

Reviewed By: dreiss

Test Plan: works in my test environment

Revert: OK

TracCamp Project: Thrift

DiffCamp Revision: 8739


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665555 13f79535-47bb-0310-9956-ffa450edef68
2008-03-05 07:51:44 +00:00
David Reiss
631dcb42d1 Thrift: concurrency/Util.h: Add converters for 'struct timeval', cleanup
Summary: - Added 'struct timeval' toMilliseconds and toTimeval converters modeled on the timespec ones
         - Added constants for microsecs, and got rid of the 500000 and 500 magic #'s :)

Reviewed By: dreiss

Test Plan: works in my test env

Revert: OK

DiffCamp Revision: 8742


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665554 13f79535-47bb-0310-9956-ffa450edef68
2008-03-05 07:51:40 +00:00
David Reiss
6987535d65 Change the Java help to be a little more consistent.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665553 13f79535-47bb-0310-9956-ffa450edef68
2008-03-04 21:10:41 +00:00
David Reiss
4ac9267cf8 Don't declare getStaticLimitedReflection if gen_reflection_limited_ is off.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665552 13f79535-47bb-0310-9956-ffa450edef68
2008-03-04 21:10:38 +00:00
David Reiss
a014788f73 Changed an awkward if/else if/else to be slightly less awkward.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665551 13f79535-47bb-0310-9956-ffa450edef68
2008-03-04 21:10:34 +00:00
David Reiss
cdd6f3c029 Fix a typo in configure.ac.
Used "==" instead of "=" in a test.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665550 13f79535-47bb-0310-9956-ffa450edef68
2008-03-04 21:10:29 +00:00
Christopher Piro
b6f18c20ee [thrift] Erlang build tweaks
Summary: fix the Makefile to use BSD-friendly find(1) and enable conditional building of the Erlang binding.  Contributed by Dan Sully (daniel@electricrain.com).

Reviewed By: eletuchy

Test Plan: builds


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665549 13f79535-47bb-0310-9956-ffa450edef68
2008-03-04 07:09:12 +00:00
dweatherford
cf997a45c6 [thrift] PHP thrift_protocol extension, revision 2.0
Summary:
  All PHP serialization and deserialization can now happen in extension-land,
  which should be much faster. This includes reading message headers and all
  complex types (structs, exceptions, whatever).

  The compiler has been updated to always emit the $_TSPEC static array for
  generated PHP code, since the new extension depends on it.

  As before, the PHP code gates enabling the accelerated serialization on
  the protocol being an instance of TBinaryProtocolAcclerated and the function
  for the [de]serialization operation existing.

  The function names have changed since the last version of the extension,
  so old and new generated code can coexist, and new generated code can run on
  a server with the old extension (but it will not use accelerated serialization).

Reviewed by: hzhao
Test Plan: Generated a couple of endpoints and called their services through the
  new extension. Both use a variety of nested complex types. Built and ran the
  extension in php-5.2.3 in debug mode, killed the reported memory leaks.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665548 13f79535-47bb-0310-9956-ffa450edef68
2008-03-04 01:08:23 +00:00
David Reiss
9f646157f0 Fix a typo in a warning message in thrifty.yy.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665547 13f79535-47bb-0310-9956-ffa450edef68
2008-03-02 21:59:48 +00:00
David Reiss
520b5eec8f Allow the C# library to be excluded from the build.
Use AX_THRIFT_LIB to make configure support --without-csharp.
Don't bother testing for the C# requirements if this is set.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665546 13f79535-47bb-0310-9956-ffa450edef68
2008-03-02 07:00:26 +00:00
David Reiss
62d3981c9e Allow the Java library to be excluded from the build.
Use AX_THRIFT_LIB to make configure support --without-java.
Don't bother testing for the Java requirements if this is set.

This is necessary because the autoconf macros we are using for Java
cause configure to quit with an error if Java is not found.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665545 13f79535-47bb-0310-9956-ffa450edef68
2008-03-02 07:00:22 +00:00
David Reiss
be5ee7c191 Infrastructure for excluding language libraries from the build.
Add a new autoconf macro (a thin wrapper around AC_ARG_WITH) that
makes it pretty easy to include or exclude specific language libraries.

This will be tested along with future changes that use it.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665544 13f79535-47bb-0310-9956-ffa450edef68
2008-03-02 07:00:19 +00:00
David Reiss
b3483d0b2c Make the configure help more consistent.
Make the help strings generated by AX_THRIFT_GEN look more like
the ones from built-in autoconf macros.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665543 13f79535-47bb-0310-9956-ffa450edef68
2008-03-02 07:00:15 +00:00
David Reiss
14feb4127c Generate quality overrides of hashCode for Thrift structs (in Java).
This feature is turned off by default because it adds a new dependency:
Apache Commons Lang.  This package seems enough like Boost that
I would be open to turning this feature on by default.

Also updated test/java/build.xml to use this new option.
ant test still passes.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665542 13f79535-47bb-0310-9956-ffa450edef68
2008-03-02 06:29:23 +00:00
David Reiss
3b15ebc251 Add support for .equals() to Java structs.
- Add a new method to t_java_generator that generates a .equals() method.
- Add a correct but useless implementation of hashCode for structs.
  (This is required by conventino when overriding .equals().)
- Add java_package to DebugProtoTest and OptionalRequiredTest.
- Add a new structure to OptionalRequiredTest to assist testing the behavior
  of .equals() with respect to null and unset fields.
- Clean up test/java/build.xml a bit.  (It still has a ways to go.)
- Add EqualityTest.java to test .equals().
- Add IdentityTest.java to test that writing and reading a structure
  preserves equality.

Tested by runnint atn test.
I also looked at the generated code for OptionalRequiredTest.thrift.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665541 13f79535-47bb-0310-9956-ffa450edef68
2008-03-02 06:29:19 +00:00
David Reiss
d2a3e566b7 Add a TDeserializer for Java.
The class is the reverse of TSerializer.
It allows you to deserialize a Thrift struct from a byte array (or String).


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665540 13f79535-47bb-0310-9956-ffa450edef68
2008-03-02 06:29:16 +00:00
David Reiss
c0fef71697 Fix a comment in the Java TSerializer.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665539 13f79535-47bb-0310-9956-ffa450edef68
2008-03-02 06:29:12 +00:00
David Reiss
dc815f5402 Add Stop methods for C# servers.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665538 13f79535-47bb-0310-9956-ffa450edef68
2008-03-02 00:58:04 +00:00
David Reiss
907ad76c2d Adding a few integration points to the C++ TSocketPool.
- Adding ability to use a vector of TSocketPoolServers to construct a TSocketPool
- Ability to get back the list of TSocketPoolServers

This is especially useful in multithreaded client code that
will just keep around the list of servers, and create the pool
on every request. Since TSocketPool updates the failure stuff,
we need a way to get back the updated TSocketPoolServers

Reviewed By: aditya

Test Plan: just compiling the code


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665537 13f79535-47bb-0310-9956-ffa450edef68
2008-03-02 00:25:58 +00:00
David Reiss
2c9824c5bd Fix potential out of bounds read issue with getTypeIDForTypeName().
Make sure type name is at least 2 characters long.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665536 13f79535-47bb-0310-9956-ffa450edef68
2008-03-02 00:20:47 +00:00
David Reiss
f50021af66 Bug fix for C++ TSocketPool
Wasn't setting the host or port for each server in the pool on open.

Reviewed By: dbraginsky

Test Plan: Just compiled.  Will test with dbraginsky's server.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665535 13f79535-47bb-0310-9956-ffa450edef68
2008-02-29 07:33:47 +00:00
David Reiss
6d0cccd640 Fail and retry logic for TSocketPool
Summary: Replicating php logic: If opening fails enough times, mark server as down for some amount of time

Reviewed By: aditya

Test Plan: compiling thrift - any good test ideas?

Revert: OK

DiffCamp Revision: 8381


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665534 13f79535-47bb-0310-9956-ffa450edef68
2008-02-28 21:20:12 +00:00
David Reiss
9163073ca1 Fix for JSON Protocol string-reading methods.
Clear return-by-reference strings before appending to them
in the JSON Protocol reading methods.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665533 13f79535-47bb-0310-9956-ffa450edef68
2008-02-28 21:11:39 +00:00
David Reiss
1a3546464d Fix for Base64 decoding.
Previously, the Base64 decoding table only covered ASCII characters,
but the decoding function looked up any character in the table.
This change extends the table.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665532 13f79535-47bb-0310-9956-ffa450edef68
2008-02-28 21:11:34 +00:00
eletuchy
6f3507c425 [thrift] erlang: fixing error logger for devious "not-quite-right" lists
Summary: ... a la dictionary

Reviewed By: cpiro

Test Plan: bin_trim of a dict with a stored integer value

Revert Plan: sure


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665531 13f79535-47bb-0310-9956-ffa450edef68
2008-02-27 23:50:21 +00:00
David Reiss
4b6a3c7a68 Fix a subtle bug in cpp_use_include_path.
Summary:
I thought I had eliminated all the places where work was only done
if cpp_use_include_path was set.  I guess I missed one.

Reviewed By: mcslee, mrabkin, kholst

Test Plan:
Built BigGrep and looked at the generated code.

Revert Plan: ok

DiffCamp Revision: 8375


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665530 13f79535-47bb-0310-9956-ffa450edef68
2008-02-27 22:28:12 +00:00
eletuchy
7d2ab9fd43 [thrift] erlang: dialyzer bug: binary protocol double type ...
Summary: ... needs to be specified as a float to work, since
         erlang's binary syntax default is "integer"

Reviewed By: cpiro

Test Plan: make dialyzer -j

Revert Plan: sure


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665529 13f79535-47bb-0310-9956-ffa450edef68
2008-02-27 19:56:52 +00:00
eletuchy
38d199b879 [thrift] erlang: dialyzer bug: bad usage of ++ operator on a non-list
Reviewed By: cpiro

Test Plan: make dialyzer -j

Revert Plan: sure


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665528 13f79535-47bb-0310-9956-ffa450edef68
2008-02-27 19:55:15 +00:00
David Reiss
cf2e8d9af3 Add an operator< for Thrift structs (in C++).
Some people want to use sets of Thrift structs.  This has interesting
implications, but it is a reasonable request.  However, in C++,
this requires structures to have a less-than operator.
It seems a little dangerous to auto-generate an arbitrary comparator,
but allowing users to define their own operator< implementations
seems fine.  This change makes that a lot easier.

The one downside of this change is that developers who try to compare
structures with operator< (including trying to make sets of them)
will now get a linker error instead of a compiler error.
However, the old compiler error was so scary that
I'm not sure this is any worse.

Reviewed By: kholst, mcslee

Test Plan: make check


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665527 13f79535-47bb-0310-9956-ffa450edef68
2008-02-27 19:38:51 +00:00
eletuchy
f0cf2a3745 [thrift] erlang: dialyzer bug: tSocket reading of send_timeout preference
Reviewed By: cpiro

Test Plan: make dialyzer

Revert Plan: sure


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665526 13f79535-47bb-0310-9956-ffa450edef68
2008-02-27 19:27:41 +00:00
eletuchy
53e571968f [thrift] erlang dialyzer error
Summary: impossible pattern matches are never good

Reviewed By: cpiro

Test Plan: make dialyzer

Revert Plan: sure


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665525 13f79535-47bb-0310-9956-ffa450edef68
2008-02-27 18:38:42 +00:00
eletuchy
57fd32c796 [thrift] make erlang error logger more efficient
Summary: when omit_fmt is included

Reviewed By: cpiro

Test Plan: sanity checked a service to make sure it ran

Revert Plan: sure

Other Notes: TODO - make reconfiguration work with this


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665524 13f79535-47bb-0310-9956-ffa450edef68
2008-02-27 17:43:40 +00:00
eletuchy
7dc23bce4b [thrift] adding dialyzer to erlang library Makefile
Summary: ... because static analysis can find bugs

Reviewed By: cpiro

Test Plan: cd src ; make dialyzer -j
     gape in awe at errors

Revert Plan: sure


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665523 13f79535-47bb-0310-9956-ffa450edef68
2008-02-27 17:41:05 +00:00
eletuchy
efe64a6cc5 [thrift] making erlang thrift error logger slightly nicer for printing binaries
Reviewed By: cpiro

Test Plan: ran some services ... verified that they worked

Revert Plan: sure


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665522 13f79535-47bb-0310-9956-ffa450edef68
2008-02-27 16:31:01 +00:00
David Reiss
10ae20f684 Fix a warning message.
Forgot to update this when copy-pasting.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665521 13f79535-47bb-0310-9956-ffa450edef68
2008-02-27 07:45:10 +00:00
David Reiss
4ce2874fd5 Make limited reflection optional (off by default).
Limited reflection is deprecated, and it is slowing down compilation.
This change will disable generation of static reflection by default,
but it adds a command line argument to re-enable it.

Tested by running make check and building the C++ test client and server.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665520 13f79535-47bb-0310-9956-ffa450edef68
2008-02-27 07:45:05 +00:00