Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes Issue 733: unvalidated BigInteger for LED hex value #775

Merged
merged 4 commits into from
Jun 12, 2019

Conversation

rgomezp
Copy link
Contributor

@rgomezp rgomezp commented Jun 12, 2019

  • Handles incorrect ledColor hex value, sets default, throws warning
  • Unit test checks that the hex value is set to the default and warning was shown

This change is Reviewable

@rgomezp rgomezp requested a review from jkasten2 June 12, 2019 01:23
Copy link
Member

@jkasten2 jkasten2 left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 3 files at r1.
Reviewable status: 1 of 3 files reviewed, 3 unresolved discussions (waiting on @jkasten2 and @rgomezp)


OneSignalSDK/onesignal/src/main/java/com/onesignal/NotificationChannelManager.java, line 136 at r1 (raw file):

      if (payload.has("ledc")){
         Pattern pattern = Pattern.compile(HEX_PATTERN);

Compile pattern in a static instead of compiling


OneSignalSDK/onesignal/src/main/java/com/onesignal/NotificationChannelManager.java, line 142 at r1 (raw file):

         BigInteger ledColor;

         if ( !matcher.matches() ) {

nit, remove spaces inside ( )


OneSignalSDK/onesignal/src/main/java/com/onesignal/NotificationChannelManager.java, line 150 at r1 (raw file):

            ledColor = new BigInteger(ledc, 16);
            channel.setLightColor(ledColor.intValue());
         } catch (Throwable t){

Missing spaces between ){

Copy link
Member

@jkasten2 jkasten2 left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 2 files at r3.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@rgomezp rgomezp merged commit 03e8b0e into master Jun 12, 2019
@rgomezp rgomezp deleted the handle-invalid-colorcode branch June 12, 2019 02:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants