Skip to content

Commit 5ba4597

Browse files
author
Ilya Bogdanov
authored
Merge branch 'master' into tls_executor
2 parents 68e87cf + 3658d72 commit 5ba4597

File tree

18 files changed

+432
-1355
lines changed

18 files changed

+432
-1355
lines changed

exonum-java-binding/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
2626
### Changed
2727
- `BinaryTransactionMessage#toString` to include some fields in human-readable
2828
format instead of the whole message in binary form.
29-
- `Node#submitTransaction` to throw _unchecked_ `InvalidTransactionException` instead
29+
- `Node#submitTransaction` to throw _unchecked_ `TransactionSubmissionException` instead
3030
of checked `InternalServerError`.
3131

3232
### Fixed

exonum-java-binding/core/rust/exonum-java/TUTORIAL.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,6 @@ in the [user guide](https://exonum.com/doc/version/0.11/get-started/java-binding
1919

2020
### Step 1. Configure Environment
2121

22-
#### `LD_LIBRARY_PATH`
23-
24-
`LD_LIBRARY_PATH` is required to locate native libraries used by Java Binding.
25-
You need to provide path to JVM library (e.g. `libjvm.so` on Linux).
26-
27-
You can use the following script for this purpose:
28-
29-
```bash
30-
JAVA_HOME="${JAVA_HOME:-$(java -XshowSettings:properties -version 2>&1 > /dev/null | grep 'java.home' | awk '{print $3}')}"
31-
LIBJVM_PATH="$(find ${JAVA_HOME} -type f -name libjvm.* | xargs -n1 dirname)"
32-
33-
export LD_LIBRARY_PATH="${LIBJVM_PATH}"
34-
```
35-
3622
#### Services definition
3723
Services must be defined in the [services.toml](https://exonum.com/doc/version/0.11/get-started/java-binding/#built-in-services)
3824
file in order to be available in the network. The configuration file consists of two sections:
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
3+
# Try to detect the Java home directory from installed executable in case JAVA_HOME is not set.
4+
JAVA_HOME="${JAVA_HOME:-$(java -XshowSettings:properties -version \
5+
2>&1 > /dev/null |\
6+
grep 'java.home' |\
7+
awk '{print $3}')}"
8+
9+
# Find the directory containing libjvm.
10+
LIBJVM_PATH="$(find -L ${JAVA_HOME} -type f -name libjvm.* | xargs -n1 dirname)"
11+
12+
export LD_LIBRARY_PATH="${LIBJVM_PATH}"
13+
14+
# Detect the root directory of the installed app.
15+
EXONUM_HOME="$(dirname $0)/.."
16+
17+
# Delegate execution to the app executable.
18+
${EXONUM_HOME}/exonum-java "$@"

exonum-java-binding/core/rust/src/proxy/node.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ use storage::View;
3434
use utils::{unwrap_exc_or, unwrap_exc_or_default, unwrap_jni_verbose};
3535
use JniResult;
3636

37-
const TX_SUBMISSION_EXCEPTION: &str = "com/exonum/binding/service/InvalidTransactionException";
37+
const TX_SUBMISSION_EXCEPTION: &str = "com/exonum/binding/service/TransactionSubmissionException";
3838

3939
/// An Exonum node context. Allows to add transactions to Exonum network
4040
/// and get a snapshot of the database state.
@@ -132,9 +132,7 @@ pub extern "system" fn Java_com_exonum_binding_service_NodeProxy_nativeSubmit(
132132
Err(err) => {
133133
// node#submit can fail for two reasons: unknown transaction id and
134134
// an error in ApiSender#send. The former is the service implementation
135-
// error and is appropriate to communicate with the exception below;
136-
// the second is an internal, unrecoverable error that has nothing
137-
// to do with the service: ECR-3190
135+
// error; the latter is an internal, unrecoverable error.
138136
let error_class = TX_SUBMISSION_EXCEPTION;
139137
let error_description = err.to_string();
140138
env.throw_new(error_class, error_description)?;

exonum-java-binding/core/src/main/java/com/exonum/binding/service/Node.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ public interface Node {
4545
*
4646
* @param rawTransaction transaction parameters to include in transaction message
4747
* @return hash of the transaction message created by the framework
48-
* @throws InvalidTransactionException if the transaction belongs to an unknown service
48+
* @throws TransactionSubmissionException if the transaction belongs to an unknown service,
49+
* or cannot be submitted
4950
* @throws NullPointerException if the transaction is null
5051
* @see Blockchain#getTxMessages()
5152
*/
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,16 @@
1616

1717
package com.exonum.binding.service;
1818

19+
import com.exonum.binding.transaction.RawTransaction;
20+
1921
/**
20-
* Indicates that the submitted transaction is not valid (e.g., belongs to an unknown service).
22+
* Indicates that a transaction could not be
23+
* {@linkplain Node#submitTransaction(RawTransaction) submitted}.
24+
* For example, the submitted transaction is not valid — belongs to an unknown service.
2125
*/
22-
public final class InvalidTransactionException extends IllegalArgumentException {
26+
public final class TransactionSubmissionException extends RuntimeException {
2327

24-
public InvalidTransactionException(String message) {
28+
public TransactionSubmissionException(String message) {
2529
super(message);
2630
}
2731
}

exonum-java-binding/cryptocurrency-demo/start-cryptocurrency-demo.sh

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,6 @@ header "DETECTING ENVIRONMENT"
1717
EXONUM_JAVA_APP="exonum-java"
1818
command -v ${EXONUM_JAVA_APP} >/dev/null 2>&1 || { echo >&2 "Please install the Exonum Java App and make sure that 'exonum-java' binary is available via PATH. Aborting."; exit 1; }
1919

20-
# Check whether JAVA_HOME is set or detect it from the currently available java binary otherwise.
21-
if [ -z "${JAVA_HOME+x}" ];
22-
then
23-
export JAVA_HOME="$(java -XshowSettings:properties -version 2>&1 > /dev/null | grep 'java.home' | awk '{print $3}')"
24-
fi
25-
echo "JAVA_HOME=${JAVA_HOME}"
26-
27-
# Find the directory containing libjvm (the relative path has changed in Java 9).
28-
export LD_LIBRARY_PATH="$(find ${JAVA_HOME} -type f -name libjvm.\* | xargs -n1 dirname)"
29-
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}"
30-
3120
# Find the latest version of artifact and build if not found.
3221
ARTIFACT_PATH="$(find ./target -type f -name exonum-java-binding-cryptocurrency-demo-*-artifact.jar)"
3322

0 commit comments

Comments
 (0)