Skip to content

Commit

Permalink
Clean up code
Browse files Browse the repository at this point in the history
  • Loading branch information
benfortuna committed May 27, 2018
1 parent e60b312 commit 0bd51a9
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/main/java/net/fortuna/ical4j/model/Component.java
Expand Up @@ -328,7 +328,7 @@ public final PeriodList calculateRecurrenceSet(final Period period) {
List<RDate> rDates = getProperties(Property.RDATE);
// add recurrence dates..
for (RDate rdate : rDates) {
final Value rdateValue = (Value) rdate.getParameter(Parameter.VALUE);
final Value rdateValue = rdate.getParameter(Parameter.VALUE);
if (Value.PERIOD.equals(rdateValue)) {
for (final Period rdatePeriod : rdate.getPeriods()) {
if (period.intersects(rdatePeriod)) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/fortuna/ical4j/model/Property.java
Expand Up @@ -423,7 +423,7 @@ public final String toString() {
buffer.append(':');
boolean needsEscape = false;
if (this instanceof XProperty) {
Value valParam = (Value) getParameter(Parameter.VALUE);
Value valParam = getParameter(Parameter.VALUE);
if (valParam == null || valParam.equals(Value.TEXT)) {
needsEscape = true;
}
Expand Down
Expand Up @@ -640,7 +640,7 @@ public final DtEnd getEndDate(final boolean deriveFromDuration) {
}

dtEnd = new DtEnd(Dates.getInstance(vEventDuration.getDuration()
.getTime(dtStart.getDate()), (Value) dtStart
.getTime(dtStart.getDate()), dtStart
.getParameter(Parameter.VALUE)));
if (dtStart.isUtc()) {
dtEnd.setUtc(true);
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/net/fortuna/ical4j/model/property/Attach.java
Expand Up @@ -125,11 +125,10 @@ public Attach() {
/**
* @param aList a list of parameters for this component
* @param aValue a value string for this component
* @throws IOException when there is an error reading the binary stream
* @throws URISyntaxException where the specified string is not a valid uri
*/
public Attach(final ParameterList aList, final String aValue)
throws IOException, URISyntaxException {
throws URISyntaxException {
super(ATTACH, aList, new Factory());
setValue(aValue);
}
Expand Down Expand Up @@ -235,7 +234,7 @@ public final void setValue(final String aValue) throws
try {
final BinaryDecoder decoder = DecoderFactory.getInstance()
.createBinaryDecoder(
(Encoding) getParameter(Parameter.ENCODING));
getParameter(Parameter.ENCODING));
binary = decoder.decode(aValue.getBytes());
} catch (UnsupportedEncodingException uee) {
Logger log = LoggerFactory.getLogger(Attach.class);
Expand All @@ -262,7 +261,7 @@ public final String getValue() {
try {
final BinaryEncoder encoder = EncoderFactory.getInstance()
.createBinaryEncoder(
(Encoding) getParameter(Parameter.ENCODING));
getParameter(Parameter.ENCODING));
return new String(encoder.encode(getBinary()));
} catch (UnsupportedEncodingException | EncoderException uee) {
Logger log = LoggerFactory.getLogger(Attach.class);
Expand Down
Expand Up @@ -108,7 +108,7 @@ public final DateList getDates() {
* {@inheritDoc}
*/
public void setValue(final String aValue) throws ParseException {
dates = new DateList(aValue, (Value) getParameter(Parameter.VALUE),
dates = new DateList(aValue, getParameter(Parameter.VALUE),
timeZone);
}

Expand Down
Expand Up @@ -243,7 +243,7 @@ public void validate() throws ValidationException {
getParameters());
}

final Value value = (Value) getParameter(Parameter.VALUE);
final Value value = getParameter(Parameter.VALUE);

if (getDate() instanceof DateTime) {

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/fortuna/ical4j/util/Calendars.java
Expand Up @@ -161,7 +161,7 @@ public static Calendar[] split(final Calendar calendar) {
}

for (final Property p : c.getProperties()) {
final TzId tzid = (TzId) p.getParameter(Parameter.TZID);
final TzId tzid = p.getParameter(Parameter.TZID);
if (tzid != null) {
final VTimeZone timezone = timezones.getComponent(tzid.getValue());
if (!uidCal.getComponents().contains(timezone)) {
Expand Down
Expand Up @@ -60,7 +60,7 @@ public void validate(Calendar target) throws ValidationException {

// if (!CompatibilityHints.isHintEnabled(CompatibilityHints.KEY_RELAXED_VALIDATION)) {
// validate method..
final Method method = (Method) target.getProperty(Property.METHOD);
final Method method = target.getProperty(Property.METHOD);
if (Method.PUBLISH.equals(method)) {
if (target.getComponent(Component.VEVENT) != null) {
ComponentValidator.assertNone(Component.VFREEBUSY, target.getComponents());
Expand Down

0 comments on commit 0bd51a9

Please sign in to comment.