public void testCopyToPointDir() throws Exception {
    File top = createTempDirectory(false);
    File sub = IoTestUtil.createTestDir(top, "sub");
    File file = IoTestUtil.createTestFile(top, "file.txt", "hi there");

    LocalFileSystem lfs = LocalFileSystem.getInstance();
    VirtualFile topDir = lfs.refreshAndFindFileByIoFile(top);
    assertNotNull(topDir);
    VirtualFile sourceFile = lfs.refreshAndFindFileByIoFile(file);
    assertNotNull(sourceFile);
    VirtualFile parentDir = lfs.refreshAndFindFileByIoFile(sub);
    assertNotNull(parentDir);
    assertEquals(2, topDir.getChildren().length);

    try {
      sourceFile.copy(this, parentDir, ".");
      fail("Copying a file into a '.' path should have failed");
    } catch (IOException e) {
      System.out.println(e.getMessage());
    }

    topDir.refresh(false, true);
    assertTrue(topDir.exists());
    assertEquals(2, topDir.getChildren().length);
  }
  /**
   * Flatten a nested list of files, returning all files in the array.
   *
   * @param files the top level of files.
   * @return the flattened list of files.
   */
  private List<VirtualFile> flattenFiles(final VirtualFile[] files) {
    final List<VirtualFile> flattened = new ArrayList<VirtualFile>();

    if (files != null) {
      for (final VirtualFile file : files) {
        flattened.add(file);

        if (file.getChildren() != null) {
          flattened.addAll(flattenFiles(file.getChildren()));
        }
      }
    }

    return flattened;
  }
 @NotNull
 private static Collection<VirtualFile> gatherIncludeRoots(
     Collection<VirtualFile> goPathSourcesRoots, Set<VirtualFile> excludeRoots) {
   Collection<VirtualFile> includeRoots = ContainerUtil.newHashSet();
   for (VirtualFile goPathSourcesDirectory : goPathSourcesRoots) {
     ProgressIndicatorProvider.checkCanceled();
     boolean excludedRootIsAncestor = false;
     for (VirtualFile excludeRoot : excludeRoots) {
       ProgressIndicatorProvider.checkCanceled();
       if (VfsUtilCore.isAncestor(excludeRoot, goPathSourcesDirectory, false)) {
         excludedRootIsAncestor = true;
         break;
       }
     }
     if (excludedRootIsAncestor) {
       continue;
     }
     for (VirtualFile file : goPathSourcesDirectory.getChildren()) {
       ProgressIndicatorProvider.checkCanceled();
       if (file.isDirectory() && !excludeRoots.contains(file)) {
         includeRoots.add(file);
       }
     }
   }
   return includeRoots;
 }
 private static void addPathCompletions(
     @NotNull CompletionResultSet result,
     @NotNull BipartiteString caretBipartiteElementText,
     @NotNull VirtualFile basePath,
     boolean directoryExpected) {
   ParentDirWithLastComponentPrefix parentWithLastComponentPrefix =
       findParentDirWithLastComponentPrefix(basePath, caretBipartiteElementText.getPrefix());
   if (parentWithLastComponentPrefix != null) {
     PrefixMatcher matcher =
         new StrictPrefixMatcher(parentWithLastComponentPrefix.getLastComponentPrefix(), false);
     result = result.withPrefixMatcher(matcher);
     VirtualFile parentFile = parentWithLastComponentPrefix.getParent();
     VirtualFile[] children = parentFile.getChildren();
     Character dirSeparatorSuffix =
         extractDirectoryTrailingFileSeparator(caretBipartiteElementText);
     if (parentFile.isDirectory()) {
       result.addElement(LookupItem.fromString(".."));
     }
     for (VirtualFile child : children) {
       if (child.isDirectory() || !directoryExpected) {
         String name = child.getName();
         if (child.isDirectory() && dirSeparatorSuffix != null) {
           name += dirSeparatorSuffix;
         }
         result.addElement(LookupItem.fromString(name));
       }
     }
   }
 }
  @Nullable
  public static VirtualFile getDirectory(@NotNull final FindModel findModel) {
    String directoryName = findModel.getDirectoryName();
    if (findModel.isProjectScope() || StringUtil.isEmpty(directoryName)) {
      return null;
    }

    String path = directoryName.replace(File.separatorChar, '/');
    VirtualFile virtualFile = LocalFileSystem.getInstance().findFileByPath(path);
    if (virtualFile == null || !virtualFile.isDirectory()) {
      virtualFile = null;
      for (LocalFileProvider provider :
          ((VirtualFileManagerEx) VirtualFileManager.getInstance()).getLocalFileProviders()) {
        VirtualFile file = provider.findLocalVirtualFileByPath(path);
        if (file != null && file.isDirectory()) {
          if (file.getChildren().length > 0) {
            virtualFile = file;
            break;
          }
          if (virtualFile == null) {
            virtualFile = file;
          }
        }
      }
    }
    return virtualFile;
  }
  @Override
  protected void setUp() throws Exception {
    if (ourOutputRoot == null) {
      ourOutputRoot = FileUtil.createTempDirectory("ExecutionTestCase", null, true);
    }
    myModuleOutputDir = new File(ourOutputRoot, PathUtil.getFileName(getTestAppPath()));
    myChecker = initOutputChecker();
    EdtTestUtil.runInEdtAndWait(
        new ThrowableRunnable<Throwable>() {
          @Override
          public void run() throws Throwable {
            ExecutionTestCase.super.setUp();
          }
        });
    if (!myModuleOutputDir.exists()) {
      VirtualFile vDir = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(ourOutputRoot);
      assertNotNull(ourOutputRoot.getAbsolutePath(), vDir);
      vDir
          .getChildren(); // we need this to load children to VFS to fire VFileCreatedEvent for the
                          // output directory

      myCompilerTester =
          new CompilerTester(
              myProject, Arrays.asList(ModuleManager.getInstance(myProject).getModules()));
      List<CompilerMessage> messages = myCompilerTester.rebuild();
      for (CompilerMessage message : messages) {
        if (message.getCategory() == CompilerMessageCategory.ERROR) {
          FileUtil.delete(myModuleOutputDir);
          fail("Compilation failed: " + message);
        }
      }
    }
  }
  public void testFileCaseChange() throws Exception {
    if (SystemInfo.isFileSystemCaseSensitive) {
      System.err.println("Ignored: case-insensitive FS required");
      return;
    }

    File top = createTempDirectory(false);
    File file = IoTestUtil.createTestFile(top, "file.txt", "test");
    File intermediate = new File(top, "_intermediate_");

    LocalFileSystem lfs = LocalFileSystem.getInstance();
    VirtualFile topDir = lfs.refreshAndFindFileByIoFile(top);
    assertNotNull(topDir);
    VirtualFile sourceFile = lfs.refreshAndFindFileByIoFile(file);
    assertNotNull(sourceFile);

    String newName = StringUtil.capitalize(file.getName());
    FileUtil.rename(file, intermediate);
    FileUtil.rename(intermediate, new File(top, newName));
    topDir.refresh(false, true);
    assertFalse(((VirtualDirectoryImpl) topDir).allChildrenLoaded());
    assertTrue(sourceFile.isValid());
    assertEquals(newName, sourceFile.getName());

    topDir.getChildren();
    newName = newName.toLowerCase();
    FileUtil.rename(file, intermediate);
    FileUtil.rename(intermediate, new File(top, newName));
    topDir.refresh(false, true);
    assertTrue(((VirtualDirectoryImpl) topDir).allChildrenLoaded());
    assertTrue(sourceFile.isValid());
    assertEquals(newName, sourceFile.getName());
  }
Example #8
0
 public static void refreshSynchronouslyRecursively(VirtualFile file) {
   if (file.is(VFileProperty.SPECIAL) || file.is(VFileProperty.SYMLINK)) {
     return;
   }
   file.refresh(false, false);
   for (VirtualFile child : file.getChildren()) {
     refreshSynchronouslyRecursively(child);
   }
 }
 private static void visitGitDirVfs(@NotNull VirtualFile gitDir) {
   gitDir.getChildren();
   for (String subdir : GitRepositoryFiles.getSubDirRelativePaths()) {
     VirtualFile dir = gitDir.findFileByRelativePath(subdir);
     // process recursively, because we need to visit all branches under refs/heads and
     // refs/remotes
     visitAllChildrenRecursively(dir);
   }
 }
  /**
   * @param path project file path
   * @param projectToClose currently active project
   * @param forceOpenInNewFrame forces opening in new frame
   * @return project by path if the path was recognized as IDEA project file or one of the project
   *     formats supported by installed importers (regardless of opening/import result) null
   *     otherwise
   */
  @Nullable
  public static Project openOrImport(
      @NotNull String path, Project projectToClose, boolean forceOpenInNewFrame) {
    VirtualFile virtualFile = LocalFileSystem.getInstance().refreshAndFindFileByPath(path);
    if (virtualFile == null) return null;
    virtualFile.refresh(false, false);

    ProjectOpenProcessor strong = ProjectOpenProcessor.getStrongImportProvider(virtualFile);
    if (strong != null) {
      return strong.doOpenProject(virtualFile, projectToClose, forceOpenInNewFrame);
    }

    if (path.endsWith(ProjectFileType.DOT_DEFAULT_EXTENSION)
        || virtualFile.isDirectory()
            && virtualFile.findChild(Project.DIRECTORY_STORE_FOLDER) != null) {
      return openProject(path, projectToClose, forceOpenInNewFrame);
    }

    if (virtualFile.isDirectory()) {
      for (VirtualFile child : virtualFile.getChildren()) {
        final String childPath = child.getPath();
        if (childPath.endsWith(ProjectFileType.DOT_DEFAULT_EXTENSION)) {
          return openProject(childPath, projectToClose, forceOpenInNewFrame);
        }
      }
    }

    ProjectOpenProcessor provider = ProjectOpenProcessor.getImportProvider(virtualFile);
    if (provider != null) {
      final Project project =
          provider.doOpenProject(virtualFile, projectToClose, forceOpenInNewFrame);

      if (project != null) {
        ApplicationManager.getApplication()
            .invokeLater(
                new Runnable() {
                  @Override
                  public void run() {
                    if (!project.isDisposed()) {
                      final ToolWindow toolWindow =
                          ToolWindowManager.getInstance(project)
                              .getToolWindow(ToolWindowId.PROJECT_VIEW);
                      if (toolWindow != null) {
                        toolWindow.activate(null);
                      }
                    }
                  }
                },
                ModalityState.NON_MODAL);
      }

      return project;
    }

    return null;
  }
Example #11
0
 public static void visitVcsDirVfs(
     @NotNull VirtualFile vcsDir, @NotNull Collection<String> subDirs) {
   vcsDir.getChildren();
   for (String subdir : subDirs) {
     VirtualFile dir = vcsDir.findFileByRelativePath(subdir);
     // process recursively, because we need to visit all branches under refs/heads and
     // refs/remotes
     ensureAllChildrenInVfs(dir);
   }
 }
 private static void checkChildCount(VirtualFile virtualDir, int expectedCount) {
   VirtualFile[] children = virtualDir.getChildren();
   if (children.length != expectedCount) {
     System.err.println("children:");
     for (VirtualFile child : children) {
       System.err.println(child.getPath());
     }
   }
   assertEquals(expectedCount, children.length);
 }
  private void iterateIndexableFilesIn_internal(VirtualFile file, ContentIterator iterator) {
    if (CacheUtil.isIgnored(file, myRootManager)) return;

    if (file.isDirectory()) {
      for (VirtualFile child : file.getChildren()) {
        iterateIndexableFilesIn_internal(child, iterator);
      }
    } else {
      iterator.processFile(file);
    }
  }
 private static boolean isSdkOtpApp(@NotNull String otpAppName, @NotNull Sdk sdk) {
   Pattern appDirNamePattern = Pattern.compile(otpAppName + "-.*");
   for (VirtualFile srcSdkDir : sdk.getRootProvider().getFiles(OrderRootType.SOURCES)) {
     for (VirtualFile child : srcSdkDir.getChildren()) {
       if (child.isDirectory() && appDirNamePattern.matcher(child.getName()).find()) {
         return true;
       }
     }
   }
   return false;
 }
 @Nullable
 private static VirtualFile findFileByExtension(
     @NotNull VirtualFile dir, @NotNull String extension) {
   for (VirtualFile file : dir.getChildren()) {
     String fileName = file.getName();
     if (!file.isDirectory() && fileName.endsWith(extension)) {
       return file;
     }
   }
   return null; // To change body of created methods use File | Settings | File Templates.
 }
 private void loadSdks(VirtualFile rubyMotion) {
   if (rubyMotion == null) {
     return;
   }
   for (VirtualFile file : rubyMotion.getChildren()) {
     if (file.isDirectory()) {
       final VirtualFile bridgeSupport = file.findChild("BridgeSupport");
       ensureFrameworkLoaded(bridgeSupport);
     }
   }
 }
  public void testChildrenAccessedButNotCached() throws Exception {
    File dir = createTempDirectory(false);
    ManagingFS managingFS = ManagingFS.getInstance();

    VirtualFile vFile =
        LocalFileSystem.getInstance()
            .refreshAndFindFileByPath(dir.getPath().replace(File.separatorChar, '/'));
    assertNotNull(vFile);
    assertFalse(managingFS.areChildrenLoaded(vFile));
    assertFalse(managingFS.wereChildrenAccessed(vFile));

    File child = new File(dir, "child");
    boolean created = child.createNewFile();
    assertTrue(created);

    File subdir = new File(dir, "subdir");
    boolean subdirCreated = subdir.mkdir();
    assertTrue(subdirCreated);

    File subChild = new File(subdir, "subdir");
    boolean subChildCreated = subChild.createNewFile();
    assertTrue(subChildCreated);

    VirtualFile childVFile =
        LocalFileSystem.getInstance()
            .refreshAndFindFileByPath(child.getPath().replace(File.separatorChar, '/'));
    assertNotNull(childVFile);
    assertFalse(managingFS.areChildrenLoaded(vFile));
    assertTrue(managingFS.wereChildrenAccessed(vFile));

    VirtualFile subdirVFile =
        LocalFileSystem.getInstance()
            .refreshAndFindFileByPath(subdir.getPath().replace(File.separatorChar, '/'));
    assertNotNull(subdirVFile);
    assertFalse(managingFS.areChildrenLoaded(subdirVFile));
    assertFalse(managingFS.wereChildrenAccessed(subdirVFile));
    assertFalse(managingFS.areChildrenLoaded(vFile));
    assertTrue(managingFS.wereChildrenAccessed(vFile));

    vFile.getChildren();
    assertTrue(managingFS.areChildrenLoaded(vFile));
    assertTrue(managingFS.wereChildrenAccessed(vFile));
    assertFalse(managingFS.areChildrenLoaded(subdirVFile));
    assertFalse(managingFS.wereChildrenAccessed(subdirVFile));

    VirtualFile subChildVFile =
        LocalFileSystem.getInstance()
            .refreshAndFindFileByPath(subChild.getPath().replace(File.separatorChar, '/'));
    assertNotNull(subChildVFile);
    assertTrue(managingFS.areChildrenLoaded(vFile));
    assertTrue(managingFS.wereChildrenAccessed(vFile));
    assertFalse(managingFS.areChildrenLoaded(subdirVFile));
    assertTrue(managingFS.wereChildrenAccessed(subdirVFile));
  }
  @Override
  public void iterateIndexableFilesIn(VirtualFile file, ContentIterator iterator) {
    if (!isInSet(file)) return;

    if (file.isDirectory()) {
      for (VirtualFile child : file.getChildren()) {
        iterateIndexableFilesIn(child, iterator);
      }
    } else {
      iterator.processFile(file);
    }
  }
 @Nullable
 protected VirtualFile findClassFile(String className, Module module) {
   //noinspection ConstantConditions
   VirtualFile path =
       ModuleRootManager.getInstance(module)
           .getModuleExtension(CompilerModuleExtension.class)
           .getCompilerOutputPath();
   path.getChildren();
   assert path != null;
   path.refresh(false, true);
   return path.findChild(className + ".class");
 }
 private void ensureFrameworkLoaded(final VirtualFile bridgeSupport) {
   String version = bridgeSupport.getParent().getName();
   List<FrameworkInfo> frameworkInfos = ContainerUtil.newArrayList();
   for (VirtualFile file : bridgeSupport.getChildren()) {
     final String name = file.getNameWithoutExtension();
     if (RubyMotionUtil.getInstance().isIgnoredFrameworkName(name)) continue;
     if ("bridgesupport".equals(file.getExtension()) && file.getLength() > 0) {
       boolean isOSX = "osx".equals(file.getParent().getParent().getParent().getName());
       frameworkInfos.add(new FrameworkInfo(name, version, isOSX, file.getPath()));
     }
   }
   myFrameworks.put(version, frameworkInfos);
 }
 /** Fills readOnlyFiles with VirtualFiles */
 private static void getReadOnlyVirtualFiles(
     VirtualFile file, ArrayList<VirtualFile> readOnlyFiles, final FileTypeManager ftManager) {
   if (ftManager.isFileIgnored(file)) return;
   if (!file.isWritable()) {
     readOnlyFiles.add(file);
   }
   if (file.isDirectory()) {
     VirtualFile[] children = file.getChildren();
     for (VirtualFile child : children) {
       getReadOnlyVirtualFiles(child, readOnlyFiles, ftManager);
     }
   }
 }
  @SuppressWarnings("UnsafeVfsRecursion")
  public static void assertDirectoriesEqual(
      VirtualFile dirAfter, VirtualFile dirBefore, @Nullable VirtualFileFilter fileFilter)
      throws IOException {
    FileDocumentManager.getInstance().saveAllDocuments();

    VirtualFile[] childrenAfter = dirAfter.getChildren();

    if (dirAfter.isInLocalFileSystem()
        && dirAfter.getFileSystem() != TempFileSystem.getInstance()) {
      File[] ioAfter = new File(dirAfter.getPath()).listFiles();
      shallowCompare(childrenAfter, ioAfter);
    }

    VirtualFile[] childrenBefore = dirBefore.getChildren();
    if (dirBefore.isInLocalFileSystem()
        && dirBefore.getFileSystem() != TempFileSystem.getInstance()) {
      File[] ioBefore = new File(dirBefore.getPath()).listFiles();
      shallowCompare(childrenBefore, ioBefore);
    }

    HashMap<String, VirtualFile> mapAfter = buildNameToFileMap(childrenAfter, fileFilter);
    HashMap<String, VirtualFile> mapBefore = buildNameToFileMap(childrenBefore, fileFilter);

    Set<String> keySetAfter = mapAfter.keySet();
    Set<String> keySetBefore = mapBefore.keySet();
    assertEquals(dirAfter.getPath(), keySetAfter, keySetBefore);

    for (String name : keySetAfter) {
      VirtualFile fileAfter = mapAfter.get(name);
      VirtualFile fileBefore = mapBefore.get(name);
      if (fileAfter.isDirectory()) {
        assertDirectoriesEqual(fileAfter, fileBefore, fileFilter);
      } else {
        assertFilesEqual(fileAfter, fileBefore);
      }
    }
  }
Example #23
0
 private void extractPlugins(
     Project project, @Nullable VirtualFile pluginRoot, Map<String, VirtualFile> res) {
   if (pluginRoot != null) {
     VirtualFile[] children = pluginRoot.getChildren();
     if (children != null) {
       for (VirtualFile child : children) {
         String pluginName = getInstalledPluginNameByPath(project, child);
         if (pluginName != null) {
           res.put(pluginName, child);
         }
       }
     }
   }
 }
    @Override
    public MultiMap<JpsModuleSourceRootType<?>, String> getSourceFolders() {
      MultiMap<JpsModuleSourceRootType<?>, String> res =
          new MultiMap<JpsModuleSourceRootType<?>, String>();

      for (VirtualFile root : ModuleRootManager.getInstance(myModule).getContentRoots()) {
        VirtualFile srcDir = root.findChild("src");
        if (srcDir != null) {
          for (String child : SRC_DIR_SUBFOLDER) {
            if (srcDir.findChild(child) != null) {
              res.putValue(JavaSourceRootType.SOURCE, "src/" + child);
            }
          }
        }

        VirtualFile griffonApp = root.findChild("griffon-app");
        if (griffonApp != null) {
          for (String child : GRIFFON_APP_SOURCE_ROOTS) {
            if (griffonApp.findChild(child) != null) {
              res.putValue(JavaSourceRootType.SOURCE, "griffon-app/" + child);
            }
          }

          for (VirtualFile child : root.getChildren()) {
            if (child.getNameWithoutExtension().endsWith("GriffonAddon")) {
              res.putValue(JavaSourceRootType.SOURCE, "");
              break;
            }
          }
        }

        List<GriffonSourceInspector.GriffonSource> sources =
            GriffonSourceInspector.processModuleMetadata(myModule);
        for (GriffonSourceInspector.GriffonSource source : sources) {
          res.putValue(JavaSourceRootType.SOURCE, source.getPath());
        }

        VirtualFile testDir = root.findChild("test");
        if (testDir != null) {
          for (String child : TEST_DIRS) {
            if (testDir.findChild(child) != null) {
              res.putValue(JavaSourceRootType.TEST_SOURCE, "test/" + child);
            }
          }
        }
      }

      return res;
    }
  public void testRefreshSeesLatestDirectoryContents() throws Exception {
    File testDir = FileUtil.createTempDirectory("RefreshChildrenTest." + getName(), null);
    String content = "";
    FileUtil.writeToFile(new File(testDir, "Foo.java"), content);

    LocalFileSystem local = LocalFileSystem.getInstance();
    VirtualFile virtualDir = local.findFileByIoFile(testDir);
    assert virtualDir != null : testDir;
    virtualDir.getChildren();
    virtualDir.refresh(false, true);
    checkChildCount(virtualDir, 1);

    FileUtil.writeToFile(new File(testDir, "Bar.java"), content);
    virtualDir.refresh(false, true);
    checkChildCount(virtualDir, 2);
  }
  private static boolean hasBeforeAndAfterTemplate(@NotNull VirtualFile dir) {
    boolean hasBefore = false;
    boolean hasAfter = false;

    for (VirtualFile file : dir.getChildren()) {
      String name = file.getName();
      if (name.endsWith(".template")) {
        if (name.startsWith("before.")) {
          hasBefore = true;
        } else if (name.startsWith("after.")) {
          hasAfter = true;
        }
      }
    }

    return hasBefore && hasAfter;
  }
Example #27
0
 public static boolean iterateRecursively(
     @Nullable final VirtualFile root, @NotNull final ContentIterator processor) {
   if (root != null) {
     if (root.isDirectory()) {
       for (VirtualFile file : root.getChildren()) {
         if (file.isDirectory()) {
           if (!iterateRecursively(file, processor)) return false;
         } else {
           if (!processor.processFile(file)) return false;
         }
       }
     } else {
       if (!processor.processFile(root)) return false;
     }
   }
   return true;
 }
 @NotNull
 @Override
 public List<VirtualFile> findAll(@NotNull ExternalProjectSettings externalProjectSettings) {
   List<VirtualFile> list = ContainerUtil.newArrayList();
   for (String path : externalProjectSettings.getModules()) {
     VirtualFile vFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(new File(path));
     if (vFile != null) {
       for (VirtualFile child : vFile.getChildren()) {
         String name = child.getName();
         if (!child.isDirectory() && name.endsWith(GradleConstants.EXTENSION)) {
           list.add(child);
         }
       }
     }
   }
   return list;
 }
Example #29
0
  public static void addAvailableScripts(
      final Collection<String> result, @Nullable final VirtualFile root) {
    if (root == null || !root.isDirectory()) {
      return;
    }

    final VirtualFile scripts = root.findChild("scripts");

    if (scripts == null || !scripts.isDirectory()) {
      return;
    }

    for (VirtualFile child : scripts.getChildren()) {
      if (isScriptFile(child)) {
        result.add(GroovyNamesUtil.camelToSnake(child.getNameWithoutExtension()));
      }
    }
  }
  private void processRecursively(final VirtualFile vFile, final SVNDepth prevDepth) {
    if (SVNDepth.EMPTY.equals(prevDepth)) return;
    if (myPartner.isIgnoredIdeaLevel(vFile)) {
      myReceiver.processIgnored(vFile);
      return;
    }
    final SVNDepth newDepth =
        SVNDepth.INFINITY.equals(prevDepth) ? SVNDepth.INFINITY : SVNDepth.EMPTY;

    final SVNStatusClient childClient = myPartner.createStatusClient();
    final VirtualFile[] children = vFile.getChildren();
    for (VirtualFile child : children) {
      final FilePath filePath = VcsUtil.getFilePath(child.getPath(), child.isDirectory());
      // recursiveness is used ONLY for search of working copies that have unversioned files above
      final MyItem childItem = new MyItem(myProject, filePath, newDepth, childClient, true);
      myQueue.add(childItem);
    }
  }