couchbaselabs / TouchDB-Android

CouchDB-compatible mobile database; Android version
239 stars 60 forks source link

Missed Context.javaToJS() conversion #63

Open dwt opened 12 years ago

dwt commented 12 years ago

I've got another one of these.


08-03 16:53:27.371: W/System.err(16851): RHINO USAGE WARNING: Missed Context.javaToJS() conversion:
08-03 16:53:27.371: W/System.err(16851): Rhino runtime detected object [] of class java.util.ArrayList where it expected String, Number, Boolean or Scriptable instance. Please check your code for missing Context.javaToJS() call.
08-03 16:53:27.378: W/TDDatabase(16851): Failed to rebuild view catalog/productsByProducer: 500
08-03 16:53:27.378: V/TDDatabase(16851): CANCEL transaction (level 1)...
08-03 16:53:27.378: E/TDDatabase(16851): Exception in TDRouter
08-03 16:53:27.378: E/TDDatabase(16851): java.lang.reflect.InvocationTargetException
08-03 16:53:27.378: E/TDDatabase(16851):    at java.lang.reflect.Method.invokeNative(Native Method)
08-03 16:53:27.378: E/TDDatabase(16851):    at java.lang.reflect.Method.invoke(Method.java:511)
08-03 16:53:27.378: E/TDDatabase(16851):    at com.couchbase.touchdb.router.TDRouter.start(TDRouter.java:390)
08-03 16:53:27.378: E/TDDatabase(16851):    at com.couchbase.touchdb.ektorp.TouchDBHttpClient.executeRequest(TouchDBHttpClient.java:191)
08-03 16:53:27.378: E/TDDatabase(16851):    at com.couchbase.touchdb.ektorp.TouchDBHttpClient.get(TouchDBHttpClient.java:68)
08-03 16:53:27.378: E/TDDatabase(16851):    at com.couchbase.touchdb.ektorp.TouchDBHttpClient.getUncached(TouchDBHttpClient.java:76)
08-03 16:53:27.378: E/TDDatabase(16851):    at org.ektorp.http.RestTemplate.getUncached(RestTemplate.java:26)
08-03 16:53:27.378: E/TDDatabase(16851):    at org.ektorp.impl.StdCouchDbConnector.executeQuery(StdCouchDbConnector.java:410)
08-03 16:53:27.378: E/TDDatabase(16851):    at org.ektorp.impl.StdCouchDbConnector.queryView(StdCouchDbConnector.java:449)
08-03 16:53:27.378: E/TDDatabase(16851):    at com.insideguidance.android.TouchDBRunner.updateAllIndexesInDesignDocument(TouchDBRunner.java:223)
08-03 16:53:27.378: E/TDDatabase(16851):    at com.insideguidance.android.InsideMobileActivity$1.doInBackground(InsideMobileActivity.java:74)
08-03 16:53:27.378: E/TDDatabase(16851):    at android.os.AsyncTask$2.call(AsyncTask.java:287)
08-03 16:53:27.378: E/TDDatabase(16851):    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
08-03 16:53:27.378: E/TDDatabase(16851):    at java.util.concurrent.FutureTask.run(FutureTask.java:137)
08-03 16:53:27.378: E/TDDatabase(16851):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
08-03 16:53:27.378: E/TDDatabase(16851):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
08-03 16:53:27.378: E/TDDatabase(16851):    at java.lang.Thread.run(Thread.java:856)
08-03 16:53:27.378: E/TDDatabase(16851): Caused by: org.mozilla.javascript.EcmaError: TypeError: Cannot call property forEach in object null. It is not a function, it is "undefined". (map#3)
08-03 16:53:27.378: E/TDDatabase(16851):    at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3785)
08-03 16:53:27.378: E/TDDatabase(16851):    at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3763)
08-03 16:53:27.378: E/TDDatabase(16851):    at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3791)
08-03 16:53:27.378: E/TDDatabase(16851):    at org.mozilla.javascript.ScriptRuntime.typeError3(ScriptRuntime.java:3817)
08-03 16:53:27.378: E/TDDatabase(16851):    at org.mozilla.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java:3884)
08-03 16:53:27.378: E/TDDatabase(16851):    at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThisHelper(ScriptRuntime.java:2360)
08-03 16:53:27.378: E/TDDatabase(16851):    at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2327)
08-03 16:53:27.378: E/TDDatabase(16851):    at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1514)
08-03 16:53:27.378: E/TDDatabase(16851):    at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:854)
08-03 16:53:27.378: E/TDDatabase(16851):    at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
08-03 16:53:27.378: E/TDDatabase(16851):    at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:426)
08-03 16:53:27.378: E/TDDatabase(16851):    at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3178)
08-03 16:53:27.378: E/TDDatabase(16851):    at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162)

The view looks like this:


function(doc) {
  if ('product' === doc.collection && doc.producers) {
    doc.producers.forEach(function(each) {
      emit(each, doc);
    });
  }
}

I'm not sure how to get the exact document that this failed out of the db.

dwt commented 12 years ago

This is on the current master.

jchris commented 11 years ago

actually maybe there is a random document where doc.producers exists but is not an array

jchris commented 11 years ago

we should add forEach tests to the Android JS tests