Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 13 for ensureOpen (0.06 sec)

  1. src/test/java/jcifs/smb/SmbPipeHandleInternalTest.java

            // Act
            SmbFileHandleImpl opened = handle.ensureOpen();
    
            // Assert
            assertSame(fh, opened);
            assertTrue(handle.isOpen(), "Handle should report open after ensureOpen");
            verify(pipe, times(1)).openUnshared(eq("\\\\pipe\\\\foo"), eq(0), anyInt(), anyInt(), eq(SmbConstants.ATTR_NORMAL), eq(0));
        }
    
        @Test
        @DisplayName("ensureOpen throws when handle already closed")
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Thu Aug 14 07:14:38 UTC 2025
    - 16.7K bytes
    - Viewed (0)
  2. src/test/java/jcifs/smb/SmbPipeInputStreamTest.java

        }
    
        @Test
        @DisplayName("ensureOpen delegates to handle")
        void ensureOpen_delegates() throws Exception {
            // Verify ensureOpen() delegates to SmbPipeHandleImpl
            SmbPipeInputStream stream = newStreamWithMinimalStubs(true);
            when(handle.ensureOpen()).thenReturn(fd);
    
            SmbFileHandleImpl result = stream.ensureOpen();
            assertSame(fd, result);
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Thu Aug 14 05:31:44 UTC 2025
    - 9.9K bytes
    - Viewed (0)
  3. src/test/java/jcifs/smb/SmbPipeHandleImplTest.java

            // Initially not open (isStale returns false when handle is null, not true)
            assertFalse(target.isOpen());
            assertFalse(target.isStale());
    
            // After ensureOpen, handle valid -> open
            SmbFileHandleImpl fh = target.ensureOpen();
            assertSame(fileHandle, fh);
            assertTrue(target.isOpen());
            assertFalse(target.isStale());
    
            // If handle becomes invalid, reflect stale
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Thu Aug 14 05:31:44 UTC 2025
    - 11.7K bytes
    - Viewed (0)
  4. src/test/java/jcifs/smb/SmbRandomAccessFileTest.java

        void write_lenZero_noIO() throws Exception {
            SmbRandomAccessFile raf = spy(newInstance("rw", false, true, false));
            // If ensureOpen is called, fail the test
            doThrow(new AssertionError("ensureOpen should not be called")).when(raf).ensureOpen();
            raf.write(new byte[1], 0, 0);
        }
    
        @Test
        @DisplayName("Null inputs: read(byte[]) and write* with nulls throw NPE")
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Thu Aug 14 05:31:44 UTC 2025
    - 18.1K bytes
    - Viewed (0)
  5. src/main/java/jcifs/smb/SmbRandomAccessFile.java

                } else {
                    throw new IllegalArgumentException("Invalid mode");
                }
    
                try (SmbFileHandle h = ensureOpen()) {}
                this.readSize = th.getReceiveBufferSize() - 70;
                this.writeSize = th.getSendBufferSize() - 70;
    
                if (th.hasCapability(SmbConstants.CAP_LARGE_READX)) {
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Sat Aug 16 01:32:48 UTC 2025
    - 18.8K bytes
    - Viewed (0)
  6. src/main/java/jcifs/smb/SmbPipeHandleImpl.java

         */
        @Override
        public boolean isStale() {
            return !this.open || this.handle != null && !this.handle.isValid();
        }
    
        @Override
        public synchronized SmbFileHandleImpl ensureOpen() throws CIFSException {
            if (!this.open) {
                throw new SmbException("Pipe handle already closed");
            }
    
            if (!isOpen()) {
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Sun Aug 31 08:00:57 UTC 2025
    - 10.2K bytes
    - Viewed (0)
  7. src/main/java/jcifs/smb/SmbFileOutputStream.java

            this.access = access | SmbConstants.FILE_WRITE_DATA;
    
            try (SmbTreeHandleImpl th = file.ensureTreeConnected()) {
                this.smb2 = th.isSMB2();
                try (SmbFileHandleImpl fh = ensureOpen()) {
                    if (append) {
                        this.fp = fh.getInitialSize();
                    }
                    init(th);
                    if (!append && this.smb2) {
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Sat Aug 16 01:32:48 UTC 2025
    - 12.8K bytes
    - Viewed (0)
  8. src/main/java/jcifs/smb/SmbFileInputStream.java

         */
        public void open() throws CIFSException {
            try (SmbFileHandleImpl fh = ensureOpen()) {}
        }
    
        /**
         * @param file
         * @param openFlags
         * @return
         * @throws SmbException
         */
        synchronized SmbFileHandleImpl ensureOpen() throws CIFSException {
            if (this.handle == null || !this.handle.isValid()) {
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Sat Aug 30 05:58:03 UTC 2025
    - 15.6K bytes
    - Viewed (0)
  9. src/test/java/jcifs/smb/SmbFileOutputStreamTest.java

            when(mockFileHandle.isValid()).thenReturn(false, true); // First false to trigger ensureOpen, then true
            when(mockFileHandle.getFileId()).thenReturn(new byte[16]);
            when(mockFileHandle.acquire()).thenReturn(mockFileHandle);
    
            // Mock for ensureOpen to reopen file
            when(mockFile.openUnshared(anyInt(), anyInt(), anyInt(), anyInt(), anyInt())).thenReturn(mockFileHandle);
    
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Thu Aug 14 05:31:44 UTC 2025
    - 15.8K bytes
    - Viewed (0)
  10. src/main/java/jcifs/netbios/NameServiceClientImpl.java

            }
        }
    
        int getNextNameTrnId() {
            if ((++this.nextNameTrnId & 0xFFFF) == 0) {
                this.nextNameTrnId = 1;
            }
            return this.nextNameTrnId;
        }
    
        void ensureOpen(final int timeout) throws IOException {
            this.closeTimeout = 0;
            if (this.transportContext.getConfig().getNetbiosSoTimeout() != 0) {
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Sat Aug 30 05:58:03 UTC 2025
    - 38.5K bytes
    - Viewed (0)
Back to top