Bob - will your permissive reader solve this problem?
Feel free to add this bib record to the list of example records for testing.
Andrew
-----Original Message-----
From: Barnett, Jeffrey [mailto:jeffrey...@yale.edu]
Sent: Monday, August 18, 2008 1:47 PM
To: Andrew Nagy; vufin...@lists.sourceforge.net
Subject: RE: [VuFind-Tech] Functional Importer (rev 916) NumberFormatException
This may be fixed in the latest version, but for the record I got the following exception after correcting VUFIND_HOME
Exception in thread "main" java.lang.NumberFormatException: For input string: "9 4b"
at java.lang.NumberFormatException.forInputString(NumberFormatException.
java:48)
at java.lang.Integer.parseInt(Integer.java:456)
at java.lang.Integer.parseInt(Integer.java:497)
at org.marc4j.marc.impl.Verifier.isControlField(Verifier.java:44)
at org.marc4j.MarcPermissiveStreamReader.parseRecord(MarcPermissiveStrea
mReader.java:628)
at org.marc4j.MarcPermissiveStreamReader.next(MarcPermissiveStreamReader
.java:237)
at org.solrmarc.marc.MarcImporter.importRecords(MarcImporter.java:323)
at org.solrmarc.marc.MarcImporter.main(MarcImporter.java:604)
I attach the record as well, since I know you guys like to collect sample records.
-----Original Message-----
From: Andrew Nagy [mailto:andre...@villanova.edu]
Sent: Monday, August 18, 2008 11:13 AM
To: Barnett, Jeffrey; vufin...@lists.sourceforge.net
Subject: RE: [VuFind-Tech] Functional Importer (rev 916)
>
> I had mistyped the VUFIND_HOME setting, so it was null, so the result
> was "/import/solrmarc"
>
> I'm so embarased :-}
:) No problem - we all do little mistakes like that.
I tried testing the latest rev on my production server with some problems. If you use rev 117 from solrmarc and the latest vufind - I think everything will work well. I hope to have the vufind trunk working in the next few days.
Andrew
/** * Returns true if the given <code>String</code> value identifies a tag for * a control field (001 through 009). */
public static boolean isControlField(String tag) throws NumberFormatException {
if (Integer.parseInt(tag) < 10)
return true;
return false;
}
/**
* Returns true if the given <code>String</code> value identifies a tag for
* a control number field (001).
*/
public static boolean isControlNumberField(String tag)
throws NumberFormatException {
if (Integer.parseInt(tag) == 1)
return true;
return false;
}
to this:/** * Returns true if the given <code>String</code> value identifies a tag for * a control field (001 through 009). */
public static boolean isControlField(String tag) {
if (tag.length() == 3 && tag.charAt(0) == '0' && tag.charAt(1) == '0' && tag.charAt(2) >= '0' && tag.charAt(2) <= '9')
return true;
return false;
}
/**
* Returns true if the given <code>String</code> value identifies a tag for
* a control number field (001).
*/
public static boolean isControlNumberField(String tag){
if (tag.equals("001"))
return true;
return false;
}