wmyywm / eclipse-code-formatter-intellij-plugin

Automatically exported from code.google.com/p/eclipse-code-formatter-intellij-plugin
0 stars 0 forks source link

exception in plugin #21

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

Just got this in the plugin, subsequently invoking the formatting again worked 
fine.

startOffset0, endOffset:1987, length of file 1987: formatting failed, probably 
due to not compilable code or wrong config file
java.lang.RuntimeException: formatting failed, probably due to not compilable 
code or wrong config file
    at krasa.formatter.eclipse.JavaCodeFormatterFacade.formatInternal(JavaCodeFormatterFacade.java:122)
    at krasa.formatter.eclipse.CodeFormatterFacade.format(CodeFormatterFacade.java:27)
    at krasa.formatter.plugin.EclipseCodeFormatter.reformat(EclipseCodeFormatter.java:157)
    at krasa.formatter.plugin.EclipseCodeFormatter.formatWhenEditorIsOpen(EclipseCodeFormatter.java:90)
    at krasa.formatter.plugin.EclipseCodeFormatter.formatWithEclipse(EclipseCodeFormatter.java:57)
    at krasa.formatter.plugin.EclipseCodeFormatter.format(EclipseCodeFormatter.java:44)
    at krasa.formatter.plugin.EclipseCodeStyleManager.formatWithEclipse(EclipseCodeStyleManager.java:118)
    at krasa.formatter.plugin.EclipseCodeStyleManager.reformatText(EclipseCodeStyleManager.java:73)
    at krasa.formatter.plugin.DelegatingCodeStyleManager.reformatText(DelegatingCodeStyleManager.java:158)
    at com.intellij.codeInsight.actions.ReformatCodeProcessor$1.call(ReformatCodeProcessor.java:93)
    at com.intellij.codeInsight.actions.ReformatCodeProcessor$1.call(ReformatCodeProcessor.java:82)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at com.intellij.codeInsight.actions.ReformatAndOptimizeImportsProcessor$1.call(ReformatAndOptimizeImportsProcessor.java:82)
    at com.intellij.codeInsight.actions.ReformatAndOptimizeImportsProcessor$1.call(ReformatAndOptimizeImportsProcessor.java:79)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at com.intellij.codeInsight.actions.AbstractLayoutCodeProcessor$2.run(AbstractLayoutCodeProcessor.java:210)
    at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:898)
    at com.intellij.codeInsight.actions.AbstractLayoutCodeProcessor$9$1$1.run(AbstractLayoutCodeProcessor.java:489)
    at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:117)
    at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:93)
    at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:81)
    at com.intellij.codeInsight.actions.AbstractLayoutCodeProcessor$9$1.run(AbstractLayoutCodeProcessor.java:484)
    at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:333)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:646)
    at java.awt.EventQueue.access$000(EventQueue.java:84)
    at java.awt.EventQueue$1.run(EventQueue.java:607)
    at java.awt.EventQueue$1.run(EventQueue.java:605)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:616)
    at com.intellij.ide.IdeEventQueue.e(IdeEventQueue.java:699)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:538)
    at com.intellij.ide.IdeEventQueue.b(IdeEventQueue.java:420)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:378)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

Original issue reported on code.google.com by Jorg.Hey...@gmail.com on 17 Apr 2012 at 6:27

GoogleCodeExporter commented 9 years ago
well, it is reproducible then? :(

Original comment by vojta.kr...@gmail.com on 17 Apr 2012 at 7:35

GoogleCodeExporter commented 9 years ago
Yes i can reproduce it :) For one of our JPA entities i was creating 
@NamedQueries annotation on the class. For example add below annotation to a 
class and format it, you should get the error because the NamedQueries has a 
syntax error in it (missing comma between @NamedQuery elements

@Entity
@Table(name = "MY_ENTITY")
@NamedQueries({
        @NamedQuery(name = "test1", query = "select a from MyEntity a where a.applicationName = 'ABC' "
                + "and a.user.active = 'false'", hints = { @QueryHint(name = QueryHints.FETCH,
                value = "a.user") })
        @NamedQuery(name = "test2",
                query = "select a from MyEntity2 a where a.user.credentialId = '123' "
                        + "and a.user.active = 'false'", hints = {
                        @QueryHint(name = QueryHints.FETCH, value = "a.user"), @QueryHint(name = QueryHints.FETCH, value = "a.credentials") }) })

Original comment by Jorg.Hey...@gmail.com on 17 Apr 2012 at 7:50

GoogleCodeExporter commented 9 years ago
well, not compilable code cannot be reformatted :-)

Original comment by vojta.kr...@gmail.com on 17 Apr 2012 at 7:51

GoogleCodeExporter commented 9 years ago
sure, but when i for example make a syntax error somewhere else i.e.

private Strang myString;

--> this formats fine and i don't get the exception.

Original comment by Jorg.Hey...@gmail.com on 17 Apr 2012 at 8:05

GoogleCodeExporter commented 9 years ago
(in any case i disabled the notification now so it doesn't bother me anymore)

Original comment by Jorg.Hey...@gmail.com on 17 Apr 2012 at 8:11

GoogleCodeExporter commented 9 years ago
well ok, i was not precise onough :] it is all about syntax :]

Original comment by vojta.kr...@gmail.com on 17 Apr 2012 at 8:15

GoogleCodeExporter commented 9 years ago

Original comment by vojta.kr...@gmail.com on 19 Apr 2012 at 3:48