{"action":"created","issue":{"url":"https://api.github.com/repos/mozilla/rhino/issues/270","repository_url":"https://api.github.com/repos/mozilla/rhino","labels_url":"https://api.github.com/repos/mozilla/rhino/issues/270/labels{/name}","comments_url":"https://api.github.com/repos/mozilla/rhino/issues/270/comments","events_url":"https://api.github.com/repos/mozilla/rhino/issues/270/events","html_url":"https://github.com/mozilla/rhino/issues/270","id":133949462,"number":270,"title":"StringIndexOutOfBoundsException when calling Context.evaluateString for preloading Java Objects","user":{"login":"heywiki","id":16119271,"avatar_url":"https://avatars.githubusercontent.com/u/16119271?v=3","gravatar_id":"","url":"https://api.github.com/users/heywiki","html_url":"https://github.com/heywiki","followers_url":"https://api.github.com/users/heywiki/followers","following_url":"https://api.github.com/users/heywiki/following{/other_user}","gists_url":"https://api.github.com/users/heywiki/gists{/gist_id}","starred_url":"https://api.github.com/users/heywiki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/heywiki/subscriptions","organizations_url":"https://api.github.com/users/heywiki/orgs","repos_url":"https://api.github.com/users/heywiki/repos","events_url":"https://api.github.com/users/heywiki/events{/privacy}","received_events_url":"https://api.github.com/users/heywiki/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-02-16T11:01:19Z","updated_at":"2016-03-10T18:02:56Z","closed_at":null,"body":"We have the following issue using rhino 1.7.7 (also tried 1.7.7.1) when preloading java classes with\r\n\r\n```\r\nString loadMe = \"RegExp;getClass;java;Packages;JavaAdapter;\";\r\ncx.evaluateString(sealedSharedScope , loadMe, \"lazyLoad\", 0, null);\r\n```\r\n\r\nWe get the following error \r\n\r\n`java.lang.StringIndexOutOfBoundsException: String index out of range: 3`\r\n\r\nThis occured after updating the machine from Java 1.8.0_72 to 74, (Java Version is 1.8.0_74-b02, Windows 10, Running inside Tomcat 8.0.32)\r\n\r\nHowever this seems not to be the issue because this member of our team also can reproduce this error in his VMs with different setups. This only happens on his machine. This only happens on his machine.\r\n\r\nFull Stacktrace is\r\n-----------------\r\njava.lang.StringIndexOutOfBoundsException: String index out of range: 3\r\n    at java.lang.String.charAt(Unknown Source)\r\n    at org.apache.catalina.loader.WebappClassLoaderBase.filter(WebappClassLoaderBase.java:2780)\r\n    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1253)\r\n    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1142)\r\n    at org.mozilla.javascript.Kit.classOrNull(Kit.java:60)\r\n    at org.mozilla.javascript.NativeJavaPackage.getPkgProperty(NativeJavaPackage.java:129)\r\n    at org.mozilla.javascript.NativeJavaPackage.get(NativeJavaPackage.java:84)\r\n    at org.mozilla.javascript.NativeJavaTopPackage.init(NativeJavaTopPackage.java:96)\r\n    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)\r\n    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)\r\n    at java.lang.reflect.Method.invoke(Unknown Source)\r\n    at org.mozilla.javascript.ScriptableObject.buildClassCtor(ScriptableObject.java:1309)\r\n    at org.mozilla.javascript.LazilyLoadedCtor.buildValue0(LazilyLoadedCtor.java:105)\r\n    at org.mozilla.javascript.LazilyLoadedCtor.access$000(LazilyLoadedCtor.java:18)\r\n    at org.mozilla.javascript.LazilyLoadedCtor$1.run(LazilyLoadedCtor.java:90)\r\n    at java.security.AccessController.doPrivileged(Native Method)\r\n    at org.mozilla.javascript.LazilyLoadedCtor.buildValue(LazilyLoadedCtor.java:86)\r\n    at org.mozilla.javascript.LazilyLoadedCtor.init(LazilyLoadedCtor.java:66)\r\n    at org.mozilla.javascript.ScriptableObject$GetterSlot.getValue(ScriptableObject.java:320)\r\n    at org.mozilla.javascript.ScriptableObject.get(ScriptableObject.java:472)\r\n    at org.mozilla.javascript.IdScriptableObject.get(IdScriptableObject.java:334)\r\n    at org.mozilla.javascript.ScriptableObject.getProperty(ScriptableObject.java:2269)\r\n    at org.mozilla.javascript.ScriptRuntime.topScopeName(ScriptRuntime.java:1947)\r\n    at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1849)\r\n    at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1558)\r\n    at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:815)\r\n    at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:109)\r\n    at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)\r\n    at org.wikiwizard.juwi.script.JuwiContextFactory.doTopCall(JuwiContextFactory.java:95)\r\n    at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3282)\r\n    at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:120)\r\n    at org.mozilla.javascript.Context.evaluateString(Context.java:1219)\r\n    at org.wikiwizard.juwi.script.RhinoEngineWrapper.run(RhinoEngineWrapper.java:162)"},"comment":{"url":"https://api.github.com/repos/mozilla/rhino/issues/comments/194979231","html_url":"https://github.com/mozilla/rhino/issues/270#issuecomment-194979231","issue_url":"https://api.github.com/repos/mozilla/rhino/issues/270","id":194979231,"user":{"login":"some-ejit","id":13380099,"avatar_url":"https://avatars.githubusercontent.com/u/13380099?v=3","gravatar_id":"","url":"https://api.github.com/users/some-ejit","html_url":"https://github.com/some-ejit","followers_url":"https://api.github.com/users/some-ejit/followers","following_url":"https://api.github.com/users/some-ejit/following{/other_user}","gists_url":"https://api.github.com/users/some-ejit/gists{/gist_id}","starred_url":"https://api.github.com/users/some-ejit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/some-ejit/subscriptions","organizations_url":"https://api.github.com/users/some-ejit/orgs","repos_url":"https://api.github.com/users/some-ejit/repos","events_url":"https://api.github.com/users/some-ejit/events{/privacy}","received_events_url":"https://api.github.com/users/some-ejit/received_events","type":"User","site_admin":false},"created_at":"2016-03-10T18:02:56Z","updated_at":"2016-03-10T18:02:56Z","body":"I am having the same issue on Tomcat 8.0.32 (embedded) with Java 1.8.0_51 and Rhino 1.7R2. I moved back to Tomcat 8.0.30 and this resolved the issue."}}