mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-14 16:40:30 +00:00
Use our own exception type for HTTP_NOT_FOUND, rather than reusing FileNotFoundException.
This commit is contained in:
parent
0999b3ba7f
commit
bff85b9f6c
3 changed files with 34 additions and 8 deletions
|
@ -17,7 +17,6 @@
|
|||
|
||||
package de.schildbach.pte;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.Serializable;
|
||||
|
@ -70,7 +69,6 @@ import de.schildbach.pte.dto.SuggestLocationsResult;
|
|||
import de.schildbach.pte.dto.Trip;
|
||||
import de.schildbach.pte.exception.InvalidDataException;
|
||||
import de.schildbach.pte.exception.ParserException;
|
||||
import de.schildbach.pte.exception.SessionExpiredException;
|
||||
import de.schildbach.pte.util.ParserUtils;
|
||||
import de.schildbach.pte.util.XmlPullUtil;
|
||||
|
||||
|
@ -2256,10 +2254,6 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
|||
{
|
||||
throw new ParserException("cannot parse xml: " + firstChars, x);
|
||||
}
|
||||
catch (final FileNotFoundException x)
|
||||
{
|
||||
throw new SessionExpiredException();
|
||||
}
|
||||
catch (final RuntimeException x)
|
||||
{
|
||||
throw new RuntimeException("uncategorized problem while processing " + uri, x);
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Copyright 2014 the original author or authors.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.schildbach.pte.exception;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* @author Andreas Schildbach
|
||||
*/
|
||||
public class NotFoundException extends AbstractHttpException
|
||||
{
|
||||
public NotFoundException(final URL url, final Reader errorReader)
|
||||
{
|
||||
super(url, errorReader);
|
||||
}
|
||||
}
|
|
@ -18,7 +18,6 @@
|
|||
package de.schildbach.pte.util;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
|
@ -42,6 +41,7 @@ import java.util.zip.GZIPInputStream;
|
|||
|
||||
import de.schildbach.pte.exception.BlockedException;
|
||||
import de.schildbach.pte.exception.InternalErrorException;
|
||||
import de.schildbach.pte.exception.NotFoundException;
|
||||
import de.schildbach.pte.exception.SessionExpiredException;
|
||||
import de.schildbach.pte.exception.UnexpectedRedirectException;
|
||||
|
||||
|
@ -197,7 +197,7 @@ public final class ParserUtils
|
|||
}
|
||||
else if (responseCode == HttpURLConnection.HTTP_NOT_FOUND)
|
||||
{
|
||||
throw new FileNotFoundException(url.toString());
|
||||
throw new NotFoundException(url, new InputStreamReader(connection.getErrorStream(), requestEncoding));
|
||||
}
|
||||
else if (responseCode == HttpURLConnection.HTTP_MOVED_PERM || responseCode == HttpURLConnection.HTTP_MOVED_TEMP)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue