当前位置: 首页 > news >正文

广州网站建设电话咨询yy直播是免费的吗

广州网站建设电话咨询,yy直播是免费的吗,网站备案都审核什么资料,微信读书网页版今天调试程序时,在调用Properties类的setProperty(String key, String value)方法时,遇到了一个小问题,程序运行到该语句时抛出异常,提示java.lang.NullPointerException,调查了半天,发现问题出在调用setPr…
今天调试程序时,在调用Properties类的setProperty(String key, String value)方法时,遇到了一个小问题,程序运行到该语句时抛出异常,提示java.lang.NullPointerException,调查了半天,发现问题出在调用setProperty(String key, String value)时,传递给该方法的value参数的值为null,由于调用setProperty(String key, String value)方法时,它会去调用Hashtable类中的public synchronized Object put(Object key, Object value)方法,查看该方法的源代码实现,代码的开始处就给出了答案:
 1ExpandedBlockStart.gifContractedBlock.gifpublic synchronized Object put(Object key, Object value)  {
 2InBlock.gif    // Make sure the value is not null

 3ExpandedSubBlockStart.gifContractedSubBlock.gif    if (value == null{
 4InBlock.gif        throw new
 NullPointerException();
 5ExpandedSubBlockEnd.gif    }

 6InBlock.gif
 7InBlock.gif    // Makes sure the key is not already in the hashtable.

 8InBlock.gif    Entry tab[] = table;
 9InBlock.gif    int hash =
 key.hashCode();
10InBlock.gif    int index = (hash & 0x7FFFFFFF%
 tab.length;
11ExpandedSubBlockStart.gifContractedSubBlock.gif    for (Entry e = tab[index] ; e != null ; e = e.next) 
{
12ExpandedSubBlockStart.gifContractedSubBlock.gif        if ((e.hash == hash) && e.key.equals(key)) 
{
13InBlock.gif        Object old =
 e.value;
14InBlock.gif        e.value =
 value;
15InBlock.gif        return
 old;
16ExpandedSubBlockEnd.gif        }

17ExpandedSubBlockEnd.gif    }

18InBlock.gif
19InBlock.gif    modCount++
;
20ExpandedSubBlockStart.gifContractedSubBlock.gif    if (count >= threshold) 
{
21InBlock.gif        // Rehash the table if the threshold is exceeded

22InBlock.gif        rehash();
23
InBlock.gif
24InBlock.gif            tab =
 table;
25InBlock.gif            index = (hash & 0x7FFFFFFF%
 tab.length;
26ExpandedSubBlockEnd.gif    }
 
27
InBlock.gif
28InBlock.gif    // Creates the new entry.

29InBlock.gif    Entry e = new Entry(hash, key, value, tab[index]);
30InBlock.gif    tab[index] =
 e;
31InBlock.gif    count++
;
32InBlock.gif    return null
;
33ExpandedBlockEnd.gif    }

就此,问题的根源找到了,以后写程序的时候得多注意这些细节。以下附上setProperty(String key, String value)方法的描述:
 1None.gif Object java.util.Properties.setProperty(String key, String value)
 2None.gifCalls the Hashtable method put. Provided for parallelism with the getProperty method. Enforces use of strings for
 property keys and values. The value returned is the result of the Hashtable call to put. 
 3
None.gif
 4
None.gifSee Also:
 5
None.gifgetProperty

 6
None.gifParameters:
 7None.gifkey: the key to be placed into this
 property list.
 8
None.gifvalue: the value corresponding to key.

 9
None.gifReturns:
10None.gifthe previous value of the specified key in this property list, or null if
 it did not have one.

11
None.gifSince: 1.2

转载于:https://www.cnblogs.com/xxpal/articles/837400.html

http://www.yayakq.cn/news/309017/

相关文章:

  • 免费制作二维码的网站相城建设监理有限公司网站
  • 外贸哪些免费网站开发客户网页设计页面大小
  • 梅河口网站建设2017建站
  • 网页建站平台建设dede 网站地图模板htm
  • 买微单的网站建设怎么制作二维码并自己编辑内容
  • 黄江镇网站仿做养生类网站源码
  • 哪家做网站的公司第三方网站系统建设
  • 备案新增网站备案网站推广技巧有哪些
  • 做网站浏览器必须用xp系统吗wordpress love
  • php 网站伪静态google企业网站seo
  • 网站建设服务合同范本合肥哪家公司做网站
  • 城乡建设网站职业查询系统做卖东西的网站多少钱
  • 做都是正品的网站很难吗公司网站是别人做的如何换logo
  • 怎么做网站信任网站怎么制作视频教程
  • 网站制作的费用2二级域名免费
  • 包头移动的网站建设全国送花网站
  • 沧州做网站的公司网站维护包括的内容
  • 网站开发商城1688西安网站建设 玖佰网络
  • 网站开发费用计入什么二级科目绍兴企业网站建设
  • 推广型的网站怎么做怎么申请信用卡收款网站接口
  • 合肥做网站开发多少钱做能支付的网站贵吗
  • 财务管理做的好的门户网站网站维护更新费用
  • 网站建设面包屑导航条手机 网站开发aspx
  • 做it的兼职网站有哪些教育培训机构微网站模板
  • 做哪个网站卖一手房比较好商标注册名字查询系统
  • 凡科网站建设价格建站平台在线提交表格功能
  • 企业网站营销策划南京汽车集团网站建设
  • 建设电子商务网站的必要性郑州百度建网站
  • 自己怎么做新闻开头视频网站网络广告策划书范文
  • 网站服务器 免费做最好的win7系统下载网站