• Welcome to KonaKart Community Forum. Please login or sign up.
 

export crashes with IndexOutOfBoundsException

Started by mdesjard, February 07, 2008, 02:55:42 am

Previous topic - Next topic

mdesjard

I'm trying to export my products to do some batch processing on them (categorization)

And I'm getting this error:
======================================================================================================
Create a file containing product data from the KonaKart database using the KK Engine
======================================================================================================
Picked up _JAVA_OPTIONS: -Xms64m -Xmx64m
Properties file found = /home/mdesjardins/import_export/classes/kkImporter.properties
06-Feb 21:52:29 INFO  (KKAdmin.java:init:237) Finished Initialising Log4j
06-Feb 21:52:29 INFO  (KKAdmin.java:init:240) The configuration file being used is /home/mdesjardins/import_export/classes/konakartadmin.properties
06-Feb 21:52:29 INFO  (KKAdmin.java:init:245) Initialising KKAdmin
06-Feb 21:52:29 INFO  (KKAdmin.java:initKonakart:467) KonaKart Admin V2.2.0.7 built 10:57AM 22-Oct-2007 BST
06-Feb 21:52:29 INFO  (KKAdmin.java:init:247) Finished Initialising KonaKartAdmin
06-Feb 21:52:29 INFO  (KKAdmin.java:init:253) Initialising Torque
06-Feb 21:52:30 INFO  (KKTorque.java:init:53) Initialising KonaKart-Torque for org.apache.torque.adapter.DBMM
06-Feb 21:52:30 INFO  (KKAdmin.java:init:266) Finished Initialising Torque
06-Feb 21:52:31 WARN  (AdminSecurityMgr.java:login:137) User 'admin@konakart.com' has just logged in to the Admin App
java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
        at java.util.ArrayList.RangeCheck(ArrayList.java:547)
        at java.util.ArrayList.get(ArrayList.java:322)
        at com.konakart.importer.ExportData.getFormattedProductData(Unknown Source)
        at com.konakart.importer.ExportData.getProduct(Unknown Source)
        at com.konakart.importer.ExportController.processDataFile(Unknown Source)
        at com.konakart.importer.ExportController.doExport(Unknown Source)
        at com.konakart.importer.ExportRunner.main(Unknown Source)

My file has 110 products in it out of the about 400.

julie

Hi,

One of the products is causing the exporter to crash. The products are exported ordered by id, ascending, so you should be able to figure out the last product that was exported successfully by looking at your export file and the v_products_id attribute.

If you find that a bit tricky to read, you can edit \KonaKart\import_export\classes\konakart-logging.properties and add the line :
log4j.logger.com.konakart.importer            = DEBUG

When you attempt the export again, you should get logging that looks something like :

07-Feb 09:08:42 DEBUG (?:getFormattedProductData:?) Created formatted data for productId = 23
07-Feb 09:08:42 DEBUG (?:getFormattedProductData:?) Created formatted data for productId = 24
07-Feb 09:08:42 DEBUG (?:getFormattedProductData:?) Created formatted data for productId = 25
07-Feb 09:08:42 DEBUG (?:getFormattedProductData:?) Created formatted data for productId = 26
07-Feb 09:08:42 DEBUG (?:getFormattedProductData:?) Created formatted data for productId = 29

If the last id you see in the log is say, 110 then you should take a look at product with id 111 and see if you can figure out what is different about it. If you look at it through the Admin app, it should point out whether there are any missing fields, or whether it has no category etc.

If you figure it out please let us know what the problem was so that we can put in some extra error checking.

Thx,

Julie

mdesjard

hi again Julie,

OK, I did a few test, found that the last products exported is indeed 110, so I looked in the DB for differences between 110 and 111 but couldn't find anything obvious.

But I did realize that 110 was the last products I had updated in the admin. See I uploaded a bunch of new products from my brick and mortar store. Now I'm running thru all of them to fix their categories and manufacturer (the fields wasn't part of my export from my cash register system, so before I imported to konakart, I just hard-coded it to all the same one).

So I did a test, I went and updated product 110, the same way I updated all the other products. I changed his category and I updated it's manufacturer. And now when I try an export, it stops at 109, 110 doesn't get exported anymore.

So it seems that when I update a product in the admin, I break it somehow and it can't be exported anymore.

Any tips on where I should look at in the DB to see what the differences might be between a good product and a broken product? Tables in particular I should check?

The java error points to an ArrayOutOfBoundException when accessing an ArrayList in the ExportData.getFormattedProductData method. You have the source code for the exporter, could you take a look at that method to see what is using an ArrayList? This could help us find the problem fields.

Thanks in advance!

julie

Hi,

The problem could be that the product isn't associated to any categories. Could you check that ?

Julie

mdesjard

Actually I just found the problem. If a product is only associated with a first level category (ie a category directly under root) it won't export.

So if I have root->Accessories->Paint

If my product is associated to the Paint category, it will work. If it's only associated to the Accessories category, then it won't work. If it's associated to both Paint and Accessories. Then it works too.

I'll re-categorize and make sure the export works fine.

Thanks

julie

Thanks for the feedback.

We'll verify and fix it in the next release.

Julie

mdesjard

Quote from: julie on February 07, 2008, 04:43:21 pm
Thanks for the feedback.

We'll verify and fix it in the next release.

Julie


Thank you very much!

Also, you might want to make a few tests with french accents, they are all replaced by "?" when going thru the importer.

Thanks

julie

Hi,

I've just been running some import / export tests and haven't been able to reproduce the character conversion problem that you have been seeing. I've managed to import and export all sorts of accented characters (àòèéçüä) without problems. Could you let me know whether the problem you are seeing is on the export or the import? (i.e. Are the characters written correctly to the file?).

Thx,

Julie