Utilities.java (was Re: Code Review Request: TLS 1.3 Implementation)

Weijun Wang weijun.wang at oracle.com
Thu Jun 7 04:49:19 UTC 2018



> On Jun 7, 2018, at 12:40 PM, Xuelei Fan <xuelei.fan at oracle.com> wrote:
> 
> On 6/6/2018 8:11 PM, Weijun Wang wrote:
>> Utilities.java:
>>   39     static final char[] hexDigits = "0123456789ABCDEF".toCharArray();
>>   40     private static final String indent = "  ";
>>   41     private static final Pattern lineBreakPatern =
>>   42                 Pattern.compile("\\r\\n|\\n|\\r");
>> Use UPPERCASE letters for final static fields.
> When the type is other than primitive type, using UPPERCASE may be not a better choice.  For example, LINE_BREAK_PATERN.split() looks weird to me.
> 
> Anyway, if you like to use UPPERCASE letters, I will make an update.

My understanding is that at least immutable static final fields should be UPPERCASE. You have the final decision.

--Max

> 
>>  147     static String indent(String source, String prefix) {
>>  148         StringBuilder builder = new StringBuilder();
>>  149         if (source == null) {
>>  150              builder.append("\n" + prefix + "<blank message>");
>>  151         } else {
>>  152             String[] lines = lineBreakPatern.split(source);
>> The split call would remove existing newline(s) at the end. Is this what you intended?
> Yes, it is intended.
> 
> Xuelei



More information about the security-dev mailing list