コード例 #1
0
 public void println(String x) {
   if (this == errInstance) {
     log.error(x);
   } else {
     log.info(x);
   }
 }
コード例 #2
0
 public void println(char[] x) {
   if (this == errInstance) {
     log.error(x == null ? null : new String(x));
   } else {
     log.info(x == null ? null : new String(x));
   }
 }
コード例 #3
0
 public void println(Object x) {
   if (this == errInstance) {
     log.error(String.valueOf(x));
   } else {
     log.info(String.valueOf(x));
   }
 }
  public void run() {
    File tmpDir = null;
    try {
      tmpDir = WidgetsetUtil.createTempDir();

      WidgetsetUtil.createWidgetset(tmpDir, widgetset, getIncludeWidgetsets());

      compiler =
          new WidgetsetCompiler(
              outputLog, widgetset, tmpDir.getAbsolutePath(), getClasspathEntries(tmpDir));

      try {
        compiler.compileWidgetset();
      } catch (InterruptedException e1) {
        Thread.currentThread().interrupt();
      }

      File compiledWidgetset = new File(tmpDir, widgetset);
      if (compiledWidgetset.exists() && compiledWidgetset.isDirectory()) {
        String ws = ControlPanelPortletUtil.getWidgetsetDir() + widgetset;
        WidgetsetUtil.rotateWidgetsetBackups(ws);
        WidgetsetUtil.backupOldWidgetset(ws);
        File destDir = new File(ws);

        outputLog.log("Copying widgetset from " + compiledWidgetset + " to " + destDir);

        System.out.println("Copying widgetset from " + compiledWidgetset + " to " + destDir);

        FileUtils.copyDirectory(compiledWidgetset, destDir);

        outputLog.log("Copying done");
        System.out.println("Copying done");
      }

    } catch (IOException e) {
      log.warn("Could not compile widgetsets.", e);
      System.out.println("Could not compile widgetsets. " + e.getMessage());
    } finally {
      try {
        System.out.println("Remove temp directory");
        FileUtils.deleteDirectory(tmpDir);
        System.out.println("Removing done...");
      } catch (IOException e) {
        log.warn("Could not delete temporary directory: " + tmpDir, e);
        System.out.println("Could not delete temporary directory: " + tmpDir + "  " + e);
      }

      compilationFinished();
    }
  }
コード例 #5
0
 /**
  * Add this exception to the collector. If a log was specified in the constructor then the
  * exception will be output to the log. You can retreive exceptions using <code>getStatus</code>.
  *
  * @param exception the exception to collect
  */
 public void handleException(CoreException exception) {
   // log the exception if we have a log
   if (log != null) {
     log.log(new Status(severity, pluginId, 0, message, exception));
   }
   // Record each status individually to flatten the resulting multi-status
   IStatus exceptionStatus = exception.getStatus();
   // Wrap the exception so the stack trace is not lost.
   IStatus status =
       new Status(
           exceptionStatus.getSeverity(),
           exceptionStatus.getPlugin(),
           exceptionStatus.getCode(),
           exceptionStatus.getMessage(),
           exception);
   recordStatus(status);
   IStatus[] children = status.getChildren();
   for (int i = 0; i < children.length; i++) {
     IStatus status2 = children[i];
     recordStatus(status2);
   }
 }