Thanks for the explanation Tony. I'm surprised that the RI would throw an exception with a 'Method not implemented' message -- I guess that is a form of assertion to ensure the type is subclassed.
We can do the same thing, but I'll add a comment in the code to show that it is not a case of Harmony falling behind. Thanks Tim Tony Wu (JIRA) wrote: > [ > https://issues.apache.org/jira/browse/HARMONY-2943?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12463058 > ] > > Tony Wu commented on HARMONY-2943: > ---------------------------------- > > Yes Tim, you are right. > I think the functionality was implemented redundantly and it will leads vm to > crash if user extends the class without overriding these methods. > I mocked a SockImpl and did a test on RI, it threw following exception, > > java.io.IOException: Method not implemented! > at java.net.SocketImpl.shutdownInput(SocketImpl.java:177) > >> [classlib][luni]SocketImpl.shutdownInput/Output leads to VM crash >> ----------------------------------------------------------------- >> >> Key: HARMONY-2943 >> URL: https://issues.apache.org/jira/browse/HARMONY-2943 >> Project: Harmony >> Issue Type: Bug >> Components: Classlib >> Reporter: Tony Wu >> Attachments: patch.diff >> >> >> Following testcase throws IOException on RI whereas leads to vm crash on >> Harmony >> public void test() throws IOException { >> MySocketImpl s = new MySocketImpl(); >> s.test(); >> } >> class MySocketImpl extends SocketImpl { >> public void test() throws IOException { >> shutdownInput(); >> } >> @Override >> protected void accept(SocketImpl newSocket) throws IOException { >> } >> @Override >> protected int available() throws IOException { >> return 0; >> } >> @Override >> protected void bind(InetAddress address, int port) throws >> IOException { >> } >> @Override >> protected void close() throws IOException { >> } >> @Override >> protected void connect(String host, int port) throws IOException { >> } >> @Override >> protected void connect(InetAddress address, int port) >> throws IOException { >> } >> @Override >> protected void connect(SocketAddress remoteAddr, int timeout) >> throws IOException { >> } >> @Override >> protected void create(boolean isStreaming) throws IOException { >> } >> @Override >> protected InputStream getInputStream() throws IOException { >> return null; >> } >> @Override >> protected OutputStream getOutputStream() throws IOException { >> return null; >> } >> @Override >> protected void listen(int backlog) throws IOException { >> } >> @Override >> protected void sendUrgentData(int value) throws IOException { >> } >> public Object getOption(int optID) throws SocketException { >> return null; >> } >> public void setOption(int optID, Object val) throws SocketException { >> } >> } >
