commit 8d02e8529ffc757be17dea188d239c333a62eee1 Author: Karsten Loesing karsten.loesing@gmx.net Date: Thu Oct 20 13:22:07 2011 +0200
Fix a String encoding problem with OpenJDK. --- .../cron/RelayDescriptorDatabaseImporter.java | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/src/org/torproject/ernie/cron/RelayDescriptorDatabaseImporter.java b/src/org/torproject/ernie/cron/RelayDescriptorDatabaseImporter.java index f8f1e9a..4a9f97c 100644 --- a/src/org/torproject/ernie/cron/RelayDescriptorDatabaseImporter.java +++ b/src/org/torproject/ernie/cron/RelayDescriptorDatabaseImporter.java @@ -496,8 +496,12 @@ public final class RelayDescriptorDatabaseImporter { this.psD.setLong(7, bandwidthAvg); this.psD.setLong(8, bandwidthBurst); this.psD.setLong(9, bandwidthObserved); + /* Remove all non-ASCII characters from the platform string, or + * we'll make Postgres unhappy. Sun's JDK and OpenJDK behave + * differently when creating a new String with a given encoding. + * That's what the regexp below is for. */ this.psD.setString(10, new String(platform.getBytes(), - "US-ASCII")); + "US-ASCII").replaceAll("[^\p{ASCII}]","")); this.psD.setTimestamp(11, new Timestamp(published), cal); this.psD.setLong(12, uptime); this.psD.setString(13, extraInfoDigest);
tor-commits@lists.torproject.org