Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

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: 21950
106
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.
 
Fire me boy! Cool, soothing, shameless self promotion:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic