Skip to content

Commit 07bac16

Browse files
Fixed checkstyle issues
1 parent 12aa934 commit 07bac16

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

src/main/java/io/cdap/plugin/gcp/gcs/source/GCSSource.java

+24-24
Original file line numberDiff line numberDiff line change
@@ -97,26 +97,26 @@ public void prepareRun(BatchSourceContext context) throws Exception {
9797
bucketName = GCSPath.from(path).getBucket();
9898
} catch (IllegalArgumentException e) {
9999
collector.addFailure(e.getMessage(), null)
100-
.withStacktrace(e.getStackTrace());
100+
.withStacktrace(e.getStackTrace());
101101
collector.getOrThrowException();
102102
}
103103

104104
Boolean isServiceAccountFilePath = config.connection.isServiceAccountFilePath();
105105
if (isServiceAccountFilePath == null) {
106106
collector.addFailure("Service account type is undefined.",
107-
"Must be `filePath` or `JSON`");
107+
"Must be `filePath` or `JSON`");
108108
collector.getOrThrowException();
109109
}
110110

111111
Credentials credentials = null;
112112
try {
113113
credentials = config.connection.getServiceAccount() == null ?
114-
null : GCPUtils.loadServiceAccountCredentials(config.connection.getServiceAccount(),
115-
isServiceAccountFilePath);
114+
null : GCPUtils.loadServiceAccountCredentials(config.connection.getServiceAccount(),
115+
isServiceAccountFilePath);
116116
} catch (Exception e) {
117117
String errorReason = "Unable to load service account credentials.";
118118
collector.addFailure(String.format("%s %s", errorReason, e.getMessage()), null)
119-
.withStacktrace(e.getStackTrace());
119+
.withStacktrace(e.getStackTrace());
120120
collector.getOrThrowException();
121121
}
122122

@@ -136,10 +136,10 @@ public void prepareRun(BatchSourceContext context) throws Exception {
136136
location = bucket.getLocation();
137137
} catch (StorageException e) {
138138
String errorReason = String.format("Error code: %s, Unable to access GCS bucket '%s'. ",
139-
e.getCode(), bucketName);
139+
e.getCode(), bucketName);
140140
collector.addFailure(String.format("%s %s", errorReason, e.getMessage()),
141-
"Ensure you entered the correct bucket path and have permissions for it.")
142-
.withStacktrace(e.getStackTrace());
141+
"Ensure you entered the correct bucket path and have permissions for it.")
142+
.withStacktrace(e.getStackTrace());
143143
collector.getOrThrowException();
144144
}
145145

@@ -153,7 +153,7 @@ public void prepareRun(BatchSourceContext context) throws Exception {
153153

154154
// set error details provider
155155
context.setErrorDetailsProvider(
156-
new ErrorDetailsProviderSpec(GCSErrorDetailsProvider.class.getName()));
156+
new ErrorDetailsProviderSpec(GCSErrorDetailsProvider.class.getName()));
157157

158158
// super is called down here to avoid instantiating the lineage recorder with a null asset
159159
super.prepareRun(context);
@@ -162,12 +162,12 @@ public void prepareRun(BatchSourceContext context) throws Exception {
162162
@Override
163163
protected Map<String, String> getFileSystemProperties(BatchSourceContext context) {
164164
Map<String, String> properties = GCPUtils.getFileSystemProperties(config.connection, config.getPath(),
165-
new HashMap<>(config.getFileSystemProperties()));
165+
new HashMap<>(config.getFileSystemProperties()));
166166
if (config.isCopyHeader()) {
167167
properties.put(PathTrackingInputFormat.COPY_HEADER, Boolean.TRUE.toString());
168168
}
169169
if (config.getFileEncoding() != null
170-
&& !config.getFileEncoding().equalsIgnoreCase(AbstractFileSourceConfig.DEFAULT_FILE_ENCODING)) {
170+
&& !config.getFileEncoding().equalsIgnoreCase(AbstractFileSourceConfig.DEFAULT_FILE_ENCODING)) {
171171
properties.put(PathTrackingInputFormat.SOURCE_FILE_ENCODING, config.getFileEncoding());
172172
}
173173
if (config.getMinSplitSize() != null) {
@@ -190,17 +190,17 @@ protected LineageRecorder getLineageRecorder(BatchSourceContext context) {
190190
@Override
191191
protected void recordLineage(LineageRecorder lineageRecorder, List<String> outputFields) {
192192
lineageRecorder.recordRead("Read", String.format("Read %s from Google Cloud Storage.",
193-
config.isEncrypted() ? " and decrypt " : " "), outputFields);
193+
config.isEncrypted() ? " and decrypt " : " "), outputFields);
194194
}
195195

196196
@Override
197197
protected boolean shouldGetSchema() {
198198
return !config.containsMacro(GCPConnectorConfig.NAME_PROJECT) &&
199-
!config.containsMacro(GCSSourceConfig.NAME_PATH) && !config.containsMacro(GCSSourceConfig.NAME_FORMAT) &&
200-
!config.containsMacro(GCSSourceConfig.NAME_DELIMITER) &&
201-
!config.containsMacro(GCSSourceConfig.NAME_FILE_SYSTEM_PROPERTIES) &&
202-
!config.containsMacro(GCPConnectorConfig.NAME_SERVICE_ACCOUNT_FILE_PATH) &&
203-
!config.containsMacro(GCPConnectorConfig.NAME_SERVICE_ACCOUNT_JSON);
199+
!config.containsMacro(GCSSourceConfig.NAME_PATH) && !config.containsMacro(GCSSourceConfig.NAME_FORMAT) &&
200+
!config.containsMacro(GCSSourceConfig.NAME_DELIMITER) &&
201+
!config.containsMacro(GCSSourceConfig.NAME_FILE_SYSTEM_PROPERTIES) &&
202+
!config.containsMacro(GCPConnectorConfig.NAME_SERVICE_ACCOUNT_FILE_PATH) &&
203+
!config.containsMacro(GCPConnectorConfig.NAME_SERVICE_ACCOUNT_JSON);
204204
}
205205

206206
/**
@@ -236,19 +236,19 @@ public static class GCSSourceConfig extends AbstractFileSourceConfig implements
236236
@Macro
237237
@Nullable
238238
@Description("Whether the data file is encrypted. If it is set to 'true', a associated metadata file needs to be "
239-
+ "provided for each data file. Please refer to the Documentation for the details of the metadata file content.")
239+
+ "provided for each data file. Please refer to the Documentation for the details of the metadata file content.")
240240
private Boolean encrypted;
241241

242242
@Macro
243243
@Nullable
244244
@Description("The file name suffix for the metadata file of the encrypted data file. "
245-
+ "The default is '" + DEFAULT_ENCRYPTED_METADATA_SUFFIX + "'.")
245+
+ "The default is '" + DEFAULT_ENCRYPTED_METADATA_SUFFIX + "'.")
246246
private String encryptedMetadataSuffix;
247247

248248
@Macro
249249
@Nullable
250250
@Description("A list of columns with the corresponding data types for whom the automatic data type detection gets" +
251-
" skipped.")
251+
" skipped.")
252252
private String override;
253253

254254
@Macro
@@ -281,23 +281,23 @@ public void validate(FailureCollector collector) {
281281
GCSPath.from(path);
282282
} catch (IllegalArgumentException e) {
283283
collector.addFailure(e.getMessage(), null).withConfigProperty(NAME_PATH)
284-
.withStacktrace(e.getStackTrace());
284+
.withStacktrace(e.getStackTrace());
285285
}
286286
}
287287
if (!containsMacro(NAME_FILE_SYSTEM_PROPERTIES)) {
288288
try {
289289
getFileSystemProperties();
290290
} catch (Exception e) {
291291
collector.addFailure("File system properties must be a valid json.", null)
292-
.withConfigProperty(NAME_FILE_SYSTEM_PROPERTIES).withStacktrace(e.getStackTrace());
292+
.withConfigProperty(NAME_FILE_SYSTEM_PROPERTIES).withStacktrace(e.getStackTrace());
293293
}
294294
}
295295
if (!containsMacro(NAME_FILE_REGEX)) {
296296
try {
297297
getFilePattern();
298298
} catch (IllegalArgumentException e) {
299299
collector.addFailure(e.getMessage(), null).withConfigProperty(NAME_FILE_REGEX)
300-
.withStacktrace(e.getStackTrace());
300+
.withStacktrace(e.getStackTrace());
301301
}
302302
}
303303
}
@@ -331,7 +331,7 @@ public boolean isEncrypted() {
331331

332332
public String getEncryptedMetadataSuffix() {
333333
return Strings.isNullOrEmpty(encryptedMetadataSuffix) ?
334-
DEFAULT_ENCRYPTED_METADATA_SUFFIX : encryptedMetadataSuffix;
334+
DEFAULT_ENCRYPTED_METADATA_SUFFIX : encryptedMetadataSuffix;
335335
}
336336

337337
Map<String, String> getFileSystemProperties() {

0 commit comments

Comments
 (0)