use of org.graylog2.shared.SuppressForbidden in project graylog2-server by Graylog2.
the class JmxProcessProbe method findMethod.
@SuppressForbidden("Reflection necessary")
private static Method findMethod(final String methodName, final Class<?> clazz) {
try {
final Method method = clazz.getDeclaredMethod(methodName);
method.setAccessible(true);
return method;
} catch (Exception e) {
return null;
}
}
use of org.graylog2.shared.SuppressForbidden in project graylog2-server by Graylog2.
the class MongoDbSession method setAttributes.
@SuppressForbidden("Deliberate use of ObjectOutputStream")
public void setAttributes(Map<Object, Object> attributes) {
try {
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
// FIXME: This could break backward compatibility if different Java versions are being used.
final ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(attributes);
oos.close();
fields.put("attributes", bos.toByteArray());
} catch (IOException e) {
LOG.error("too bad :(", e);
}
}
use of org.graylog2.shared.SuppressForbidden in project graylog2-server by Graylog2.
the class StaticFieldFilterTest method testFilterIsNotOverwritingExistingKeys.
@Test
@SuppressForbidden("Executors#newSingleThreadExecutor() is okay for tests")
public void testFilterIsNotOverwritingExistingKeys() throws Exception {
Message msg = new Message("hello", "junit", Tools.nowUTC());
msg.addField("foo", "IWILLSURVIVE");
final StaticFieldFilter filter = new StaticFieldFilter(inputService, new EventBus(), Executors.newSingleThreadScheduledExecutor());
filter.filter(msg);
assertEquals("hello", msg.getMessage());
assertEquals("junit", msg.getSource());
assertEquals("IWILLSURVIVE", msg.getField("foo"));
}
Aggregations