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

Fix all errors being not applicable. #468

Merged
merged 2 commits into from
Jan 12, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/com/dmdirc/logger/SentryLoggingErrorManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ void handleNoErrorReporting(final boolean value) {
* @return True if the source is valid, false otherwise
*/
private boolean isValidSource(final Collection<String> trace) {
final String line = getSourceLine(trace).orElse("");
return line.startsWith("com.dmdirc")
&& !line.startsWith("com.dmdirc.addons.ui_swing.DMDircEventQueue");
final String line = getSourceLine(trace).orElse("").trim();
return line.startsWith("at com.dmdirc")
&& !line.startsWith("at com.dmdirc.addons.ui_swing.DMDircEventQueue");
}

/**
Expand All @@ -133,7 +133,7 @@ private boolean isValidSource(final Collection<String> trace) {
*/
private Optional<String> getSourceLine(final Collection<String> trace) {
for (String line : trace) {
if (line.startsWith("com.dmdirc")) {
if (line.trim().startsWith("at com.dmdirc")) {
return Optional.of(line);
}
}
Expand Down
4 changes: 2 additions & 2 deletions test/com/dmdirc/logger/SentryLoggingErrorManagerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void setUp() throws Exception {
when(appErrorEvent.getError()).thenReturn(appError);
when(appError.isAppError()).thenReturn(true);
when(appError.getThrowable()).thenReturn(new IllegalStateException());
when(appError.getTrace()).thenReturn(Lists.newArrayList("com.dmdirc.Main"));
when(appError.getTrace()).thenReturn(Lists.newArrayList("at com.dmdirc.Main"));
when(userErrorEvent.getError()).thenReturn(userError);
when(userError.isAppError()).thenReturn(false);
when(config.getBinder()).thenReturn(configBinder);
Expand All @@ -83,7 +83,7 @@ public void testHandleErrorEvent() throws Exception {

@Test
public void testHandleErrorEvent_DMDircEventQueue() throws Exception {
when(appError.getTrace()).thenReturn(Lists.newArrayList("com.dmdirc.addons.ui_swing" +
when(appError.getTrace()).thenReturn(Lists.newArrayList("at com.dmdirc.addons.ui_swing" +
".DMDircEventQueue", "java.somethingelse"));
instance.handleErrorEvent(appErrorEvent);
verify(sentryErrorReporter, never()).sendException(anyString(), any(ErrorLevel.class),
Expand Down