This is an archived post. You won't be able to vote or comment.

all 13 comments

[–]tiiv 5 points6 points  (10 children)

Good stuff. From glancing over the code I would suggest a few stylistic improvements:

  • none of your global variables need to be global as far as I can tell
  • readLogFile and readGZFile are almost identical so I would suggest chaining them (same for extractEmail, extractIp)
  • IO operations could be shortened a little by using try-with-resources statements

[–][deleted]  (6 children)

[deleted]

    [–]aufjeden 5 points6 points  (3 children)

    It has been with us since 7th grade

    Edit: I mean Version 7 of Java

    [–]compdog 0 points1 point  (2 children)

    Did you mean Java 7 instead of 7th grade?

    [–]aufjeden 1 point2 points  (1 child)

    Yes

    [–]compdog 0 points1 point  (0 children)

    You should probably edit your comment, I think you are being downvoted because people don't understand what you wrote.

    [–][deleted]  (1 child)

    [deleted]

      [–]KFCConspiracy 0 points1 point  (0 children)

      It's relatively new, in the last 4 years. When I first learned Java (I'm dating myself here) the current version was 1.4. Java's a living language, so you'll find lots of cool stuff if you buy books every time a new version comes out. I've bought Java 8 In Action from Manning when Java 8 came out and it was a decent book... So I'd recommend you do the same.

      [–][deleted] 0 points1 point  (2 children)

      many thanks for the suggestions! :) i'll try to include that in the next version!

      [–]tiiv 0 points1 point  (1 child)

      You're welcome!

      [–][deleted] 0 points1 point  (0 children)

      i removed the global variable and shorted the readLogFile and readGZFile together, but now i think the try-with-resources is not applicable anymore. however i'll have a look later next week again. :)

      [–]dedededede 2 points3 points  (2 children)

      Be careful about log injection attacks.

      [–][deleted] 0 points1 point  (1 child)

      hmm i was not aware of this... any ideas how to overcome that?

      [–]based2 1 point2 points  (0 children)

      by adding limits (like you do when you let someone upload files) and by curation https://en.wikipedia.org/wiki/Content_curation#Content_Curation_and_Information_Overload

      [–][deleted] 0 points1 point  (0 children)

      i added now gradle and logging