Skip to content

Commit dc038c5

Browse files
committed
src linting
1 parent c82e0dc commit dc038c5

6 files changed

Lines changed: 192 additions & 196 deletions

File tree

src/main/java/picoded/dstack/KeyLongMap.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ default Long addAndGet(Object key, Object delta) {
183183
// We simply use get and add, with the delta,
184184
// this reduce the amount of permutation needed to support
185185
//
186-
return getAndAdd(key, delta)+GenericConvert.toLong(delta);
186+
return getAndAdd(key, delta) + GenericConvert.toLong(delta);
187187
}
188188

189189
/**

src/main/java/picoded/dstack/core/Core_FileWorkspace.java

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,12 @@ public void setupWorkspace() {
105105
main.setupWorkspace(_oid());
106106
_isUninitialized = false;
107107
}
108-
108+
109109
/**
110110
* Calls setupWorkspace if _isUninitialized is true
111111
*/
112112
protected void setupUninitializedWorkspace() {
113-
if( _isUninitialized ) {
113+
if (_isUninitialized) {
114114
setupWorkspace();
115115
}
116116
}
@@ -145,7 +145,7 @@ protected static String normalizeFolderPathString(final String folderPath) {
145145
* @return true, if file exists (and writable), false if it does not. Possible a folder
146146
*/
147147
public boolean fileExist(final String filepath) {
148-
if( _isUninitialized ) {
148+
if (_isUninitialized) {
149149
return false;
150150
}
151151
return main.backend_fileExist(_oid, normalizeFilePathString(filepath));
@@ -157,7 +157,7 @@ public boolean fileExist(final String filepath) {
157157
* @param filepath in the workspace to delete
158158
*/
159159
public void removeFile(final String filepath) {
160-
if( _isUninitialized ) {
160+
if (_isUninitialized) {
161161
return;
162162
}
163163
main.backend_removeFile(_oid, normalizeFilePathString(filepath));
@@ -174,7 +174,7 @@ public void removeFile(final String filepath) {
174174
* @return the file contents, null if file does not exists
175175
*/
176176
public InputStream readInputStream(final String filepath) {
177-
if( _isUninitialized ) {
177+
if (_isUninitialized) {
178178
return null;
179179
}
180180
return main.backend_fileReadInputStream(_oid, normalizeFilePathString(filepath));
@@ -204,7 +204,7 @@ public void writeInputStream(final String filepath, final InputStream data) {
204204
* @return the file contents, null if file does not exists
205205
*/
206206
public byte[] readByteArray(final String filepath) {
207-
if( _isUninitialized ) {
207+
if (_isUninitialized) {
208208
return null;
209209
}
210210
return main.backend_fileRead(_oid, normalizeFilePathString(filepath));
@@ -247,7 +247,7 @@ public void appendByteArray(final String filepath, final byte[] data) {
247247
* @param folderPath in the workspace (note, folderPath is normalized to end with "/")
248248
*/
249249
public void removeFolderPath(final String folderPath) {
250-
if( _isUninitialized ) {
250+
if (_isUninitialized) {
251251
return;
252252
}
253253
main.backend_removeFolderPath(_oid, normalizeFolderPathString(folderPath));
@@ -260,7 +260,7 @@ public void removeFolderPath(final String folderPath) {
260260
* @return true if folderPath is valid
261261
*/
262262
public boolean folderPathExist(final String folderPath) {
263-
if( _isUninitialized ) {
263+
if (_isUninitialized) {
264264
return false;
265265
}
266266
return main.backend_folderPathExist(_oid, normalizeFolderPathString(folderPath));
@@ -294,7 +294,7 @@ public void ensureFolderPath(final String folderPath) {
294294
* @return DataObject created timestamp in ms
295295
*/
296296
public long createdTimestamp(final String filepath) {
297-
if( _isUninitialized ) {
297+
if (_isUninitialized) {
298298
return -1;
299299
}
300300
return main.backend_createdTimestamp(_oid, normalizeFilePathString(filepath));
@@ -309,7 +309,7 @@ public long createdTimestamp(final String filepath) {
309309
* @return DataObject created timestamp in ms
310310
*/
311311
public long modifiedTimestamp(final String filepath) {
312-
if( _isUninitialized ) {
312+
if (_isUninitialized) {
313313
return -1;
314314
}
315315
return main.backend_modifiedTimestamp(_oid, normalizeFilePathString(filepath));
@@ -334,7 +334,7 @@ public long modifiedTimestamp(final String filepath) {
334334
* @param destinationFile
335335
*/
336336
public void moveFile(final String sourceFile, final String destinationFile) {
337-
if( _isUninitialized ) {
337+
if (_isUninitialized) {
338338
return;
339339
}
340340
main.backend_moveFile(_oid, normalizeFilePathString(sourceFile),
@@ -358,7 +358,7 @@ public void moveFile(final String sourceFile, final String destinationFile) {
358358
* @param destinationFolder
359359
*/
360360
public void moveFolderPath(final String sourceFolder, final String destinationFolder) {
361-
if( _isUninitialized ) {
361+
if (_isUninitialized) {
362362
return;
363363
}
364364
main.backend_moveFolderPath(_oid, normalizeFolderPathString(sourceFolder),
@@ -384,7 +384,7 @@ public void moveFolderPath(final String sourceFolder, final String destinationFo
384384
* @param destinationFile
385385
*/
386386
public void copyFile(final String sourceFile, final String destinationFile) {
387-
if( _isUninitialized ) {
387+
if (_isUninitialized) {
388388
return;
389389
}
390390
main.backend_copyFile(_oid, normalizeFilePathString(sourceFile),
@@ -408,7 +408,7 @@ public void copyFile(final String sourceFile, final String destinationFile) {
408408
* @param destinationFolder
409409
*/
410410
public void copyFolderPath(final String sourceFolder, final String destinationFolder) {
411-
if( _isUninitialized ) {
411+
if (_isUninitialized) {
412412
return;
413413
}
414414
main.backend_copyFolderPath(_oid, normalizeFolderPathString(sourceFolder),
@@ -428,7 +428,7 @@ public void copyFolderPath(final String sourceFolder, final String destinationFo
428428
*/
429429
public Set<String> getFileAndFolderPathSet(final String folderPath, final int minDepth,
430430
final int maxDepth) {
431-
if( _isUninitialized ) {
431+
if (_isUninitialized) {
432432
return new HashSet<>();
433433
}
434434
return main.backend_getFileAndFolderPathSet(_oid, normalizeFolderPathString(folderPath),
@@ -444,7 +444,7 @@ public Set<String> getFileAndFolderPathSet(final String folderPath, final int mi
444444
* @return list of path strings - relative to the given folderPath
445445
*/
446446
public Set<String> getFilePathSet(final String folderPath, final int minDepth, final int maxDepth) {
447-
if( _isUninitialized ) {
447+
if (_isUninitialized) {
448448
return new HashSet<>();
449449
}
450450
return main.backend_getFilePathSet(_oid, normalizeFolderPathString(folderPath), minDepth,
@@ -461,7 +461,7 @@ public Set<String> getFilePathSet(final String folderPath, final int minDepth, f
461461
*/
462462
public Set<String> getFolderPathSet(final String folderPath, final int minDepth,
463463
final int maxDepth) {
464-
if( _isUninitialized ) {
464+
if (_isUninitialized) {
465465
return new HashSet<>();
466466
}
467467
return main.backend_getFolderPathSet(_oid, normalizeFolderPathString(folderPath), minDepth,

src/main/java/picoded/dstack/core/Core_FileWorkspaceMap.java

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,12 @@ protected static String normalizeFilePathString(final String filePath) {
125125
if (res.endsWith("/")) {
126126
res = res.substring(0, res.length() - 1);
127127
}
128-
128+
129129
// Block empty filepath
130-
if( res.isEmpty() ) {
130+
if (res.isEmpty()) {
131131
throw new RuntimeException("Empty file path is not allowed");
132132
}
133-
133+
134134
return res;
135135
}
136136

@@ -298,7 +298,7 @@ public void backend_fileAppendByteArray(final String oid, final String filepath,
298298

299299
// Get the existing byte array
300300
byte[] read = backend_fileRead(oid, filepath);
301-
301+
302302
// Just write it as it is (read is null)
303303
if (read == null) {
304304
backend_fileWrite(oid, filepath, data);
@@ -409,17 +409,17 @@ public void backend_moveFolderPath(final String oid, final String sourceFolder,
409409
final String destinationFolder) {
410410
// Get the list of valid sub paths in the sourceFolder
411411
Set<String> subPath = backend_getFileAndFolderPathSet(oid, sourceFolder, -1, -1);
412-
412+
413413
// Lets sync up all the folders first
414-
for(String dir : subPath) {
415-
if(dir.endsWith("/")) {
416-
backend_ensureFolderPath(oid, destinationFolder+dir);
414+
for (String dir : subPath) {
415+
if (dir.endsWith("/")) {
416+
backend_ensureFolderPath(oid, destinationFolder + dir);
417417
}
418418
}
419419
// Lets sync up all the files next
420-
for(String file : subPath) {
421-
if(!file.endsWith("/")) {
422-
backend_copyFile(oid, sourceFolder+file, destinationFolder+file);
420+
for (String file : subPath) {
421+
if (!file.endsWith("/")) {
422+
backend_copyFile(oid, sourceFolder + file, destinationFolder + file);
423423
}
424424
}
425425
// Lets remove the original folders
@@ -449,7 +449,8 @@ public void backend_moveFolderPath(final String oid, final String sourceFolder,
449449
*/
450450
public void backend_copyFile(final String oid, final String sourceFile,
451451
final String destinationFile) {
452-
backend_fileWriteInputStream(oid, destinationFile, backend_fileReadInputStream(oid, sourceFile));
452+
backend_fileWriteInputStream(oid, destinationFile,
453+
backend_fileReadInputStream(oid, sourceFile));
453454
}
454455

455456
/**
@@ -476,17 +477,17 @@ public void backend_copyFolderPath(final String oid, final String sourceFolder,
476477
final String destinationFolder) {
477478
// Get the list of valid sub paths in the sourceFolder
478479
Set<String> subPath = backend_getFileAndFolderPathSet(oid, sourceFolder, -1, -1);
479-
480+
480481
// Lets sync up all the folders first
481-
for(String dir : subPath) {
482-
if(dir.endsWith("/")) {
483-
backend_ensureFolderPath(oid, destinationFolder+dir);
482+
for (String dir : subPath) {
483+
if (dir.endsWith("/")) {
484+
backend_ensureFolderPath(oid, destinationFolder + dir);
484485
}
485486
}
486487
// Lets sync up all the files next
487-
for(String file : subPath) {
488-
if(file.endsWith("/") == false) {
489-
backend_copyFile(oid, sourceFolder+file, destinationFolder+file);
488+
for (String file : subPath) {
489+
if (file.endsWith("/") == false) {
490+
backend_copyFile(oid, sourceFolder + file, destinationFolder + file);
490491
}
491492
}
492493
}
@@ -600,20 +601,20 @@ protected Set<String> backend_filterPathSet(final Set<String> rawSet, final Stri
600601
}
601602

602603
// Alrighto - lets check file / folder type - and add it in
603-
604+
604605
// Ignore empty, or root path
605-
if(subPath.isEmpty() || subPath.equals("/")) {
606+
if (subPath.isEmpty() || subPath.equals("/")) {
606607
continue;
607608
}
608-
609+
609610
// Expect a folder, reject files
610611
if (pathType == 1) {
611612
if (subPath.endsWith("/")) {
612613
// Not a file - abort!
613614
continue;
614615
}
615616
}
616-
617+
617618
// Expect files, reject folders
618619
if (pathType == 2) {
619620
if (!subPath.endsWith("/")) {

0 commit comments

Comments
 (0)