• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

Sonar qube reorting bug saying : make variable transient or serializable.

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everyone,
I am getting below bug after running sonarqube analysis.  
Make "getPreAHistFlt" transient or serializable.

Following is the code snippet of it . Kindly help me how we can resolve this issue
package com.sanju.p1;

@WebFault(name = "getPreAHistFlt", targetNamespace = "http://www.getPreAuthorizationHistory")
public class getPreAHistFltMsg extends Exception {
   
   private com.sanju.p2.GetPreAHistFlt getPreAHistFlt;   // showing bug here

   public getPreAHistFltMsg() {
       super();
   }
   
   public getPreAHistFltMsg(String message) {
       super(message);
   }
   
   public getPreAHistFltMsg(String message, Throwable cause) {
       super(message, cause);
   }

   public getPreAHistFltMsg(String message, com.sanju.p2.GetPreAHistFlt getPreAHistFlt) {
       super(message);
       this.getPreAHistFlt = getPreAHistFlt;
   }

   public getPreAHistFltMsg(String message, com.sanju.p2.GetPreAHistFlt getPreAHistFlt, Throwable cause) {
       super(message, cause);
       this.getPreAHistFlt = getPreAHistFlt;
   }

   public com.sanju.p2.GetPreAHistFlt getFaultInfo() {
       return this.getPreAHistFlt;
   }
}
 
Sheriff
Posts: 21784
104
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Throwable implements Serializable, and as a result every exception does. So your exception class implements Serializable, but it contains a field that is not serializable. If you tried to serialize instances of your exception class it would fail.

Unless your exception really does need to be serialized (e.g. because of remote calls), I would ignore the warning.
 
Water proof donuts! Eat them while reading this tiny ad:
create, convert, edit or print DOC and DOCX in Java
https://products.aspose.com/words/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!