Skip to content
This repository has been archived by the owner on Aug 29, 2018. It is now read-only.

Commit

Permalink
Handle all encodings during regex comparisons
Browse files Browse the repository at this point in the history
Open files in binary mode to support regex matching on all encodings.

Fix bug #1191681
  • Loading branch information
ironcladlou committed Feb 12, 2015
1 parent 77a2043 commit 48b237d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion node-util/conf/watchman/plugins.d/jboss_plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def apply(iteration)
# skip missing log files as jboss may be coming up.
next unless File.exist?(log)

File.open(log, 'r:utf-8').grep(/ java.lang.OutOfMemoryError/) do |event|
File.open(log, 'rb').grep(/ java.lang.OutOfMemoryError/) do |event|
# timezones are just a PITA. server.log message doesn't include timezone or date so inject both from today
#
# Set the timestamp for messages with invalid timestamps to the 'epoch',
Expand Down
3 changes: 3 additions & 0 deletions node/test/node_functional/jboss_plugin_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,11 @@ def test_ceiling
def test_utf8
start_time = DateTime.civil(2012, 2, 7, 12, 0, 0, -6)
File.open(@server_log, 'w') do |file|
# Write something using utf-8
file.write('2012/02/07 17:57:11,034 INFO [stdout] (Ergebnisse_Holen) {pointsTeam2=2, matchIsFinished=true, pointsTeam1=0, nameTeam1=Borussia Mönchengladbach, nameTeam2=Bayern München}')
file.write("\n")
# Write something using ISO-8859-1
file.write("\xe9\n")
end

@restart.expects(:call).never
Expand Down

0 comments on commit 48b237d

Please sign in to comment.