Пример #1
1
  /**
   * Performs OCR operation.
   *
   * @param imageList a list of <code>IIOImage</code> objects
   * @param rect the bounding rectangle defines the region of the image to be recognized. A
   *     rectangle of zero dimension or <code>null</code> indicates the whole image.
   * @return the recognized text
   * @throws TesseractException
   */
  public String doOCR(List<IIOImage> imageList, Rectangle rect) throws TesseractException {
    init();
    setTessVariables();

    try {
      StringBuilder sb = new StringBuilder();

      for (IIOImage oimage : imageList) {
        pageNum++;
        try {
          setImage(oimage.getRenderedImage(), rect);
          sb.append(getOCRText());
        } catch (IOException ioe) {
          // skip the problematic image
          logger.log(Level.SEVERE, ioe.getMessage(), ioe);
        }
      }

      if (hocr) {
        sb.insert(0, htmlBeginTag).append(htmlEndTag);
      }

      return sb.toString();
    } finally {
      dispose();
    }
  }
Пример #2
0
  private void ukkonenExtendSuffixTree(int arrayIdx) {
    logger.entering("UkkonenSuffixTree", "ukkonenExtendSuffixTree");
    logger.log(Level.FINEST, String.format("Ukkonen Algorithm String #%d", arrayIdx));

    TreeString string = strings.get(arrayIdx);
    extState = new UkkonenState(string);

    logger.log(
        Level.FINEST,
        String.format("Ukkonen: (%d,%d)", extState.nextPhaseStart, extState.string.length()));

    for (int phase = extState.nextPhaseStart; phase < extState.string.length(); phase++) {
      ukkonenSPA(phase);

      System.err.println(String.format("Phase %d results: ", phase));
      print(System.err);
      System.err.println();
      System.err.flush();
    }

    logger.log(Level.FINEST, String.format("Finishing edges: %d", extState.lastE));
    extState.finishFinalEdges();

    System.err.println(String.format("Finished results: "));
    print(System.err);
    System.err.println();
    System.err.flush();

    logger.exiting("UkkonenSuffixTree", "ukkonenExtendSuffixTree");
  }
Пример #3
0
 public static void logMessage(Level level, String message) {
   if (level == Level.SEVERE) {
     m_severeLogger.log(level, message);
   } else {
     m_nonSevereLogger.log(level, message);
   }
 }
Пример #4
0
  /** @param aProperties the updated properties. */
  @SuppressWarnings("rawtypes")
  final void setProperties(final Dictionary aProperties) {
    final Map<String, String> newProps = new HashMap<String, String>();

    Enumeration keys = aProperties.keys();
    while (keys.hasMoreElements()) {
      final String key = (String) keys.nextElement();
      if (!KNOWN_KEYS.contains(key) && !IGNORED_KEYS.contains(key)) {
        LOG.log(Level.WARNING, "Unknown/unsupported profile key: " + key);
        continue;
      }

      final String value = aProperties.get(key).toString();
      newProps.put(key, value.trim());
    }

    // Verify whether all known keys are defined...
    final List<String> checkedKeys = new ArrayList<String>(KNOWN_KEYS);
    checkedKeys.removeAll(newProps.keySet());
    if (!checkedKeys.isEmpty()) {
      throw new IllegalArgumentException(
          "Profile settings not complete! Missing keys are: " + checkedKeys.toString());
    }

    this.properties.putAll(newProps);

    LOG.log(
        Level.INFO,
        "New device profile settings applied for {1} ({0}) ...", //
        new Object[] {getType(), getDescription()});
  }
Пример #5
0
  protected boolean navigationClick(final int status, int time) {
    System.out.println("***** navigationClick *****");
    System.out.println("status=" + Integer.toHexString(status));
    if ((status & (KeypadListener.STATUS_FOUR_WAY | KeypadListener.STATUS_TRACKWHEEL)) == 0) {
      if (status != 0) Logger.log("navClick ignored status " + Integer.toHexString(status));
      return true;
    }

    boolean used = false;

    try {
      if (c_on_navigation_click == 0)
        c_on_navigation_click = CibylCallTable.getAddressByName("rim_on_navigation_click");
    } catch (Throwable t) {
      Logger.log("Exception in navigationClick: " + t);
      t.printStackTrace();

      System.exit(0);
    }

    if (c_on_navigation_click != 0) {
      UIWorker.addUIEvent(c_on_navigation_click, status, time, 0, 0, true);
    }

    return true;
  }
Пример #6
0
  private void doConnect() {
    L.info(
        "Connecting to MQTT broker "
            + mqttc.getServerURI()
            + " with CLIENTID="
            + mqttc.getClientId()
            + " and TOPIC PREFIX="
            + topicPrefix);

    MqttConnectOptions copts = new MqttConnectOptions();
    copts.setWill(topicPrefix + "connected", "0".getBytes(), 1, true);
    copts.setCleanSession(true);
    copts.setUserName("emonpi");
    copts.setPassword("emonpimqtt2016".toCharArray());
    try {
      mqttc.connect(copts);
      sendConnectionState();
      L.info("Successfully connected to broker, subscribing to " + topicPrefix + "(set|get)/#");
      try {
        mqttc.subscribe(topicPrefix + "set/#", 1);
        mqttc.subscribe(topicPrefix + "get/#", 1);
        shouldBeConnected = true;
      } catch (MqttException mqe) {
        L.log(Level.WARNING, "Error subscribing to topic hierarchy, check your configuration", mqe);
        throw mqe;
      }
    } catch (MqttException mqe) {
      L.log(
          Level.WARNING,
          "Error while connecting to MQTT broker, will retry: " + mqe.getMessage(),
          mqe);
      queueConnect(); // Attempt reconnect
    }
  }
Пример #7
0
  /**
   * @param sourceFile File to read from
   * @return List of String objects with the shas
   */
  public static FileRequestFileContent readRequestFile(final File sourceFile) {
    if (!sourceFile.isFile() || !(sourceFile.length() > 0)) {
      return null;
    }
    Document d = null;
    try {
      d = XMLTools.parseXmlFile(sourceFile.getPath());
    } catch (final Throwable t) {
      logger.log(Level.SEVERE, "Exception in readRequestFile, during XML parsing", t);
      return null;
    }

    if (d == null) {
      logger.log(Level.SEVERE, "Could'nt parse the request file");
      return null;
    }

    final Element rootNode = d.getDocumentElement();

    if (rootNode.getTagName().equals(TAG_FrostFileRequestFile) == false) {
      logger.severe(
          "Error: xml request file does not contain the root tag '"
              + TAG_FrostFileRequestFile
              + "'");
      return null;
    }

    final String timeStampStr = XMLTools.getChildElementsTextValue(rootNode, TAG_timestamp);
    if (timeStampStr == null) {
      logger.severe("Error: xml file does not contain the tag '" + TAG_timestamp + "'");
      return null;
    }
    final long timestamp = Long.parseLong(timeStampStr);

    final List<Element> nodelist = XMLTools.getChildElementsByTagName(rootNode, TAG_shaList);
    if (nodelist.size() != 1) {
      logger.severe("Error: xml request files must contain only one element '" + TAG_shaList + "'");
      return null;
    }

    final Element rootShaNode = nodelist.get(0);

    final List<String> shaList = new LinkedList<String>();
    final List<Element> xmlKeys = XMLTools.getChildElementsByTagName(rootShaNode, TAG_sha);
    for (final Element el : xmlKeys) {

      final Text txtname = (Text) el.getFirstChild();
      if (txtname == null) {
        continue;
      }

      final String sha = txtname.getData();
      shaList.add(sha);
    }

    final FileRequestFileContent content = new FileRequestFileContent(timestamp, shaList);
    return content;
  }
Пример #8
0
  /**
   * Sends a specific <tt>Request</tt> to the STUN server associated with this
   * <tt>StunCandidateHarvest</tt>.
   *
   * @param request the <tt>Request</tt> to send to the STUN server associated with this
   *     <tt>StunCandidateHarvest</tt>
   * @param firstRequest <tt>true</tt> if the specified <tt>request</tt> should be sent as the first
   *     request in the terms of STUN; otherwise, <tt>false</tt>
   * @return the <tt>TransactionID</tt> of the STUN client transaction through which the specified
   *     <tt>Request</tt> has been sent to the STUN server associated with this
   *     <tt>StunCandidateHarvest</tt>
   * @param transactionID the <tt>TransactionID</tt> of <tt>request</tt> because <tt>request</tt>
   *     only has it as a <tt>byte</tt> array and <tt>TransactionID</tt> is required for the
   *     <tt>applicationData</tt> property value
   * @throws StunException if anything goes wrong while sending the specified <tt>Request</tt> to
   *     the STUN server associated with this <tt>StunCandidateHarvest</tt>
   */
  protected TransactionID sendRequest(
      Request request, boolean firstRequest, TransactionID transactionID) throws StunException {
    if (!firstRequest && (longTermCredentialSession != null))
      longTermCredentialSession.addAttributes(request);

    StunStack stunStack = harvester.getStunStack();
    TransportAddress stunServer = harvester.stunServer;
    TransportAddress hostCandidateTransportAddress = hostCandidate.getTransportAddress();

    if (transactionID == null) {
      byte[] transactionIDAsBytes = request.getTransactionID();

      transactionID =
          (transactionIDAsBytes == null)
              ? TransactionID.createNewTransactionID()
              : TransactionID.createTransactionID(harvester.getStunStack(), transactionIDAsBytes);
    }
    synchronized (requests) {
      try {
        transactionID =
            stunStack.sendRequest(
                request, stunServer, hostCandidateTransportAddress, this, transactionID);
      } catch (IllegalArgumentException iaex) {
        if (logger.isLoggable(Level.INFO)) {
          logger.log(
              Level.INFO,
              "Failed to send "
                  + request
                  + " through "
                  + hostCandidateTransportAddress
                  + " to "
                  + stunServer,
              iaex);
        }
        throw new StunException(StunException.ILLEGAL_ARGUMENT, iaex.getMessage(), iaex);
      } catch (IOException ioex) {
        if (logger.isLoggable(Level.INFO)) {
          logger.log(
              Level.INFO,
              "Failed to send "
                  + request
                  + " through "
                  + hostCandidateTransportAddress
                  + " to "
                  + stunServer,
              ioex);
        }
        throw new StunException(StunException.NETWORK_ERROR, ioex.getMessage(), ioex);
      }

      requests.put(transactionID, request);
    }
    return transactionID;
  }
  private void initDriverList() {
    try {
      Thread thread = Thread.currentThread();
      ClassLoader loader = thread.getContextClassLoader();

      Enumeration iter = loader.getResources("META-INF/services/java.sql.Driver");
      while (iter.hasMoreElements()) {
        URL url = (URL) iter.nextElement();

        ReadStream is = null;
        try {
          is = Vfs.lookup(url.toString()).openRead();

          String filename;

          while ((filename = is.readLine()) != null) {
            int p = filename.indexOf('#');

            if (p >= 0) filename = filename.substring(0, p);

            filename = filename.trim();
            if (filename.length() == 0) continue;

            try {
              Class cl = Class.forName(filename, false, loader);
              Driver driver = null;

              if (Driver.class.isAssignableFrom(cl)) driver = (Driver) cl.newInstance();

              if (driver != null) {
                log.fine(L.l("DatabaseManager adding driver '{0}'", driver.getClass().getName()));

                _driverList.add(driver);
              }
            } catch (Exception e) {
              log.log(Level.FINE, e.toString(), e);
            }
          }
        } catch (Exception e) {
          log.log(Level.FINE, e.toString(), e);
        } finally {
          if (is != null) is.close();
        }
      }
    } catch (Exception e) {
      log.log(Level.FINE, e.toString(), e);
    }
  }
Пример #10
0
 private void updateOutput() {
   try {
     setOutputStream(new FileOutputStream(filename, true));
   } catch (IOException ex) {
     logger.log(Level.SEVERE, "Unable to open " + filename + " for writing", ex);
   }
 }
Пример #11
0
  /**
   * Copies the properties of a specific <tt>DatagramPacket</tt> to another <tt>DatagramPacket</tt>.
   * The property values are not cloned.
   *
   * @param src the <tt>DatagramPacket</tt> which is to have its properties copied to <tt>dest</tt>
   * @param dest the <tt>DatagramPacket</tt> which is to have its properties set to the value of the
   *     respective properties of <tt>src</tt>
   */
  public static void copy(DatagramPacket src, DatagramPacket dest) {
    synchronized (dest) {
      dest.setAddress(src.getAddress());
      dest.setPort(src.getPort());

      byte[] srcData = src.getData();

      if (srcData == null) dest.setLength(0);
      else {
        byte[] destData = dest.getData();

        if (destData == null) dest.setLength(0);
        else {
          int destOffset = dest.getOffset();
          int destLength = destData.length - destOffset;
          int srcLength = src.getLength();

          if (destLength >= srcLength) destLength = srcLength;
          else if (logger.isLoggable(Level.WARNING)) {
            logger.log(Level.WARNING, "Truncating received DatagramPacket data!");
          }
          System.arraycopy(srcData, src.getOffset(), destData, destOffset, destLength);
          dest.setLength(destLength);
        }
      }
    }
  }
Пример #12
0
 private void doPublish(
     String name,
     Object val,
     String src,
     String dpt,
     String textual,
     long updateTime,
     long lastChange) {
   JsonObject jso = new JsonObject();
   jso.add("ts", updateTime).add("lc", lastChange).add("knx_src_addr", src).add("knx_dpt", dpt);
   if (textual != null) jso.add("knx_textual", textual);
   if (val instanceof Integer) jso.add("val", ((Integer) val).intValue());
   else if (val instanceof Number) jso.add("val", ((Number) val).doubleValue());
   else jso.add("val", val.toString());
   String txtmsg = jso.toString();
   MqttMessage msg = new MqttMessage(jso.toString().getBytes(StandardCharsets.UTF_8));
   msg.setQos(0);
   msg.setRetained(true);
   try {
     String fullTopic = topicPrefix + "status/" + name;
     mqttc.publish(fullTopic, msg);
     L.finer("Published " + txtmsg + " to " + fullTopic);
   } catch (MqttException e) {
     L.log(Level.WARNING, "Error when publishing message " + txtmsg, e);
   }
 }
Пример #13
0
 /**
  * Obtain a new Node from a type that matches the given string. It will try to correctly detect
  * RealVar and constant nodes. The Node is cloned and initialized, so it can be used separatedly
  *
  * @param name The type of the requested Node. It must coincide with one of the class names of
  *     available Nodes, unless it represents a variable or constant terminal
  * @param currentGlobalDepth The depth of the requested Node in the Tree
  */
 public Node newNode(String name, int currentGlobalDepth) {
   System.out.println(name);
   Node outNode = null;
   if (name.startsWith("X")) {
     outNode = new RealVar(Integer.parseInt(name.substring("X".length(), name.length())));
   } else if (name.startsWith("angle")) {
     outNode = new Angle(Integer.parseInt(name.substring("angle".length(), name.length())));
   } else if (name.substring(0, 1).matches("\\d")) {
     outNode = new RealConstant(Double.parseDouble(name));
   } else if (name.equals("true")) {
     outNode = new LogicConstant(1);
   } else if (name.equals("false")) {
     outNode = new LogicConstant(0);
   } else {
     List<Node> all = new ArrayList<Node>();
     for (int i = 0; i < nodeSets.length; i++) {
       all.addAll(nodeSets[i].getAll());
     }
     for (Node n : all) {
       if (name.equals(n.name())) {
         try {
           outNode = (Node) n.clone();
         } catch (CloneNotSupportedException e) {
           Logger.log(e);
         }
         break;
       }
     }
   }
   outNode.setCurrentDepth(currentGlobalDepth);
   return outNode;
 }
Пример #14
0
  protected boolean touchEvent(TouchEvent te) {
    System.out.println("touchEvent type " + Integer.toString(te.getEvent()));
    if (te.getEvent() == TouchEvent.CANCEL) return true;
    int x = te.getX(1);
    int y = te.getY(1);
    if (x < 0 || x > this.getWidth() || y < 0 || y > this.getHeight()) {
      Logger.log(
          "touchedEvent type "
              + Integer.toString(te.getEvent())
              + " x="
              + Integer.toString(x)
              + " y="
              + Integer.toString(x)
              + " outside "
              + Integer.toString(getWidth())
              + "x"
              + Integer.toString(getHeight()));
      return super.touchEvent(te);
    }
    switch (te.getEvent()) {
      case TouchEvent.DOWN:
        touchDownEvent(x, y);
        break;
      case TouchEvent.UP:
        touchUpEvent(x, y);
        break;
      case TouchEvent.MOVE:
        touchMovedEvent(x, y);
        break;
      default:
        return super.touchEvent(te);
    }

    return true;
  }
Пример #15
0
  /** Initialise mod hooks */
  private void initHooks() {
    try {
      // Chat hook
      if ((chatListeners.size() > 0 || chatFilters.size() > 0) && !chatHooked) {
        chatHooked = true;
        HookChat.Register();
        HookChat.RegisterPacketHandler(this);
      }

      // Login hook
      if ((preLoginListeners.size() > 0 || loginListeners.size() > 0) && !loginHooked) {
        loginHooked = true;
        ModUtilities.registerPacketOverride(1, HookLogin.class);
        HookLogin.loader = this;
      }

      // Plugin channels hook
      if (pluginChannelListeners.size() > 0 && !pluginChannelHooked) {
        pluginChannelHooked = true;
        HookPluginChannels.Register();
        HookPluginChannels.RegisterPacketHandler(this);
      }

      // Tick hook
      if (!tickHooked) {
        tickHooked = true;
        PrivateFields.minecraftProfiler.SetFinal(minecraft, new HookProfiler(this, logger));
      }
    } catch (Exception ex) {
      logger.log(Level.WARNING, "Error creating hooks", ex);
      ex.printStackTrace();
    }
  }
Пример #16
0
 public void removeThread(WorkerThread thread) {
   threads.remove(thread);
   Logger.log(Level.DEBUG, Messages.getString("connection_closed", Settings.getLocale()));
   if (FancyFileServer.getGUI() != null) {
     FancyFileServer.getGUI().updateConnectionsCounter();
   }
 }
Пример #17
0
  private void checkOrientationChanged(int w, int h) {
    // calculate current orientation based on width and height
    int isLandscape = w > h ? 1 : 0;
    if (isLandscape == isLandscapeScreen) {
      return;
    }
    if (!isUIWorkerInit) {
      // verify that UIWorker is initialized
      isUIWorkerInit = UIWorker.isInit();
      if (!isUIWorkerInit) return;
    }
    isLandscapeScreen = isLandscape;
    try {
      if (c_on_orientation_change == 0)
        c_on_orientation_change = CibylCallTable.getAddressByName("rim_on_orientation_change");
    } catch (Throwable t) {
      Logger.log("Exception in checkOrientationChanged: " + t);
      t.printStackTrace();

      System.exit(0);
    }

    if (c_on_orientation_change != 0) {
      UIWorker.addUIEvent(c_on_orientation_change, isLandscape, 0, 0, 0, true);
    }
  }
Пример #18
0
  /**
   * Reads a base class overrride from a resource file
   *
   * @param binaryClassName
   * @param fileName
   */
  private void registerBaseClassOverride(String binaryClassName, String fileName) {
    try {
      Method mDefineClass =
          ClassLoader.class.getDeclaredMethod(
              "defineClass", String.class, byte[].class, int.class, int.class);
      mDefineClass.setAccessible(true);

      InputStream resourceInputStream =
          LiteLoader.class.getResourceAsStream("/classes/" + fileName + ".bin");

      if (resourceInputStream != null) {
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

        for (int readBytes = resourceInputStream.read();
            readBytes >= 0;
            readBytes = resourceInputStream.read()) {
          outputStream.write(readBytes);
        }

        byte[] data = outputStream.toByteArray();

        outputStream.close();
        resourceInputStream.close();

        logger.info("Defining class override for " + binaryClassName);
        mDefineClass.invoke(
            Minecraft.class.getClassLoader(), binaryClassName, data, 0, data.length);
      } else {
        logger.info("Error defining class override for " + binaryClassName + ", file not found");
      }
    } catch (Throwable th) {
      logger.log(Level.WARNING, "Error defining class override for " + binaryClassName, th);
    }
  }
Пример #19
0
  /**
   * Creates a <tt>ServerReflexiveCandidate</tt> using {@link #hostCandidate} as its base and the
   * <tt>XOR-MAPPED-ADDRESS</tt> attribute in <tt>response</tt> for the actual
   * <tt>TransportAddress</tt> of the new candidate. If the message is malformed and/or does not
   * contain the corresponding attribute, this method simply has no effect.
   *
   * @param response the STUN <tt>Response</tt> which is supposed to contain the address we should
   *     use for the new candidate
   */
  protected void createServerReflexiveCandidate(Response response) {
    TransportAddress addr = getMappedAddress(response);

    if (addr != null) {
      ServerReflexiveCandidate srvrRflxCand = createServerReflexiveCandidate(addr);

      if (srvrRflxCand != null) {
        try {
          addCandidate(srvrRflxCand);
        } finally {
          // Free srvrRflxCand if it has not been consumed.
          if (!containsCandidate(srvrRflxCand)) {
            try {
              srvrRflxCand.free();
            } catch (Exception ex) {
              if (logger.isLoggable(Level.FINE)) {
                logger.log(
                    Level.FINE,
                    "Failed to free" + " ServerReflexiveCandidate: " + srvrRflxCand,
                    ex);
              }
            }
          }
        }
      }
    }
  }
Пример #20
0
 private void loadCustomModsFromJar(File file)
     throws IOException, ClassNotFoundException, IllegalAccessException, InstantiationException {
   Logger.log(Logger.LOG_JAR, "Opening %s", file.getPath());
   final JarFile jar = new JarFile(file);
   URLClassLoader loader =
       new URLClassLoader(new URL[] {file.toURI().toURL()}, getClass().getClassLoader());
   for (JarEntry entry : Collections.list(jar.entries())) {
     if (!entry.isDirectory() && MinecraftJar.isClassFile(entry.getName())) {
       Mod mod = loadCustomMod(loader, ClassMap.filenameToClassName(entry.getName()));
       if (addNoReplace(mod)) {
         Logger.log(Logger.LOG_MOD, "new %s()", mod.getClass().getName());
         mod.customJar = file;
       }
     }
   }
 }
Пример #21
0
  void _pickInitial() throws MongoException {
    if (_curAddress != null) return;

    // we need to just get a server to query for ismaster
    _pickCurrent();

    try {
      _logger.info("current address beginning of _pickInitial: " + _curAddress);

      DBObject im = isMasterCmd();
      if (_isMaster(im)) return;

      synchronized (_allHosts) {
        Collections.shuffle(_allHosts);
        for (ServerAddress a : _allHosts) {
          if (_curAddress == a) continue;

          _logger.info("remote [" + _curAddress + "] -> [" + a + "]");
          _set(a);

          im = isMasterCmd();
          if (_isMaster(im)) return;

          _logger.severe("switched to: " + a + " but isn't master");
        }

        throw new MongoException("can't find master");
      }
    } catch (Exception e) {
      _logger.log(Level.SEVERE, "can't pick initial master, using random one", e);
    }
  }
Пример #22
0
  /**
   * Creates window using parameters <code>params</code> If params contain flag DELAYED doesn't do
   * anything. Note: Descendants can call this method to create the window at the time different to
   * instance construction.
   */
  protected final void init(XCreateWindowParams params) {
    awtLock();
    initialising = InitialiseState.INITIALISING;
    awtUnlock();

    try {
      if (!Boolean.TRUE.equals(params.get(DELAYED))) {
        preInit(params);
        create(params);
        postInit(params);
      } else {
        instantPreInit(params);
        delayedParams = params;
      }
      awtLock();
      initialising = InitialiseState.INITIALISED;
      awtLockNotifyAll();
      awtUnlock();
    } catch (RuntimeException re) {
      awtLock();
      initialising = InitialiseState.FAILED_INITIALISATION;
      awtLockNotifyAll();
      awtUnlock();
      throw re;
    } catch (Throwable t) {
      log.log(Level.WARNING, "Exception during peer initialization", t);
      awtLock();
      initialising = InitialiseState.FAILED_INITIALISATION;
      awtLockNotifyAll();
      awtUnlock();
    }
  }
  /**
   * Perform the actual version check by connecting to the version server.
   *
   * @param data_to_send version message
   * @return version reply
   * @throws Exception if the server check connection fails
   */
  private Map performVersionCheck(
      Map data_to_send, boolean use_az_message, boolean use_http, boolean v6) throws Exception {
    Exception error = null;
    Map reply = null;

    if (use_http) {

      try {
        reply = executeHTTP(data_to_send, v6);

        reply.put("protocol_used", "HTTP");

        error = null;
      } catch (IOException e) {
        error = e;
      } catch (Exception e) {
        Debug.printStackTrace(e);
        error = e;
      }
    }

    if (reply == null && use_az_message) {

      try {
        reply = executeAZMessage(data_to_send, v6);

        reply.put("protocol_used", "AZMSG");
      } catch (IOException e) {
        error = e;
      } catch (Exception e) {
        Debug.printStackTrace(e);
        error = e;
      }
    }
    if (error != null) {

      throw (error);
    }

    if (Logger.isEnabled())
      Logger.log(
          new LogEvent(
              LOGID,
              "VersionCheckClient server "
                  + "version check successful. Received "
                  + reply.size()
                  + " reply keys."));

    if (v6) {

      last_check_time_v6 = SystemTime.getCurrentTime();

    } else {

      last_check_time_v4 = SystemTime.getCurrentTime();
    }

    return reply;
  }
Пример #24
0
 public void setDummyTexture(Texture texture) {
   if (texture != null) {
     dummy = texture;
     replaceTexture("--dummy--", texture);
   } else {
     Logger.log("Texture can't be null!", 0);
   }
 }
Пример #25
0
 synchronized void flushOpenGLIDs(int i) {
   for (Enumeration enumeration = textureList.keys(); enumeration.hasMoreElements(); ) {
     String s = (String) enumeration.nextElement();
     Texture texture = getTexture(s);
     if (texture != null) texture.clearIDs(i);
     else Logger.log("Texture '" + s + "' is supposed to be there, but couldn't be found!?", 1);
   }
 }
Пример #26
0
 public synchronized Texture getTexture(String s) {
   if (s != null) {
     int i = getTextureID(s);
     if (i != -1) return textures[i];
   }
   Logger.log("Requested texture (" + s + ") not found!", 0);
   return null;
 }
Пример #27
0
 /**
  * Performs OCR operation.
  *
  * @param bi a buffered image
  * @param rect the bounding rectangle defines the region of the image to be recognized. A
  *     rectangle of zero dimension or <code>null</code> indicates the whole image.
  * @return the recognized text
  * @throws TesseractException
  */
 public String doOCR(BufferedImage bi, Rectangle rect) throws TesseractException {
   try {
     return doOCR(ImageIOHelper.getIIOImageList(bi), rect);
   } catch (Exception e) {
     logger.log(Level.SEVERE, e.getMessage(), e);
     throw new TesseractException(e);
   }
 }
Пример #28
0
 void loadCustomMods(File directory) {
   if (directory.isDirectory()) {
     for (File f :
         directory.listFiles(
             new FileFilter() {
               public boolean accept(File pathname) {
                 return pathname.isFile() && pathname.getName().endsWith(".jar");
               }
             })) {
       try {
         loadCustomModsFromJar(f);
       } catch (Throwable e) {
         Logger.log(Logger.LOG_JAR, "Error loading mods from %s", f.getPath());
         Logger.log(e);
       }
     }
   }
 }
Пример #29
0
  public void addString(String str) {
    char[] array = str.toCharArray();
    strings.add(new TreeString(strings.size(), array));

    logger.log(Level.INFO, String.format("Adding string \"%s\"", str));

    ukkonenExtendSuffixTree(strings.size() - 1);
    // naiveExtendSuffixTree(strings.size()-1);
  }
Пример #30
0
 public void handlePropertyNotify(XEvent xev) {
   XPropertyEvent msg = xev.get_xproperty();
   if (XPropertyCache.isCachingSupported()) {
     XPropertyCache.clearCache(window, XAtom.get(msg.get_atom()));
   }
   if (eventLog.isLoggable(Level.FINER)) {
     eventLog.log(Level.FINER, "{0}", new Object[] {String.valueOf(msg)});
   }
 }