UniFileTest
From Pickwiki
Jump to navigationJump to search
Back to JavaSource
ReadNamedField works if you call the method that takes both the key and the field name together, but does NOT work if you set the key with setRecordID and then call it with only the field name. Any ideas? This is using the asjava.zip file that came with UV10PE, which is reporting itself as Version 1.1.1. Thanks! Wendy
I've got independent confirmation from two sources on this one, so I think it's an official bug. Thanks to Mark and Louis from the U2-Users list! -- Wendy 08/13/2002
You were right! it was a bug and the readNamedField(fieldName) method has been fixed (Call No: 346996) for the "next" release. -- Stuart 2003-11-06
import asjava.uniobjects.*; import asjava.uniclientlibs.*; public class [[TestUniFile2]] { public static void main(String args[]) { [[UniJava]] uJava = new [[UniJava]](); try { [[UniSession]] uSession = uJava.openSession(); uSession.set[[HostName]]("[[HostName]]"); uSession.set[[UserName]]("[[UserName]]"); uSession.setPassword("Password"); uSession.set[[AccountPath]]("[[AccountPath]]"); uSession.connect(); [[UniFile]] fImage = uSession.open("IMAGE"); String key = "P6080010.JPG"; fImage.set[[RecordID]](key); System.out.println("1 " + fImage.read()); System.out.println("2 " + fImage.read(key)); System.out.println("3 " + fImage.readField(key, 2)); /[[/This]] one doesn't work: fImage.set[[RecordID]](key); System.out.println("4 " + fImage.read[[NamedField]]("IMAGE.PATH")); System.out.println("5 " + fImage.read[[NamedField]](key, "IMAGE.PATH")); fImage.close(); uSession.disconnect(); } catch ([[UniSessionException]] e) { System.out.println("Error: " + e); } catch ([[UniFileException]] e) { System.out.println("File Error: " + e); } } }