Skip to content
This repository was archived by the owner on Aug 18, 2020. It is now read-only.

Added new parameter #148

Merged
merged 12 commits into from
Nov 9, 2019
Merged

Added new parameter #148

merged 12 commits into from
Nov 9, 2019

Conversation

derNiklaas
Copy link
Contributor

@derNiklaas derNiklaas commented Nov 7, 2019

Closes #54

Added:

  • Integer parameter
  • Double parameter
  • Boolean parameter
  • List parameter
  • Map parameter
  • Color parameter
  • URI / URL parameter
  • Time parameter

API Pullrequest: codeoverflow-org/chatoverflow-api#18

Copy link
Contributor

@justgerd justgerd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good, but a few parts of the code are unnecessary complicated.

@derNiklaas derNiklaas marked this pull request as ready for review November 8, 2019 23:17
Copy link
Member

@J0B10 J0B10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry but I think the map and list code is still .

It would be way cleaner to just use the scala collections and return the java versions by using .asJava.
I agreed with skate that this changes should be made but if you can finish them fast we might be able to include your PR in pre-alpha3 as you requested 😄.

Also Url, LocalTime, LocalDate and LocalDateTime parameters are still missing 😉.
If you really don't want to do them I can do It once you are finished.

@J0B10 J0B10 added this to the pre-alpha 3 milestone Nov 9, 2019
@derNiklaas
Copy link
Contributor Author

@joblo2213 Hi there. Thanks for the feedback.
I added a URI parameter (can be converted to URL by using URI.toURL() ). also converted java map/list to scala map/list. Also added comments to the regex.

Could you do the time parameter?

@J0B10 J0B10 self-assigned this Nov 9, 2019
hlxid
hlxid previously requested changes Nov 9, 2019
@J0B10
Copy link
Member

J0B10 commented Nov 9, 2019

After commit aacdd21 and the changes @daniel0611 requested I think there is some confusion about how exception handling should work for the parameters:

I think it should be the following way:
Any exceptions that are thrown in deserialize() should get passed.

https://github.com/derNiklaas/chatoverflow/blob/e5bbc816311c92d48d59caa50a974bc9ea14140b/src/main/scala/org/codeoverflow/chatoverflow/configuration/ConfigurationService.scala#L290-L301:

            try {
              val reqContent = loadedRequirementType.get.newInstance().asInstanceOf[io.Serializable]
              requirements.getAccess.setRequirementContent(requirementId, reqContent)
              reqContent.deserialize(content)


              logger info s"Created requirement content for '$requirementId' and deserialized its content."
              true
            } catch {
              case e: Exception =>
                logger error s"Unable to instantiate requirement content. Exception: ${e.getMessage}"
                false
            }

Here all exceptions that are thown while deserializing are cought and logged, and the framework keeps the information that not all requirements could be fullfilled so that it could also be displayed to the gui.

Thats why form my point of view no messages need to be logged and all exceptions may be uncought.
Also if the deserialization failed (like in the ColorPrameter) an exception should be thrown.

The only thing we may think about is making sure that the message of the exception does tell the user what actually is wrong.

@derNiklaas
Copy link
Contributor Author

Just removed Error handlers from Parameter classes.

@J0B10 J0B10 dismissed hlxid’s stale review November 9, 2019 14:15

exception handling is now fine

@derNiklaas
Copy link
Contributor Author

895f22f fixed an bug which was introduced by b93b859 .

(test;test2),(test3;test4),(test5,test6) would turn into (test;test2),(test3;test4),(;) which shouldn't happen.
it now throws an IllegalArgumentException.

@J0B10 J0B10 merged commit 4bd3edb into codeoverflow-org:develop Nov 9, 2019
@sebinside sebinside mentioned this pull request Nov 11, 2019
3 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants