Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@

public class PipeConnectionException extends PipeException {

public static String CONNECTION_ERROR_FORMATTER = "Connect to receiver %s:%s error, because: %s";
public static final String CONNECTION_ERROR_FORMATTER =
"Error occurred while connecting to receiver %s:%s, please check network connectivity or SSL configurations when enable SSL transmission";

public PipeConnectionException(String message) {
super(message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@

public class PipeParameterNotValidException extends PipeException {

public static String PARSE_URL_ERROR_FORMATTER =
"Error parsing node urls from target servers %s, because %s";

public PipeParameterNotValidException(String message) {
super(message);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,7 @@ public void handshake() throws Exception {
}
} catch (TException e) {
throw new PipeConnectionException(
String.format(
PipeConnectionException.CONNECTION_ERROR_FORMATTER, ipAddress, port, e.getMessage()),
e);
String.format(PipeConnectionException.CONNECTION_ERROR_FORMATTER, ipAddress, port), e);
}

sessionPool =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,7 @@ private void reconstructClient(TEndPoint endPoint) throws IOException {
String.format(
PipeConnectionException.CONNECTION_ERROR_FORMATTER,
endPoint.getIp(),
endPoint.getPort(),
e.getMessage()),
endPoint.getPort()),
e);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ public abstract class IoTDBConnector implements PipeConnector {

protected boolean isTabletBatchModeEnabled = true;

private static final String PARSE_URL_ERROR_FORMATTER =
"Exception occurred while parsing node urls from target servers: {}";

private static final String PARSE_URL_ERROR_MESSAGE =
"Error occurred while parsing node urls from target servers, please check the specified 'ip':'port' or 'node-urls'";

@Override
public void validate(PipeParameterValidator validator) throws Exception {
final PipeParameters parameters = validator.getParameters();
Expand Down Expand Up @@ -128,9 +134,8 @@ protected Set<TEndPoint> parseNodeUrls(PipeParameters parameters)
Arrays.asList(parameters.getStringByKeys(SINK_IOTDB_NODE_URLS_KEY).split(","))));
}
} catch (Exception e) {
throw new PipeParameterNotValidException(
String.format(
PipeParameterNotValidException.PARSE_URL_ERROR_FORMATTER, givenNodeUrls, e));
LOGGER.warn(PARSE_URL_ERROR_FORMATTER, e.toString());
throw new PipeParameterNotValidException(PARSE_URL_ERROR_MESSAGE);
}

checkNodeUrls(givenNodeUrls);
Expand All @@ -140,18 +145,12 @@ protected Set<TEndPoint> parseNodeUrls(PipeParameters parameters)
private void checkNodeUrls(Set<TEndPoint> nodeUrls) throws PipeParameterNotValidException {
for (TEndPoint nodeUrl : nodeUrls) {
if (Objects.isNull(nodeUrl.ip) || nodeUrl.ip.isEmpty()) {
throw new PipeParameterNotValidException(
String.format(
PipeParameterNotValidException.PARSE_URL_ERROR_FORMATTER,
nodeUrls,
"ip cannot be empty"));
LOGGER.warn(PARSE_URL_ERROR_FORMATTER, "ip cannot be empty");
throw new PipeParameterNotValidException(PARSE_URL_ERROR_MESSAGE);
}
if (nodeUrl.port == 0) {
throw new PipeParameterNotValidException(
String.format(
PipeParameterNotValidException.PARSE_URL_ERROR_FORMATTER,
nodeUrls,
"port cannot be empty"));
LOGGER.warn(PARSE_URL_ERROR_FORMATTER, "port cannot be empty");
throw new PipeParameterNotValidException(PARSE_URL_ERROR_MESSAGE);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,7 @@ public void handshake() throws Exception {
null));
} catch (TTransportException e) {
throw new PipeConnectionException(
String.format(
PipeConnectionException.CONNECTION_ERROR_FORMATTER, ip, port, e.getMessage()),
e);
String.format(PipeConnectionException.CONNECTION_ERROR_FORMATTER, ip, port), e);
}

// TODO: validate client connectivity here, just like in ThriftSync.
Expand Down