Author: j16sdiz
Date: 2008-05-04 10:13:59 +0000 (Sun, 04 May 2008)
New Revision: 19726

Modified:
   trunk/freenet/src/freenet/clients/http/HTTPRequestImpl.java
   trunk/freenet/src/freenet/clients/http/QueueToadlet.java
   trunk/freenet/src/freenet/clients/http/Spider.java
   trunk/freenet/src/freenet/clients/http/Toadlet.java
   trunk/freenet/src/freenet/clients/http/filter/GenericReadFilterCallback.java
   trunk/freenet/src/freenet/clients/http/filter/JPEGFilter.java
   trunk/freenet/src/freenet/crypt/Yarrow.java
   trunk/freenet/src/freenet/frost/message/FrostMessage.java
   trunk/freenet/src/freenet/keys/ClientKSK.java
   trunk/freenet/src/freenet/keys/ClientSSK.java
   trunk/freenet/src/freenet/node/DarknetPeerNode.java
   trunk/freenet/src/freenet/node/FNPPacketMangler.java
   trunk/freenet/src/freenet/node/NodeARKInserter.java
   trunk/freenet/src/freenet/node/NodeCrypto.java
   trunk/freenet/src/freenet/node/PeerManager.java
   trunk/freenet/src/freenet/node/PeerNode.java
   trunk/freenet/src/freenet/node/SSKInsertHandler.java
   trunk/freenet/src/freenet/node/fcp/ClientPut.java
   trunk/freenet/src/freenet/node/fcp/PeerNote.java
   trunk/freenet/src/freenet/support/SimpleFieldSet.java
   trunk/freenet/src/freenet/support/URIPreEncoder.java
   trunk/freenet/src/freenet/support/URLDecoder.java
   trunk/freenet/src/freenet/support/URLEncoder.java
   trunk/freenet/src/freenet/support/compress/GzipCompressor.java
Log:
consistant exception for impossible exception (utf-8 / iso-8859-1 not supported)


Modified: trunk/freenet/src/freenet/clients/http/HTTPRequestImpl.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/HTTPRequestImpl.java 2008-05-04 
09:43:00 UTC (rev 19725)
+++ trunk/freenet/src/freenet/clients/http/HTTPRequestImpl.java 2008-05-04 
10:13:59 UTC (rev 19726)
@@ -203,7 +203,7 @@
                                                name = URLDecoder.decode(name, 
"UTF-8");
                                                value = 
URLDecoder.decode(value, "UTF-8");
                                        } catch (UnsupportedEncodingException 
e) {
-                                               throw new Error(e);
+                                               throw new 
RuntimeException("Impossible: JVM doesn't support UTF-8: " + e, e);
                                        }
                                if(logMINOR) {
                                        Logger.minor(this, "Decoded name: 
"+name);
@@ -217,7 +217,7 @@
                                try {
                                        buf = value.getBytes("UTF-8");
                                } catch (UnsupportedEncodingException e) {
-                                       throw new Error(e);
+                                       throw new RuntimeException("Impossible: 
JVM doesn't support UTF-8: " + e, e);
                                } // FIXME some other encoding?
                                Bucket b = new SimpleReadOnlyArrayBucket(buf);
                                parts.put(name, b);
@@ -564,9 +564,8 @@
                try {
                        return new String(getPartAsBytes(name, maxlength), 
"UTF-8");
                } catch (UnsupportedEncodingException e) {
-                       /* UTF-8 is always supported. */
+                       throw new RuntimeException("Impossible: JVM doesn't 
support UTF-8: " + e, e);
                }
-               return null;
        }

        /* (non-Javadoc)

Modified: trunk/freenet/src/freenet/clients/http/QueueToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/QueueToadlet.java    2008-05-04 
09:43:00 UTC (rev 19725)
+++ trunk/freenet/src/freenet/clients/http/QueueToadlet.java    2008-05-04 
10:13:59 UTC (rev 19726)
@@ -1161,7 +1161,7 @@
                        // Normal
                        return false;
                } catch (UnsupportedEncodingException e) {
-                       throw new RuntimeException(e);
+                       throw new RuntimeException("Impossible: JVM doesn't 
support UTF-8: " + e, e);
                } catch (IOException e) {
                        Logger.error(this, "Could not read completed 
identifiers list from "+file);
                        return false;

Modified: trunk/freenet/src/freenet/clients/http/Spider.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/Spider.java  2008-05-04 09:43:00 UTC 
(rev 19725)
+++ trunk/freenet/src/freenet/clients/http/Spider.java  2008-05-04 10:13:59 UTC 
(rev 19726)
@@ -243,7 +243,7 @@
                try {
                        osw = new OutputStreamWriter(fos, "UTF-8");
                } catch (UnsupportedEncodingException e) {
-                       throw new Error(e);
+                       throw new RuntimeException("Impossible: JVM doesn't 
support UTF-8: " + e, e);
                }

                if (urisByWord.isEmpty() || urisWithWords.isEmpty()) {

Modified: trunk/freenet/src/freenet/clients/http/Toadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/Toadlet.java 2008-05-04 09:43:00 UTC 
(rev 19725)
+++ trunk/freenet/src/freenet/clients/http/Toadlet.java 2008-05-04 10:13:59 UTC 
(rev 19726)
@@ -186,8 +186,7 @@
                try {
                        buf = redirDoc.getBytes("UTF-8");
                } catch (UnsupportedEncodingException e) {
-                       // No way!
-                       throw new Error(e);
+                       throw new RuntimeException("Impossible: JVM doesn't 
support UTF-8: " + e, e);
                }
                ctx.sendReplyHeaders(301, "Moved Permanently", mvt, "text/html; 
charset=UTF-8", buf.length);
                ctx.writeData(buf, 0, buf.length);
@@ -207,8 +206,7 @@
                try {
                        buf = redirDoc.getBytes("UTF-8");
                } catch (UnsupportedEncodingException e) {
-                       // No way!
-                       throw new Error(e);
+                       throw new RuntimeException("Impossible: JVM doesn't 
support UTF-8: " + e, e);
                }
                ctx.sendReplyHeaders(302, "Found", mvt, "text/html; 
charset=UTF-8", buf.length);
                ctx.writeData(buf, 0, buf.length);

Modified: 
trunk/freenet/src/freenet/clients/http/filter/GenericReadFilterCallback.java
===================================================================
--- 
trunk/freenet/src/freenet/clients/http/filter/GenericReadFilterCallback.java    
    2008-05-04 09:43:00 UTC (rev 19725)
+++ 
trunk/freenet/src/freenet/clients/http/filter/GenericReadFilterCallback.java    
    2008-05-04 10:13:59 UTC (rev 19726)
@@ -239,6 +239,7 @@
                                // FIXME encode it properly
                                        p += 
URLEncoder.encode(u.getFragment(),"UTF-8");
                                }catch (UnsupportedEncodingException e1){
+                                       throw new RuntimeException("Impossible: 
JVM doesn't support UTF-8: " + e, e);
                                }
                        }
                        return p;

Modified: trunk/freenet/src/freenet/clients/http/filter/JPEGFilter.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/filter/JPEGFilter.java       
2008-05-04 09:43:00 UTC (rev 19725)
+++ trunk/freenet/src/freenet/clients/http/filter/JPEGFilter.java       
2008-05-04 10:13:59 UTC (rev 19726)
@@ -370,7 +370,7 @@
                        baos.write(data);
                        baos.write(0);
                } catch (UnsupportedEncodingException e) {
-                       throw new Error(e);
+                       throw new RuntimeException("Impossible: JVM doesn't 
support ISO-8859-1: " + e, e);
                }
        }


Modified: trunk/freenet/src/freenet/crypt/Yarrow.java
===================================================================
--- trunk/freenet/src/freenet/crypt/Yarrow.java 2008-05-04 09:43:00 UTC (rev 
19725)
+++ trunk/freenet/src/freenet/crypt/Yarrow.java 2008-05-04 10:13:59 UTC (rev 
19726)
@@ -739,7 +739,7 @@
                try {
                        b = str.getBytes("UTF-8");
                } catch (UnsupportedEncodingException e) {
-                       throw new Error(e);
+                       throw new RuntimeException("Impossible: JVM doesn't 
support UTF-8: " + e, e);
                }
                consumeBytes(b);
        }

Modified: trunk/freenet/src/freenet/frost/message/FrostMessage.java
===================================================================
--- trunk/freenet/src/freenet/frost/message/FrostMessage.java   2008-05-04 
09:43:00 UTC (rev 19725)
+++ trunk/freenet/src/freenet/frost/message/FrostMessage.java   2008-05-04 
10:13:59 UTC (rev 19726)
@@ -283,7 +283,7 @@
                try {
                        data = this.getXml().getBytes("UTF-8");
                } catch (UnsupportedEncodingException e1) {
-                       throw new Error(e1);
+                       throw new RuntimeException("Impossible: JVM doesn't 
support UTF-8: " + e1, e1);
                }
        InsertBlock block = null;


Modified: trunk/freenet/src/freenet/keys/ClientKSK.java
===================================================================
--- trunk/freenet/src/freenet/keys/ClientKSK.java       2008-05-04 09:43:00 UTC 
(rev 19725)
+++ trunk/freenet/src/freenet/keys/ClientKSK.java       2008-05-04 10:13:59 UTC 
(rev 19726)
@@ -40,7 +40,7 @@
                        try {
                                keywordHash = 
md256.digest(keyword.getBytes("UTF-8"));
                        } catch (UnsupportedEncodingException e) {
-                               throw new Error(e);
+                               throw new RuntimeException("Impossible: JVM 
doesn't support UTF-8: " + e, e);
                        }
                        MersenneTwister mt = new MersenneTwister(keywordHash);
                        DSAPrivateKey privKey = new 
DSAPrivateKey(Global.DSAgroupBigA, mt);

Modified: trunk/freenet/src/freenet/keys/ClientSSK.java
===================================================================
--- trunk/freenet/src/freenet/keys/ClientSSK.java       2008-05-04 09:43:00 UTC 
(rev 19725)
+++ trunk/freenet/src/freenet/keys/ClientSSK.java       2008-05-04 10:13:59 UTC 
(rev 19726)
@@ -63,7 +63,7 @@
                        try {
                                md.update(docName.getBytes("UTF-8"));
                        } catch (UnsupportedEncodingException e) {
-                               throw new Error(e);
+                               throw new RuntimeException("Impossible: JVM 
doesn't support UTF-8: " + e, e);
                        }
                        byte[] buf = md.digest();
                        try {

Modified: trunk/freenet/src/freenet/node/DarknetPeerNode.java
===================================================================
--- trunk/freenet/src/freenet/node/DarknetPeerNode.java 2008-05-04 09:43:00 UTC 
(rev 19725)
+++ trunk/freenet/src/freenet/node/DarknetPeerNode.java 2008-05-04 10:13:59 UTC 
(rev 19726)
@@ -411,7 +411,7 @@
                try {
                        isr = new InputStreamReader(fis, "UTF-8");
                } catch (UnsupportedEncodingException e) {
-                       throw new Error("Impossible: JVM doesn't support UTF-8: 
"+e, e);
+                       throw new RuntimeException("Impossible: JVM doesn't 
support UTF-8: " + e, e);
                }
                BufferedReader br = new BufferedReader(isr);
                SimpleFieldSet fs = null;
@@ -503,7 +503,7 @@
                                        n2nm = 
DMT.createNodeToNodeMessage(type, fs.toString().getBytes("UTF-8"));
                                } catch (UnsupportedEncodingException e) {
                                        Logger.error(this, 
"UnsupportedEncodingException processing extraPeerDataType 
("+extraPeerDataTypeString+") in file "+extraPeerDataFile.getPath(), e);
-                                       return false;
+                                       throw new RuntimeException("Impossible: 
JVM doesn't support UTF-8: " + e, e);
                                }

                                try {
@@ -578,7 +578,7 @@
                try {
                        w = new OutputStreamWriter(fos, "UTF-8");
                } catch (UnsupportedEncodingException e2) {
-                       throw new Error("UTF-8 unsupported!: "+e2, e2);
+                       throw new RuntimeException("Impossible: JVM doesn't 
support UTF-8: " + e2, e2);
                }
                BufferedWriter bw = new BufferedWriter(w);
                try {
@@ -676,7 +676,7 @@
                try {
                        w = new OutputStreamWriter(fos, "UTF-8");
                } catch (UnsupportedEncodingException e2) {
-                       throw new Error("JVM doesn't support UTF-8 charset!: 
"+e2, e2);
+                       throw new RuntimeException("Impossible: JVM doesn't 
support UTF-8: " + e2, e2);
                }
                BufferedWriter bw = new BufferedWriter(w);
                try {
@@ -709,7 +709,7 @@
                try {
                        fs.putSingle("privateDarknetComment", 
Base64.encode(comment.getBytes("UTF-8")));
                } catch (UnsupportedEncodingException e) {
-                       throw new Error(e);
+                       throw new RuntimeException("Impossible: JVM doesn't 
support UTF-8: " + e, e);
                }
                if(localFileNumber == -1) {
                        localFileNumber = writeNewExtraPeerDataFile(fs, 
Node.EXTRA_PEER_DATA_TYPE_PEER_NOTE);
@@ -810,7 +810,7 @@
                                try {
                                        s = new String(Base64.decode(s), 
"UTF-8");
                                } catch (UnsupportedEncodingException e) {
-                                       throw new Error(e);
+                                       throw new RuntimeException("Impossible: 
JVM doesn't support UTF-8: " + e, e);
                                } catch (IllegalBase64Exception e) {
                                        // Maybe it wasn't encoded? FIXME remove
                                }
@@ -826,7 +826,7 @@
                        try {
                                fs.putSingle("comment", 
Base64.encode(comment.getBytes("UTF-8")));
                        } catch (UnsupportedEncodingException e) {
-                               throw new Error(e);
+                               throw new RuntimeException("Impossible: JVM 
doesn't support UTF-8: " + e, e);
                        }
                        fs.put("size", size);
                }
@@ -1262,7 +1262,7 @@
                        this.setPeerNodeStatus(System.currentTimeMillis());
                        return getPeerNodeStatus();
                } catch (UnsupportedEncodingException e) {
-                       throw new Error("Impossible: "+e, e);
+                       throw new RuntimeException("Impossible: JVM doesn't 
support UTF-8: " + e, e);
                }
        }

@@ -1296,7 +1296,7 @@
                        this.setPeerNodeStatus(System.currentTimeMillis());
                        return getPeerNodeStatus();
                } catch (UnsupportedEncodingException e) {
-                       throw new Error("Impossible: "+e, e);
+                       throw new RuntimeException("Impossible: JVM doesn't 
support UTF-8: " + e, e);
                }
        }

@@ -1330,7 +1330,7 @@
                        this.setPeerNodeStatus(System.currentTimeMillis());
                        return getPeerNodeStatus();
                } catch (UnsupportedEncodingException e) {
-                       throw new Error("Impossible: "+e, e);
+                       throw new RuntimeException("Impossible: JVM doesn't 
support UTF-8: " + e, e);
                }
        }

@@ -1372,7 +1372,7 @@
                        }
                        return status;
                } catch (UnsupportedEncodingException e) {
-                       throw new Error("Impossible: "+e, e);
+                       throw new RuntimeException("Impossible: JVM doesn't 
support UTF-8: " + e, e);
                }
        }


Modified: trunk/freenet/src/freenet/node/FNPPacketMangler.java
===================================================================
--- trunk/freenet/src/freenet/node/FNPPacketMangler.java        2008-05-04 
09:43:00 UTC (rev 19725)
+++ trunk/freenet/src/freenet/node/FNPPacketMangler.java        2008-05-04 
10:13:59 UTC (rev 19726)
@@ -82,8 +82,12 @@
        private static final byte[] JFK_PREFIX_INITIATOR, JFK_PREFIX_RESPONDER;
        static {
                byte[] I = null,R = null;
-               try { I = "I".getBytes("UTF-8"); } catch 
(UnsupportedEncodingException e) {}
-               try { R = "R".getBytes("UTF-8"); } catch 
(UnsupportedEncodingException e) {}
+               try {
+                       I = "I".getBytes("UTF-8");
+                       R = "R".getBytes("UTF-8");
+               } catch (UnsupportedEncodingException e) {
+                       throw new RuntimeException("Impossible: JVM doesn't 
support UTF-8: " + e, e);
+               }

                JFK_PREFIX_INITIATOR = I;
                JFK_PREFIX_RESPONDER = R;
@@ -2788,7 +2792,11 @@
        private byte[] computeJFKSharedKey(BigInteger exponential, byte[] nI, 
byte[] nR, String what) {
                assert("0".equals(what) || "1".equals(what) || 
"2".equals(what));
                byte[] number = null;
-               try { number = what.getBytes("UTF-8"); } catch 
(UnsupportedEncodingException e) {}
+               try {
+                       number = what.getBytes("UTF-8");
+               } catch (UnsupportedEncodingException e) {
+                       throw new RuntimeException("Impossible: JVM doesn't 
support UTF-8: " + e, e);
+               }

                byte[] toHash = new byte[NONCE_SIZE * 2 + number.length];
                int offset = 0;

Modified: trunk/freenet/src/freenet/node/NodeARKInserter.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeARKInserter.java 2008-05-04 09:43:00 UTC 
(rev 19725)
+++ trunk/freenet/src/freenet/node/NodeARKInserter.java 2008-05-04 10:13:59 UTC 
(rev 19726)
@@ -143,7 +143,7 @@
                try {
                        buf = s.getBytes("UTF-8");
                } catch (UnsupportedEncodingException e) {
-                       throw new Error("UTF-8 not supported");
+                       throw new RuntimeException("Impossible: JVM doesn't 
support UTF-8: " + e, e);
                }

                Bucket b = new SimpleReadOnlyArrayBucket(buf);

Modified: trunk/freenet/src/freenet/node/NodeCrypto.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeCrypto.java      2008-05-04 09:43:00 UTC 
(rev 19725)
+++ trunk/freenet/src/freenet/node/NodeCrypto.java      2008-05-04 10:13:59 UTC 
(rev 19726)
@@ -358,10 +358,10 @@
                        return _signature;
                } catch(UnsupportedEncodingException e){
                        //duh ?
-                       Logger.error(this, "Error while signing the node 
identity!"+e);
+                       Logger.error(this, "Error while signing the node 
identity!" + e, e);
                        System.err.println("Error while signing the node 
identity!"+e);
                        e.printStackTrace();
-                       throw new 
NodeInitException(NodeInitException.EXIT_CRAPPY_JVM, "UTF-8 not supported!");
+                       throw new 
NodeInitException(NodeInitException.EXIT_CRAPPY_JVM, "Impossible: JVM doesn't 
support UTF-8");
                }
        }


Modified: trunk/freenet/src/freenet/node/PeerManager.java
===================================================================
--- trunk/freenet/src/freenet/node/PeerManager.java     2008-05-04 09:43:00 UTC 
(rev 19725)
+++ trunk/freenet/src/freenet/node/PeerManager.java     2008-05-04 10:13:59 UTC 
(rev 19726)
@@ -191,7 +191,7 @@
                try {
                        ris = new InputStreamReader(fis, "UTF-8");
                } catch (UnsupportedEncodingException e4) {
-                       throw new Error("UTF-8 not supported!: "+e4, e4);
+                       throw new RuntimeException("Impossible: JVM doesn't 
support UTF-8: " + e4, e4);
                }
         BufferedReader br = new BufferedReader(ris);
         try { // FIXME: no better way?
@@ -1040,7 +1040,7 @@
                                w = new OutputStreamWriter(fos, "UTF-8");
                        } catch (UnsupportedEncodingException e2) {
                                Closer.close(w);
-                               throw new Error("UTF-8 unsupported!: "+e2, e2);
+                               throw new RuntimeException("Impossible: JVM 
doesn't support UTF-8: " + e2, e2);
                        }
             BufferedWriter bw = new BufferedWriter(w);
             try {

Modified: trunk/freenet/src/freenet/node/PeerNode.java
===================================================================
--- trunk/freenet/src/freenet/node/PeerNode.java        2008-05-04 09:43:00 UTC 
(rev 19725)
+++ trunk/freenet/src/freenet/node/PeerNode.java        2008-05-04 10:13:59 UTC 
(rev 19726)
@@ -263,7 +263,7 @@
                try {
                        TEST_AS_BYTES = "test".getBytes("UTF-8");
                } catch (UnsupportedEncodingException e) {
-                       throw new Error(e);
+                       throw new RuntimeException("Impossible: JVM doesn't 
support UTF-8: " + e, e);
                }
        }

@@ -445,11 +445,7 @@
                                        Logger.error(this, "Invalid reference: 
" + e, e);
                                        throw new 
ReferenceSignatureVerificationException("The node reference you added is 
invalid: It does not have a valid signature.");
                                } catch(UnsupportedEncodingException e) {
-                                       //   duh ?
-                                       Logger.error(this, "Error while signing 
the node identity!" + e);
-                                       System.err.println("Error while signing 
the node identity!" + e);
-                                       e.printStackTrace();
-                                       
node.exit(NodeInitException.EXIT_CRAPPY_JVM);
+                                       throw new RuntimeException("Impossible: 
JVM doesn't support UTF-8: " + e, e);
                                }
                        } else {
                                // Local is always good (assumed)
@@ -2228,7 +2224,7 @@
                try {
                        isr = new InputStreamReader(bais, "UTF-8");
                } catch(UnsupportedEncodingException e1) {
-                       throw new Error(e1);
+                       throw new RuntimeException("Impossible: JVM doesn't 
support UTF-8: " + e1, e1);
                }
                BufferedReader br = new BufferedReader(isr);
                try {
@@ -3200,8 +3196,7 @@
                try {
                        ref = new String(data, "UTF-8");
                } catch(UnsupportedEncodingException e) {
-                       // Yeah, right.
-                       throw new Error(e);
+                       throw new RuntimeException("Impossible: JVM doesn't 
support UTF-8: " + e, e);
                }

                SimpleFieldSet fs;
@@ -3779,7 +3774,7 @@
                                }
                        }
                } catch (UnsupportedEncodingException e) {
-                       throw new Error("Impossible: "+e, e);
+                       throw new RuntimeException("Impossible: JVM doesn't 
support UTF-8: " + e, e);
                }
        }


Modified: trunk/freenet/src/freenet/node/SSKInsertHandler.java
===================================================================
--- trunk/freenet/src/freenet/node/SSKInsertHandler.java        2008-05-04 
09:43:00 UTC (rev 19725)
+++ trunk/freenet/src/freenet/node/SSKInsertHandler.java        2008-05-04 
10:13:59 UTC (rev 19726)
@@ -239,7 +239,7 @@
                                        block = new SSKBlock(data, headers, 
key, true);
                                } catch (SSKVerifyException e1) {
                                        // Is verified elsewhere...
-                                       throw new Error("Impossible: "+e1);
+                                       throw new RuntimeException("Impossible: 
" + e1, e1);
                                }
                                try {
                                        RequestHandler.sendSSK(headers, data, 
false, pubKey, source, uid, this);

Modified: trunk/freenet/src/freenet/node/fcp/ClientPut.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/ClientPut.java   2008-05-04 09:43:00 UTC 
(rev 19725)
+++ trunk/freenet/src/freenet/node/fcp/ClientPut.java   2008-05-04 10:13:59 UTC 
(rev 19726)
@@ -231,6 +231,7 @@
                                try {
                                        md.update(salt.getBytes("UTF-8"));
                                } catch (UnsupportedEncodingException e) {
+                                       throw new RuntimeException("Impossible: 
JVM doesn't support UTF-8: " + e, e);
                                }
                                try {
                                        InputStream is = data.getInputStream();

Modified: trunk/freenet/src/freenet/node/fcp/PeerNote.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/PeerNote.java    2008-05-04 09:43:00 UTC 
(rev 19725)
+++ trunk/freenet/src/freenet/node/fcp/PeerNote.java    2008-05-04 10:13:59 UTC 
(rev 19726)
@@ -31,7 +31,7 @@
                try {
                        fs.putSingle("NoteText", 
Base64.encode(noteText.getBytes("UTF-8"), true));
                } catch (UnsupportedEncodingException e) {
-                       throw new Error(e);
+                       throw new RuntimeException("Impossible: JVM doesn't 
support UTF-8: " + e, e);
                }
                if(identifier != null)
                        fs.putSingle("Identifier", identifier);

Modified: trunk/freenet/src/freenet/support/SimpleFieldSet.java
===================================================================
--- trunk/freenet/src/freenet/support/SimpleFieldSet.java       2008-05-04 
09:43:00 UTC (rev 19725)
+++ trunk/freenet/src/freenet/support/SimpleFieldSet.java       2008-05-04 
10:13:59 UTC (rev 19726)
@@ -684,7 +684,7 @@
                        } catch (UnsupportedEncodingException e) {
                                Logger.error(SimpleFieldSet.class, "Impossible: 
"+e, e);
                                is.close();
-                               return null;
+                               throw new RuntimeException("Impossible: JVM 
doesn't support UTF-8: " + e, e);
                        }
                        br = new BufferedReader(isr);
                        SimpleFieldSet fs = new SimpleFieldSet(br, 
allowMultiple, shortLived);

Modified: trunk/freenet/src/freenet/support/URIPreEncoder.java
===================================================================
--- trunk/freenet/src/freenet/support/URIPreEncoder.java        2008-05-04 
09:43:00 UTC (rev 19725)
+++ trunk/freenet/src/freenet/support/URIPreEncoder.java        2008-05-04 
10:13:59 UTC (rev 19726)
@@ -1,5 +1,6 @@
 package freenet.support;

+import java.io.BufferedReader;
 import java.io.UnsupportedEncodingException;
 import java.net.URI;
 import java.net.URISyntaxException;
@@ -38,7 +39,7 @@
                                                
output.append(Integer.toHexString(x));
                                        }
                                } catch (UnsupportedEncodingException e) {
-                                       throw new Error(e);
+                                       throw new RuntimeException("Impossible: 
JVM doesn't support UTF-8: " + e, e);
                                }
                        }
                }

Modified: trunk/freenet/src/freenet/support/URLDecoder.java
===================================================================
--- trunk/freenet/src/freenet/support/URLDecoder.java   2008-05-04 09:43:00 UTC 
(rev 19725)
+++ trunk/freenet/src/freenet/support/URLDecoder.java   2008-05-04 10:13:59 UTC 
(rev 19726)
@@ -3,6 +3,7 @@
  * http://www.gnu.org/ for further details of the GPL. */
 package freenet.support;

+import java.io.BufferedReader;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
@@ -70,7 +71,7 @@
                                                        decodedBytes.write(buf, 
0, buf.length);
                                                        continue;
                                                } catch 
(UnsupportedEncodingException e) {
-                                                       throw new Error(e);
+                                                       throw new 
RuntimeException("Impossible: JVM doesn't support UTF-8: " + e, e);
                                                }
                                        }

@@ -81,7 +82,7 @@
                                        byte[] encoded = 
(""+c).getBytes("UTF-8");
                                        decodedBytes.write(encoded, 0, 
encoded.length);
                                } catch (UnsupportedEncodingException e) {
-                                       throw new Error(e);
+                                       throw new RuntimeException("Impossible: 
JVM doesn't support UTF-8: " + e, e);
                                }
                        }
                }

Modified: trunk/freenet/src/freenet/support/URLEncoder.java
===================================================================
--- trunk/freenet/src/freenet/support/URLEncoder.java   2008-05-04 09:43:00 UTC 
(rev 19725)
+++ trunk/freenet/src/freenet/support/URLEncoder.java   2008-05-04 10:13:59 UTC 
(rev 19726)
@@ -3,6 +3,7 @@
  * http://www.gnu.org/ for further details of the GPL. */
 package freenet.support;

+import java.io.BufferedReader;
 import java.io.UnsupportedEncodingException;

 /**
@@ -43,7 +44,7 @@
                                                
enc.append(Integer.toHexString(x));
                                        }
                                } catch (UnsupportedEncodingException e) {
-                                       throw new Error(e);
+                                       throw new RuntimeException("Impossible: 
JVM doesn't support UTF-8: " + e, e);
                                }
                        }
                }

Modified: trunk/freenet/src/freenet/support/compress/GzipCompressor.java
===================================================================
--- trunk/freenet/src/freenet/support/compress/GzipCompressor.java      
2008-05-04 09:43:00 UTC (rev 19725)
+++ trunk/freenet/src/freenet/support/compress/GzipCompressor.java      
2008-05-04 10:13:59 UTC (rev 19726)
@@ -102,7 +102,8 @@
                try {
                        bytes = (int)decompress(bais, baos, output.length, -1);
                } catch (IOException e) {
-                       throw new Error("Got IOException: "+e.getMessage());
+                       // Impossible
+                       throw new RuntimeException("Got IOException: " + 
e.getMessage(), e);
                }
                byte[] buf = baos.toByteArray();
                System.arraycopy(buf, 0, output, 0, bytes);


Reply via email to