ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • java.lang.NullPointerException: println needs a message
    과거...../개발일지 2010. 8. 11. 09:41
    테스트할때 로그값에 null값이 들어가도 에러가 납니다. 밑에는 구글링에서 찾은 예제소스고여~~~

    *********calling log.i(null,null) results in null pointer exception
    *****************


    NOTE: This form is only for reporting user bugs. For all other user
    discussions please visit: http://groups.google.com/group/android-discuss

    Please describe the problem in detail. Be sure to include:
    I was debugging an application and the code could result something like the following:

    String s = null;
    /*..... */
    log.i(s,s); /* this causes a null pointer exception */


    Test case:

    package com.testy;

    import android.app.Activity;
    import android.os.Bundle;
    import android.util.Log;

    public class test extends Activity {
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState)
        {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
            String i = null;
    /* trigger the null pointer de-ref */
            Log.i(i,i);
        }
    }
Designed by Tistory.