This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 189495 - JSP: Java code formatting
Summary: JSP: Java code formatting
Status: RESOLVED WONTFIX
Alias: None
Product: javaee
Classification: Unclassified
Component: JSP (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P3 normal with 1 vote (vote)
Assignee: David Konecny
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-13 16:21 UTC by falberts
Modified: 2016-07-07 08:53 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description falberts 2010-08-13 16:21:39 UTC
When using the Format feature (Alt+Shift+f) on a JSP document containing more than two Java blocks the document may have corrupt intents. In particular it does happen when the Java code does contain several nested statements.

At the example below the Java code in the middle is eight chars too far right. Furthermore I do not understand why the first intent is at twelve chars.

It seems there is just an eight char intention that simply should be removed.


Example:
    <body>
        <h1>Hello World!</h1>
        <%
                    String s1;
                    if (1 == 1)
                    {
                        s1 = "1";
        %>
        <h1>Hello World!</h1>
        <%
                                if (1 == 1)
                                {
                                    s1 = "1";
        %>
        <h1>Hello World!</h1>
        <%
                            if (1 == 1)
                            {
                                s1 = "1";
                            }
                        }
                    }
        %>
    </body>


A much better layout would look like this:
    <body>
        <h1>Hello World!</h1>
        <%
            String s1;
            if (1 == 1)
            {
                s1 = "1";
        %>
        <h1>Hello World!</h1>
        <%
                if (1 == 1)
                {
                    s1 = "1";
        %>
        <h1>Hello World!</h1>
        <%
                    if (1 == 1)
                    {
                        s1 = "1";
                    }
                }
            }
        %>
    </body>
Comment 1 Martin Fousek 2011-10-31 15:30:49 UTC
Formating changed its behaviour a little bit, but it's still doesn't work properly for your case:
<body>
    <h1>Hello World!</h1>
    <%
        String s1;
        if (1 == 1) {
            s1 = "1";
    %>
    <h1>Hello World!</h1>
    <%
        if (1 == 1) {
            s1 = "1";
    %>
    <h1>Hello World!</h1>
    <%
                if (1 == 1) {
                    s1 = "1";
                }
            }
        }
    %>
</body>
Comment 2 Martin Balin 2016-07-07 08:53:14 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss