0
byte bytes [] = Base64.getDecoder().decode(element.getElementsByTagName("Bytes").item(0).getTextContent());
Importer imp = null;
fmd = imp.ImportFmd(bytes, Fmd.Format.ANSI_378_2004, Fmd.Format.ANSI_378_2004);

I'm getting warning dereferencing null pointer, how can I resolve this warning in ImportFmd method? I'm using digital persona sdk.

azurefrog
  • 10,785
  • 7
  • 42
  • 56
  • 4
    what is `imp` that is assigned as null. u try to access method `imp.ImportFmd(..)` which us `null.ImportFmd(..)` – bNd Jan 04 '16 at 05:01
  • 3
    Possible duplicate of [What is a Null Pointer Exception, and how do I fix it?](http://stackoverflow.com/questions/218384/what-is-a-null-pointer-exception-and-how-do-i-fix-it) – Atri Jan 04 '16 at 05:17

2 Answers2

1

You need an instance of the Importer class to call the ImportFmd method on.

Some Googling turns up that you can get an Importer instance this way:

UareUGlobal.GetImporter()

So your code becomes:

byte bytes [] = Base64.getDecoder().decode(element.getElementsByTagName("Bytes").item(0).getTextContent());
Importer imp = UareUGlobal.GetImporter();
fmd = imp.ImportFmd(bytes, Fmd.Format.ANSI_378_2004, Fmd.Format.ANSI_378_2004);
Erwin Bolwidt
  • 30,799
  • 15
  • 56
  • 79
1

Your variable imp is null when you access it first: In the second line, you assign null to it, and on the third line, you call the method ImportFmd on it.

You need to check the documentation of Importer on how to set it up correctly. It could be as simple as

Importer imp = new Importer();

but OTOH, it probably needs some more work to set it up. The important thing here is that you have to assign a valid value to the imp variable, otherwise it is null when you access it first and this will cause a NullPointerException.

David Tanzer
  • 2,732
  • 18
  • 30