Topic
5 replies Latest Post - ‏2012-12-14T10:14:57Z by babinag
babinag
babinag
91 Posts
ACCEPTED ANSWER

Pinned topic Unexpected error, number convertation while import

‏2012-12-10T11:52:15Z |
Hi.
There occurred an error in hierarchy import process.
This code:


var parser = newDelimParser(in, 
"\t"); var bDone = 

false; var delimiter = 
"/"; var tree = getCategoryTreeByName(); 

while (!bDone) 
{ var aTokens = parser.splitLine(); bDone = (

null == aTokens); 

if (!bDone) 
{ var id = checkString(aTokens[0],
""); var categ = tree.getEntryByPrimaryKey(id); ... rest


results in fun "number format" error:

2012-12-10 14:41:50,385 [sch_worker_0] ERROR com.ibm.ccd.connectivity.common.CtgToDb JOB_ID:2226- CWPCM0001E:Generic error / Exception : , Exception:Script execution failed (com.ibm.ccd.common.error.AustinException) Exception:Generic Error Generic Error at com.ibm.ccd.element.common.AbstractContainer.convertPrimaryKeyStringForDB(Unknown Source) at com.ibm.ccd.content.common.CategoryTree.getEntryByPrimaryKey(Unknown Source) at com.ibm.ccd.content.common.CategoryTree.getEntryByPrimaryKey(Unknown Source) at com.ibm.ccd.common.script.ScriptOperationsEntry.getEntryByPrimaryKey(Unknown Source) at com.ibm.ccd.common.interpreter.operation.generated.GenGetEntryByPrimaryKeyOperation.execute(Unknown Source) at WPCHierarchySBITImportscript13551397100150.run(WPCHierarchySBITImportscript13551397100150.java:98) at com.ibm.ccd.common.interpreter.engine.Script.runFunction(Unknown Source) at com.ibm.ccd.common.interpreter.engine.Script.execute(Unknown Source) at com.ibm.ccd.common.interpreter.engine.Script.run(Unknown Source) at com.ibm.ccd.connectivity.common.DataImporter.importCatalog(Unknown Source) at com.ibm.ccd.connectivity.common.CtgToDb.execute(Unknown Source) at com.ibm.ccd.scheduler.threads.SchedulerThread.fuzaoRun(Unknown Source) at com.ibm.ccd.common.util.FuzaoRunnableAdapter.run(Unknown Source) at com.ibm.ccd.common.util.FuzaoThread.run(Unknown Source) Caused by: CWPEL0144E:Invalid Number to parse as Integer: [1222]- basicTypeEnum = Integer at com.ibm.ccd.element.common.DBTypeUtility.convertStringToValueWithBasicTypeEnum(Unknown Source) at com.ibm.ccd.element.common.DBTypeUtility.convertStringToValueWithBasicTypeEnum(Unknown Source) at com.ibm.ccd.element.common.DBTypeUtility.convertStringToValueWithBasicTypeEnum(Unknown Source) ... 14 more


This means, 1222(the primarykey of hierarchy) can not be converted to Integer in this import context.
But when i make equal operations - get tree, than get category with same pk as above "1222" - from sandbox, all fine.

How to workaround this?
Updated on 2012-12-14T10:14:57Z at 2012-12-14T10:14:57Z by babinag
  • SystemAdmin
    SystemAdmin
    648 Posts
    ACCEPTED ANSWER

    Re: Unexpected error, number convertation while import

    ‏2012-12-11T08:48:43Z  in response to babinag
    Hi!

    Are you sure there is no any space or something else in aTokens[0]? Make trim of id by checkString(aTokens[0],"", *true*);
    • babinag
      babinag
      91 Posts
      ACCEPTED ANSWER

      Re: Unexpected error, number convertation while import

      ‏2012-12-11T11:19:55Z  in response to SystemAdmin
      Hi Alexander.
      This exception occurs with either version of checkString operaction. Also, I'm sure that there are no heading or trailing spaces in import values.

      Also, when i try to cast id value to integer:
      
      var integerValueId = toInteger(id);
      

      toInteger(id) - results in more funny error:
      
      Tue Dec 11 14:10:28 MSK 2012 - worker thread 
      'Thread-423' started (ScheduleId: 49246) Script execution failed (java.lang.NumberFormatException) Exception:For input string: 
      "1217" java.lang.NumberFormatException: For input string: 
      "1217" at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1280) at java.lang.Double.valueOf(Double.java:486) at java.lang.Double.<init>(Double.java:578) at WPCHierarchySBITImportscript13552242290410.run(WPCHierarchySBITImportscript13552242290410.java:91) at com.ibm.ccd.common.interpreter.engine.Script.runFunction(Unknown Source) at com.ibm.ccd.common.interpreter.engine.Script.execute(Unknown Source) at com.ibm.ccd.common.interpreter.engine.Script.run(Unknown Source) at com.ibm.ccd.connectivity.common.DataImporter.importCatalog(Unknown Source) at com.ibm.ccd.connectivity.common.CtgToDb.execute(Unknown Source) at com.ibm.ccd.scheduler.threads.SchedulerThread.fuzaoRun(Unknown Source) at com.ibm.ccd.common.util.FuzaoRunnableAdapter.run(Unknown Source) at com.ibm.ccd.common.util.FuzaoThread.run(Unknown Source)   at WPCHierarchySBITImportscript13552242290410.run(WPCHierarchySBITImportscript13552242290410.java:233) at com.ibm.ccd.common.interpreter.engine.Script.runFunction(Unknown Source) at com.ibm.ccd.common.interpreter.engine.Script.execute(Unknown Source) at com.ibm.ccd.common.interpreter.engine.Script.run(Unknown Source) at com.ibm.ccd.connectivity.common.DataImporter.importCatalog(Unknown Source) at com.ibm.ccd.connectivity.common.CtgToDb.execute(Unknown Source) at com.ibm.ccd.scheduler.threads.SchedulerThread.fuzaoRun(Unknown Source) at com.ibm.ccd.common.util.FuzaoRunnableAdapter.run(Unknown Source) at com.ibm.ccd.common.util.FuzaoThread.run(Unknown Source)
      


      this is java-interpreted script, line 91:

      
      Object integerValueId = (java.lang.Integer) 
      
      new Integer(
      
      new Double(
      "" + id).intValue());
      

      The same errors occurs when i try to get category using javaapi call from import script.

      I dont want to bruteforce category tree and for each category make id<->category id comparisons, for each import line, but seems that there is no choice.

      I think that jre lib, that scheduler use, is bugged.
      • babinag
        babinag
        91 Posts
        ACCEPTED ANSWER

        Re: Unexpected error, number convertation while import

        ‏2012-12-11T11:57:48Z  in response to babinag
        Ok, solved. I have deleted this import, then created new, with same script, and all works fine.
        • SystemAdmin
          SystemAdmin
          648 Posts
          ACCEPTED ANSWER

          Re: Unexpected error, number convertation while import

          ‏2012-12-13T08:07:33Z  in response to babinag
          Hi,

          May i ask what you did when you got the error. Did you try to change the script and get the same error?
          It might just be that your script was not updated or something, I have encountered that before.

          Solution back then was that the server did not support multicast and therefor the script not got updated.

          regards
          • babinag
            babinag
            91 Posts
            ACCEPTED ANSWER

            Re: Unexpected error, number convertation while import

            ‏2012-12-14T10:14:57Z  in response to SystemAdmin
            Hi HanvandenHeuvel-Jibes.

            This was an old script that was used more than an year ago. Yes, i tried to change this script after error has been encountered, but this did not help.

            Recreation of import resolved this error.