Skip to content

Commit 83fcd86

Browse files
committed
Image: renamed field image to data.
Reported by PMD about field name that matches the declaring class name. No functional changes.
1 parent ecf1812 commit 83fcd86

File tree

6 files changed

+7
-7
lines changed

6 files changed

+7
-7
lines changed

src/env/dev/WEB-INF/classes/mysql-scheme.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
create table images (
2323
id integer not null auto_increment,
24-
image longblob not null,
24+
data longblob not null,
2525
type varchar(4) not null,
2626
primary key (id)
2727
) ENGINE=InnoDB;

src/env/test/WEB-INF/classes/h2-scheme.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
create table images (
2323
id integer generated by default as identity,
24-
image blob not null,
24+
data blob not null,
2525
type varchar(4) not null,
2626
primary key (id)
2727
);

src/main/java/ru/mystamps/web/controller/ImageController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ public void getImage(@PathVariable("id") final Integer id, final HttpServletResp
5353

5454
// TODO: set content disposition
5555
response.setContentType("image/" + image.getType().toString().toLowerCase());
56-
response.setContentLength(image.getImage().length);
56+
response.setContentLength(image.getData().length);
5757

58-
response.getOutputStream().write(image.getImage());
58+
response.getOutputStream().write(image.getData());
5959
}
6060

6161
}

src/main/java/ru/mystamps/web/entity/Image.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public class Image {
4949

5050
@Lob
5151
@Basic(optional = false, fetch = FetchType.LAZY)
52-
private byte[] image;
52+
private byte[] data;
5353

5454
public enum Type {
5555
JPEG, PNG

src/main/java/ru/mystamps/web/service/ImageService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ String save(final MultipartFile file) {
6060
image.setType(Image.Type.valueOf(extension.toUpperCase()));
6161

6262
try {
63-
image.setImage(file.getBytes());
63+
image.setData(file.getBytes());
6464
} catch (final IOException e) {
6565
// throw RuntimeException for rolling back transaction
6666
throw Throwables.propagate(e);

src/test/java/ru/mystamps/web/service/ImageServiceTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public void saveShouldPassFileContentToDao() throws IOException {
131131

132132
verify(imageDao).save(imageCaptor.capture());
133133

134-
assertThat(imageCaptor.getValue().getImage()).isEqualTo(expected);
134+
assertThat(imageCaptor.getValue().getData()).isEqualTo(expected);
135135
}
136136

137137
@Test

0 commit comments

Comments
 (0)