Skip to content

Commit

Permalink
Polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
jhoeller committed May 10, 2022
1 parent de6180b commit c81e11d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -53,7 +53,7 @@
* @author Juergen Hoeller
* @since 2.5
* @see java.sql.SQLTransientException
* @see java.sql.SQLTransientException
* @see java.sql.SQLNonTransientException
* @see java.sql.SQLRecoverableException
*/
public class SQLExceptionSubclassTranslator extends AbstractFallbackSQLExceptionTranslator {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -100,13 +100,12 @@ private static Part partInternal(HttpHeaders headers, Content content) {


/**
* Abstract base class.
* Abstract base class for {@link Part} implementations.
*/
private static abstract class AbstractPart implements Part {

private final HttpHeaders headers;


protected AbstractPart(HttpHeaders headers) {
Assert.notNull(headers, "HttpHeaders is required");
this.headers = headers;
Expand All @@ -119,7 +118,6 @@ public String name() {
return name;
}


@Override
public HttpHeaders headers() {
return this.headers;
Expand Down Expand Up @@ -172,7 +170,6 @@ private static class DefaultPart extends AbstractPart {

protected final Content content;


public DefaultPart(HttpHeaders headers, Content content) {
super(headers);
this.content = content;
Expand All @@ -198,7 +195,6 @@ public String toString() {
return "DefaultPart";
}
}

}


Expand All @@ -213,7 +209,7 @@ public DefaultFilePart(HttpHeaders headers, Content content) {

@Override
public String filename() {
String filename = this.headers().getContentDisposition().getFilename();
String filename = headers().getContentDisposition().getFilename();
Assert.state(filename != null, "No filename found");
return filename;
}
Expand All @@ -235,7 +231,6 @@ public String toString() {
return "DefaultFilePart{(" + filename + ")}";
}
}

}


Expand All @@ -249,22 +244,20 @@ private interface Content {
Mono<Void> transferTo(Path dest);

Mono<Void> delete();

}


/**
* {@code Content} implementation based on a flux of data buffers.
*/
private static final class FluxContent implements Content {

private final Flux<DataBuffer> content;


public FluxContent(Flux<DataBuffer> content) {
this.content = content;
}


@Override
public Flux<DataBuffer> content() {
return this.content;
Expand All @@ -279,7 +272,6 @@ public Mono<Void> transferTo(Path dest) {
public Mono<Void> delete() {
return Mono.empty();
}

}


Expand All @@ -292,13 +284,11 @@ private static final class FileContent implements Content {

private final Scheduler scheduler;


public FileContent(Path file, Scheduler scheduler) {
this.file = file;
this.scheduler = scheduler;
}


@Override
public Flux<DataBuffer> content() {
return DataBufferUtils.readByteChannel(
Expand Down

0 comments on commit c81e11d

Please sign in to comment.