Changing sort()

We have had many bug reports on `sort()` with apps crashing now and then (but consistently). Changing `sort()` to be an in-place sort will help core to deallocate only when allowed.

A few extra changes done:

* Fix spelling error in the sort order constant (it is now called `SORT_ORDER_DESCENDING`).
* Throws an `IllegalArgumentException` if field name does not exist.
* Validate the table view before calling any method in core.

@benjaminprakash88 @bmunkholm @emanuelez @cmelchior 
Yeah, but I'm not sure we want mulitiple try/catch for code size reasons -
just one per method.
All in for the combined macro.

On Tue, Dec 2, 2014 at 12:45 PM, Kenneth Geisshirt <notifications@github.com
> wrote:

> In realm-jni/src/io_realm_internal_tableview.cpp:
>
> >      return TV(nativeViewPtr)->size();   // noexcept
> >  }
> >
> >  JNIEXPORT jlong JNICALL Java_io_realm_internal_TableView_nativeGetSourceRowIndex
> >  (JNIEnv *env, jobject, jlong nativeViewPtr, jlong rowIndex)
> >  {
> > -    TV(nativeViewPtr)->sync_if_needed();
>
> That's true. It might be better to add sync_if_need() to VIEW_VALID (and
> rename it to VIEW_VALID_AND_IN_SYNC.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/realm/realm-java/pull/634/files#r21153848>.
>