Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
dghgit committed Oct 22, 2023
2 parents 255207e + 685a5b7 commit 1cae543
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,83 +8,67 @@
*/
public class X500NameTokenizer
{
private String value;
private int index;
private char separator;
private StringBuffer buf = new StringBuffer();
private final String value;
private final char separator;

public X500NameTokenizer(
String oid)
private int index;

public X500NameTokenizer(String oid)
{
this(oid, ',');
}

public X500NameTokenizer(
String oid,
char separator)

public X500NameTokenizer(String oid, char separator)
{
// TODO Null or empty value should return zero tokens?
this.value = oid;
this.index = -1;
this.separator = separator;
}

public boolean hasMoreTokens()
{
return (index != value.length());
return index < value.length();
}

public String nextToken()
{
if (index == value.length())
if (index >= value.length())
{
return null;
}

int end = index + 1;
boolean quoted = false;
boolean escaped = false;

buf.setLength(0);

while (end != value.length())
int initialIndex = index;
while (++index < value.length())
{
char c = value.charAt(end);
char c = value.charAt(index);

if (c == '"')
if (escaped)
{
if (!escaped)
{
quoted = !quoted;
}
buf.append(c);
escaped = false;
}
else
else if (c == '"')
{
quoted = !quoted;
}
else if (quoted)
{
}
else if (c == '\\')
{
escaped = true;
}
else if (c == separator)
{
if (escaped || quoted)
{
buf.append(c);
escaped = false;
}
else if (c == '\\')
{
buf.append(c);
escaped = true;
}
else if (c == separator)
{
break;
}
else
{
buf.append(c);
}
break;
}
end++;
}

index = end;
// TODO Error if still escaped or quoted?

return buf.toString();
return value.substring(initialIndex + 1, index);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ static void appendCipherSuiteDetail(StringBuilder sb, ProvSSLContextSpi context,
sb.append(Hex.toHexString(new byte[]{ (byte)cipherSuite }));
sb.append('}');

String name = context.getCipherSuiteName(cipherSuite);
String name = ProvSSLContextSpi.getCipherSuiteName(cipherSuite);
if (name == null)
{
sb.append('?');
Expand Down

0 comments on commit 1cae543

Please sign in to comment.