Avoid too much nesting

This commit is contained in:
ByteHamster 2019-12-02 10:30:49 +01:00
parent cbcd97f6c9
commit 26e91c0b81
4 changed files with 175 additions and 164 deletions

View File

@ -244,5 +244,14 @@
<property name="exceptionVariableName" value="expected"/>
</module>
<module name="CommentsIndentation"/>
<module name="NestedIfDepth">
<property name="max" value="4"/>
</module>
<module name="NestedTryDepth">
<property name="max" value="2"/>
</module>
<module name="NestedForDepth">
<property name="max" value="2"/>
</module>
</module>
</module>

View File

@ -91,5 +91,14 @@
<property name="tokens" value="VARIABLE_DEF"/>
<property name="allowSamelineMultipleAnnotations" value="true"/>
</module>
<module name="NestedIfDepth">
<property name="max" value="4"/>
</module>
<module name="NestedTryDepth">
<property name="max" value="2"/>
</module>
<module name="NestedForDepth">
<property name="max" value="2"/>
</module>
</module>
</module>

View File

@ -97,12 +97,10 @@ public class NSAtom extends Namespace {
type = SyndTypeUtils.getMimeTypeFromUrl(href);
}
if(SyndTypeUtils.enclosureTypeValid(type)) {
FeedItem currItem = state.getCurrentItem();
if(currItem != null && !currItem.hasMedia()) {
if (SyndTypeUtils.enclosureTypeValid(type) && currItem != null && !currItem.hasMedia()) {
currItem.setMedia(new FeedMedia(currItem, href, size, type));
}
}
} else if (LINK_REL_PAYMENT.equals(rel)) {
state.getCurrentItem().setPaymentLink(href);
}

View File

@ -47,23 +47,18 @@ public class ID3Reader {
onEndTag();
} else {
while (readerPosition < tagHeader.getSize()) {
FrameHeader frameHeader = createFrameHeader(readBytes(
input, HEADER_LENGTH));
FrameHeader frameHeader = createFrameHeader(readBytes(input, HEADER_LENGTH));
if (checkForNullString(frameHeader.getId())) {
break;
} else {
}
rc = onStartFrameHeader(frameHeader, input);
if (rc == ACTION_SKIP) {
if (frameHeader.getSize() + readerPosition > tagHeader
.getSize()) {
if (frameHeader.getSize() + readerPosition > tagHeader.getSize()) {
break;
} else {
}
skipBytes(input, frameHeader.getSize());
}
}
}
}
onEndTag();
}
}