|
From: Michael B. <m.g...@we...> - 2006-05-20 21:20:35
|
I had the same problem with KeyringEditor v1.1 not showing any of the records in my v4 database. I've no experience in Java or Palm programming but from http://tinyurl.com/zassz I think KeyringEditor is filtering dirty records where it should filter deleted records. I've added an exception handler in Crypto.java to handle the ArrayIndexOutOfBoundsException. I think I've found another bug where KeyringEditor ignores empty (deleted) categories and thus gets the wrong cross references to the entries. Asume you deleted category #5. Then in the database category #5 is the empty string and thus it is skipped. Now category #6 becomes #5 in KeyringEditor and #7 becomes #6. Any entries which have category #6 now will show category #7. Last I changed the CSV export format to be compatible with Passwordmanager PWM/Pi on my Zaurus. (http://www.pi-sync.net/html/pwm_pi.html) This is my patch: diff -w -u keyring_org/Crypto.java keyring/Crypto.java --- keyring_org/Crypto.java 2005-05-26 22:28:36.000000000 +0200 +++ keyring/Crypto.java 2006-05-20 19:19:58.000000000 +0200 @@ -593,8 +593,13 @@ =20 String notes =3D Model.sliceString(plainText, nextItem, -1); nextItem +=3D notes.length() + 1; - - byte[] datetype =3D Model.sliceBytes(plainText, nextItem, 2); + byte[] datetype =3D {0, 0}; + try { + datetype =3D Model.sliceBytes(plainText, nextItem, 2); + } + catch(Exception e) { + ; + } =20 if(fieldName.equals("account")) return (Object)account; if(fieldName.equals("password")) return (Object)password; diff -w -u keyring_org/Model.java keyring/Model.java --- keyring_org/Model.java 2005-09-25 12:50:32.000000000 +0200 +++ keyring/Model.java 2006-05-20 22:38:51.000000000 +0200 @@ -70,7 +70,7 @@ /** * CSV-Separator */ - private static char csvSeparator =3D ';'; // default + private static char csvSeparator =3D ','; // compatible with PWM/Pi =20 // PDB header information (readPDBHeader) /** @@ -355,9 +355,14 @@ for(int i=3D0; i<16; i++) { String categoryName =3D sliceString(data, pdbAppInfoOffset + 2 + (16 * = i), 16); =20 - if (!categoryName.equals("")) { - categories.add(categoryName); + if(DEBUG) { + System.out.println(i + ": " + categoryName); } +// if (!categoryName.equals("")) { +// categories.add(categoryName); +// } + // empty categories must be added to get correct cross references to = entries + categories.add(categoryName); } =20 if(pdbVersion =3D=3D 5) { @@ -408,7 +413,10 @@ for(int i=3Dstart; i<pdbNumRecords; i++) { =20 // check record attribute - if((pdbAttribute[i] & 0xF0) =3D=3D 0x40) { + //if((pdbAttribute[i] & 0xF0) =3D=3D 0x40) { +=09=09 + // check for deleted record + if((pdbAttribute[i] & 0x80) =3D=3D 0x00) { // determine entry length if(i =3D=3D pdbNumRecords - 1) { entryLength =3D pdbLength - pdbOffset[i]; @@ -1066,14 +1074,15 @@ =20 for(Enumeration e =3D entries.elements(); e.hasMoreElements(); ) { Entry entry =3D (Entry)e.nextElement(); - + // CSV file compatible with PWM/Pi String buffer =3D - "" + '"' + entry.getEntryId() + '"' + csvSeparator + - '"' + categories.elementAt(entry.getCategory()) + '"' + csvSeparator + + "" + '"' + categories.elementAt(entry.getCategory()) +=20 + '"' + csvSeparator + csvSeparator + '"' + entry.getTitle() + '"' + csvSeparator + '"' + entry.getAccount() + '"' + csvSeparator + '"' + entry.getPassword() + '"' + csvSeparator + - '"' + entry.getDate() + '"' + "\n"; + csvSeparator + csvSeparator + + '"' + entry.getNotes().replace('\n',' ').replace('\200','=A4') + '"' + = "\n"; =20 out.write(buffer.toCharArray()); } |