In the following code snippet, I attempted to use the createOFG from JavaToObjectFlow.rsc:
void run(loc source) {
m = createM3FromEclipseProject(source);
set[Declaration] asts = createAstsFromEclipseProject(source, true);
FlowProgram p = createOFG(asts);
}
Upon executing this method, the following error was received:
|std:///lang/java/flow/JavaToObjectFlow.rsc|(4167,1,<153,26>,<153,27>):
Undeclared annotation: decl on Expression
Advice: |http://tutor.rascal-
mpl.org/Errors/Static/UndeclaredAnnotation/UndeclaredAnnotation.html|
Since the error is coming from std:///lang/java/flow/JavaToObjectFlow.rsc and none of our fellow students receive the same error, I am wondering what is going wrong. The error occurs in both the stable and unstable versions of Rascal.
you should be on unstable, as this message points to a known problem on stable.
are you sure you get exactly the same message on unstable? in that case, please tell me what you see on that line (153 of file /lang/java/flow/JavaToObjectFlow.rsc)
If you don't have a source location to click on to get you there, you can always browse the code from any rascal project:
Related
While compiling an opensource project, I encounter a problem with a Maven plugin that fails.
And I would like to open an issue about its problem. To be helpful to those who will search to solve it, I would like to explain how it might happen.
Execution default of goal pl.project13.maven:git-commit-id-plugin:4.0.3:revision failed. (pl.project13.maven:git-commit-id-plugin:4.0.3:revision:default:initialize)
org.apache.maven.plugin.PluginExecutionException: Execution default of goal pl.project13.maven:git-commit-id-plugin:4.0.3:revision failed.
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:148)
at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:332)
at org.eclipse.m2e.core.internal.embedder.MavenImpl.lambda$8(MavenImpl.java:1380)
at [...]
Caused by: java.lang.NullPointerException
at pl.project13.maven.git.GitCommitIdMojo.execute(GitCommitIdMojo.java:441)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
... 30 more
For that, I've red the involved line that causes the NullPointerException on its Git repository.
The content of the line 441 of GitCommitIdMojo.java is :
List<MavenProject> sortedProjects =
Optional.ofNullable(session.getProjectDependencyGraph())
.map(graph -> graph.getSortedProjects())
.orElseGet(() -> {
log.warn("Maven's dependency graph is null. Assuming project is the only one executed.");
return Collections.singletonList(session.getCurrentProject());
});
But I'm not so experienced with Optional and other inline functions. And I wonder from where the NullPointerException is really coming. I have no way to test it in Live, so I can only guess.
I've checked on the source file : session is a required attribute. It shouldn't be null.
I believe that the Optional.ofNullable(...) protects the content inside parenthesis and that the NullPointerException isn't coming from here.
But when entering the .orElseGet(...) part of the expression, it might fail on Collections.singletonList(session.getCurrentProject()) where session.getCurrentProject() would return null.
Am I right?
What other parts of this statement could lead to a NullPointerException under what conditions?
You're not looking at the right version of the code. The maven-error refers to 4.0.3 of git-commit-id-plugin, but the code you're displaying comes from the master branch, which is at 4.0.4-SNAPSHOT.
This is line 441 in version 4.0.3:
List sortedProjects = session.getProjectDependencyGraph().getSortedProjects();
The NullPointer can come from any of the three parts.
I am working on Android app and we are working as a team. I am facing a serious issue. And that is when ever I try to get the data from intent it gives me following exception
Parcel android.os.Parcel#355932a: Unmarshalling unknown type code
4784211 at offset 712
I know on SO there are a lot of helping material related to this issue, but my case is different and quiet mind boggling .....
Here is a quick code to see how I am getting my object
try {
if (data.hasExtra("KEY_MY_MODEL")) {
MyCustomModel newSelectedModel = data.getParcelableExtra("KEY_MY_MODEL");
//DO SOME THING WITH OBJECT
}
} catch (Exception e) {
e.printStackTrace();
}
Case1:
I am getting exception on first line if (data.hasExtra("KEY_MY_MODEL")) {
and this is quiet funny because when I inspect the intent object (data) while debugging and if I look into intent object using debugging I can see all my custom object.
The keys of getting object are same, if in any case the key is wrong I think the code inside the if condition must not get run. as it will return false.
But instead of returning false it is giving the above mentioned exception.
Case2: As I told you we are working in team, the same set of code is running perfectly on other system, but when I run app from my system and install app on device, it is giving the exception I mentioned above.
This is very much frustrating. I think there is something wrong with proguard, as I read on S.O but its still not helpful. Any Idea why this is happening? This looks like a big bug.
Note: I am using A.S 3.5 and on other system A.S 3.5 is in use, even we have same set of sdk, configurations and other things are quiet
identical on both sides...
It seems to be a ProGuard issue
Just add this line in proguard.rules.pro/txt
-keepclassmembers class * implements android.os.Parcelable {
static ** CREATOR;
}
My JDMK based application is getting intermittent IOExceptions at line 313 in com.sun.jdmk.comm.HttpSendSocket and I can't figure out why. All I know from the Javadoc about this is if an I/O error occurs while creating the input stream you'll get an IOException, but I don't know what kind of I/O error occurred or why one did. The code actually worked both before and after this error transpired.
Any tips on how to debug this intermittent problem would be appreciated.
I don't want to paste the source code here for HttpSendSocket since it belongs not to me, but I know it's doing an HttpURLConnection conn.getInputStream() when the IOException exception is thrown.
I thought about trying to create my own version of HttpSendSocket, and adding diagnostics in it, but couldn't figure out how since it's a package protected class.
Stack trace below:
com.sun.jdmk.comm.CommunicationException: java.io.IOException: HTTP request failed
at com.sun.jdmk.comm.HttpSendSocket.readNotify(HttpSendSocket.java:313)
at com.sun.jdmk.comm.HttpSendInputStream.read(HttpSendInputStream.java:95)
at java.io.FilterInputStream.read(FilterInputStream.java:94)
at java.io.PushbackInputStream.read(PushbackInputStream.java:150)
at com.sun.jdmk.comm.GenericHttpConnectorClient.sendHttp(GenericHttpConnectorClient.java:486)
at com.sun.jdmk.comm.GenericHttpConnectorClient.invokeRemoteOperation(GenericHttpConnectorClient.java:2234)
at com.sun.jdmk.comm.GenericHttpConnectorClient.invoke(GenericHttpConnectorClient.java:1366)
As I said, any helpful suggestions would be appreciated.
The communication Exception was caused by using ArrayList method subList. ArrayList is serializable but subList data IS NOT serializable, and therefore you cannot retrieve the data over an HttpConnector. The solution was to change:
List<UserProcessInfo> values = new ArrayList<UserProcessInfo>();
...
values.size() <= 1000 ? values : values.subList(0,1000);
to:
List<UserProcessInfo> values = new ArrayList<UserProcessInfo>();
...
return values.size() <= 1000 ? values : new ArrayList<UserProcessInfo>(values.subList(0,1000));
Attach the JDMK source to your IDE, then set a breakpoint in the HttpSendSocket and run it with debugging enabled. At least in IntelliJ you can attach the library source by trying to open the class from the stacktrace, then choosing to link source. Don't know how the process is for other IDE's but I would expect it to be possible.
We are getting a mustache play error in production (amazon linux EC2 AMI) but not in development (MACs) and we have tried upgrading the jvm, using the jdk instead, and changing from a tomcat deploy model to match our development environments as much as possible but nothing is working. Please any help would be greatly appreciated. We have lots of shared code in java and javascript using mustache and it would be a big deal to rewrite everything if we had to ditch mustache on the java side.
20:48:52,403 ERROR ~
#6al2dd0po
Internal Server Error (500) for request GET /mystuff/people
Execution exception (In {module:mustache-0.2}/app/play/modules/mustache/MustacheTags.java around line 32)
NullPointerException occured : null
play.exceptions.JavaExecutionException
at play.templates.BaseTemplate.throwException(BaseTemplate.java:90)
at play.templates.GroovyTemplate.internalRender(GroovyTemplate.java:257)
at play.templates.Template.render(Template.java:26)
at play.templates.GroovyTemplate.render(GroovyTemplate.java:187)
at play.mvc.results.RenderTemplate.<init>(RenderTemplate.java:24)
at play.mvc.Controller.renderTemplate(Controller.java:660)
at play.mvc.Controller.renderTemplate(Controller.java:640)
at play.mvc.Controller.render(Controller.java:695)
at controllers.MyStuff.people(MyStuff.java:183)
at play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:548)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:502)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:478)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:473)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:161)
at Invocation.HTTP Request(Play!)
Caused by: java.lang.NullPointerException
at play.modules.mustache.MustacheTags._template(MustacheTags.java:32)
at play.modules.mustache.MustacheTags$_template.call(Unknown Source)
at /app/views/User/people.html.(line:22)
at play.templates.GroovyTemplate.internalRender(GroovyTemplate.java:232)
... 13 more
Seems the issue is with the threadlocal. In Prod as per my logs, the session gets initialized with the main thread.
[2012-06-30 18:35:38,102] INFO 10097[**main**] - Mustache module initialized
However, MustacheTag tries to access with various thread like this during request.
[2012-06-30 17:48:44,669] INFO 66048[**play-thread-1**] - [{module:mustache-0.2}/app/play/modules/mustache/MustacheTags.java:46] _meta() :: MustachePlugin.session():null
So I changed the implementation of MustachePlugin like this.Changed line commented out:
//private static ThreadLocal<MustacheSession> session_ = new ThreadLocal<MustacheSession>();
private static MustacheSession _session = null;
public static MustacheSession session(){
//return session_.get();
return _session;
}
public void onConfigurationRead(){
// some code
_session = new MustacheSession(compiler, root);
// some code
}
And it is working fine now in prod mode! I see no reason why it should have been in a ThreadLocal in the first place as the session gets initialized at startup!
your issue is difficult to reproduce so i'll give few pointers here. you have tried to eliminate of issue being env issue. so other possible issues could be
data issue: many times reason for production issue is usually difference in actual data and test data. check if its data issue which is casuing NPE.
code issue: Is there something at people.html.(line:22) causing issue. first try removing / altering that to check if thats causing issue. Or can you get source code of mustache (exact version which you are using) and see what object its trying to create and where its failing.
Properties file for different environments: do you have different proprties file for each env? If yes, have u missed on any property for prod env?
You have a NullPointerException on MustacheTags.java at line 32.
This means that you are probably calling a method of the Mustache library and passing a null value.
Try logging all the parameters you transfer to this method (MyStuff.java line 183?).
You can look at the source code of MustacheTags here, it might help you understand what values you are passing and what should be passed.
we are getting this error at the end of running application. I search in google buti don't know what cause this error and what this means. What to do and how to solve it?
i even don't know what raise this exception...
Exception breakpoint occurred at line 145 of EventDispatchThread.java.
java.lang.NullPointerException:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at oracle.jbo.uicli.jui.JUTableBinding$JUTableModel$2.run(JUTableBinding.java:1209)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Don't know what kind of searches you have performed on Google. I would suggest looking up each error (or rather each class where error occurs). Starting from the beginning as subsequent errors may be a due to error propagation. Two searches for EventDispatchThread and JUTableBinding.java may provide some insight at what went wrong.
http://www.docjar.org/docs/api/java/awt/EventDispatchThread.html
It seems that this class deals with AWT components ("takes events off the EventQueue and dispatches them to the appropriate AWT components")
For the JUTableBinding.java there are quite a few pages that say about NullPointerException
https://forums.oracle.com/forums/thread.jspa?threadID=515213
https://forums.oracle.com/forums/thread.jspa?threadID=2343921
https://kr.forums.oracle.com/forums/thread.jspa?threadID=503593
Some of them say that the problem may be with jdk version (seems 1.6 and above throw errors). I would assume that may be the case. Try to recompile using earlier versions of jdk and check whether error is still there. If it is not this then we will investigate further.
"I've looked into the code and found out that JUTableBinding.JUTableModel calls
mScrollUnit = control.getScrollableUnitIncrement(null,
SwingConstants.VERTICAL, 0);
(Line 947)
This was okay in Java 5, since JTable's getScrollableUnitIncrement just returned the row height."
"I changed the line to:
mScrollUnit = control.getScrollableUnitIncrement(
control.getVisibleRect(), SwingConstants.VERTICAL, 0);
and everything works fine on Java 6..."
Hope it helps.