mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-19 08:49:58 +00:00
Use FileNotFoundException in favour of own NotFoundException on HTTP status "not found".
This commit is contained in:
parent
7fcaf904dd
commit
84d47b6202
3 changed files with 5 additions and 51 deletions
|
@ -18,6 +18,7 @@
|
|||
package de.schildbach.pte;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
|
@ -69,7 +70,6 @@ import de.schildbach.pte.dto.StationDepartures;
|
|||
import de.schildbach.pte.dto.Stop;
|
||||
import de.schildbach.pte.dto.Trip;
|
||||
import de.schildbach.pte.exception.InvalidDataException;
|
||||
import de.schildbach.pte.exception.NotFoundException;
|
||||
import de.schildbach.pte.exception.ParserException;
|
||||
import de.schildbach.pte.exception.ProtocolException;
|
||||
import de.schildbach.pte.exception.SessionExpiredException;
|
||||
|
@ -2225,7 +2225,7 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
|||
{
|
||||
throw new ParserException(x);
|
||||
}
|
||||
catch (final NotFoundException x)
|
||||
catch (final FileNotFoundException x)
|
||||
{
|
||||
throw new SessionExpiredException();
|
||||
}
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
/*
|
||||
* Copyright 2013-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.IOException;
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* @author Andreas Schildbach
|
||||
*/
|
||||
public class NotFoundException extends IOException
|
||||
{
|
||||
private final URL url;
|
||||
|
||||
public NotFoundException()
|
||||
{
|
||||
this.url = null;
|
||||
}
|
||||
|
||||
public NotFoundException(final URL url)
|
||||
{
|
||||
super(url.toString());
|
||||
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public URL getUrl()
|
||||
{
|
||||
return url;
|
||||
}
|
||||
}
|
|
@ -18,6 +18,7 @@
|
|||
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;
|
||||
|
@ -41,7 +42,6 @@ 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.UnexpectedRedirectException;
|
||||
|
||||
/**
|
||||
|
@ -179,7 +179,7 @@ public final class ParserUtils
|
|||
}
|
||||
else if (responseCode == HttpURLConnection.HTTP_NOT_FOUND)
|
||||
{
|
||||
throw new NotFoundException(url);
|
||||
throw new FileNotFoundException(url.toString());
|
||||
}
|
||||
else if (responseCode == HttpURLConnection.HTTP_MOVED_PERM || responseCode == HttpURLConnection.HTTP_MOVED_TEMP)
|
||||
{
|
||||
|
@ -306,7 +306,7 @@ public final class ParserUtils
|
|||
}
|
||||
else if (responseCode == HttpURLConnection.HTTP_NOT_FOUND)
|
||||
{
|
||||
throw new NotFoundException(url);
|
||||
throw new FileNotFoundException(url.toString());
|
||||
}
|
||||
else if (responseCode == HttpURLConnection.HTTP_MOVED_PERM || responseCode == HttpURLConnection.HTTP_MOVED_TEMP)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue