Peter Serwylo 930c906460 Allow bluetooth:// URLs to be parsed by java.net.URL.
Sets a stream handler in FDroidApp which understands bluetooth://
URLs and returns a non-functioning URL handler for such URLs.
The reason it is  non-funcitoning is because the openConnection()
function is not being used by the BluetoothDownloader at this point.

In the absense of this, a MalformedURLException is thrown.

The bluetooth stuff is still broken, but it is not broken in
this way any more.
2015-08-17 08:08:49 +10:00

18 lines
584 B
Java

package sun.net.www.protocol.bluetooth;
import java.io.IOException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLStreamHandler;
/**
* This class is added so that the bluetooth:// scheme we use for the {@link org.fdroid.fdroid.net.BluetoothDownloader}
* is not treated as invalid by the {@link URL} class.
*/
public class Handler extends URLStreamHandler {
@Override
protected URLConnection openConnection(URL u) throws IOException {
throw new UnsupportedOperationException("openConnection() not supported on bluetooth:// URLs");
}
}