test_class.declarator: mockContext
test_class.original_string: Context mockContext;
test_class.type: Context
test_class.var_name: mockContext
test_class.declarator: mockAssets
test_class.original_string: AssetManager mockAssets;
test_class.type: AssetManager
test_class.var_name: mockAssets
test_class.declarator: testResult
test_class.original_string: int testResult;
test_class.type: int
test_class.var_name: testResult
test_class.file: app/src/test/java/org/jak_linux/dns66/FileHelperTest.java
test_class.identifier: FileHelperTest
test_case.body: @Test
      @PrepareForTest({Log.class, Os.class})
      public void testPoll_fault() throws Exception {
          mockStatic(Log.class);
          mockStatic(Os.class);
  
          // Eww, Android is playing dirty and setting all errno values to 0.
          // Hack around it so we can test that aborting the loop works.
          final ErrnoException e = new ErrnoException("foo", 42);
          e.getClass().getDeclaredField("errno").setInt(e, 42);
          when(Os.poll(any(StructPollfd[].class), anyInt())).then(new Answer<Integer>() {
              @Override
              public Integer answer(InvocationOnMock invocation) throws Throwable {
                  testResult++;
                  throw e;
              }
          });
  
          try {
              FileHelper.poll(null, 0);
              fail("Did not throw");
          } catch (ErrnoException e1) {
              assertEquals(42, e1.errno);
              assertSame(e, e1);
          }
          assertEquals(1, testResult);
      }
test_case.class_method_signature: FileHelperTest.testPoll_fault()
test_case.full_signature: @Test @PrepareForTest({Log.class, Os.class}) public void testPoll_fault()
test_case.identifier: testPoll_fault
test_case.invocations: mockStatic mockStatic setInt getDeclaredField getClass then when poll any anyInt poll fail assertEquals assertSame assertEquals
test_case.modifiers: @Test @PrepareForTest({Log.class, Os.class}) public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testPoll_fault()
focal_class.file: app/src/main/java/org/jak_linux/dns66/FileHelper.java
focal_class.identifier: FileHelper
focal_class.class_method_signature: FileHelper.openRead(Context context, String filename)
focal_class.full_signature: public static InputStream openRead(Context context, String filename)
focal_class.identifier: openRead
focal_class.modifiers: public static
focal_class.parameters: (Context context, String filename)
focal_class.return: InputStream
focal_class.signature: InputStream openRead(Context context, String filename)
focal_class.class_method_signature: FileHelper.openWrite(Context context, String filename)
focal_class.full_signature: public static OutputStream openWrite(Context context, String filename)
focal_class.identifier: openWrite
focal_class.modifiers: public static
focal_class.parameters: (Context context, String filename)
focal_class.return: OutputStream
focal_class.signature: OutputStream openWrite(Context context, String filename)
focal_class.class_method_signature: FileHelper.readConfigFile(Context context, String name, boolean defaultsOnly)
focal_class.full_signature: private static Configuration readConfigFile(Context context, String name, boolean defaultsOnly)
focal_class.identifier: readConfigFile
focal_class.modifiers: private static
focal_class.parameters: (Context context, String name, boolean defaultsOnly)
focal_class.return: Configuration
focal_class.signature: Configuration readConfigFile(Context context, String name, boolean defaultsOnly)
focal_class.class_method_signature: FileHelper.loadCurrentSettings(Context context)
focal_class.full_signature: public static Configuration loadCurrentSettings(Context context)
focal_class.identifier: loadCurrentSettings
focal_class.modifiers: public static
focal_class.parameters: (Context context)
focal_class.return: Configuration
focal_class.signature: Configuration loadCurrentSettings(Context context)
focal_class.class_method_signature: FileHelper.loadPreviousSettings(Context context)
focal_class.full_signature: public static Configuration loadPreviousSettings(Context context)
focal_class.identifier: loadPreviousSettings
focal_class.modifiers: public static
focal_class.parameters: (Context context)
focal_class.return: Configuration
focal_class.signature: Configuration loadPreviousSettings(Context context)
focal_class.class_method_signature: FileHelper.loadDefaultSettings(Context context)
focal_class.full_signature: public static Configuration loadDefaultSettings(Context context)
focal_class.identifier: loadDefaultSettings
focal_class.modifiers: public static
focal_class.parameters: (Context context)
focal_class.return: Configuration
focal_class.signature: Configuration loadDefaultSettings(Context context)
focal_class.class_method_signature: FileHelper.writeSettings(Context context, Configuration config)
focal_class.full_signature: public static void writeSettings(Context context, Configuration config)
focal_class.identifier: writeSettings
focal_class.modifiers: public static
focal_class.parameters: (Context context, Configuration config)
focal_class.return: void
focal_class.signature: void writeSettings(Context context, Configuration config)
focal_class.class_method_signature: FileHelper.getItemFile(Context context, Configuration.Item item)
focal_class.full_signature: public static File getItemFile(Context context, Configuration.Item item)
focal_class.identifier: getItemFile
focal_class.modifiers: public static
focal_class.parameters: (Context context, Configuration.Item item)
focal_class.return: File
focal_class.signature: File getItemFile(Context context, Configuration.Item item)
focal_class.class_method_signature: FileHelper.openItemFile(Context context, Configuration.Item item)
focal_class.full_signature: public static InputStreamReader openItemFile(Context context, Configuration.Item item)
focal_class.identifier: openItemFile
focal_class.modifiers: public static
focal_class.parameters: (Context context, Configuration.Item item)
focal_class.return: InputStreamReader
focal_class.signature: InputStreamReader openItemFile(Context context, Configuration.Item item)
focal_class.class_method_signature: FileHelper.poll(StructPollfd[] fds, int timeout)
focal_class.full_signature: public static int poll(StructPollfd[] fds, int timeout)
focal_class.identifier: poll
focal_class.modifiers: public static
focal_class.parameters: (StructPollfd[] fds, int timeout)
focal_class.return: int
focal_class.signature: int poll(StructPollfd[] fds, int timeout)
focal_class.class_method_signature: FileHelper.closeOrWarn(FileDescriptor fd, String tag, String message)
focal_class.full_signature: public static FileDescriptor closeOrWarn(FileDescriptor fd, String tag, String message)
focal_class.identifier: closeOrWarn
focal_class.modifiers: public static
focal_class.parameters: (FileDescriptor fd, String tag, String message)
focal_class.return: FileDescriptor
focal_class.signature: FileDescriptor closeOrWarn(FileDescriptor fd, String tag, String message)
focal_class.class_method_signature: FileHelper.closeOrWarn(T fd, String tag, String message)
focal_class.full_signature: public static T closeOrWarn(T fd, String tag, String message)
focal_class.identifier: closeOrWarn
focal_class.modifiers: public static
focal_class.parameters: (T fd, String tag, String message)
focal_class.return: T
focal_class.signature: T closeOrWarn(T fd, String tag, String message)
focal_method.body: public static int poll(StructPollfd[] fds, int timeout) throws ErrnoException, InterruptedException {
          while (true) {
              if (Thread.interrupted())
                  throw new InterruptedException();
              try {
                  return Os.poll(fds, timeout);
              } catch (ErrnoException e) {
                  if (e.errno == OsConstants.EINTR)
                      continue;
                  throw e;
              }
          }
      }
focal_method.class_method_signature: FileHelper.poll(StructPollfd[] fds, int timeout)
focal_method.full_signature: public static int poll(StructPollfd[] fds, int timeout)
focal_method.identifier: poll
focal_method.invocations: interrupted poll
focal_method.modifiers: public static
focal_method.parameters: (StructPollfd[] fds, int timeout)
focal_method.return: int
focal_method.signature: int poll(StructPollfd[] fds, int timeout)