• 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
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

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: 21759
102
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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!