• 2015年工作中遇到的问题121-130


    121.Java的equals,经常被坑。
    project的status是Short类型的变量。
    project.getStatus().equals(2);false


    整数2默认的类型的int,有这个印象,网上也是这么说的。
    我想通过debug求证下,看看Short的equas,但是那个obj竟然无法“watch”,debug模式也看不出类型,郁闷。


    这个时候2被当作Integer,通过debug发现的。(这是我debug之前的“想当然”,机智反被机智误啊)


    203 == project.getStatus(),为true,会自动进行类型转换。


    122.maxUploadSize的大小不能用乘法1*2这种,必须输入整数。
    <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
    <property name="maxUploadSize" value="1048*57600" />
    <property name="maxInMemorySize" value="10240" />
    </bean>
    java.lang.NumberFormatException: For input string: "1048*57600"


    如果上传的图片大小超过了限制,报错~
    org.springframework.web.multipart.MaxUploadSizeExceededException: 
    Maximum upload size of 1024 bytes exceeded; nested exception is org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException: 
    the request was rejected because its size (5849) exceeds the configured maximum (1024)


    123.Mybatis引入资源,placeholder属性解析失败。


    spring-resource.xml
    <import resource="classpath:spring-mybatis-config.xml" />
    <import resource="classpath:spring-fastdfs-config.xml" />


    可行的:
      spring-mybatis-config
      <context:property-placeholder location="classpath:*.properties" />
      spring-fastdfs-config
      不配置property-placeholder
      
     不可行的
      spring-mybatis-config
      <context:property-placeholder location="classpath:jdbc.properties" />
      spring-fastdfs-config
       <context:property-placeholder location="classpath:fast.properties" />

      比较奇怪的是,其它项目中,类似的配置就可以。
      property-placeholder 存在冲突,无效等问题,没有搞清楚具体原因。
      
    124.Git可以使用.gitignore文件,忽视某个目录。
    /target/
    /log4j/


    2个目录的变动,就不会被记录了。


    每次提交的时候,/.settings目录下的文件,都出现在对话框里,但是我又不想提交,不方便使用“全选”。
    解决办法,手动在.gitignore文件中加入一条/.settings。


    一次性搞定这个烦人的问题~
    我真是机智啊~


    125../configure --prefix=/home/
    prefix设置安装到的目录

    126.if ($w != "")。
    Nginx的if语句,左右貌似需要空格~
    坑~


    127.开启红警2提示"fatal"string manager failed to initilaized propely。
    如果系统是VISTA/WIN7,则右键点击“以管理员模式运行”。
    参考资料:http://wenwen.sogou.com/z/q1702977128.htm


    128.VIM删除一行。
    在非编辑模式下,直接按“dd”。切记,编辑模式下是没有用的,会直接输入2个“d”字符。


    129.id的初始值为“”,不是null和undefined,坑啊。
    <input type="hidden" name="id" id="id"> 


    130.Java不可变对象。
       check(null,null);
    private void check(Long maxId, Integer limit) {
    if (maxId == null) {
    maxId = Long.MAX_VALUE;
    }
    if (limit == null || limit <= 0 || limit > 50) {
    limit = 10;
    }
    }
    调用之后,limit仍然是null。
    Integer也是“不可变对象”。
  • 相关阅读:
    分布式系统基础设施
    6种负载均衡算法
    缓存类
    HTTP状态码100、200、300、400、500、600的含义
    Java中的多线程你只要看这一篇就够了(引用)
    An incompatible version 1.1.1 of the APR based Apache Tomcat Native library is installed, while Tomcat requires version 1.1.17
    EL表达式与JSTL(C)标签
    JSP标准标签库
    SpringMVC HttpMessageConverter 匹配规则
    springboot学习(三)——使用HttpMessageConverter进行http序列化和反序列化
  • 原文地址:https://www.cnblogs.com/qitian1/p/6462570.html
Copyright © 2020-2023  润新知