Exemplo n.º 1
0
 public String transform(String message) {
   String rv = message;
   try {
     log.debug("in=" + message);
     // decode the message
     org.jengine.tools.hl7.Message msg =
         org.jengine.tools.hl7.Message.read(new java.io.StringReader(message));
     // pass the decoded message to beanshell
     interpreter.eval("org.jengine.tools.hl7.Message message");
     interpreter.set("message", msg);
     // pass the logging category to beanshell
     interpreter.eval("org.apache.log4j.Category log");
     interpreter.set("log", log);
     // call the script
     interpreter.eval(script);
     // encode the possibly modified message
     java.io.StringWriter sw = new java.io.StringWriter();
     msg.write(sw);
     rv = sw.toString();
     log.debug("out=" + rv);
   } catch (Exception e) {
     log.error("Problem processing transformation", e);
   }
   return rv;
 }
  /**
   * Method addKeyStore
   *
   * @param keyStore
   */
  public void add(KeyStore keyStore) {

    try {
      this.add(new KeyStoreResolver(keyStore));
    } catch (StorageResolverException ex) {
      cat.error("Could not add KeyStore because of: ", ex);
    }
  }
Exemplo n.º 3
0
 /**
  * Returns complete composite object, if applicable, by searching the database key on the <code>
  * List</code> object of <code>PersistentObject</code>s that contains an encoded key (<code>
  * PersistentObject.getEncodedKey()</code>).
  *
  * @param list <code>List</code> of objects to search.
  * @param encodedKey key obtained via <code>PersistentObject.getEncodedKey()</code>.
  * @return object that matches encoded key or <code>null</code> if not found.
  * @see net.sf.jrf.domain.PersistentObject#getEncodedKey()
  * @see #findIndexByKey(List,String)
  */
 public PersistentObject findByKey(List list, String encodedKey) {
   PersistentObject po = getPoInList(list, encodedKey);
   if (po == null) {
     LOG.error("findByKey(List," + encodedKey + ") called without key on the list.");
     return null;
   }
   return findByKey(po);
 }
Exemplo n.º 4
0
 public static String stackTrace(Throwable t) {
   StringWriter sw = new StringWriter();
   t.printStackTrace(new PrintWriter(sw));
   String s = sw.toString();
   try {
     sw.close();
   } catch (IOException e) {
     cat.error("::stackTrace - cannot close the StringWriter object", e);
   }
   return s;
 }
Exemplo n.º 5
0
  /**
   * Removes a CSS item from the CSS file.
   *
   * @param selectorName Name of selector.
   * @param name Name of item to remove.
   */
  public void removeValueFromSelector(String selectorName, String name) {
    if (selectorName != null && name != null) {
      if (m_css.indexOf(selectorName) >= 0) {
        boolean done = false;
        int pos = 0;
        while (!done) {
          int beginPos = m_css.indexOf(selectorName, pos);

          if (beginPos >= 0) {
            int endPos = m_css.indexOf("{", beginPos);

            if (endPos >= 0) {
              String workSelectorName = m_css.substring(beginPos, endPos).trim();

              if (workSelectorName.equals(selectorName)) {

                // ArrayList lines = readLines(m_css.substring(endPos, m_css.indexOf("}")));
                // String work = m_css.substring(endPos, m_css.indexOf("}"));
                // int removeStartPos = m_css.substring(endPos, m_css.indexOf("}")).indexOf(name);
                int removeStartPos = m_css.indexOf(name, endPos);
                int removeEndPos = m_css.indexOf(";", removeStartPos);

                if (removeStartPos < removeEndPos) {
                  // logger.info("REMOVING:::::::" + m_css.substring(removeStartPos,
                  // removeEndPos+1));
                  m_css.replace(removeStartPos, removeEndPos + 1, " ");
                }
                done = true;
              }

              pos = endPos;
              if (pos >= m_css.length()) {
                done = true;
              }
            } else {
              done = true;
            }
          } else {
            done = true;
          }
        }
      } else {
        logger.error("Error processing CSS removeValueFromSelector: " + selectorName);
      }
    }
  }
Exemplo n.º 6
0
  public String echo(String arg) {
    log.info("echo, arg=" + arg);
    try {
      InitialContext ctx = new InitialContext();
      Object ref = ctx.lookup("java:comp/env/ra/DirContextFactory");
      log.info("echo, ra/DirContextFactory=" + ref);

      DirContextFactory dcf = (DirContextFactory) ref;
      log.info("echo, found dcf=" + dcf);

      DirContext dc = dcf.getConnection();
      log.info("echo, lookup dc=" + dc);

      dc.close();
    } catch (NamingException e) {
      log.error("Failed during JNDI access", e);
    }
    return arg;
  }
Exemplo n.º 7
0
  public static void main(String[] args) {
    // Ensure to have all necessary drivers installed !
    try {
      Driver d = (Driver) (Class.forName("oracle.jdbc.driver.OracleDriver").newInstance());
      DriverManager.registerDriver(d);
    } catch (Exception e) {
    }

    // Set the priority which messages have to be logged
    cat.setPriority(Priority.INFO);

    // Configuration with configuration-file
    PropertyConfigurator.configure("log4jtestprops.txt");

    // These messages with Priority >= setted priority will be logged to the database.
    cat.debug("debug"); // this not, because Priority DEBUG is less than INFO
    cat.info("info");
    cat.error("error");
    cat.fatal("fatal");
  }
Exemplo n.º 8
0
  private boolean validateIP() {
    getXMLElements();
    boolean flag = false;

    try {
      InetAddress[] addresses;
      addresses = InetAddress.getAllByName(InetAddress.getLocalHost().getHostName());
      if (addresses.length == 1 && "127.0.0.1".equals(addresses[0].getHostAddress())) {
        flag = true;
      } else {
        for (int i = 0; i < addresses.length; i++) {
          if (withinSubnet(addresses[i].getHostAddress())) {
            return (true);
          }
        }
      }
    } catch (UnknownHostException e) {
      log.error("Error When Validating Host", e);
    }
    return flag;
  }
Exemplo n.º 9
0
  public boolean validateLicence() {
    if (this.readFlag) {
      return (this.isValidLicense);
    }

    getXMLElements();
    boolean flag = false;
    synchronized (lock) {
      if (validateIP()) {
        String s = new String();
        for (Enumeration e = Modules.elements(); e.hasMoreElements(); ) {
          ModuleLicenceInfo ml = ((ModuleLicenceInfo) e.nextElement());
          s += ml.getName();
          s += ml.getType();
          s += ml.getNo();
        }
        s += Info.getIp();
        s += Info.getExpDate();
        s += Info.getVersion();
        try {
          if (TextUtility.encodeObject(md5util.getDigest(s))
              .equals(Info.getKey().trim().toString())) {
            flag = true;
          }
        } catch (Exception e) {
          log.error(Priority.INFO, e);
        }
      }
      /*
            if (!flag) {
              for (Enumeration e = Modules.elements(); e.hasMoreElements(); ) {
                ModuleLicenceInfo ml = ( (ModuleLicenceInfo) e.nextElement());
                ml.setNo(-1);
              }
            }
      */
      this.isValidLicense = flag;
    }
    return flag;
  }
Exemplo n.º 10
0
  /**
   * This method inserts a value into the selector. It allows you to insert new CSS into the
   * template.
   *
   * @param selectorName Name of CSS selector.
   * @param name Name of CSS item.
   * @param value Value of CSS item.
   */
  public void insertValueIntoSelector(String selectorName, String name, String value) {
    if (selectorName != null && name != null && value != null) {
      if (m_css.indexOf(selectorName) >= 0) {
        boolean done = false;
        int pos = 0;
        while (!done) {
          int beginPos = m_css.indexOf(selectorName, pos);

          if (beginPos >= 0) {
            int endPos = m_css.indexOf("{", beginPos);

            if (endPos >= 0) {
              String workSelectorName = m_css.substring(beginPos, endPos).trim();

              if (workSelectorName.equals(selectorName)) {
                int workEndPos = m_css.indexOf("}", endPos);
                m_css.insert(workEndPos - 1, "\n" + name + ":" + value + ";\n");
                done = true;
              }

              pos = endPos;
              if (pos >= m_css.length()) {
                done = true;
              }
            } else {
              done = true;
            }
          } else {
            done = true;
          }
        }
      } else {
        logger.error(
            "Error processing CSS in insertValueIntoSelector: selectorName:" + selectorName);
      }
    }
  }
Exemplo n.º 11
0
  private void getXMLElements() {
    synchronized (lock) {
      if (this.readFlag) {
        return;
      }

      document = null;
      Modules = new Hashtable();
      Info = new LicenceInfo();
      log.info("License File Path: " + path);
      XMLfile = new XMLUtility(path);

      try {
        NodeList rootlist = XMLfile.getNodeListByTagName("MODULE");
        for (int intloop = 0; intloop < rootlist.getLength(); intloop++) {
          ModuleLicenceInfo ml = new ModuleLicenceInfo();
          Element node = (Element) rootlist.item(intloop);

          ml.setName(
              node.getElementsByTagName("MODULE_CODE")
                  .item(0)
                  .getChildNodes()
                  .item(0)
                  .getNodeValue());
          if (node.getElementsByTagName("CONCURRENT_USER") != null
              && node.getElementsByTagName("CONCURRENT_USER").getLength() > 0) {
            ml.setType("CONCURRENT_USER");
            ml.setNo(
                Integer.parseInt(
                    node.getElementsByTagName("CONCURRENT_USER")
                        .item(0)
                        .getChildNodes()
                        .item(0)
                        .getNodeValue()));
          } else {
            ml.setType("NAMED_USER");
            ml.setNo(
                Integer.parseInt(
                    node.getElementsByTagName("NAMED_USER")
                        .item(0)
                        .getChildNodes()
                        .item(0)
                        .getNodeValue()));
          }
          log.info(ml.getName() + ":" + ml.getType() + ":" + ml.getNo());
          Modules.put(ml.getName(), ml);
        }

        Element infoNode = (Element) XMLfile.getNodeListByTagName("INFORMATION").item(0);
        Info = new LicenceInfo();
        Info.setKey(
            infoNode
                .getElementsByTagName("LICENSE_KEY")
                .item(0)
                .getChildNodes()
                .item(0)
                .getNodeValue());
        Info.setExpDate(
            infoNode
                .getElementsByTagName("EXPIRY_DATE")
                .item(0)
                .getChildNodes()
                .item(0)
                .getNodeValue());
        Info.setIp(
            infoNode
                .getElementsByTagName("HOST_IP")
                .item(0)
                .getChildNodes()
                .item(0)
                .getNodeValue());
        Info.setComName(
            infoNode
                .getElementsByTagName("COMPANY_NAME")
                .item(0)
                .getChildNodes()
                .item(0)
                .getNodeValue());
        Info.setVersion(
            infoNode
                .getElementsByTagName("VERSION")
                .item(0)
                .getChildNodes()
                .item(0)
                .getNodeValue());
        log.info("License Key: " + Info.getKey());
        log.info("Expiry Date: " + Info.getExpDate());
        log.info("Host IP    : " + Info.getIp());
        log.info("Company    : " + Info.getComName());
        log.info("Version    : " + Info.getVersion());

        this.readFlag = true;
      } catch (Exception e) {
        log.error("Error in parsing License File.", e);
      }
    }
  }
Exemplo n.º 12
0
  @Override
  public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
      throws java.io.IOException, javax.servlet.ServletException {
    HttpServletRequest httpServletRequest = (HttpServletRequest) request;
    HttpServletResponse httpServletResponse = (HttpServletResponse) response;
    boolean needAuth = false;

    HttpSession session = httpServletRequest.getSession();
    Principal principal = httpServletRequest.getUserPrincipal();

    String contextPath = ((HttpServletRequest) request).getContextPath();

    if (!isUnprotectedPage(httpServletRequest.getRequestURI().replaceFirst(contextPath, ""))) {
      if (request.getAttribute(OS_AUTHSTATUS_KEY) != null
          && apiBypassEnabled
          && principal != null) {
        // Request has gone through OAuth, we're done if it succeeded
        if (!request.getAttribute(OS_AUTHSTATUS_KEY).equals(LOGIN_SUCCESS)) {
          throw new ServletException("OAuth authentication failed");
        }
      } else if (principal != null) {
        // User has logged in locally, has there been a Duo auth?
        if (session.getAttribute(DUO_AUTH_SUCCESS_KEY) == null) {
          // are we coming from the Duo auth servlet?
          String duoResponse = (String) session.getAttribute(DUO_RESPONSE_ATTRIBUTE);
          if (duoResponse != null) {
            String duoUsername = null;
            try {
              duoUsername = DuoWeb.verifyResponse(ikey, skey, akey, duoResponse);
            } catch (DuoWebException e) {
              e.printStackTrace();
              log.error(e.getMessage());
            } catch (NoSuchAlgorithmException e) {
              e.printStackTrace();
              log.error(e.getMessage());
            } catch (InvalidKeyException e) {
              e.printStackTrace();
              log.error(e.getMessage());
            }
            if (duoUsername != null && duoUsername.equals(principal.getName())) {
              session.setAttribute(DUO_AUTH_SUCCESS_KEY, true);
            } else {
              needAuth = true;
            }
          } else {
            needAuth = true;
          }
        } // user has already authed with us this session
      } // no user -> Seraph has not required auth -> we don't either,
      // or user came from OAuth and we're configured to not require 2fa for that
    } // we're serving a page for Duo auth

    if (needAuth) {
      String result = preauthWithRetries(MAX_TRIES, principal);

      if (result.equals("ALLOW") || result.equals("FAILOPEN")) {
        session.setAttribute(DUO_AUTH_SUCCESS_KEY, true);
        chain.doFilter(request, response);
        return;
      } else {
        redirectDuoAuth(principal, httpServletRequest, httpServletResponse, contextPath);
        return;
      }
    }

    // We do not need Duo auth.  Continue with the filter chain.
    chain.doFilter(request, response);
  }
Exemplo n.º 13
0
  /**
   * Adds a Data Line to the yData- and the xData - puffer
   *
   * @param s The feature to be added to the XYPAIRSandPEAKTABLEdataLine attribute
   * @exception NumberFormatException Description of the Exception
   */
  private final void addXYPAIRSandPEAKTABLEdataLine(String s) throws NumberFormatException {
    double xDataDummy = 0;
    double yDataDummy = 0;

    if (!separatorStandardChecked) {
      // entscheide ob , als Trennung oder fuer FlieSkommazahl verwendet wird !;-((
      int kommaIndex = s.indexOf(",", 0);
      int pointIndex = s.indexOf(".", 0);
      int spaceIndex = s.indexOf(" ", 0);
      int tabulatorIndex = s.indexOf("\t", 0);

      if (pointIndex == -1) {
        // bei schlechtem Standard, kann auch Komma Fuer FlieSkommazahlen
        // vorkommen und darf NICHT als Trennzeichen interpretiert werden
        // Was fuer ein Mist, gibts, aber !!!
        if ((kommaIndex != -1) && (spaceIndex != -1)) {
          if (kommaIndex < spaceIndex) {
            if ((s.charAt(kommaIndex + 1) >= '0') && (s.charAt(kommaIndex + 1) <= '9')) {
              // s=s.replace(',','.');
              standardSeparator = false;
            }
          }
        } else if ((kommaIndex != -1) && (tabulatorIndex != -1)) {
          if (kommaIndex < tabulatorIndex) {
            if ((s.charAt(kommaIndex + 1) >= '0') && (s.charAt(kommaIndex + 1) <= '9')) {
              // s=s.replace(',','.');
              standardSeparator = false;
            }
          }
        }
      }

      separatorStandardChecked = true;
    }

    if (!standardSeparator) {
      s = s.replace(',', '.');
    }

    StringTokenizer dataLine = new StringTokenizer(s, " \t,");
    String s1 = "";

    try {
      s1 = dataLine.nextToken();
    } catch (NoSuchElementException e) {
      logger.error("The data line \"" + s + "\" is skipped. It contains" + " no valid data.");

      return;
    }

    try {
      // println("x "+s1);
      xDataDummy = (new Double(s1)).doubleValue();
    } catch (NumberFormatException e) {
      logger.error("The data line \"" + s + "\" is skipped. It contains" + " not a valid X value.");

      return;
    }

    xDataDummy = xDataDummy * xFactor;
    xData.add(new Double(xDataDummy));

    try {
      s1 = dataLine.nextToken();
    } catch (NoSuchElementException e) {
      logger.error(e.getMessage());
    }

    try {
      // println("y "+s1);
      yDataDummy = (new Double(s1)).doubleValue();
    } catch (NumberFormatException e) {
      logger.error("The data line \"" + s + "\" is skipped. It contains" + " not a valid Y value.");

      return;
    }

    yDataDummy = yDataDummy * yFactor;
    yData.add(new Double(yDataDummy));
  }
Exemplo n.º 14
0
  /**
   * Adds a Data Line to the yData- and the xData - puffer
   *
   * @param s The feature to be added to the XYDATADataLine attribute
   * @exception NumberFormatException Description of the Exception
   */
  private final void addXYDATADataLine(String s) throws NumberFormatException {
    double xDataDummy = 0;
    double yDataDummy = 0;

    if (!separatorStandardChecked) {
      // entscheide ob , als Trennung oder fuer FlieSkommazahl verwendet wird !;-((
      int kommaIndex = s.indexOf(",", 0);
      int pointIndex = s.indexOf(".", 0);
      int spaceIndex = s.indexOf(" ", 0);
      int tabulatorIndex = s.indexOf("\t", 0);

      if (pointIndex == -1) {
        // bei schlechtem Standard, kann auch Komma Fuer FlieSkommazahlen
        // vorkommen und darf NICHT als Trennzeichen interpretiert werden
        // Was fuer ein Mist, gibts, aber !!!
        if ((kommaIndex != -1) && (spaceIndex != -1)) {
          if (kommaIndex < spaceIndex) {
            if ((s.charAt(kommaIndex + 1) >= '0') && (s.charAt(kommaIndex + 1) <= '9')) {
              // s=s.replace(',','.');
              standardSeparator = false;
            }
          }
        } else if ((kommaIndex != -1) && (tabulatorIndex != -1)) {
          if (kommaIndex < tabulatorIndex) {
            if ((s.charAt(kommaIndex + 1) >= '0') && (s.charAt(kommaIndex + 1) <= '9')) {
              // s=s.replace(',','.');
              standardSeparator = false;
            }
          }
        }
      }

      separatorStandardChecked = true;
    }

    if (!standardSeparator) {
      s = s.replace(',', '.');
    }

    StringTokenizer dataLine = new StringTokenizer(s, " \t,");
    int yDataPerLine = dataLine.countTokens() - 1;
    int dummyIndex = 0;
    String s1 = "";
    String s2 = "";

    yDataPerLine = 0;

    do {
      try {
        s1 = dataLine.nextToken();
      } catch (NoSuchElementException e) {
        break;
      }

      int signIndex = s1.indexOf("-", 1);

      // X Wert gar nicht erst auf - ueberpruefen
      String sign = "-";

      if (signIndex != -1) {
        int posSignIndex = s1.indexOf("+", 1);

        if ((posSignIndex != -1) && (posSignIndex < signIndex)) {
          signIndex = posSignIndex;
          sign = "+";
        }
      } else {
        int posSignIndex = s1.indexOf("+", 1);

        if (posSignIndex != -1) {
          signIndex = posSignIndex;
          sign = "+";
        }
      }

      if (signIndex > 0) {
        if (signIndex > 0) {
          //                    println("sign in "+s1+ "  "+signIndex);
          s2 = s1.substring(0, signIndex);
          yDataPerLine++;

          if (yDataPerLine == 1) {
            try {
              xDataDummy = (new Double(s2)).doubleValue();
            } catch (NumberFormatException e) {
              //                      logger.error(s2);
              logger.error(
                  "The data line \""
                      + s
                      + "\""
                      + " is skipped. It contains"
                      + " not a valid X value.");

              return;
            }

            xDataDummy = xDataDummy * xFactor;

            //                    println("x="+s2);
          } else {
            try {
              yDataDummy = (new Double(s2)).doubleValue();
            } catch (NumberFormatException e) {
              logger.error(
                  "The data line \""
                      + s
                      + "\""
                      + " is skipped. It contains"
                      + " not a valid Y value.");

              return;
            }

            yDataDummy = yDataDummy * yFactor;
            xData.add(new Double(xDataDummy));
            yData.add(new Double(yDataDummy));
            xDataDummy = xDataDummy + deltaX;

            //                           println("y="+s2);
          }

          do {
            dummyIndex = s1.indexOf(sign, signIndex + 1);

            if (dummyIndex == -1) {
              dummyIndex = s1.length();
            }

            s2 = s1.substring(signIndex, dummyIndex);
            yDataPerLine++;

            try {
              yDataDummy = (new Double(s2)).doubleValue();
            } catch (NumberFormatException e) {
              logger.error(
                  "The data line \""
                      + s
                      + "\""
                      + " is skipped. It contains"
                      + " not a valid Y value.");

              return;
            }

            yDataDummy = yDataDummy * yFactor;
            xData.add(new Double(xDataDummy));
            yData.add(new Double(yDataDummy));
            xDataDummy = xDataDummy + deltaX;

            //                           println("y="+s2);
            signIndex = s1.indexOf(sign, signIndex + 1);
          } while (dummyIndex != s1.length());
        }
      } else {
        yDataPerLine++;

        if (yDataPerLine == 1) {
          try {
            // println(s1);
            xDataDummy = (new Double(s1)).doubleValue();
          } catch (NumberFormatException e) {
            logger.error(
                "The data line \""
                    + s
                    + "\""
                    + " is skipped. It contains"
                    + " not a valid X value.");

            return;
          }

          xDataDummy = xDataDummy * xFactor;

          // println("x: "+xDataDummy);
        } else {
          try {
            yDataDummy = (new Double(s1)).doubleValue();
          } catch (NumberFormatException e) {
            logger.error(
                "The data line \""
                    + s
                    + "\""
                    + " is skipped. It contains"
                    + " not a valid Y value.");

            return;
          }

          yDataDummy = yDataDummy * yFactor;
          xData.add(new Double(xDataDummy));
          yData.add(new Double(yDataDummy));

          // println(xDataDummy+" "+yDataDummy);
          xDataDummy = xDataDummy + deltaX;
        }
      }
    } while (true);
  }
Exemplo n.º 15
0
  /**
   * Decodes XYDATA. Only the uncompressed ASDF format is supported. The compressed AFFN format is
   * not supported.
   *
   * @exception JCAMPException Description of the Exception
   * @exception NumberFormatException Description of the Exception
   */
  private void decodeXYDATA() throws JCAMPException, NumberFormatException {
    LabelData set = new LabelData();
    int begin;
    int end = 0;
    String s1 = "";
    String s2 = "";

    set = getParameter("DELTAX");

    if (set == null) {
      logger.warn("The label DELTAX is missing. Now its calculated !;-)");
      calculatedDeltaXneeded = true;
    }

    deltaX = getDouble(set);

    set = getParameter("LASTX");

    if (set == null) {
      String add = "";

      if (!calculatedDeltaXneeded) {
        add = ". The label DELTAX is missing and " + "can not be calculated";
      }

      throw new JCAMPException("The label LASTX is missing" + add);
    }

    lastX = getDouble(set);

    set = getParameter("FIRSTX");

    if (set == null) {
      String add = "";

      if (!calculatedDeltaXneeded) {
        add = ". The label DELTAX is missing and " + "can not be calculated";
      }

      throw new JCAMPException("The label FIRSTX is missing" + add);
    }

    firstX = getDouble(set);

    set = getParameter("NPOINTS");

    if (set == null) {
      String add = "";

      if (!calculatedDeltaXneeded) {
        add = ". The label NPOINTS is missing and DELTAX" + "can not be calculated";
        throw new JCAMPException("The label FIRSTX is missing" + add);
      }

      logger.warn("The label NPOINTS is missing. Now its estimated");
      estimatedNPointsNeeded = true;
    }

    nPoints = getDouble(set);

    // Berechnung von deltaX;
    if (calculatedDeltaXneeded) {
      deltaX = (lastX - firstX) / (nPoints - 1);
    } else {
      double dummy = 0;

      if (!estimatedNPointsNeeded && (nPoints != 0)) {
        // einfach nochmals zur Kontrolle von deltaX. Eigentlich unnoetig !
        dummy = (lastX - firstX) / (nPoints - 1);

        if (Math.abs(dummy - deltaX) > DELTAX_DIFFERENCE_WARNING_VALUE) {
          logger.warn(
              "The calculated DELTAX="
                  + dummy
                  + " (original DELTAX="
                  + deltaX
                  + ") shows a difference above "
                  + DELTAX_DIFFERENCE_WARNING_VALUE);
        }
      }
    }

    set = getParameter("XFACTOR");

    if (set == null) {
      throw new JCAMPException("The label XFACTOR is missing");
    }

    xFactor = getDouble(set);

    set = getParameter("YFACTOR");

    if (set == null) {
      throw new JCAMPException("The label YFACTOR is missing");
    }

    yFactor = getDouble(set);

    // beginne Dekodierung
    set = getParameter("XYPAIRS");

    // if (set == null)
    // {
    // }
    //    if(dataType==XYPAIRS){
    //      end=set.getData().indexOf("\n",0);
    //      if (end==-1)throw new JCAMPException("Carriage return after \"=\" is not allowed");
    //      s1=set.getData().substring(0, end).trim();
    //    }
    //    else
    if (dataType == XYDATA_X_YY) {
      set = getParameter("XYDATA");

      //            if (set == null)
      //            {
      //            }
      end = set.getData().indexOf("\n", 0);

      if (end == -1) {
        throw new JCAMPException("Carriage return" + " after \"=\" is not allowed");
      }

      s1 = set.getData().substring(0, end).trim();
    }

    s1 = set.getData().substring(end + 1, set.getData().indexOf("\n", end + 1));

    // s1=s1.trim();
    // hier findet keine Unterscheidung zwischen AFFN (ungepackt) oder ASDF (gepackt) statt
    // Pseudo-digits or ASDF forms
    // ASCII digits          0 1 2 3 4 5 6 7 8 9
    // Positive SQZ digits   @ A B C D E F G H I
    // Negative SQZ digits     a b c d e f g h i
    // Positive DIF digits   % J K L M N O P Q R
    // Negative DIF digits     j k l m n o p q r
    // Positive DUP digits     S T U V W X Y Z s
    StringTokenizer isAFFN =
        new StringTokenizer(s1, "@ABCDEFGHIabcdefghi%JKLMNOPQRjklmnopqrSTUVWXYZs");

    try {
      s2 = isAFFN.nextToken();

      if (s1.equals(s2)) {
        // ist ein Token enthalten, so ist s1 ungleich s2
        // OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
        // nur AFFN !!!
        // OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
        // wieviele Datenpunkte sind es denn etwa ?
        //                StringTokenizer dataValue = new StringTokenizer(s1, " \t");
        // ruhig groS waehlen, da sie nachher eh geloescht werden.
        //            int dataPerLine=100;
        // Anzahl der Datenwerte ist NPOINTS/countTokens
        // dataPerLine=Math.max(dataValue.countTokens(), 100);
        //            yData= new Vector((int)nPoints, dataPerLine);
        //            xData= new Vector((int)nPoints, dataPerLine);
        xData = new LinkedList();
        yData = new LinkedList();

        begin = 0;
        begin = set.getData().indexOf("\n", begin);
        begin++;

        do {
          end = set.getData().indexOf("\n", begin);

          if (set.getData().indexOf(";", begin) != -1) {
            end = Math.min(end, set.getData().indexOf(";", begin));
          }

          if (end == -1) {
            break;
          }

          s1 = set.getData().substring(begin, end).trim();

          // dataLine
          // println("s1:"+parameterSaetze[1].substring(begin,end));
          addXYDATADataLine(s1);
          begin = end + 1;
        } while (true);

        sendDataToDoubleArray();

        return;
      } else {
        throw new JCAMPException("Compressed data in ASDF format is not supported ");
      }
    } catch (NoSuchElementException e) {
      logger.error(e.getMessage());
    }
  }