UniFileTest: Difference between revisions

From Pickwiki
Jump to navigationJump to search
No edit summary
(No difference)

Revision as of 05:51, 10 December 2003

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.setHostName("HostName");
               uSession.setUserName("UserName");
               uSession.setPassword("Password");
               uSession.setAccountPath("AccountPath");
               uSession.connect();

               UniFile fImage = uSession.open("IMAGE");

               String key = "P6080010.JPG";

               fImage.setRecordID(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.setRecordID(key);
               System.out.println("4 " + fImage.readNamedField("IMAGE.PATH"));

               System.out.println("5 " + fImage.readNamedField(key, "IMAGE.PATH"));

               fImage.close();

               uSession.disconnect();

          } catch (UniSessionException e) {
               System.out.println("Error: " + e);
          } catch (UniFileException e) {
               System.out.println("File Error: " + e);
          }
     }
}