Skip to content

Ref switch #29087

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,17 @@ private void runWebSocket() throws Exception {
private void readWebSocketFrame() throws IOException {
try {
Frame frame = Frame.read(this.inputStream);
if (frame.getType() == Frame.Type.PING) {
writeWebSocketFrame(new Frame(Frame.Type.PONG));
}
else if (frame.getType() == Frame.Type.CLOSE) {
throw new ConnectionClosedException();
}
else if (frame.getType() == Frame.Type.TEXT) {
logger.debug(LogMessage.format("Received LiveReload text frame %s", frame));
}
else {
throw new IOException("Unexpected Frame Type " + frame.getType());
switch (frame.getType()){
case PING:
writeWebSocketFrame(new Frame(Frame.Type.PONG));
case CLOSE:
throw new ConnectionClosedException();
case TEXT:
logger.debug(LogMessage.format("Received LiveReload text frame %s", frame));
default:
throw new IOException("Unexpected Frame Type " + frame.getType());
}

}
catch (SocketTimeoutException ex) {
writeWebSocketFrame(new Frame(Frame.Type.PING));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,15 @@ protected MergedContextConfiguration processMergedContextConfiguration(MergedCon
WebEnvironment webEnvironment = getWebEnvironment(mergedConfig.getTestClass());
if (webEnvironment != null && isWebEnvironmentSupported(mergedConfig)) {
WebApplicationType webApplicationType = getWebApplicationType(mergedConfig);
if (webApplicationType == WebApplicationType.SERVLET
&& (webEnvironment.isEmbedded() || webEnvironment == WebEnvironment.MOCK)) {
mergedConfig = new WebMergedContextConfiguration(mergedConfig, determineResourceBasePath(mergedConfig));
}
else if (webApplicationType == WebApplicationType.REACTIVE
&& (webEnvironment.isEmbedded() || webEnvironment == WebEnvironment.MOCK)) {
return new ReactiveWebMergedContextConfiguration(mergedConfig);
if(webEnvironment.isEmbedded() || webEnvironment == WebEnvironment.MOCK){
switch(webApplicationType){
case SERVLET:
mergedConfig = new WebMergedContextConfiguration(mergedConfig, determineResourceBasePath(mergedConfig));
case REACTIVE:
return new ReactiveWebMergedContextConfiguration(mergedConfig);
}
}

}
return mergedConfig;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,14 @@ private String getBaseUrl(boolean sslEnabled, String port) {

private String deduceBasePath() {
WebApplicationType webApplicationType = deduceFromApplicationContext(this.applicationContext.getClass());
if (webApplicationType == WebApplicationType.REACTIVE) {
return this.applicationContext.getEnvironment().getProperty("spring.webflux.base-path");
switch(webApplicationType){
case REACTIVE:
return this.applicationContext.getEnvironment().getProperty("spring.webflux.base-path");
case SERVLET:
return ((WebApplicationContext) this.applicationContext).getServletContext().getContextPath();
default :
return null;
}
else if (webApplicationType == WebApplicationType.SERVLET) {
return ((WebApplicationContext) this.applicationContext).getServletContext().getContextPath();
}
return null;
}

static WebApplicationType deduceFromApplicationContext(Class<?> applicationContextClass) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,20 +416,18 @@ private void beforeValue() throws JSONException {
}

Scope context = peek();
if (context == Scope.EMPTY_ARRAY) { // first in array
replaceTop(Scope.NONEMPTY_ARRAY);
newline();
}
else if (context == Scope.NONEMPTY_ARRAY) { // another in array
this.out.append(',');
newline();
}
else if (context == Scope.DANGLING_KEY) { // value for key
this.out.append(this.indent == null ? ":" : ": ");
replaceTop(Scope.NONEMPTY_OBJECT);
}
else if (context != Scope.NULL) {
throw new JSONException("Nesting problem");
switch (context){
case EMPTY_ARRAY:
replaceTop(Scope.NONEMPTY_ARRAY);
newline();
case NONEMPTY_ARRAY:
this.out.append(',');
newline();
case DANGLING_KEY:
this.out.append(this.indent == null ? ":" : ": ");
replaceTop(Scope.NONEMPTY_OBJECT);
case NULL:
throw new JSONException("Nesting problem");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ private OutputStream convertToFileOutputStream(ByteArrayOutputStream byteArrayOu
private void initializeTempFile() throws IOException {
if (this.tempFile == null) {
this.tempFile = File.createTempFile("springboot-", "-entrycontent");
this.tempFile.deleteOnExit();
this.tempFile.deleteOnExit();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,13 @@ public LibraryContentFilter(String coordinatesPattern) {
StringBuilder regex = new StringBuilder();
for (int i = 0; i < coordinatesPattern.length(); i++) {
char c = coordinatesPattern.charAt(i);
if (c == '.') {
regex.append("\\.");
}
else if (c == '*') {
regex.append(".*");
}
else {
regex.append(c);
switch (c){
case '.':
regex.append("\\.");
case '*':
regex.append(".*");
default :
regex.append(c);
}
}
this.pattern = Pattern.compile(regex.toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -902,29 +902,30 @@ Elements parse(Function<CharSequence, CharSequence> valueProcessor) {
ElementType type = ElementType.EMPTY;
for (int i = 0; i < length; i++) {
char ch = this.source.charAt(i);
if (ch == '[') {
if (openBracketCount == 0) {
switch (ch){
case '[':
if (openBracketCount == 0) {
add(start, i, type, valueProcessor);
start = i + 1;
type = ElementType.NUMERICALLY_INDEXED;
}
openBracketCount++;
}
else if (ch == ']') {
openBracketCount--;
if (openBracketCount == 0) {
add(start, i, type, valueProcessor);
start = i + 1;
type = ElementType.EMPTY;
}
}
else if (!type.isIndexed() && ch == this.separator) {
add(start, i, type, valueProcessor);
start = i + 1;
type = ElementType.EMPTY;
}
else {
type = updateType(type, ch, i - start);
}
openBracketCount++;
case ']':
openBracketCount--;
if (openBracketCount == 0) {
add(start, i, type, valueProcessor);
start = i + 1;
type = ElementType.EMPTY;
}
default:
if (!type.isIndexed() && ch == this.separator) {
add(start, i, type, valueProcessor);
start = i + 1;
type = ElementType.EMPTY;
}
else {
type = updateType(type, ch, i - start);
}
}
}
if (openBracketCount != 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,12 @@ boolean read(boolean wrappedLine) throws IOException {
}
}
}
if (this.character == '\\') {
this.escaped = true;
readEscaped();
}
else if (this.character == '\n') {
this.columnNumber = -1;
switch (this.character){
case '\\':
this.escaped = true;
readEscaped();
case '\n':
this.columnNumber = -1;
}
return !isEndOfFile();
}
Expand Down Expand Up @@ -262,12 +262,14 @@ private void readEscaped() throws IOException {
if (escapeIndex != -1) {
this.character = ESCAPES[1].charAt(escapeIndex);
}
else if (this.character == '\n') {
this.columnNumber = -1;
read(true);
}
else if (this.character == 'u') {
readUnicode();
else {
switch(this.character){
case '\n':
this.columnNumber = -1;
read(true);
case 'u':
readUnicode();
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
* message using the underlying {@link MessageInterpolator}.
*
* @author Dmytro Nosan
* @author Tharik Lourenco
*/
class MessageSourceMessageInterpolator implements MessageInterpolator {

Expand Down Expand Up @@ -78,20 +79,19 @@ private String replaceParameters(String message, Locale locale, Set<String> visi
int startIndex = -1;
int endIndex = -1;
for (int i = 0; i < buf.length(); i++) {
if (buf.charAt(i) == ESCAPE) {
i++;
}
else if (buf.charAt(i) == PREFIX) {
if (startIndex == -1) {
startIndex = i;
}
parentheses++;
}
else if (buf.charAt(i) == SUFFIX) {
if (parentheses > 0) {
parentheses--;
}
endIndex = i;
switch (buf.charAt(i)){
case ESCAPE:
i++;
case PREFIX:
if (startIndex == -1) {
startIndex = i;
}
parentheses++;
case SUFFIX:
if (parentheses > 0) {
parentheses--;
}
endIndex = i;
}
if (parentheses == 0 && startIndex < endIndex) {
String parameter = buf.substring(startIndex + 1, endIndex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,12 @@ protected void configureSsl(SslContextFactory.Server factory, Ssl ssl, SslStoreP
}

private void configureSslClientAuth(SslContextFactory.Server factory, Ssl ssl) {
if (ssl.getClientAuth() == Ssl.ClientAuth.NEED) {
factory.setNeedClientAuth(true);
factory.setWantClientAuth(true);
}
else if (ssl.getClientAuth() == Ssl.ClientAuth.WANT) {
factory.setWantClientAuth(true);
switch (ssl.getClientAuth()){
case NEED:
factory.setNeedClientAuth(true);
factory.setWantClientAuth(true);
case WANT:
factory.setWantClientAuth(true);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ protected AbstractProtocolSslContextSpec<?> createSslContextSpec() {
if (this.ssl.getCiphers() != null) {
builder.ciphers(Arrays.asList(this.ssl.getCiphers()));
}
if (this.ssl.getClientAuth() == Ssl.ClientAuth.NEED) {
builder.clientAuth(ClientAuth.REQUIRE);
}
else if (this.ssl.getClientAuth() == Ssl.ClientAuth.WANT) {
builder.clientAuth(ClientAuth.OPTIONAL);
switch (this.ssl.getClientAuth()){
case NEED :
builder.clientAuth(ClientAuth.REQUIRE);
case WANT:
builder.clientAuth(ClientAuth.OPTIONAL);
}
});
return sslContextSpec;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ private void configureSslClientAuth(SSLHostConfig config, Ssl ssl) {
}
else if (ssl.getClientAuth() == Ssl.ClientAuth.WANT) {
config.setCertificateVerification("optional");

}
}

Expand Down