Skip to content

Commit 10bb78e

Browse files
Updated to be compiled with Java 8
1 parent aa5363e commit 10bb78e

File tree

8 files changed

+19
-24
lines changed

8 files changed

+19
-24
lines changed

Demos/Javalin/src/main/kotlin/com/groupdocs/ui/config/ApplicationConfig.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package com.groupdocs.ui.config
22

33
import com.groupdocs.ui.Defaults
44
import java.nio.file.Path
5+
import java.nio.file.Paths
56

67
@kotlinx.serialization.Serializable
78
data class ApplicationConfig(
@@ -63,8 +64,8 @@ data class Local(
6364
) {
6465

6566
val filesDirectoryOrDefault: Path
66-
get() = Path.of(filesDirectory.ifBlank { Defaults.Local.DEFAULT_FILES_DIRECTORY })
67+
get() = Paths.get(filesDirectory.ifBlank { Defaults.Local.DEFAULT_FILES_DIRECTORY })
6768

6869
val resultDirectoryOrDefault: Path
69-
get() = Path.of(resultDirectory.ifBlank { Defaults.Local.DEFAULT_RESULT_DIRECTORY })
70+
get() = Paths.get(resultDirectory.ifBlank { Defaults.Local.DEFAULT_RESULT_DIRECTORY })
7071
}

Demos/Javalin/src/main/kotlin/com/groupdocs/ui/modules/compare/CompareController.kt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ import com.groupdocs.ui.util.InternalServerException
1010
import kotlinx.coroutines.Dispatchers
1111
import kotlinx.coroutines.withContext
1212
import org.koin.core.component.KoinComponent
13-
import java.io.BufferedInputStream
14-
import java.io.BufferedOutputStream
15-
import java.io.FileInputStream
16-
import java.io.FileOutputStream
13+
import java.io.*
1714
import java.nio.file.Files
1815
import java.util.*
1916
import kotlin.io.path.extension
@@ -71,7 +68,7 @@ class CompareControllerImpl(
7168
previewWidth = previewPageWidth,
7269
previewRatio = previewPageRatio
7370
) { pageNumber, pageInputStream ->
74-
val data = Base64.getEncoder().encodeToString(pageInputStream.readAllBytes())
71+
val data = Base64.getEncoder().encodeToString(pageInputStream.readBytes())
7572
pages.add(
7673
ComparePage(
7774
number = pageNumber - 1,

Demos/Javalin/src/main/kotlin/com/groupdocs/ui/modules/description/DescriptionController.kt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
package com.groupdocs.ui.modules.description
22

3-
import com.groupdocs.comparison.result.FileType
43
import com.groupdocs.ui.manager.PathManager
5-
import com.groupdocs.ui.model.FileDescriptionEntity
64
import com.groupdocs.ui.model.DescriptionRequest
75
import com.groupdocs.ui.model.LoadDocumentEntity
86
import com.groupdocs.ui.model.PageDescriptionEntity
97
import com.groupdocs.ui.modules.BaseController
10-
import com.groupdocs.ui.usecase.GetLocalFilesUseCase
11-
import com.groupdocs.ui.usecase.LocalStorageEntry
128
import com.groupdocs.ui.usecase.RetrieveLocalFilePagesStreamUseCase
139
import kotlinx.coroutines.Dispatchers
1410
import kotlinx.coroutines.withContext
@@ -40,7 +36,7 @@ class DescriptionControllerImpl(
4036
previewWidth = previewPageWidth,
4137
previewRatio = previewPageRatio
4238
) { pageNumber, pageInputStream ->
43-
val data = Base64.getEncoder().encodeToString(pageInputStream.readAllBytes())
39+
val data = Base64.getEncoder().encodeToString(pageInputStream.readBytes())
4440
entity.pages.add(
4541
PageDescriptionEntity(
4642
number = pageNumber - 1,

Demos/Micronaut/src/main/kotlin/com/groupdocs/ui/config/ApplicationConfig.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package com.groupdocs.ui.config
22

33
import com.groupdocs.ui.Defaults
44
import java.nio.file.Path
5+
import java.nio.file.Paths
56

67
data class ApplicationConfig(
78
val common: Common = Common(),
@@ -52,8 +53,8 @@ data class Local(
5253
) {
5354

5455
val filesDirectoryOrDefault: Path
55-
get() = Path.of(filesDirectory.ifBlank { Defaults.Local.DEFAULT_FILES_DIRECTORY })
56+
get() = Paths.get(filesDirectory.ifBlank { Defaults.Local.DEFAULT_FILES_DIRECTORY })
5657

5758
val resultDirectoryOrDefault: Path
58-
get() = Path.of(resultDirectory.ifBlank { Defaults.Local.DEFAULT_RESULT_DIRECTORY })
59+
get() = Paths.get(resultDirectory.ifBlank { Defaults.Local.DEFAULT_RESULT_DIRECTORY })
5960
}

Demos/Micronaut/src/main/kotlin/com/groupdocs/ui/modules/compare/CompareBean.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ class CompareBeanImpl(
3838
) : CompareBean {
3939
override suspend fun compare(request: CompareRequest): CompareResponse {
4040
val (sourceDocument, targetDocument) = request.guids
41-
val sourceFile = URLDecoder.decode(sourceDocument.guid, StandardCharsets.UTF_8)
42-
val targetFile = URLDecoder.decode(targetDocument.guid, StandardCharsets.UTF_8)
41+
val sourceFile = URLDecoder.decode(sourceDocument.guid, StandardCharsets.UTF_8.toString())
42+
val targetFile = URLDecoder.decode(targetDocument.guid, StandardCharsets.UTF_8.toString())
4343

4444
val sourceFilePath = pathManager.assertPathIsInsideFilesDirectory(sourceFile)
4545
val targetFilePath = pathManager.assertPathIsInsideFilesDirectory(targetFile)
@@ -82,7 +82,7 @@ class CompareBeanImpl(
8282
previewWidth = previewPageWidth,
8383
previewRatio = previewPageRatio
8484
) { pageNumber, pageInputStream ->
85-
val data = Base64.getEncoder().encodeToString(pageInputStream.readAllBytes())
85+
val data = Base64.getEncoder().encodeToString(pageInputStream.readBytes())
8686
pages.add(
8787
ComparePage(
8888
number = pageNumber - 1,
@@ -135,7 +135,7 @@ class CompareBeanImpl(
135135
} else resultDirectory.relativize(resultPath)
136136

137137
return CompareResponse(
138-
guid = URLEncoder.encode(guid.toString(), StandardCharsets.UTF_8),
138+
guid = URLEncoder.encode(guid.toString(), StandardCharsets.UTF_8.toString()),
139139
changes = changes,
140140
pages = pages,
141141
extension = resultExtension

Demos/Micronaut/src/main/kotlin/com/groupdocs/ui/modules/description/DescriptionBean.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ class DescriptionBeanImpl(
3030
@Inject private val appConfig: ApplicationConfig
3131
) : DescriptionBean {
3232
override suspend fun description(request: DescriptionRequest): LoadDocumentEntity {
33-
val guid = URLDecoder.decode(request.guid, StandardCharsets.UTF_8)
33+
val guid = URLDecoder.decode(request.guid, StandardCharsets.UTF_8.toString())
3434
val path = pathManager.assertPathIsInsideFilesDirectory(guid)
3535
val password = request.password
3636
val previewPageWidth = appConfig.comparison.previewPageWidthOrDefault
3737
val previewPageRatio = appConfig.comparison.previewPageRatioOrDefault
3838

3939
val entity = LoadDocumentEntity(
40-
guid = URLEncoder.encode(guid, StandardCharsets.UTF_8),
40+
guid = URLEncoder.encode(guid, StandardCharsets.UTF_8.toString()),
4141
printAllowed = appConfig.common.print
4242
)
4343
return withContext(Dispatchers.IO) {
@@ -48,7 +48,7 @@ class DescriptionBeanImpl(
4848
previewWidth = previewPageWidth,
4949
previewRatio = previewPageRatio
5050
) { pageNumber, pageInputStream ->
51-
val data = Base64.getEncoder().encodeToString(pageInputStream.readAllBytes())
51+
val data = Base64.getEncoder().encodeToString(pageInputStream.readBytes())
5252
entity.pages.add(
5353
PageDescriptionEntity(
5454
number = pageNumber - 1,

Demos/Micronaut/src/main/kotlin/com/groupdocs/ui/modules/tree/TreeBean.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class TreeBeanImpl(
2424
@Inject private val pathManager: PathManager,
2525
) : TreeBean {
2626
override suspend fun tree(request: TreeRequest): List<FileDescriptionEntity> {
27-
val path = pathManager.assertPathIsInsideFilesDirectory(URLDecoder.decode(request.path, StandardCharsets.UTF_8))
27+
val path = pathManager.assertPathIsInsideFilesDirectory(URLDecoder.decode(request.path, StandardCharsets.UTF_8.toString()))
2828

2929
val localFiles = getLocalFiles(path)
3030
return localFiles.sortedBy {
@@ -38,7 +38,7 @@ class TreeBeanImpl(
3838
val fileFullPath = it.fullPath
3939
val guid = filesDirectory.relativize(fileFullPath).toString()
4040
FileDescriptionEntity(
41-
guid = URLEncoder.encode(guid, StandardCharsets.UTF_8),
41+
guid = URLEncoder.encode(guid, StandardCharsets.UTF_8.toString()),
4242
name = it.name,
4343
docType = docType,
4444
directory = isDirectory,

Demos/Spring/src/main/java/com/groupdocs/ui/comparison/spring/service/ComparisonServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ public CompareResultResponse compare(CompareRequest compareRequest, SessionCache
262262
pageDescriptionEntities = cachedPageStream.stream().map(item -> {
263263
try (InputStream inputStream = item.pageStream) {
264264
final PageDescriptionEntity pageDescription = new PageDescriptionEntity();
265-
pageDescription.setNumber(item.pageIndex);
265+
pageDescription.setNumber(item.pageIndex); // 0->3???
266266
pageDescription.setHeight(pageHeight);
267267
pageDescription.setWidth(pageWidth);
268268
pageDescription.setData(getStringFromStream(inputStream));

0 commit comments

Comments
 (0)