1. 程式人生 > >java.lang.IllegalStateException: Optional int parameter 'currentSpecialIndex' is present but cannot

java.lang.IllegalStateException: Optional int parameter 'currentSpecialIndex' is present but cannot

java.lang.IllegalStateException: Optional int parameter 'currentSpecialIndex' is present but cannot be translated into a null value due to being declared as a primitive type. Consider declaring it as object wrapper for the corresponding primitive type.

spring mvc 封裝引數猜想
1. 如果用物件來接受引數 spring 會首先new 一個物件出來然後將傳過來的匹配到屬性的值賦給屬性。
2. 如果在方法中直接寫變數來接受前臺的引數 如果匹配到變數則賦值 如果前臺沒有對應變數的引數spring會給該變數一個null 值而不是改變數型別的預設值。
public Knowledge findVideoBySpecialId(int specialId,int currentPage)
以上問題是因為我定義了一個int型別的變數來接受引數傳入但是前臺並沒有傳入該引數所以sping給一個null 但是null並不能賦值給int 所以引發異常 可以考慮用string 型別或者將引數封裝為物件 或者用該型別的包裝型別。

—待驗證啊。。。。

相關推薦

java.lang.IllegalStateException: Optional int parameter 'currentSpecialIndex' is present but cannot

java.lang.IllegalStateException: Optional int parameter 'currentSpecialIndex' is present but cannot b

Optional int parameter 'xx' is present but cannot be translated into a null value

今天在controller中獲取post引數時,報瞭如下錯誤 { "timestamp": "2018-09-07T07:25:51.524+0000", "status": 50

java.lang.IllegalStateException: Optional int parameter 'i' is not present but cannot be translated

開發中訪問方法時報 java.lang.IllegalStateException: Optional int parameter 'i' is not present but cannot be translated into a null value due to being declared

Optional int parameter 'time' is present but cannot be translated into a null value due to being decla

sla ans con option 接受 not param 不存在 springmvc 今天在操作redis的時候報了這個錯:Optional int parameter ‘time‘ is present but cannot be translated into a

Optional int parameter 'category_id' is present but cannot

Optional int parameter 'category_id' is present but cannot be translated into a null value due to being declared as a primitive type. Consider dec

暫時解決java.lang.IllegalStateException: It is invalid to call isReady() when the response has not been put into non-blocking mode

服務器 lose img () arguments it is 分享 exc 解決 環境: 本機-apache-tomcat-9.0.0.M21 服務器-apache-tomcat-9.0.0.M9 錯誤復盤: 最初不知道是tomcat版本解決的,實現了

解決java.lang.IllegalStateException: Not allowed to start service Intent xxxx app is in background u

問題描述 java.lang.IllegalStateException: Not allowed to start service Intent xxxx app is in background uid UidRecord 原因分析 Android 8.0 有以下調整: An

java.lang.IllegalStateException: FragmentManager is already executing transactions 及 SmartTabLayout複用

      在複用 SmartTabLayout  時, 出現了標題所示的錯誤。首先我的場景是Activity下兩個fragment  :A 和 B,A中使用了SmarttabLayout和viewpager結合, B也同樣使用了這個結合, 然後就出現了B

關於Timer計時器控制元件的java.lang.IllegalStateException: TimerTask is scheduled already問題分析

博主最近在改被人的專案,準備寫一個類似今日頭條的載入完成提示,就寫了個計時器讓它顯示幾秒,於是就用到了timer這個計時器控制元件,簡單的正常程式碼如下,因為博主的載入需要多次,當timer二次呼叫的時候就出現了java.lang.IllegalStateException: TimerTask i

springboot 檔案上傳報錯 Maximum upload size exceeded; nested exception is java.lang.IllegalStateException

# 最大支援檔案大小 spring.http.multipart.max-file-size=100MB # 最大支援請求大小 spring.http.multipart.max-request-siz

java.lang.IllegalStateException: FragmentManager is already executing transactions 及 SmartTabLayout複用

  在複用 SmartTabLayout  時, 出現了標題所示的錯誤。首先我的場景是Activity下兩個fragment  :A 和 B,A中使用了SmarttabLayout和viewpager結合, B也同樣使用了這個結合, 然後就出現了B中滑動異常或不顯示了, 網上的答案有幾種情況:   

java.lang.IllegalStateException: It is illegal to call this method if the current request is not in

使用fastjson報的錯誤 原因是序列化了 ServletRequest ServletResponse MultipartFile 這些類的物件 而這些類的物件不能序列化 參考 關於一次AOP攔截入參記錄日誌報錯的梳理總結 It is illegal to call thi

【spring boot】【elasticsearch】spring boot整合elasticsearch,啟動報錯Caused by: java.lang.IllegalStateException: availableProcessors is already set to [8], reje

  spring boot整合elasticsearch, 啟動報錯: Caused by: java.lang.IllegalStateException: availableProcessors is already set to [8], rejecting [8] at

org.springframework.web.multipart.MultipartException: Could not parse multipart servlet request; nested exception is java.lang.IllegalStateException:

感覺自己找的錯毫無理由,就是錯了,而且不知道原因 <bean id="commonsMultipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">

使用RecyclerView中引發 java.lang.IllegalStateException: Cannot call this method while RecyclerView is com

出錯原因 在介面卡onBindViewHolder(….)方法裡呼叫了notifyItemChanged(position),導致RecyclerView還沒有渲染完滑動引發的 錯誤程

java.lang.IllegalStateException:app is in background uid UidRecord

bugly上出了這個錯誤,而且都是Android 8.0上的,心裡隱約覺得又出新么蛾子了。查了下大概是8.0以上不允許建立後臺服務了判斷下版本,startForeground(1, new Notification())放在oncreate()裡就行。好了,問題解決。更新: 

java.lang.IllegalStateException: 總是提示JdbcType.int,但是對映檔案裡我都已經該過來了還是這樣

java.lang.IllegalStateException: Failed to load ApplicationContextat org.springframework.test.context.cache.DefaultCacheAwareContextLoade

spring cloud feign:Caused by: java.lang.IllegalStateException: RequestParam.value() was empty on parameter 0

use except app caused ise als stp lstat name 報錯之前: @RequestMapping(value = "hi", method = RequestMethod.GET)String hiService(@Request

java.lang.LinkageError: JAXB 2.0 API is being loaded from the bootstrap classloader

int ava 自己 end servle 目錄 load 解決 位置 我的解決辦法: 1、如果是application工程,則在程序中打印出 system.out.println(System.getProperty("java.endorsed.d

解決kylin報錯:java.lang.IllegalStateException

util bstr map dex apach default current con str 一個kylin build job執行到第三步Extract Fact Table Distinct Columns時報錯: 2017-05-24 20:04:07,930