flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLINK-4668) Fix positive random int generation
Date Fri, 23 Sep 2016 16:40:20 GMT

    [ https://issues.apache.org/jira/browse/FLINK-4668?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15516928#comment-15516928

ASF GitHub Bot commented on FLINK-4668:

Github user greghogan commented on the issue:

    These are temporary files automatically deleted by the client. To handle paths with leading
dashes one can prefix with a directory (`vi ./-44.txt`) or place after a double dash (`vi
-- -44.txt`).
    This looks to me like a safe change (I'd first question why we're prefixing with a random
string when Java is doing the same in `File.createTempFile`). On the other hand, this isn't
fixing an error and there are limitless ways to refactor the existing codebase. And fortunately
the anti-pattern is well-known.

> Fix positive random int generation
> ----------------------------------
>                 Key: FLINK-4668
>                 URL: https://issues.apache.org/jira/browse/FLINK-4668
>             Project: Flink
>          Issue Type: Bug
>          Components: Client
>            Reporter: Alexander Pivovarov
>            Priority: Trivial
> According to java spec
> {code}Math.abs(Integer.MIN_VALUE) == Integer.MIN_VALUE{code}
> So, {code}Math.abs(rnd.nextInt()){code} might return negative value
> To generate positive random int value we can use 
> {code}rnd.nextInt(Integer.MAX_VALUE){code}
> Integer.MAX_VALUE will be excluded btw

This message was sent by Atlassian JIRA

View raw message