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

Commit

Permalink
Bug 1059804 - Watchman support for UTF-8
Browse files Browse the repository at this point in the history
  • Loading branch information
jwhonce committed Jan 30, 2014
1 parent 43ef0fa commit 5679cd8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
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 @@ -46,7 +46,7 @@ def apply
# skip missing log files as jboss may be coming up.
next unless File.exist?(log)

File.open(log).grep(/ java.lang.OutOfMemoryError/) do |event|
File.open(log, 'r:utf-8').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
2 changes: 1 addition & 1 deletion node-util/sbin/oo-watchman
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ module OpenShift
rescue Exception => e
msg = "Unhandled exception (#{e}) from Watchman plugin #{plugin}: #{e.message}"
Syslog.notice(msg)
logger.debug(%Q{#{msg}\n#{e.backtrace.join("\n")}})
@logger.debug(%Q{#{msg}\n#{e.backtrace.join("\n")}})
end
end

Expand Down
12 changes: 12 additions & 0 deletions node/test/node_functional/jboss_plugin_test.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8
#--
# Copyright 2014 Red Hat, Inc.
#
Expand Down Expand Up @@ -125,4 +126,15 @@ def test_ceiling

assert_equal 2, counter, 'Failed to find 2 entries'
end

def test_utf8
start_time = DateTime.civil(2012, 2, 7, 12, 0, 0, -6)
File.open(@server_log, 'w') do |file|
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")
end

restart = lambda { |u, t| raise 'This should never happen!' }
JbossPlugin.new(@config, @gears, restart, start_time).apply
end
end

0 comments on commit 5679cd8

Please sign in to comment.