-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### Changed - bugfix: fixed bug in strange text cursor caret movement in the StyledDocumentWithChunk which has JComponents. - bugfix: fixed bug in dissapeared CR Jlabel component while editing in the ParmGenRegex. - bugfix: fixed bug in getting into infinite loop after sending request which contain no contents. - bugfix: fixed bug in problem when it cannot be displayed as ImageIcon in the StyledDocumentWithChunk. - maintenance: Added Deprecated Annotation for no meaning doing things in PRequest.
- Loading branch information
Showing
16 changed files
with
611 additions
and
272 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
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
50 changes: 50 additions & 0 deletions
50
...acrobuilder/src/main/java/org/zaproxy/zap/extension/automacrobuilder/PrintableString.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,50 @@ | ||
package org.zaproxy.zap.extension.automacrobuilder; | ||
|
||
import java.util.stream.IntStream; | ||
|
||
import static java.util.stream.Collectors.joining; | ||
|
||
public class PrintableString { | ||
|
||
private String nonPrintableString = null; | ||
|
||
public PrintableString(String nonPrintableString) { | ||
this.nonPrintableString = nonPrintableString; | ||
} | ||
|
||
public String convert(int len) { | ||
return convert(this.nonPrintableString, len); | ||
} | ||
|
||
public String convert(String original, int len) { | ||
this.nonPrintableString = original; | ||
|
||
if (original == null || original.isEmpty()) { | ||
return ""; | ||
} else if (len > 0 && len < original.length()) { | ||
int divideLen = len / 2; | ||
int reminderlen = len % 2; | ||
int originalLen = original.length(); | ||
original = original.substring(0, divideLen + reminderlen) + "..." + original.substring(originalLen - divideLen, originalLen); | ||
} | ||
|
||
String convertedString = ""; | ||
try (IntStream istream = original.chars()) { // after executed, then this resource automatically be freed. | ||
|
||
convertedString = istream.mapToObj(ci -> { | ||
String value = ""; | ||
if (ci <= 0x001f || ci == 0x007f || (ci >= 0x0080)) { | ||
try { | ||
value = String.format("%%%02x", ci); | ||
} catch (Exception e) { | ||
} | ||
} else { | ||
value = String.valueOf((char) ci); | ||
} | ||
return value; | ||
}).collect(joining()); | ||
} | ||
|
||
return convertedString; | ||
} | ||
} |
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
Oops, something went wrong.