Skip to content

Commit 3c86573

Browse files
Fix compilation error
1 parent c2d4984 commit 3c86573

File tree

4 files changed

+15
-13
lines changed

4 files changed

+15
-13
lines changed

gxcompress/src/main/java/com/genexus/compression/Compression.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@ public class Compression {
1515
private static final Logger log = org.apache.logging.log4j.LogManager.getLogger(Compression.class);
1616

1717
private String absolutePath;
18+
private long maxCombinedFileSize;
1819
private GXBaseCollection<SdtMessages_Message>[] messages;
1920
private ArrayList<String> filesToCompress;
2021

2122
public Compression() {}
2223

23-
public Compression(String absolutePath, GXBaseCollection<SdtMessages_Message>[] messages) {
24+
public Compression(String absolutePath, long maxCombinedFileSize, GXBaseCollection<SdtMessages_Message>[] messages) {
2425
this.absolutePath = absolutePath;
26+
this.maxCombinedFileSize = maxCombinedFileSize;
2527
this.messages = messages;
2628
filesToCompress = new ArrayList<>();
2729
}
@@ -35,7 +37,7 @@ public void addElement(String filePath) {
3537
}
3638

3739
public Boolean save() {
38-
return GXCompressor.compress(filesToCompress, absolutePath, messages);
40+
return GXCompressor.compress(filesToCompress, absolutePath, maxCombinedFileSize, messages);
3941
}
4042

4143
public void clear() {

gxcompress/src/main/java/com/genexus/compression/GXCompressor.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public static Boolean compress(ArrayList<String> files, String path, long maxCom
7878
}
7979
long fileSize = file.length();
8080
totalSize += fileSize;
81-
if (totalSize > maxCombinedFileSize) {
81+
if (totalSize > maxCombinedFileSize && maxCombinedFileSize > -1) {
8282
log.error(MAX_FILESIZE_EXCEEDED + "{}", maxCombinedFileSize);
8383
storageMessages(MAX_FILESIZE_EXCEEDED + maxCombinedFileSize, messages[0]);
8484
return false;
@@ -119,8 +119,8 @@ public static Boolean compress(ArrayList<String> files, String path, long maxCom
119119
}
120120
}
121121

122-
public static Compression newCompression(String path, GXBaseCollection<SdtMessages_Message>[] messages) {
123-
return new Compression(path, messages);
122+
public static Compression newCompression(String path, long maxCombinedFileSize, GXBaseCollection<SdtMessages_Message>[] messages) {
123+
return new Compression(path, maxCombinedFileSize, messages);
124124
}
125125

126126
public static Boolean decompress(String file, String path, GXBaseCollection<SdtMessages_Message>[] messages) {

gxcompress/src/main/java/com/genexus/compression/IGXCompressor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import java.util.ArrayList;
77

88
public interface IGXCompressor {
9-
static Boolean compress(ArrayList<String> files, String path, GXBaseCollection<SdtMessages_Message>[] messages) {return false;}
10-
static Compression newCompression(String path, GXBaseCollection<SdtMessages_Message>[] messages) { return new Compression();}
9+
static Boolean compress(ArrayList<String> files, String path, long maxCombinedFileSize, GXBaseCollection<SdtMessages_Message>[] messages) {return false;}
10+
static Compression newCompression(String path, long maxCombinedFileSize, GXBaseCollection<SdtMessages_Message>[] messages) { return new Compression();}
1111
static Boolean decompress(String file, String path, GXBaseCollection<SdtMessages_Message>[] messages) {return false;}
1212
}

gxcompress/src/test/java/com/genexus/compression/TestCompression.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,23 +53,23 @@ public void tearDown() {
5353
@Test
5454
public void testCompressToZip() {
5555
String outputPath = new File(testDirectory, "output.zip").getAbsolutePath();
56-
Boolean result = GXCompressor.compress(files, outputPath, msgs);
56+
Boolean result = GXCompressor.compress(files, outputPath, -1, msgs);
5757
assertTrue(result);
5858
assertTrue(new File(outputPath).exists());
5959
}
6060

6161
@Test
6262
public void testCompressToSevenZ() {
6363
String outputPath = new File(testDirectory, "output.7z").getAbsolutePath();
64-
Boolean result = GXCompressor.compress(files, outputPath, msgs);
64+
Boolean result = GXCompressor.compress(files, outputPath, -1, msgs);
6565
assertTrue(result);
6666
assertTrue(new File(outputPath).exists());
6767
}
6868

6969
@Test
7070
public void testCompressToTar() {
7171
String outputPath = new File(testDirectory, "output.tar").getAbsolutePath();
72-
Boolean result = GXCompressor.compress(files, outputPath, msgs);
72+
Boolean result = GXCompressor.compress(files, outputPath, -1, msgs);
7373
assertTrue(result);
7474
assertTrue(new File(outputPath).exists());
7575
}
@@ -79,23 +79,23 @@ public void testCompressToGzip() {
7979
String outputPath = new File(testDirectory, "output.gz").getAbsolutePath();
8080
ArrayList<String> singleFileCollection = new ArrayList<>();
8181
singleFileCollection.add(files.get(0));
82-
Boolean result = GXCompressor.compress(singleFileCollection, outputPath, msgs);
82+
Boolean result = GXCompressor.compress(singleFileCollection, outputPath, -1, msgs);
8383
assertTrue(result);
8484
assertTrue(new File(outputPath).exists());
8585
}
8686

8787
@Test
8888
public void testCompressToJar() {
8989
String outputPath = new File(testDirectory, "output.jar").getAbsolutePath();
90-
Boolean result = GXCompressor.compress(files, outputPath, msgs);
90+
Boolean result = GXCompressor.compress(files, outputPath, -1, msgs);
9191
assertTrue(result);
9292
assertTrue(new File(outputPath).exists());
9393
}
9494

9595
@Test
9696
public void testUnsupportedFormat() {
9797
String outputPath = new File(testDirectory, "output.unknown").getAbsolutePath();
98-
Boolean result = GXCompressor.compress(files, outputPath, msgs);
98+
Boolean result = GXCompressor.compress(files, outputPath, -1, msgs);
9999
assertFalse(result);
100100
}
101101
}

0 commit comments

Comments
 (0)