| 1 | package com.renomad.minum.web; | |
| 2 | ||
| 3 | import java.util.Objects; | |
| 4 | ||
| 5 | /** | |
| 6 | * This class represents the information in the Content-Disposition | |
| 7 | * header of a multipart/form-data partition. Let's look at an example: | |
| 8 | * | |
| 9 | * <pre> | |
| 10 | * --i_am_a_boundary | |
| 11 | * Content-Type: text/plain | |
| 12 | * Content-Disposition: form-data; name="text1" | |
| 13 | * | |
| 14 | * I am a value that is text | |
| 15 | * --i_am_a_boundary | |
| 16 | * Content-Type: application/octet-stream | |
| 17 | * Content-Disposition: form-data; name="image_uploads"; filename="photo_preview.jpg" | |
| 18 | * </pre> | |
| 19 | * | |
| 20 | * <br> | |
| 21 | * In this example, there are two partitions, and each has a Content-Disposition header. | |
| 22 | * The first has a name of "text1" and the second has a name of "image_uploads". The | |
| 23 | * second partition also has a filename. | |
| 24 | * <br> | |
| 25 | * This is useful for filtering partition data when an endpoint receives multipart data. | |
| 26 | * | |
| 27 | */ | |
| 28 | public final class ContentDisposition { | |
| 29 | private final String name; | |
| 30 | private final String filename; | |
| 31 | ||
| 32 | public ContentDisposition(String name, String filename) { | |
| 33 | ||
| 34 | this.name = name; | |
| 35 | this.filename = filename; | |
| 36 | } | |
| 37 | ||
| 38 | public String getName() { | |
| 39 |
1
1. getName : replaced return value with "" for com/renomad/minum/web/ContentDisposition::getName → KILLED |
return name; |
| 40 | } | |
| 41 | ||
| 42 | public String getFilename() { | |
| 43 |
1
1. getFilename : replaced return value with "" for com/renomad/minum/web/ContentDisposition::getFilename → KILLED |
return filename; |
| 44 | } | |
| 45 | ||
| 46 | @Override | |
| 47 | public boolean equals(Object o) { | |
| 48 |
2
1. equals : replaced boolean return with false for com/renomad/minum/web/ContentDisposition::equals → TIMED_OUT 2. equals : negated conditional → KILLED |
if (this == o) return true; |
| 49 |
3
1. equals : negated conditional → KILLED 2. equals : replaced boolean return with true for com/renomad/minum/web/ContentDisposition::equals → KILLED 3. equals : negated conditional → KILLED |
if (o == null || getClass() != o.getClass()) return false; |
| 50 | ContentDisposition that = (ContentDisposition) o; | |
| 51 |
3
1. equals : negated conditional → KILLED 2. equals : negated conditional → KILLED 3. equals : replaced boolean return with true for com/renomad/minum/web/ContentDisposition::equals → KILLED |
return Objects.equals(name, that.name) && Objects.equals(filename, that.filename); |
| 52 | } | |
| 53 | ||
| 54 | @Override | |
| 55 | public int hashCode() { | |
| 56 |
1
1. hashCode : replaced int return with 0 for com/renomad/minum/web/ContentDisposition::hashCode → KILLED |
return Objects.hash(name, filename); |
| 57 | } | |
| 58 | ||
| 59 | @Override | |
| 60 | public String toString() { | |
| 61 |
1
1. toString : replaced return value with "" for com/renomad/minum/web/ContentDisposition::toString → KILLED |
return "ContentDisposition{" + |
| 62 | "name='" + name + '\'' + | |
| 63 | ", filename='" + filename + '\'' + | |
| 64 | '}'; | |
| 65 | } | |
| 66 | } | |
Mutations | ||
| 39 |
1.1 |
|
| 43 |
1.1 |
|
| 48 |
1.1 2.2 |
|
| 49 |
1.1 2.2 3.3 |
|
| 51 |
1.1 2.2 3.3 |
|
| 56 |
1.1 |
|
| 61 |
1.1 |