-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
160 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,6 @@ | |
int filters_maxTotal() default 25; | ||
|
||
String memoryLimit() default "10%"; | ||
|
||
String progressive() default "jpeg"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+9.48 KB
...core-image/src/test/resources/com/enonic/xp/core/impl/image/not_progressive.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-139 Bytes
(82%)
.../core/core-image/src/test/resources/com/enonic/xp/core/impl/image/processed.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+8.41 KB
...ore/core-image/src/test/resources/com/enonic/xp/core/impl/image/progressive.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
63 changes: 63 additions & 0 deletions
63
modules/core/core-internal/src/main/java/com/enonic/xp/core/internal/SimpleCsvParser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package com.enonic.xp.core.internal; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public final class SimpleCsvParser | ||
{ | ||
private SimpleCsvParser() | ||
{ | ||
} | ||
|
||
public static List<String> parseLine( final String line ) | ||
{ | ||
final List<String> fields = new ArrayList<>(); | ||
final StringBuilder field = new StringBuilder(); | ||
boolean inQuotes = false; | ||
|
||
for ( int i = 0; i < line.length(); i++ ) | ||
{ | ||
char c = line.charAt( i ); | ||
|
||
if ( inQuotes ) | ||
{ | ||
if ( c == '\"' ) | ||
{ | ||
if ( i + 1 < line.length() && line.charAt( i + 1 ) == '\"' ) | ||
{ | ||
field.append( c ); | ||
i++; | ||
} | ||
else | ||
{ | ||
inQuotes = false; | ||
} | ||
} | ||
else | ||
{ | ||
field.append( c ); | ||
} | ||
} | ||
else | ||
{ | ||
if ( c == '\"' ) | ||
{ | ||
inQuotes = true; | ||
} | ||
else if ( c == ',' ) | ||
{ | ||
fields.add( field.toString() ); | ||
field.setLength( 0 ); | ||
} | ||
else | ||
{ | ||
field.append( c ); | ||
} | ||
} | ||
} | ||
|
||
fields.add( field.toString() ); | ||
|
||
return fields; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...les/core/core-internal/src/test/java/com/enonic/xp/core/internal/SimpleCsvParserTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.enonic.xp.core.internal; | ||
|
||
import java.util.List; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
class SimpleCsvParserTest | ||
{ | ||
@Test | ||
void parseLine() | ||
{ | ||
assertEquals( List.of( "a", "b", "c" ), SimpleCsvParser.parseLine( "a,b,c" ) ); | ||
assertEquals( List.of( "Cache-Control: no-store, private", " X-Instance: \"jupiter\"" ), | ||
SimpleCsvParser.parseLine( "\"Cache-Control: no-store, private\", \"X-Instance: \"\"jupiter\"\"\"" ) ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#scale.maxDimension = 8000 | ||
#filters.maxTotal = 25 | ||
#memoryLimit = 10% | ||
#progressive = jpeg |