TechnionYP5777 / Bugquery

Bug query
9 stars 1 forks source link

Improving StackTraceExtractor #37

Closed rodedzats closed 7 years ago

rodedzats commented 7 years ago

This class is used for extracting all stack traces from stackoverflow post (or any other post). It works fine now for most posts however we need to improve it in order to find all possible stack traces and only the legal stack traces in all possible cases.

tonylekhtman commented 7 years ago

I found a problem with getting the exception of the class in some of the posts. For exampe:

<p>I was hoping someone could help me out with a problem I'm having using the java search function in Eclipse on a particular project.</p>&#xA;&#xA;<p>When using the java search on one particular project, I get an error message saying <code>Class file name must end with .class</code> (see stack trace below). This does not seem to be happening on all projects, just one particular one, so perhaps there's something I should try to get rebuilt?</p>&#xA;&#xA;<p>I have already tried <code>Project -&gt; Clean</code>... and Closing Eclipse, deleting all the built class files and restarting Eclipse to no avail.</p>&#xA;&#xA;<p>The only reference I've been able to find on Google for the problem is at <a href="http://www.crazysquirrel.com/computing/java/eclipse/error-during-java-search.jspx">http://www.crazysquirrel.com/computing/java/eclipse/error-during-java-search.jspx</a>, but unfortunately his solution (closing, deleting class files, restarting) did not work for me.</p>&#xA;&#xA;<p>If anyone can suggest something to try, or there's any more info I can gather which might help track it's down, I'd greatly appreciate the pointers.</p>&#xA;&#xA;<pre><code>Version: 3.4.0&#xA;Build id: I20080617-2000&#xA;</code></pre>&#xA;&#xA;<p>Also just found this thread - <a href="http://www.myeclipseide.com/PNphpBB2-viewtopic-t-20067.html">http://www.myeclipseide.com/PNphpBB2-viewtopic-t-20067.html</a> - which indicates the same problem may occur when the project name contains a period. Unfortunately, that's not the case in my setup, so I'm still stuck.</p>&#xA;&#xA;<pre><code>Caused by: java.lang.IllegalArgumentException: Class file name must end with .class&#xA;at org.eclipse.jdt.internal.core.PackageFragment.getClassFile(PackageFragment.java:182)&#xA;at org.eclipse.jdt.internal.core.util.HandleFactory.createOpenable(HandleFactory.java:109)&#xA;at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1177)&#xA;at org.eclipse.jdt.internal.core.search.JavaSearchParticipant.locateMatches(JavaSearchParticipant.java:94)&#xA;at org.eclipse.jdt.internal.core.search.BasicSearchEngine.findMatches(BasicSearchEngine.java:223)&#xA;at org.eclipse.jdt.internal.core.search.BasicSearchEngine.search(BasicSearchEngine.java:506)&#xA;at org.eclipse.jdt.core.search.SearchEngine.search(SearchEngine.java:551)&#xA;at org.eclipse.jdt.internal.corext.refactoring.RefactoringSearchEngine.internalSearch(RefactoringSearchEngine.java:142)&#xA;at org.eclipse.jdt.internal.corext.refactoring.RefactoringSearchEngine.search(RefactoringSearchEngine.java:129)&#xA;at org.eclipse.jdt.internal.corext.refactoring.rename.RenameTypeProcessor.initializeReferences(RenameTypeProcessor.java:594)&#xA;at org.eclipse.jdt.internal.corext.refactoring.rename.RenameTypeProcessor.doCheckFinalConditions(RenameTypeProcessor.java:522)&#xA;at org.eclipse.jdt.internal.corext.refactoring.rename.JavaRenameProcessor.checkFinalConditions(JavaRenameProcessor.java:45)&#xA;at org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring.checkFinalConditions(ProcessorBasedRefactoring.java:225)&#xA;at org.eclipse.ltk.core.refactoring.Refactoring.checkAllConditions(Refactoring.java:160)&#xA;at org.eclipse.jdt.internal.ui.refactoring.RefactoringExecutionHelper$Operation.run(RefactoringExecutionHelper.java:77)&#xA;at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:39)&#xA;at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:709)&#xA;at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1800)&#xA;at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:4650)&#xA;at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:92)&#xA;at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)&#xA;</code></pre>&#xA;&#xA;<p>Thanks McDowell, closing and opening the project seems to have fixed it (at least for now).</p>&#xA;
tonylekhtman commented 7 years ago

Another Problem: In this question The exception returned was "C". Link to question :http://stackoverflow.com/questions/152462/running-a-j6se-app-on-an-nt-box

<p>I need to run a Java application, which we are trying to port to Java 6, on an NT box.</p>&#xA;&#xA;<p>I manage to run java 5 on it (although not officially supported), but when I try to run java 6 I get the following error:</p>&#xA;&#xA;<pre><code>Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Program Files\Java\jre1.6.0_05\bin\awt.dll: The specified procedure could not be found at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(Unknown Source) at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at sun.security.action.LoadLibraryAction.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at sun.awt.NativeLibLoader.loadLibraries(Unknown Source) at sun.awt.DebugHelper.<clinit>(Unknown Source) at java.awt.EventQueue.<clinit>(Unknown Source) at javax.swing.SwingUtilities.invokeLater(Unknown Source) at ui.sequencer.test.WindowTest.main(WindowTest.java:136)

Anybody has any idea how to solve this?

This persists even when I move the java executables to another directory with no spaces in its name.

Thanks in advance, Michael

p.s. I know, I should upgrade, but it's not up to me or my company - this is a very very bug huge gigantic company we work with, and they intend to keep NT for another 5 years.

`

rodedzats commented 7 years ago

@tonylekhtman I fixed the StackTraceExtractor and StackTrace classes, now both of the examples you posted work fine (I added tests for them). I'm leaving this issue open for further improvement if needed.

tonylekhtman commented 7 years ago

Another problem, throws an exception for some reason:

<p>Using <a href="http://www.codeplex.com/aspnet" rel="nofollow" title="for Visual Studio 2005">preview 4</a> of <a href="http://asp.net/mvc" rel="nofollow" title="for Visual Studio 2008">ASP.NET MVC</a> &#xA;Code like:</p>&#xA;&#xA;<pre><code>&lt;%= Html.CheckBox( "myCheckBox", "Click Here", "True", false ) %&gt;&#xA;</code></pre>&#xA;&#xA;<p>only outputs:</p>&#xA;&#xA;<pre><code>&lt;input type="checkbox"  value="True"  name="myCheckBox"  /&gt;&#xA;</code></pre>&#xA;&#xA;<p>There is a <code>name</code> there for the form post back but no <code>id</code> for javascript or labels :-(</p>&#xA;&#xA;<p>I was hoping that changing it to:</p>&#xA;&#xA;<pre><code>Html.CheckBox( "myCheckBox", "Click Here", &#xA;               "True", false, new { id="myCheckBox" } )&#xA;</code></pre>&#xA;&#xA;<p>would work - but instead I get an exception:</p>&#xA;&#xA;<pre><code>System.ArgumentException: An item with the same key has already been added.&#xA;</code></pre>&#xA;&#xA;<p>As if there was already an id somewhere in a collection somewhere - I'm stumped!</p>&#xA;&#xA;<p>The full exception for anyone interested follows (hey - wouldn't it be nice to attach files in here):</p>&#xA;&#xA;<pre>System.ArgumentException: An item with the same key has already been added. &#xA;   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)&#xA;   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)&#xA;   at System.Web.Routing.RouteValueDictionary.Add(String key, Object value)&#xA;   at System.Web.Mvc.TagBuilder2.CreateInputTag(HtmlInputType inputType, String name, RouteValueDictionary attributes)&#xA;   at System.Web.Mvc.CheckBoxBuilder.CheckBox(String htmlName, RouteValueDictionary htmlAttributes)&#xA;   at System.Web.Mvc.CheckBoxBuilder.CheckBox(String htmlName, String text, String value, Boolean isChecked, RouteValueDictionary htmlAttributes)&#xA;   at System.Web.Mvc.CheckBoxExtensions.CheckBox(HtmlHelper helper, String htmlName, String text, String value, Boolean isChecked, Object htmlAttributes)&#xA;   at ASP.views_account_termsandconditions_ascx.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in c:\dev\myProject\Views\Account\Edit.ascx:line 108</pre>&#xA;
tonylekhtman commented 7 years ago

Hi, I solved the issue by checking the tags. Another example, this time in java that throws an exception.

java.sql.BatchUpdateException: Incorrect string value: '\xF1a' for column 'body' at row 1
    at com.mysql.jdbc.ServerPreparedStatement.executeBatch(ServerPreparedStatement.java:657)
    at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch(NewProxyPreparedStatement.java:1723)
    at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
    at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:242)
    at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)
    at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
    at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
    at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
    at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
    at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
    at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
    at com.cerebra.cerepedia.item.dao.ItemDAOHibernate.addComment(ItemDAOHibernate.java:505)
    at com.cerebra.cerepedia.item.ItemManagerPOJOImpl.addComment(ItemManagerPOJOImpl.java:164)
    at com.cerebra.cerepedia.struts.item.ItemAction.addComment(ItemAction.java:126)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:269)
    at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:170)
    at org.apache.struts.actions.MappingDispatchAction.execute(MappingDispatchAction.java:166)
    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at com.cerebra.cerepedia.security.AuthorizationFilter.doFilter(AuthorizationFilter.java:78)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at com.cerebra.cerepedia.hibernate.HibernateSessionRequestFilter.doFilter(HibernateSessionRequestFilter.java:30)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at filters.UTF8Filter.doFilter(UTF8Filter.java:14)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Unknown Source)
yonzarecki commented 7 years ago

@tonylekhtman We fixed all the current examples, if you can send us more (even all of them) we'll work on them too.

tonylekhtman commented 7 years ago

Hi @yonzarecki, good job! I haven't found more examples for bad exception retrival but there is some indexOutOfBounds error in: http://stackoverflow.com/questions/315115/java-lang-unsupportedoperationexception-in-jpa-transaction.

The stacktrace looks odd, not sure if we should support it or not.

tonylekhtman commented 7 years ago

I am creating a log file to you with all the questions causing problems while I am creating the final db #9.

yonzarecki commented 7 years ago

Closing this issue for now, all the tony's examples seem resolved