Dedian  
          -- 關(guān)注搜索引擎的開發(fā)
          日歷
          <2006年6月>
          28293031123
          45678910
          11121314151617
          18192021222324
          2526272829301
          2345678
          統(tǒng)計
          • 隨筆 - 82
          • 文章 - 2
          • 評論 - 228
          • 引用 - 0

          導(dǎo)航

          常用鏈接

          留言簿(8)

          隨筆分類(45)

          隨筆檔案(82)

          文章檔案(2)

          Java Spaces

          搜索

          •  

          積分與排名

          • 積分 - 66092
          • 排名 - 813

          最新評論

          閱讀排行榜

          評論排行榜

           
          when I try to debug my webcrawler?by crawling?yahoo website, I found that when trying to connect to a website which URL is such as http://www.youtube.com/w/Kak%E1?v=PIBe_V9PBIA&search=kak%C3%A1, the following exception will happen:

          Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 12
          ?at java.lang.String.substring(Unknown Source)
          ?at sun.net.www.ParseUtil.unescape(Unknown Source)
          ?at sun.net.www.ParseUtil.decode(Unknown Source)
          ?at sun.net.www.ParseUtil.toURI(Unknown Source)
          ?at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
          ?at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)

          follow is simple testing code:
          ?
          private static final String urlstring = "
          ???URL url = new URL(urlstring);
          ???
          ???URLConnection con = url.openConnection();
          ???
          ???con.connect();

          since there?are no other explicit exceptions except MalformedURLException & IOException mentioned to catch for this code, I am not sure if it is a bug in Java for URL parsing...

          anybody got some idea about that?

          P.S. ok, somebody has pointed out that Runtime exceptions, like java.lang.StringIndexOutOfBoundsException, do not have to be declared, but they can be thrown. So i need catch StringIndexOutOfBoundsException this exception for my code. But in my understanding, the function should catch all the exceptions from lower functions, and then throw out if it can not handle them, thus we can catch those exception from deep functions. I am not sure Runtime exceptions are exceptional ...

          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導(dǎo)航:
           
           
          Copyright © Dedian Powered by: 博客園 模板提供:滬江博客
          主站蜘蛛池模板: 枣强县| 疏附县| 五大连池市| 三穗县| 文昌市| 长宁区| 隆安县| 无锡市| 麻城市| 乐业县| 石楼县| 秦皇岛市| 通许县| 陆川县| 曲麻莱县| 综艺| 兴海县| 玛纳斯县| 镇赉县| 中阳县| 盐池县| 梧州市| 大悟县| 健康| 平武县| 安吉县| 邢台市| 嵩明县| 瑞昌市| 红桥区| 平潭县| 汶川县| 磐石市| 班戈县| 筠连县| 庆城县| 乌拉特前旗| 芮城县| 宝应县| 蛟河市| 正蓝旗|