Skip to content

Commit

Permalink
Merge pull request WeBankBlockchain#108 from yg3630536/fixbug/adapt-j…
Browse files Browse the repository at this point in the history
…dk-for-bcos1.3

adapt jdk for fisco bcos1.3
  • Loading branch information
chenhaozx authored Dec 27, 2019
2 parents f65eda7 + 6d56189 commit b640021
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .ci/script/build-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ weid_config_tpl=${java_source_code_dir}/src/main/resources/weidentity.properties
weid_config=${java_source_code_dir}/src/main/resources/weidentity.properties
font=${java_source_code_dir}/src/main/resources/NotoSansCJKtc-Regular.ttf

JAVA_OPTS='-Djdk.tls.namedGroups="secp256k1"'
JAVA_OPTS='-Djdk.tls.namedGroups="secp256r1,secp256k1"'

function modify_config()
{
Expand Down
7 changes: 1 addition & 6 deletions build-tools/bin/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ app_xml_config=${java_source_code_dir}/src/main/resources/fisco.properties
weid_config_tpl=${java_source_code_dir}/src/main/resources/weidentity.properties.tpl
weid_config=${java_source_code_dir}/src/main/resources/weidentity.properties

JAVA_OPTS='-Djdk.tls.namedGroups="secp256k1"'
JAVA_OPTS='-Djdk.tls.namedGroups="secp256r1,secp256k1"'

CLASSPATH=${java_source_code_dir}/dist/conf

Expand Down Expand Up @@ -134,11 +134,6 @@ function gradle_build_sdk()

done

if [[ $bcos_version == 1 ]];
then
JAVA_OPTS=''
fi

export BLOCKCHIAN_NODE_INFO=$(echo -e ${content})
export WEID_ADDRESS="0x0"
export CPT_ADDRESS="0x0"
Expand Down
3 changes: 1 addition & 2 deletions check-info.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

JAVA_OPTS='-Djdk.tls.namedGroups="secp256k1"'
JAVA_OPTS='-Djdk.tls.namedGroups="secp256r1,secp256k1"'
classpathDir="./dist/conf"
libDir="./dist/lib"
set -- `getopt c:l: "$@"`
Expand Down Expand Up @@ -148,7 +148,6 @@ function check_user_config() {
else
echo "the client.keystore is exists and the MD5 is `md5sum $client_keystore | cut -d " " -f1`"
fi
JAVA_OPTS=''
elif [[ $bcos_version == 2* ]];
then
if [ ! -f "$node_crt" ];
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
org.gradle.jvmargs='-Dfile.encoding=UTF-8'
jdkTlsNamedGroups=secp256k1
jdkTlsNamedGroups=secp256r1,secp256k1
signing.keyId=
signing.password=
signing.secretKeyRingFile=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ protected static <T> T reloadContract(
logger.info(cls.getSimpleName() + " init succ");
} catch (Exception e) {
logger.error("load contract :{} failed. Error message is :{}",
cls.getSimpleName(), e);
cls.getSimpleName(), e.getMessage(), e);
throw new LoadContractException();
}

Expand Down Expand Up @@ -116,11 +116,11 @@ protected static <T> T getContractService(String contractAddress, Class<T> cls)

} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
logger.error("load contract :{} failed. Error message is :{}",
cls.getSimpleName(), e);
cls.getSimpleName(), e.getMessage(), e);
throw new LoadContractException();
} catch (Exception e) {
logger.error("load contract Exception:{} failed. Error message is :{}",
cls.getSimpleName(), e);
cls.getSimpleName(), e.getMessage(), e);
throw new LoadContractException();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ public ResponseData<Integer> save(String domain, String id, String data) {
String dataKey = DataToolUtils.getHash(id);
try {
SqlDomain sqlDomain = new SqlDomain(domain);
Object[] datas = {dataKey, data, sqlDomain.getExpire()};
Date now = sqlDomain.getNow();
Object[] datas = {dataKey, data, sqlDomain.getExpire(), now, now};
return new SqlExecutor(sqlDomain).execute(SqlExecutor.SQL_SAVE, datas);
} catch (WeIdBaseException e) {
logger.error("[mysql->save] save the data error.", e);
Expand Down
15 changes: 14 additions & 1 deletion src/main/java/com/webank/weid/util/JsonUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public class JsonUtil {
*
* @param cptJsonSchema Map类型的JsonSchema
* @return 返回有效Key的集合
* @throws IOException 可能出现的异常,如JSON序列化异常
*/
public static List<String> extractCptProperties(Map<String, Object> cptJsonSchema)
throws IOException {
Expand All @@ -93,6 +94,7 @@ public static List<String> extractCptProperties(Map<String, Object> cptJsonSchem
*
* @param cptJsonSchema Json类型的JsonSchema
* @return 返回有效Key的集合
* @throws IOException 可能出现的异常,如JSON序列化异常
*/
public static List<String> extractCptProperties(String cptJsonSchema) throws IOException {

Expand Down Expand Up @@ -209,6 +211,7 @@ private static void buildByType(Map<String, Object> resultMap, String key, JType
*
* @param credential 凭证
* @return 返回处理后的平级Json
* @throws IOException 可能出现的异常,如JSON序列化异常
*/
public static Map<String, String> credentialToMonolayer(CredentialPojo credential)
throws IOException {
Expand Down Expand Up @@ -237,6 +240,7 @@ private static Map<String, String> monolayerToMap(String json) throws IOExceptio
*
* @param claimPolicy 披露策略
* @return 返回处理后的平级Json
* @throws IOException 可能出现的异常,如JSON序列化异常
*/
public static String claimPolicyToMonolayer(ClaimPolicy claimPolicy) throws IOException {

Expand All @@ -249,7 +253,9 @@ public static String claimPolicyToMonolayer(ClaimPolicy claimPolicy) throws IOEx
* 将多级Json转换成平级Json,无补全处理.
*
* @param json 多级Json字符串
* @param radix 需要转换的进制
* @return 返回平级Json
* @throws IOException 可能出现的异常,如JSON序列化异常
*/
public static String jsonToMonolayer(String json, int radix) throws IOException {

Expand All @@ -260,6 +266,7 @@ public static String jsonToMonolayer(String json, int radix) throws IOException
* 将多级Json转换成平级Json.
*
* @param jsonNode 多级的JsonNode
* @param radix 需要转换的进制
* @return 返回平级Json
*/
public static String jsonToMonolayer(JsonNode jsonNode, int radix) {
Expand Down Expand Up @@ -554,7 +561,10 @@ private static String decimalToString(String value, int radix) {
}

/**
* 带循环下标的循环.
* 带循环下标的循环.
* @param <T> 循环出来的泛型对象
* @param consumer 用户包装循环的Consumer
* @return 包装了循环出来的对象和下标的对象
*/
public static <T> Consumer<T> consumerWithIndex(BiConsumer<T, Integer> consumer) {

Expand All @@ -574,7 +584,9 @@ class Index {
* 将平级Json转换成多级Json.
*
* @param json 平级Json字符串
* @param radix 需要转换的进制
* @return 返回一个多级的Json字符串
* @throws IOException 可能出现的异常,如JSON序列化异常
*/
public static String monolayerToJson(String json, int radix) throws IOException {

Expand All @@ -585,6 +597,7 @@ public static String monolayerToJson(String json, int radix) throws IOException
* 将平级Json转换成多级Json.
*
* @param jsonNode 平级JsonNode对象
* @param radix 需要转换的进制
* @return 返回一个多级的Json字符串
*/
public static String monolayerToJson(JsonNode jsonNode, int radix) {
Expand Down

0 comments on commit b640021

Please sign in to comment.