mbien commented on code in PR #9208:
URL: https://github.com/apache/netbeans/pull/9208#discussion_r2820304679


##########
ide/projectui/src/org/netbeans/modules/project/ui/zip/ExportZIP.java:
##########
@@ -477,7 +477,11 @@ public void actionPerformed(java.awt.event.ActionEvent 
evt) {
     private void zipButtonActionPerformed(java.awt.event.ActionEvent evt) 
{//GEN-FIRST:event_zipButtonActionPerformed
         JFileChooser fc = new JFileChooser();
         if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) {
-            zipField.setText(fc.getSelectedFile().getAbsolutePath());
+            String sf = fc.getSelectedFile().getAbsolutePath();
+            if(!sf.toLowerCase().endsWith(".zip")) {
+              sf += ".zip";
+            }

Review Comment:
   fwiw: I am not super concerned about the locale issue in this particular 
case, but `equalsIgnoreCase` alone isn't really fixing the locale issue.
   ```java
           String a = "ß";
           System.out.println(a.equalsIgnoreCase(a.toUpperCase()));            
// false
           System.out.println(a.equalsIgnoreCase(a.toUpperCase(Locale.ROOT))); 
// false
           System.out.println(a.toUpperCase().equals(a.toUpperCase()));        
// true
   ```
   `equalsIgnoreCase` is implemented with `regionMatches` which javadoc devines 
as: 
   
   (...)
   `if ignoreCase is false, all pairs of corresponding Unicode code points are 
equal integer values; or if ignoreCase is true, Character.toLowerCase( 
Character.toUpperCase(int)) on all pairs of Unicode code points results in 
equal integer values.`
   
   So the effect should be the same as calling  `toLowerCase`+`equals` 
directly, just potentially a bit faster due to lack of an extra copy.
   
   anyway, lets get this in as is IMO



-- 
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