:- eval(ex021()).

on_io_exception(Reader) :-
   exception(Ex),
   println([Ex]),
   % Corrective action: make Reader access a constant String
   StringReader=java.io.StringReader('<?xml version="1.0"?>'),
	Reader = java.io.BufferedReader(StringReader).

ex021() :- 
   on_exception(java.io.IOException,on_io_exception(Reader)),
   fopen("nosuchfile.xml",Reader),
   % Enumerate and print one Line at a time
   read_enum(Reader,Line),
   println(["Line=",Line]).
