kemperalves opened a new issue, #5323:
URL: https://github.com/apache/netbeans/issues/5323

   ### Apache NetBeans version
   
   Apache NetBeans 16
   
   ### What happened
   
   Today netbeans formatted my code erroneous, I converted the code to a simple 
sample with same structure and then the code continue to be wrong formatted.
   
   ### How to reproduce
   
   1 - Create a new java project with a main class.
   
   2 -Make your main function above:
   
   ```
   
       public static void main(String[] args) throws Exception {
   
           List<String> myList = new ArrayList<>();
   
           for (String s : myList) {
               if (!s.isBlank()) {
   
                   switch (s.substring(0, 1)) {
                       case "T":
                           System.out.println("T");
                           break;
                       case "N":                               
                                   try {
                           System.out.println(Long.valueOf(s));
                       } catch (Exception ex) {
                           throw new Exception("FIRST ERROR MESSAGE");
                       }
                       break;
                       case "F":
                                       try {
                           System.out.println(new BigDecimal(s));
                       } catch (Exception ex) {
                           throw new Exception("ANOTHER ERROR MESSAGE");
                       }
                       break;
                       case "M":
                                       try {
                           System.out.println(new BigDecimal(s));
                       } catch (Exception ex) {
                           throw new Exception("OPS, MORE ONE ERROR MESSAGE");
                       }
                       break;
                       case "D":
                           throw new Exception("THIS VALUE CAN NOT BE USED");
                       case "L":
                                   try {
                           System.out.println(Boolean.valueOf(s));
                       } catch (Exception ex) {
                           throw new Exception("THIS VALUE IS NOT A BOOLEAN");
                       }
                       break;
                   }
               }
           }
   
       }
   
   
   ```
   
   3 - Click in Source / Format or type the keyboard shortcut
   
   And then, the code is formatted but, incorrect. the try blocks is not 
aligned, the breaks statements not aligned too.
   
   
   
   ### Did this work correctly in an earlier version?
   
   No / Don't know
   
   ### Operating System
   
   macOS 13.1 (22C65), Darwin 22.2.0, MacBookPro18,3, MKGP3LL/A
   
   ### JDK
   
   JDK 18, zulu
   
   ### Apache NetBeans packaging
   
   Apache NetBeans provided installer
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit a pull request?
   
   No
   
   ### Code of Conduct
   
   Yes


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to