Remove tab characters from last 6 files

This commit is contained in:
ByteHamster 2024-03-04 22:39:09 +01:00
parent c21edc8b79
commit 6c0f9eec62
7 changed files with 141 additions and 130 deletions

View File

@ -11,6 +11,10 @@
<property name="file" value="${config_loc}/suppressions.xml" /> <property name="file" value="${config_loc}/suppressions.xml" />
</module> </module>
<module name="FileTabCharacter">
<property name="eachLine" value="true"/>
</module>
<module name="TreeWalker"> <module name="TreeWalker">
<module name="OuterTypeFilename"/> <module name="OuterTypeFilename"/>
<module name="IllegalTokenText"> <module name="IllegalTokenText">

View File

@ -1,6 +1,8 @@
package de.danoeh.antennapod.core.export.opml; package de.danoeh.antennapod.core.export.opml;
/** Represents a single feed in an OPML file. */ /**
* Represents a single feed in an OPML file.
*/
public class OpmlElement { public class OpmlElement {
private String text; private String text;
private String xmlUrl; private String xmlUrl;

View File

@ -12,24 +12,21 @@ import java.util.ArrayList;
import de.danoeh.antennapod.core.BuildConfig; import de.danoeh.antennapod.core.BuildConfig;
/** Reads OPML documents. */ /**
* Reads OPML documents.
*/
public class OpmlReader { public class OpmlReader {
private static final String TAG = "OpmlReader"; private static final String TAG = "OpmlReader";
// ATTRIBUTES
private boolean isInOpml = false; private boolean isInOpml = false;
private ArrayList<OpmlElement> elementList;
/** /**
* Reads an Opml document and returns a list of all OPML elements it can * Reads an Opml document and returns a list of all OPML elements it can
* find * find
*
* @throws IOException
* @throws XmlPullParserException
*/ */
public ArrayList<OpmlElement> readDocument(Reader reader) public ArrayList<OpmlElement> readDocument(Reader reader)
throws XmlPullParserException, IOException { throws XmlPullParserException, IOException {
elementList = new ArrayList<>(); ArrayList<OpmlElement> elementList = new ArrayList<>();
XmlPullParserFactory factory = XmlPullParserFactory.newInstance(); XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
factory.setNamespaceAware(true); factory.setNamespaceAware(true);
XmlPullParser xpp = factory.newPullParser(); XmlPullParser xpp = factory.newPullParser();
@ -39,17 +36,20 @@ public class OpmlReader {
while (eventType != XmlPullParser.END_DOCUMENT) { while (eventType != XmlPullParser.END_DOCUMENT) {
switch (eventType) { switch (eventType) {
case XmlPullParser.START_DOCUMENT: case XmlPullParser.START_DOCUMENT:
if (BuildConfig.DEBUG) if (BuildConfig.DEBUG) {
Log.d(TAG, "Reached beginning of document"); Log.d(TAG, "Reached beginning of document");
}
break; break;
case XmlPullParser.START_TAG: case XmlPullParser.START_TAG:
if (xpp.getName().equals(OpmlSymbols.OPML)) { if (xpp.getName().equals(OpmlSymbols.OPML)) {
isInOpml = true; isInOpml = true;
if (BuildConfig.DEBUG) if (BuildConfig.DEBUG) {
Log.d(TAG, "Reached beginning of OPML tree."); Log.d(TAG, "Reached beginning of OPML tree.");
}
} else if (isInOpml && xpp.getName().equals(OpmlSymbols.OUTLINE)) { } else if (isInOpml && xpp.getName().equals(OpmlSymbols.OUTLINE)) {
if (BuildConfig.DEBUG) if (BuildConfig.DEBUG) {
Log.d(TAG, "Found new Opml element"); Log.d(TAG, "Found new Opml element");
}
OpmlElement element = new OpmlElement(); OpmlElement element = new OpmlElement();
final String title = xpp.getAttributeValue(null, OpmlSymbols.TITLE); final String title = xpp.getAttributeValue(null, OpmlSymbols.TITLE);
@ -70,18 +70,21 @@ public class OpmlReader {
} }
elementList.add(element); elementList.add(element);
} else { } else {
if (BuildConfig.DEBUG) if (BuildConfig.DEBUG) {
Log.d(TAG, Log.d(TAG, "Skipping element because of missing xml url");
"Skipping element because of missing xml url");
} }
} }
}
break;
default:
break; break;
} }
eventType = xpp.next(); eventType = xpp.next();
} }
if (BuildConfig.DEBUG) if (BuildConfig.DEBUG) {
Log.d(TAG, "Parsing finished."); Log.d(TAG, "Parsing finished.");
}
return elementList; return elementList;
} }

View File

@ -2,7 +2,9 @@ package de.danoeh.antennapod.core.export.opml;
import de.danoeh.antennapod.core.export.CommonSymbols; import de.danoeh.antennapod.core.export.CommonSymbols;
/** Contains symbols for reading and writing OPML documents. */ /**
* Contains symbols for reading and writing OPML documents.
*/
final class OpmlSymbols extends CommonSymbols { final class OpmlSymbols extends CommonSymbols {
public static final String OPML = "opml"; public static final String OPML = "opml";