“java.lang.UnsupportedOperationException: Not supported yet.”

前端 未结 5 831
鱼传尺愫
鱼传尺愫 2021-01-21 08:55

What I am trying to do :

I am trying to connect to Web Portal [that uses https]using Java. I have written code for supplying user credentials using Authenticator class.W

相关标签:
5条回答
  • 2021-01-21 09:24

    You don't give a body to your method. Check the line where you have the problem and override your method with the code you want.

    0 讨论(0)
  • 2021-01-21 09:34

    You've probably used an IDE such as Netbeans to implement an interface / override an abstract class that needs certain methods implementing. When IDEs do this (Netbeans definitely does) they generate method stubs for you like this so the code still compiles but if you try and call a method you haven't actually implemented you get an unavoidable error.

    Usually this means you have to implement the given method, but sometimes an implementation does genuinely call for a blank method stub, in which case just delete the line that's throwing the exception.

    0 讨论(0)
  • 2021-01-21 09:36

    This happens when you did not provide implementations for all methods from the interface you've implemented. Check which method you not implemented.

    0 讨论(0)
  • 2021-01-21 09:40

    Have you seen this code fragment ?

        @Override
        public Result authenticate(HttpExchange he) {
            throw new UnsupportedOperationException("Not supported yet.");
        }
    

    It's precisely the one that will throw the aforementionned exception each time you try to authenticate.

    So, to my mind, the solution to your authentication problem is quite simple : implement this method.

    0 讨论(0)
  • 2021-01-21 09:42

    if you don't want implement this method :

        @Override
        public Result authenticate(HttpExchange he) {
            throw new UnsupportedOperationException("Not supported yet.");
        }
    

    take it easy , only delete this line of method :

    throw new UnsupportedOperationException("Not supported yet.");
    
    0 讨论(0)
提交回复
热议问题