Skip to content

Commit 83dde1a

Browse files
committed
disable online updates (for now)
* due to upstream changes out of our control, the UA database is no * longer free and updates will not work. we must fallback to the bundled * db until a workaround can be found and/or compatibility with the * commercial db can be implemented.
1 parent a641de6 commit 83dde1a

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ A fast User Agent parser library, using data from [user-agent-string.info](http:
55
<hr>
66
**NOTE:** As of December 1, 2014, the upstream User Agent database is no longer free and the old update URL is returning *bad data*.
77

8-
This means that the `OnlineUpdater`, `OnlineUpdateUASparser`, and `CachingOnlineUpdateUASparser` APIs will retrieve an incorrect database and **must be disabled immediately**.
8+
This means that the `OnlineUpdater`, `OnlineUpdateUASparser`, and `CachingOnlineUpdateUASparser` APIs will retrieve an incorrect database and **must be disabled immediately**. If you were using any of these methods, please update your code as in the example below.
99

1010
You may continue to use this library with the bundled UA database, as long as updating is disabled.
1111
<hr>

src/main/java/cz/mallat/uasparser/OnlineUpdater.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ public OnlineUpdater(UASparser parser, String cacheDir, long interval, TimeUnit
7878
updateInterval = units.toMillis(interval);
7979

8080
init();
81+
82+
if (true) { return; } // DISABLED - upstream db is no longer free and updates are impossible
83+
8184
start();
8285
}
8386

@@ -86,7 +89,10 @@ public OnlineUpdater(UASparser parser, String cacheDir, long interval, TimeUnit
8689
*/
8790
public void init() {
8891

89-
if (this.cacheFile.exists()) {
92+
if (false && this.cacheFile.exists()) {
93+
// DISABLED - upstream db is no longer free and updates are impossible and
94+
// cached db is probably bad by now, don't use it.
95+
if (true) { return; }
9096
try {
9197
parser.loadDataFromFile(cacheFile);
9298
this.currentVersion =

src/main/java/cz/mallat/uasparser/UASparser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public UserAgentInfo parse(String useragent) throws IOException {
101101
useragent = useragent.trim();
102102

103103
// check that the data maps are up-to-date (deprecated)
104-
checkDataMaps();
104+
// checkDataMaps(); // DISABLED - upstream db is no longer free and updates are impossible
105105

106106
// first check if it's a robot
107107
if (processRobot(useragent, uaInfo)) {

0 commit comments

Comments
 (0)