# Error when creating text file through Java



## Wozzer (Oct 2, 2012)

I'm using the metadata extractor API to print out all the metadata from an image taken on my phone. As part of my program, I want to allow the user to extract all this information into a text file.

I know the information is printing out correctly as I have done a simple system.out statement to make sure it's printing something.

As requested, the errors I receive are:


```
[Exif Thumbnail] Thumbnail Compression - JPEG (old-style)
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
[Exif Thumbnail] Orientation - Top, left side (Horizontal / normal)
[Exif Thumbnail] X Resolution - 72 dots per inch
[Exif Thumbnail] Y Resolution - 72 dots per inch
[Exif Thumbnail] Resolution Unit - Inch
[Exif Thumbnail] Thumbnail Offset - 973 bytes
[Exif Thumbnail] Thumbnail Length - 46531 bytes
null
[Jpeg] Compression Type - Baseline
[Jpeg] Data Precision - 8 bits
[Jpeg] Image Height - 2448 pixels
[Jpeg] Image Width - 3264 pixels
[Jpeg] Number of Components - 3
[Jpeg] Component 1 - Y component: Quantization table 0, Sampling factors 1 horiz/2 vert
[Jpeg] Component 2 - Cb component: Quantization table 1, Sampling factors 1 horiz/1 vert
[Jpeg] Component 3 - Cr component: Quantization table 1, Sampling factors 1 horiz/1 vert
[Exif SubIFD] Exposure Time - 1/110 sec
[Exif SubIFD] F-Number - F2.6
[Exif SubIFD] Exposure Program - Aperture priority
[Exif SubIFD] ISO Speed Ratings - 32
[Exif SubIFD] Exif Version - 2.20
[Exif SubIFD] Date/Time Original - 2012:09:27 17:41:28
[Exif SubIFD] Date/Time Digitized - 2012:09:27 17:41:28
[Exif SubIFD] Shutter Speed Value - 1/109 sec
[Exif SubIFD] Aperture Value - F2.6
[Exif SubIFD] Brightness Value - 6.19
[Exif SubIFD] Exposure Bias Value - 0 EV
[Exif SubIFD] Max Aperture Value - F2.6
[Exif SubIFD] Metering Mode - Center weighted average
[Exif SubIFD] Flash - Flash did not fire, auto
[Exif SubIFD] Focal Length - 4.03 mm
[Exif SubIFD] User Comment - User comments
[Exif SubIFD] Color Space - sRGB
[Exif SubIFD] Exif Image Width - 3264 pixels
[Exif SubIFD] Exif Image Height - 2448 pixels
[Exif SubIFD] Exposure Mode - Auto exposure
[Exif SubIFD] White Balance Mode - Auto white balance
[Exif SubIFD] Scene Capture Type - Standard
[Exif SubIFD] Unique Image ID - SCEE09
[Exif IFD0] Unknown tag (0x0100) - 3264
    at java.io.Writer.write(Writer.java:157[Exif IFD0] Unknown tag (0x0101) - 2448
)
[Exif IFD0] Make - SAMSUNG
[Exif IFD0] Model - GT-I9100
    at MetaDataExtractor.metadataImageButtonMouseClicked(MetaDataExtractor.java:545)
[Exif IFD0] Orientation - Top, left side (Horizontal / normal)
    at MetaDataExtractor.access$300([Exif IFD0] Software - Exif Software Version 1.0.2.0
MetaDataExtractor.java:25)
[Exif IFD0] Date/Time - 2012:09:27 17:41:28
    at MetaDataExtractor$4.mouseClicked(MetaDataExtractor.java:207)
[Exif IFD0] YCbCr Positioning - Center of pixel array
[GPS] GPS Version ID - 2.200
[GPS] GPS Latitude Ref - N
[GPS] GPS Latitude - 51°27'1.25784"
    at java.awt.Component.processMouseEvent([GPS] GPS Longitude Ref - W
Component.java:6508)
[GPS] GPS Longitude - 2°37'2.53344"
[GPS] GPS Altitude Ref - Sea level
[GPS] GPS Altitude - 82 metres
    at javax.swing.JComponent.processMouseEvent([GPS] GPS Time-Stamp - 16:41:29 UTC
JComponent.java:3321)
[GPS] GPS Processing Method - 65 83 67 73 73 0 0 0 71 80 83
[GPS] GPS Date Stamp - 2012:09:27
    at java.awt.Component.processEvent(Component.java:6270)
[Exif Thumbnail] Thumbnail Image Width - 320 pixels
    at java.awt.Container.processEvent([Exif Thumbnail] Thumbnail Image Height - 240 pixels
Container.java:2229)
[Exif Thumbnail] Thumbnail Compression - JPEG (old-style)
    at java.awt.Component.dispatchEventImpl(Component.java:4861)
[Exif Thumbnail] Orientation - Top, left side (Horizontal / normal)
[Exif Thumbnail] X Resolution - 72 dots per inch
    at java.awt.Container.dispatchEventImpl(Container.java:2287)
[Exif Thumbnail] Y Resolution - 72 dots per inch
[Exif Thumbnail] Resolution Unit - Inch
    at java.awt.Component.dispatchEvent(Component.java:4687)
[Exif Thumbnail] Thumbnail Offset - 973 bytes
    at java.awt.LightweightDispatcher.retargetMouseEvent([Exif Thumbnail] Thumbnail Length - 46531 bytes
Container.java:4832)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4501)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
    at java.awt.Container.dispatchEventImpl(Container.java:2273)
    at java.awt.Window.dispatchEventImpl(Window.java:2713)
    at java.awt.Component.dispatchEvent(Component.java:4687)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:707)
    at java.awt.EventQueue.access$000(EventQueue.java:101)
    at java.awt.EventQueue$3.run(EventQueue.java:666)
    at java.awt.EventQueue$3.run(EventQueue.java:664)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
    at java.awt.EventQueue$4.run(EventQueue.java:680)
    at java.awt.EventQueue$4.run(EventQueue.java:678)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:677)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:211)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
```
I did think it was something between conflicting variable types so I created a string like so:


```
String report = "Report: " + Metadata.alltags();
```
But that only returned the string "Report"......

Any ideas on how to solve the issue.


----------



## Kreij (Oct 2, 2012)

Can you post all your code?

It looks like your sending something null to the java.io.Writer after a mouse click.


----------



## Wozzer (Oct 2, 2012)

Kreij said:


> Can you post all your code?
> 
> It looks like your sending something null to the java.io.Writer after a mouse click.



Hi Kreij,

I could PM you a pastebin link?


----------



## Kreij (Oct 2, 2012)

I got your PM, Woz ... let's start there with that code.


----------



## Jimmy6 (Dec 11, 2013)

Reinstall/update your Java RTE...


----------

