Skip to content

Commit

Permalink
Merge pull request #1 from ballerina-platform/master
Browse files Browse the repository at this point in the history
Changes to date 2019-09-08
  • Loading branch information
dulvinw authored Sep 8, 2019
2 parents a3abef6 + aab2dde commit 64c4013
Show file tree
Hide file tree
Showing 1,120 changed files with 86,636 additions and 68,916 deletions.
29 changes: 6 additions & 23 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,11 @@ install:
- nvm use 8.9.0
- npm install -g npm@'5.6.0'

jobs:
include:
- stage: "Build and Check"
name: "Build without tests"
script:
- while sleep 9m; do echo "=====[ $SECONDS seconds still running ]====="; done &
- ./gradlew build --console=plain -x test -x createJavadoc --stacktrace -scan
# Killing background sleep loop
- kill %1
- stage: "Tests"
name: "Run Build + tests (without integration) - checks"
script:
- while sleep 9m; do echo "=====[ $SECONDS seconds still running ]====="; done &
- ./gradlew build -x :jballerina-integration-test:test -x check -x createJavadoc --stacktrace -scan
# Killing background sleep loop
- kill %1
- script:
- while sleep 9m; do echo "=====[ $SECONDS seconds still running ]====="; done &
- ./gradlew :jballerina-integration-test:test --stacktrace -scan -x createJavadoc -Dorg.gradle.parallel=false
# Killing background sleep loop
- kill %1
name: "Integration tests"
script:
- while sleep 9m; do echo "=====[ $SECONDS seconds still running ]====="; done &
- ./gradlew build --console=plain --stacktrace -scan -x createJavadoc -Dorg.gradle.parallel=false
# Killing background sleep loop
- kill %1

after_success:
- bash <(curl -s https://codecov.io/bash)
Expand All @@ -74,4 +57,4 @@ branches:
only:
- master
- packerina-dev
- next-release
- next-release
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,14 @@ public static Object toJSON(TableValue table) {

return new StreamingJsonValue(jsonDataSource);
}

public static ErrorValue createJsonConversionError(Throwable throwable, String prefix) {
String detail = throwable.getMessage() != null ?
prefix + ": " + throwable.getMessage() :
"error occurred in JSON Conversion";
return BallerinaErrors.createError(BallerinaErrorReasons.JSON_CONVERSION_ERROR, detail);
}

// Private methods

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public class TableConstants {

static final String SQL_TYPE_BIGINT = "BIGINT";
static final String SQL_TYPE_DOUBLE = "DOUBLE";
static final String SQL_TYPE_DECIMAL = "DECIMAL";
static final String SQL_TYPE_BOOLEAN = "BOOLEAN";
static final String SQL_TYPE_BLOB = "BLOB";
static final String SQL_TYPE_ARRAY = "ARRAY";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.ballerinalang.jvm.types.BType;
import org.ballerinalang.jvm.types.BTypes;
import org.ballerinalang.jvm.types.TypeTags;
import org.ballerinalang.jvm.util.exceptions.BLangRuntimeException;
import org.ballerinalang.jvm.util.exceptions.BallerinaException;
import org.ballerinalang.jvm.values.ArrayValue;
import org.ballerinalang.jvm.values.DecimalValue;
Expand Down Expand Up @@ -76,7 +75,7 @@ public Object next() {
this.df.moveToNext();
return this.objGen.transform(this.df);
} catch (IOException e) {
throw new BLangRuntimeException("error while geting next data", e);
throw TableUtils.createTableOperationError(e, "error while geting next data");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.ballerinalang.jvm.types.BUnionType;
import org.ballerinalang.jvm.types.TypeTags;
import org.ballerinalang.jvm.values.ArrayValue;
import org.ballerinalang.jvm.values.DecimalValue;
import org.ballerinalang.jvm.values.MapValueImpl;
import org.ballerinalang.jvm.values.TableIterator;

Expand Down Expand Up @@ -210,9 +211,11 @@ private void generateCreateTableStatement(int type, BField sf, StringBuilder sb)
sb.append(TableConstants.SQL_TYPE_VARCHAR);
break;
case TypeTags.FLOAT_TAG:
case TypeTags.DECIMAL_TAG:
sb.append(TableConstants.SQL_TYPE_DOUBLE);
break;
case TypeTags.DECIMAL_TAG:
sb.append(TableConstants.SQL_TYPE_DECIMAL);
break;
case TypeTags.BOOLEAN_TAG:
sb.append(TableConstants.SQL_TYPE_BOOLEAN);
break;
Expand Down Expand Up @@ -273,6 +276,9 @@ private void prepareAndExecuteStatement(String queryStatement, ArrayValue params
case TypeTags.FLOAT_TAG:
stmt.setDouble(index, (Double) params.getRefValue(index - 1));
break;
case TypeTags.DECIMAL_TAG:
stmt.setBigDecimal(index, ((DecimalValue) params.getRefValue(index - 1)).value());
break;
case TypeTags.BOOLEAN_TAG:
stmt.setBoolean(index, (Boolean) params.getRefValue(index - 1));
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ private static void prepareAndExecuteStatement(PreparedStatement stmt, MapValueI
break;
case TypeTags.DECIMAL_TAG:
if (value == null) {
stmt.setNull(index, Types.DOUBLE);
stmt.setNull(index, Types.DECIMAL);
} else {
stmt.setDouble(index, ((DecimalValue) data.get(fieldName)).floatValue());
stmt.setBigDecimal(index, ((DecimalValue) data.get(fieldName)).decimalValue());
}
break;
case TypeTags.BOOLEAN_TAG:
Expand Down Expand Up @@ -225,7 +225,7 @@ static Object[] getArrayData(ArrayValue value) {
arrayLength = value.size();
arrayData = new BigDecimal[arrayLength];
for (int i = 0; i < arrayLength; i++) {
arrayData[i] = value.getRefValue(i);
arrayData[i] = ((DecimalValue) value.getRefValue(i)).value();
}
break;
default:
Expand All @@ -234,6 +234,13 @@ static Object[] getArrayData(ArrayValue value) {
return arrayData;
}

public static ErrorValue createTableOperationError(Throwable throwable, String errorSuffix) {
String detail = throwable.getMessage() != null ?
errorSuffix + ": " + throwable.getMessage() :
DEFAULT_ERROR_DETAIL_MESSAGE;
return BallerinaErrors.createError(BallerinaErrorReasons.TABLE_OPERATION_ERROR, detail);
}

public static ErrorValue createTableOperationError(Throwable throwable) {
String detail = throwable.getMessage() != null ? throwable.getMessage() : DEFAULT_ERROR_DETAIL_MESSAGE;
return BallerinaErrors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public static String[] initConfigurations(String[] args) {

String observeFlag = configArgs.get(CONFIG_OBSERVABILITY_ENABLED);
// load configurations
loadConfigurations(configArgs, configArgs.get(CONFIG_FILE_PROPERTY), Boolean.getBoolean(observeFlag));
loadConfigurations(configArgs, configArgs.get(CONFIG_FILE_PROPERTY), Boolean.parseBoolean(observeFlag));
return userProgramArgs.toArray(new String[0]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,11 @@ private void run() {
if (!(e instanceof ErrorValue)) {
RuntimeUtils.printCrashLog(e);
}
// Please refer #18763.
// This logs cases where errors have occurred while strand is blocked.
if (item.isYielded()) {
RuntimeUtils.printCrashLog(e);
}
} finally {
strandHolder.get().strand = null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class BLangConstants {
public static final String BALLERINA_ARGS_INIT_PREFIX = "--";
public static final int BALLERINA_ARGS_INIT_PREFIX_LENGTH = BALLERINA_ARGS_INIT_PREFIX.length();
public static final String CONFIG_SEPARATOR = "=";
public static final String CONFIG_FILE_PROPERTY = "b7a.config";
public static final String CONFIG_FILE_PROPERTY = "b7a.config.file";

public static final String EMPTY = "";
public static final String ANON_ORG = "$anon";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@
import static org.ballerinalang.jvm.util.exceptions.BallerinaErrorReasons.getModulePrefixedReason;

/**
* <p>
* Abstract class to be extended by all the ballerina objects.
* </p>
* <p>
* <i>Note: This is an internal API and may change in future versions.</i>
* </p>
*
* @since 0.995.0
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,12 @@
import static org.ballerinalang.jvm.util.exceptions.BallerinaErrorReasons.getModulePrefixedReason;

/**
* <p>
* Represent an array in ballerina.
* </p>
* <p>
* <i>Note: This is an internal API and may change in future versions.</i>
* </p>
*
* @since 0.995.0
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,13 @@
package org.ballerinalang.jvm.values;

/**
* <p>
* {@code {@link CollectionValue}} represents a collection in Ballerina.
*
* </p>
* <p>
* <i>Note: This is an internal API and may change in future versions.</i>
* </p>
*
* @since 0.995.0
*/
public interface CollectionValue {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@
import java.math.MathContext;

/**
* <p>
* The {@link DecimalValue} represents a decimal value in Ballerina.
*
* </p>
* <p>
* <i>Note: This is an internal API and may change in future versions.</i>
* </p>
* @since 0.995.0
*/
public class DecimalValue {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,13 @@
import static org.ballerinalang.jvm.util.BLangConstants.MODULE_INIT_CLASS_NAME;

/**
* <p>
* Represent an error in ballerina.
*
* </p>
* <p>
* <i>Note: This is an internal API and may change in future versions.</i>
* </p>
*
* @since 0.995.0
*/
public class ErrorValue extends RuntimeException implements RefValue {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,13 @@
import java.util.function.Function;

/**
* <p>
* Ballerina runtime value representation of a function pointer.
*
* </p>
* <p>
* <i>Note: This is an internal API and may change in future versions.</i>
* </p>
*
* @param <T> the type of the input to the function
* @param <R> the type of the result of the function
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,16 @@
import java.util.Map;
import java.util.StringJoiner;

/**
* Represent a Ballerina future in Java.
*
* @since 0.995.0
*/
/**
* <p>
* Represent a Ballerina future in Java.
* </p>
* <p>
* <i>Note: This is an internal API and may change in future versions.</i>
* </p>
*
* @since 0.995.0
*/
public class FutureValue implements RefValue {

public Strand strand;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,13 @@
import java.util.Map;

/**
* <p>
* Represent an opaque handle value in jBallerina.
*
* </p>
* <p>
* <i>Note: This is an internal API and may change in future versions.</i>
* </p>
*
* @since 1.0
*/
public class HandleValue implements RefValue {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,13 @@
import java.util.Map;

/**
* <p>
* Represents an iterator of a Ballerina {@code {@link CollectionValue}}.
*
* </p>
* <p>
* <i>Note: This is an internal API and may change in future versions.</i>
* </p>
*
* @since 0.995.0
*/
public interface IteratorValue extends RefValue, Iterator {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,14 @@
import java.util.Map;

/**
* <p>
* An interface for MapValue. This is created only for the purpose of java bytecode verifier to pass at runtime when
* we used the implementation of MapValue.
*
* </p>
* <p>
* <i>Note: This is an internal API and may change in future versions.</i>
* </p>
*
* @param <K> the type of keys maintained by this map
* @param <V> the type of mapped values
* @since 0.995.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,14 @@
import static org.ballerinalang.jvm.values.freeze.FreezeUtils.handleInvalidUpdate;

/**
* <p>
* Structure that represents the mapping between key value pairs in ballerina.
* A map cannot contain duplicate keys; each key can map to at most one value.
*
* </p>
* <p>
* <i>Note: This is an internal API and may change in future versions.</i>
* </p>
*
* @param <K> the type of keys maintained by this map
* @param <V> the type of mapped values
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@
import java.util.HashMap;

/**
* <p>
* Interface to be implemented by all the ballerina objects.
* </p>
* <p>
* <i>Note: This is an internal API and may change in future versions.</i>
* </p>
*
* @since 0.995.0
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@
import java.util.Map;

/**
* <p>
* Interface to be implemented by all the reference types.
* </p>
* <p>
* <i>Note: This is an internal API and may change in future versions.</i>
* </p>
*
* @since 0.995.0
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,13 @@
import java.util.UUID;

/**
* <p>
* The {@link StreamValue} represents a stream in Ballerina.
*
* </p>
* <p>
* <i>Note: This is an internal API and may change in future versions.</i>
* </p>
*
* @since 0.995.0
*/
public class StreamValue implements RefValue {
Expand Down
Loading

0 comments on commit 64c4013

Please sign in to comment.