JDK-6535353 : No exceptions specified for SocketPermission constructor
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux
  • CPU: x86
  • Submitted: 2007-03-16
  • Updated: 2022-01-19
  • Resolved: 2022-01-19
Related Reports
Duplicate :  
Relates :  
Description
In class level specification something like BNF for constructor parameter is specified. However behavior in case of violation of such grammar is not specified.

JDK usually throws IAE however absense of expection specification means that other implementations may behave in different manner violating "compile once run everywhere" idea.

Yet sometimes JDK does not throw any exception event if grammar is violated:

* '*' is allowed as port number violating rule
    portrange = portnumber | -portnumber | portnumber-[portnumber]
* port number may be empty while ':' is used  violating rule
    host = (hostname | IPv4address | iPv6reference) [:portrange]
* lead/trailng spaces are allowed in action names
* action comparison looks case-insentive (while it is specified nowhere)

I thing it would be useful to add something like "IAE is thrown if grammar for either host or action is violated" and clarify case-sensitivity for actions (for hostnames it is clear that they are case-insensitivy as consequrence of RFCs for DNS).

Comments
Exception was documented in JDK-8230407
19-01-2022

EVALUATION The implementation does throw IAE when the parameters are not well formed. Therefore it should be easy enough to update the spec. to reflect this.
31-07-2007