Skip to content
This repository has been archived by the owner on Mar 9, 2022. It is now read-only.

Missed Context.javaToJS() conversion #63

Open
dwt opened this issue Aug 3, 2012 · 3 comments
Open

Missed Context.javaToJS() conversion #63

dwt opened this issue Aug 3, 2012 · 3 comments
Assignees
Labels

Comments

@dwt
Copy link
Contributor

dwt commented Aug 3, 2012

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
Copy link
Contributor Author

dwt commented Aug 3, 2012

This is on the current master.

@jchris
Copy link
Contributor

jchris commented Jul 24, 2013

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

@jchris
Copy link
Contributor

jchris commented Jul 24, 2013

we should add forEach tests to the Android JS tests

@ghost ghost assigned tleyden Jul 24, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants