Skip to content
This repository has been archived by the owner on Oct 13, 2021. It is now read-only.

Crash when using a proxy without a user #197

Open
jonenst opened this issue Apr 18, 2019 · 0 comments
Open

Crash when using a proxy without a user #197

jonenst opened this issue Apr 18, 2019 · 0 comments

Comments

@jonenst
Copy link
Contributor

jonenst commented Apr 18, 2019

  • Do you want to request a feature or report a bug?
    bug

  • What is the current behavior?
    The gse crashes during startup if a proxy config without a user/password is given

  • If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem
    Specify a proxy in config.yaml without a user:

proxy:    
  host: localhost                                                                           
  port: 3128         

or with a null value:

proxy:    
  host: localhost                                                                           
  port: 3128 
  user: ~
  password: ~        

equivalent to

proxy:    
  host: localhost                                                                           
  port: 3128 
  user: 
  password: 

The app crashes with the following stacktrace:
com.powsybl.commons.PowsyblException: Property user is not set
at com.powsybl.commons.config.AbstractModuleConfig.createPropertyNotSetException(AbstractModuleConfig.java:29)
at com.powsybl.commons.config.AbstractModuleConfig.lambda$getStringProperty$0(AbstractModuleConfig.java:34)
at java.util.Optional.orElseThrow(Optional.java:290)
at com.powsybl.commons.config.AbstractModuleConfig.getStringProperty(AbstractModuleConfig.java:34)
at com.powsybl.gse.util.GseUtil.lambda$setProxy$8(GseUtil.java:196)
at java.util.Optional.ifPresent(Optional.java:159)
at com.powsybl.gse.util.GseUtil.setProxy(GseUtil.java:193)
at com.powsybl.gse.app.GseApp.main(GseApp.java:94)
at com.powsybl.gse.demo.GseDemo.main(GseDemo.java:60)

  • What is the expected behavior?
    Without a user password, the code should just assume an unauthenticated proxy

  • What is the motivation / use case for changing the behavior?
    don"t force user to invent fake usernames/passwords

  • Please tell us about your environment:

    • PowSyBl Version: 2.4, GSE 1.4
  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, spectrum, etc)
    We should just change GseUtils.java public static void setProxy() to use getOptionalConfig, and create the authenticator only if they are set.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant