src/java.base/share/classes/java/net/SocketPermission.java
changeset 52902 e3398b2e1ab0
parent 52700 b206bdfb9fe2
child 53018 8bf9268df0e2
equal deleted inserted replaced
52901:3ba9ff4d4aaf 52902:e3398b2e1ab0
   303     private void setDeny() {
   303     private void setDeny() {
   304         defaultDeny = true;
   304         defaultDeny = true;
   305     }
   305     }
   306 
   306 
   307     private static String getHost(String host) {
   307     private static String getHost(String host) {
   308         if (host.equals("")) {
   308         if (host.isEmpty()) {
   309             return "localhost";
   309             return "localhost";
   310         } else {
   310         } else {
   311             /* IPv6 literal address used in this context should follow
   311             /* IPv6 literal address used in this context should follow
   312              * the format specified in RFC 2732;
   312              * the format specified in RFC 2732;
   313              * if not, we try to solve the unambiguous case
   313              * if not, we try to solve the unambiguous case
   342 
   342 
   343     private int[] parsePort(String port)
   343     private int[] parsePort(String port)
   344         throws Exception
   344         throws Exception
   345     {
   345     {
   346 
   346 
   347         if (port == null || port.equals("") || port.equals("*")) {
   347         if (port == null || port.isEmpty() || port.equals("*")) {
   348             return new int[] {PORT_MIN, PORT_MAX};
   348             return new int[] {PORT_MIN, PORT_MAX};
   349         }
   349         }
   350 
   350 
   351         int dash = port.indexOf('-');
   351         int dash = port.indexOf('-');
   352 
   352 
   356         } else {
   356         } else {
   357             String low = port.substring(0, dash);
   357             String low = port.substring(0, dash);
   358             String high = port.substring(dash+1);
   358             String high = port.substring(dash+1);
   359             int l,h;
   359             int l,h;
   360 
   360 
   361             if (low.equals("")) {
   361             if (low.isEmpty()) {
   362                 l = PORT_MIN;
   362                 l = PORT_MIN;
   363             } else {
   363             } else {
   364                 l = Integer.parseInt(low);
   364                 l = Integer.parseInt(low);
   365             }
   365             }
   366 
   366 
   367             if (high.equals("")) {
   367             if (high.isEmpty()) {
   368                 h = PORT_MAX;
   368                 h = PORT_MAX;
   369             } else {
   369             } else {
   370                 h = Integer.parseInt(high);
   370                 h = Integer.parseInt(high);
   371             }
   371             }
   372             if (l < 0 || h < 0 || h<l)
   372             if (l < 0 || h < 0 || h<l)
   494 
   494 
   495         if (action == null) {
   495         if (action == null) {
   496             throw new NullPointerException("action can't be null");
   496             throw new NullPointerException("action can't be null");
   497         }
   497         }
   498 
   498 
   499         if (action.equals("")) {
   499         if (action.isEmpty()) {
   500             throw new IllegalArgumentException("action can't be empty");
   500             throw new IllegalArgumentException("action can't be empty");
   501         }
   501         }
   502 
   502 
   503         int mask = NONE;
   503         int mask = NONE;
   504 
   504