Input:
public boolean renderImpl(final GWikiContext ctx, final MacroAttributes attrs)
  {
    if (RenderModes.NoToc.isSet(ctx.getRenderMode()) == true) {
      return true;
    }
    final GWikiElementInfo elementInfo = ctx.getCurrentElement().getElementInfo();
    if (elementInfo.getId() == null) {
      return false;
    }
    final ArrayList<String> breadcrumbs = new ArrayList<String>();
    if (elementInfo.isIndexed()) {
      breadcrumbs.add(elementInfo.getId());
      setParentForElement(ctx, elementInfo, breadcrumbs);
    } else {
      final String pageId = ctx.getRequestParameter("pageId");
      final String parentPageId = ctx.getRequestParameter("parentPageId");
      if (StringUtils.isNotBlank(pageId)) {
        computeParameter(ctx, breadcrumbs, pageId);
      } else if (StringUtils.isNotBlank(parentPageId)) {
        computeParameter(ctx, breadcrumbs, parentPageId);
      } else {
        breadcrumbs.add(ctx.getWikiWeb().getWikiConfig().getWelcomePageId());
      }
    }
    ctx.append("
");
    for (int i = breadcrumbs.size() - 1; i >= 0; i--) {
      ctx.append("
").append(ctx.renderLocalUrl(breadcrumbs.get(i))).append("
");
    }
    ctx.append("
");
    ctx.flush();
    return true;
  }

Output:
  public boolean renderImpl(final GWikiContext ctx, final MacroAttributes attrs)
  {
    if (RenderModes.NoToc.isSet(ctx.getRenderMode()) == true) {
      return true;
    }
    final GWikiElementInfo elementInfo = ctx.getCurrentElement().getElementInfo();
    if (elementInfo.getId() == null) {
      return false;
    }
    final ArrayList<String> breadcrumbs = new ArrayList<String>();
    if (elementInfo.isIndexed()) {
      breadcrumbs.add(elementInfo.getId());
      setParentForElement(ctx, elementInfo, breadcrumbs);
    } else {
      final String pageId = ctx.getRequestParameter("pageId");
      final String parentPageId = ctx.getRequestParameter("parentPageId");
      if (StringUtils.isNotBlank(pageId)
          && ctx.getWikiWeb().findElement(pageId) != null
          && ctx.getWikiWeb().findElement(pageId).getElementInfo().isIndexed()) {
        computeParameter(ctx, breadcrumbs, pageId);
      } else if (StringUtils.isNotBlank(parentPageId)
          && ctx.getWikiWeb().findElement(parentPageId) != null
          && ctx.getWikiWeb().findElement(parentPageId).getElementInfo().isIndexed()) {
        computeParameter(ctx, breadcrumbs, parentPageId);
      } else {
        breadcrumbs.add(ctx.getWikiWeb().getWikiConfig().getWelcomePageId());
      }
    }
    ctx.append("<ul>");
    for (int i = breadcrumbs.size() - 1; i >= 0; i--) {
      ctx.append("<li>").append(ctx.renderLocalUrl(breadcrumbs.get(i))).append("</li>");
    }
    ctx.append("</ul>");
    ctx.flush();
    return true;
  }


Input:
	public ActionForward search(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
	{
		ActionErrors errors = new ActionErrors();
		ActionMessages messages = new ActionMessages();
		HttpSession session = request.getSession();
		BaseDBForm baseDBForm = (BaseDBForm)form;
		if (session.isNew() || (session.getAttribute(DisplayConstants.LOGIN_OBJECT) == null)) {
			if (logDB.isDebugEnabled())
				logDB.debug("||"+baseDBForm.getFormName()+"|search|Failure|No Session or User Object Forwarding to the Login Page||");
			return mapping.findForward(ForwardConstants.LOGIN_PAGE);
		}
		UserInfoHelper.setUserInfo(((LoginForm)session.getAttribute(DisplayConstants.LOGIN_OBJECT)).getLoginId(), session.getId());
		try
		{
			SearchResult searchResult = baseDBForm.searchObjects(request,errors,messages);
			if ( searchResult.getSearchResultObjects() == null || searchResult.getSearchResultObjects().isEmpty())
			{
				errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(DisplayConstants.ERROR_ID, "The search criteria returned zero results"));
				saveErrors( request,errors );
				if (logDB.isDebugEnabled())
					logDB.debug(session.getId()+"|"+((LoginForm)session.getAttribute(DisplayConstants.LOGIN_OBJECT)).getLoginId()+
						"|"+baseDBForm.getFormName()+"|search|Failure|No Records found for "+baseDBForm.getFormName()+" object|"
						+form.toString()+"|");
				baseDBForm.resetForm();
				return (mapping.findForward(ForwardConstants.SEARCH_FAILURE));
			}
			if (searchResult.getSearchResultMessage() != null && !(searchResult.getSearchResultMessage().trim().equalsIgnoreCase("")))
			{
				messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(DisplayConstants.MESSAGE_ID, searchResult.getSearchResultMessage()));
				saveMessages( request, messages );
			}
			if(session.getAttribute(DisplayConstants.SEARCH_RESULT)!=null){
				session.setAttribute(DisplayConstants.ORIGINAL_SEARCH_RESULT, session.getAttribute(DisplayConstants.SEARCH_RESULT) );
			}
			session.setAttribute(DisplayConstants.SEARCH_RESULT, searchResult);
		}
		catch (CSException cse)
		{
			errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(DisplayConstants.ERROR_ID, cse.getMessage()));
			saveErrors( request,errors );
			if (logDB.isDebugEnabled())
				logDB.debug(session.getId()+"|"+((LoginForm)session.getAttribute(DisplayConstants.LOGIN_OBJECT)).getLoginId()+
					"|"+baseDBForm.getFormName()+"|search|Failure|Error Searching the "+baseDBForm.getFormName()+" object|"
					+form.toString()+"|"+ cse.getMessage());
		}
		session.setAttribute(DisplayConstants.CURRENT_FORM, baseDBForm);
		if (logDB.isDebugEnabled())
			logDB.debug(session.getId()+"|"+((LoginForm)session.getAttribute(DisplayConstants.LOGIN_OBJECT)).getLoginId()+
				"|"+baseDBForm.getFormName()+"|search|Success|Success in searching "+baseDBForm.getFormName()+" object|"
				+form.toString()+"|");
		return (mapping.findForward(ForwardConstants.SEARCH_SUCCESS));
	}

Output:
	public ActionForward search(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
	{
		ActionErrors errors = new ActionErrors();
		ActionMessages messages = new ActionMessages();
		HttpSession session = request.getSession();
		BaseDBForm baseDBForm = (BaseDBForm)form;
		if (session.isNew() || (session.getAttribute(DisplayConstants.LOGIN_OBJECT) == null)) {
			if (logDB.isDebugEnabled())
				logDB.debug("||"+baseDBForm.getFormName()+"|search|Failure|No Session or User Object Forwarding to the Login Page||");
			return mapping.findForward(ForwardConstants.LOGIN_PAGE);
		}
		UserInfoHelper.setUserInfo(((LoginForm)session.getAttribute(DisplayConstants.LOGIN_OBJECT)).getLoginId(), session.getId());
		try
		{
			SearchResult searchResult = baseDBForm.searchObjects(request,errors,messages);
			if ( searchResult.getSearchResultObjects() == null || searchResult.getSearchResultObjects().isEmpty())
			{
				errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(DisplayConstants.ERROR_ID, "The search criteria returned zero results"));
				saveErrors( request,errors );
				if (logDB.isDebugEnabled())
					logDB.debug(session.getId()+"|"+((LoginForm)session.getAttribute(DisplayConstants.LOGIN_OBJECT)).getLoginId()+
						"|"+baseDBForm.getFormName()+"|search|Failure|No Records found for "+baseDBForm.getFormName()+" object|"
						+form.toString()+"|");
				baseDBForm.resetForm();
				return (mapping.findForward(ForwardConstants.SEARCH_FAILURE));
			}
			if (searchResult.getSearchResultMessage() != null && !(searchResult.getSearchResultMessage().trim().equalsIgnoreCase("")))
			{
				messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(DisplayConstants.MESSAGE_ID, searchResult.getSearchResultMessage()));
				saveMessages( request, messages );
			}
			if(session.getAttribute(DisplayConstants.SEARCH_RESULT)!=null){
				if(session.getAttribute(DisplayConstants.ORIGINAL_SEARCH_RESULT)==null)
					session.setAttribute(DisplayConstants.ORIGINAL_SEARCH_RESULT, session.getAttribute(DisplayConstants.SEARCH_RESULT) );
			}
			session.setAttribute(DisplayConstants.SEARCH_RESULT, searchResult);
		}
		catch (CSException cse)
		{
			errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(DisplayConstants.ERROR_ID, cse.getMessage()));
			saveErrors( request,errors );
			if (logDB.isDebugEnabled())
				logDB.debug(session.getId()+"|"+((LoginForm)session.getAttribute(DisplayConstants.LOGIN_OBJECT)).getLoginId()+
					"|"+baseDBForm.getFormName()+"|search|Failure|Error Searching the "+baseDBForm.getFormName()+" object|"
					+form.toString()+"|"+ cse.getMessage());
		}
		session.setAttribute(DisplayConstants.CURRENT_FORM, baseDBForm);
		if (logDB.isDebugEnabled())
			logDB.debug(session.getId()+"|"+((LoginForm)session.getAttribute(DisplayConstants.LOGIN_OBJECT)).getLoginId()+
				"|"+baseDBForm.getFormName()+"|search|Success|Success in searching "+baseDBForm.getFormName()+" object|"
				+form.toString()+"|");
		return (mapping.findForward(ForwardConstants.SEARCH_SUCCESS));
	}


Input:
    public void startElement(String namespaceURI, String localName, String qName, Attributes attrs) throws SAXException {
        String eName = ("".equals(localName)) ? qName : localName;
        transformedXmlAsBuffer.append("<" + eName);
        if(eName.equals("Link")) {
            for(int i = 0; i < attrs.getLength(); i++) {
                String aName = attrs.getQName(i);
                String aValue = attrs.getValue(i);
                if(aName.equals("href")) {
                    if(aValue.startsWith("external_")) {
                        aValue = aValue.substring(9);
                    } else {
                        boolean externalLink = false;
                        for(int j=0; j<externalLinks.length; j++) {
                            if(aValue.startsWith(externalLinks[j])) {
                                externalLink = true;
                                break;
                            }
                        }
                        if(!externalLink && !resourceExists(aValue)) {
                            log.error("Resource : [" + aValue + "] does not exist");
                            transformedXmlAsBuffer.append(" exist=\"false\"");
                        }
                    }
                }
                transformedXmlAsBuffer.append(" " + aName + "=\"" + aValue + "\"");
            }
        } else {
            for(int i = 0; i < attrs.getLength(); i++) {
                String aName = attrs.getQName(i);
                String aValue = attrs.getValue(i);
                StringBuffer tmp = new StringBuffer();
                for(int j=0; j<aValue.length(); j++) {
                    if(aValue.charAt(j) == '"') tmp.append(""");
                    else tmp.append(aValue.charAt(j));
                }
                transformedXmlAsBuffer.append(" " + aName + "=\"" + tmp.toString() + "\"");
            }
        }
        transformedXmlAsBuffer.append(">");
    }

Output:
    public void startElement(String namespaceURI, String localName, String qName, Attributes attrs) throws SAXException {
        String eName = ("".equals(localName)) ? qName : localName;
        transformedXmlAsBuffer.append("<" + eName);
        if(eName.equals("Link")) {
            for(int i = 0; i < attrs.getLength(); i++) {
                String aName = attrs.getQName(i);
                String aValue = attrs.getValue(i);
                if(aName.equals("href")) {
                    if(aValue.startsWith("external_")) {
                        aValue = aValue.substring(9);
                    } else {
                        boolean externalLink = false;
                        for(int j=0; j<externalLinks.length; j++) {
                            if(aValue.startsWith(externalLinks[j])) {
                                externalLink = true;
                                break;
                            }
                        }
                        if(!externalLink && !resourceExists(aValue)) {
                            log.warn("Link : [" + aValue + "] does not exist");
                            transformedXmlAsBuffer.append(" exist=\"false\"");
                        }
                    }
                }
                transformedXmlAsBuffer.append(" " + aName + "=\"" + aValue + "\"");
            }
        } else {
            for(int i = 0; i < attrs.getLength(); i++) {
                String aName = attrs.getQName(i);
                String aValue = attrs.getValue(i);
                StringBuffer tmp = new StringBuffer();
                for(int j=0; j<aValue.length(); j++) {
                    if(aValue.charAt(j) == '"') tmp.append(""");
                    else tmp.append(aValue.charAt(j));
                }
                transformedXmlAsBuffer.append(" " + aName + "=\"" + tmp.toString() + "\"");
            }
        }
        transformedXmlAsBuffer.append(">");
    }


Input:
  protected void initFile(String id) throws FormatException, IOException {
    if (debug) debug("ND2Reader.initFile(" + id + ")");
    if (noJ2k) throw new FormatException(NO_J2K_MSG);
    super.initFile(id);
    in = new RandomAccessStream(id);
    if (in.read() == -38 && in.read() == -50) {
      isJPEG = false;
      in.seek(0);
      in.order(true);
      byte[] b = new byte[1024 * 1024];
      while (in.getFilePointer() < in.length()) {
        if (in.read() == -38 && in.read() == -50 && in.read() == -66 &&
          in.read() == 10)
        {
          int len = in.readInt() + in.readInt();
          if (len > b.length) {
            int size = b.length + b.length;
            if (size < len) size = len;
            b = new byte[size];
          }
          in.skipBytes(4);
          if (debug) {
            debug("Reading chunk of size " + len +
              " at position " + in.getFilePointer());
          }
          in.readFully(b, 0, len);
          if (len >= 12 && b[0] == 'I' && b[1] == 'm' && b[2] == 'a' &&
            b[3] == 'g' && b[4] == 'e' && b[5] == 'D' && b[6] == 'a' &&
            b[7] == 't' && b[8] == 'a' && b[9] == 'S' && b[10] == 'e' &&
            b[11] == 'q')
          {
            StringBuffer sb = new StringBuffer();
            int pt = 13;
            while (b[pt] != '!') {
              sb.append((char) b[pt]);
              pt++;
            }
            int ndx = Integer.parseInt(sb.toString());
            if (core.sizeC[0] == 0) {
              core.sizeC[0] = len / (core.sizeX[0] * core.sizeY[0] *
                FormatTools.getBytesPerPixel(core.pixelType[0]));
            }
            offsets[0][ndx] = in.getFilePointer() - len + sb.length() + 21;
            while (offsets[0][ndx] - in.getFilePointer() +
              len - 14 - sb.length() < 8)
            {
              offsets[0][ndx]++;
            }
          }
          else if (len >= 5 && b[0] == 'I' && b[1] == 'm' && b[2] == 'a' &&
            b[3] == 'g' && b[4] == 'e')
          {
            ND2Handler handler = new ND2Handler();
            int off = 0;
            for (int i=0; i<len; i++) {
              char c = (char) b[i];
              if (off == 0 && c == '!') off = i + 1;
              if (Character.isISOControl(c) || !Character.isDefined(c)) {
                b[i] = (byte) ' ';
              }
            }
            if (len - off >= 5 && b[off] == '<' && b[off + 1] == '?' &&
              b[off + 2] == 'x' && b[off + 3] == 'm' &&
              b[off + 4] == 'l')
            {
              ByteArrayInputStream s =
                new ByteArrayInputStream(b, off, len - off);
              try {
                SAXParser parser = SAX_FACTORY.newSAXParser();
                parser.parse(s, handler);
              }
              catch (ParserConfigurationException exc) {
                throw new FormatException(exc);
              }
              catch (SAXException exc) {
                throw new FormatException(exc);
              }
            }
          }
          if (core.imageCount[0] > 0 && offsets == null) {
            offsets = new long[1][core.imageCount[0]];
          }
          if (in.getFilePointer() < in.length() - 1) {
            if (in.read() != -38) in.skipBytes(15);
            else in.seek(in.getFilePointer() - 1);
          }
        }
      }
      if (core.sizeC[0] == 0) core.sizeC[0] = 1;
      core.currentOrder[0] = "XYCZT";
      core.rgb[0] = core.sizeC[0] > 1;
      if (core.sizeC[0] > 1 && adjustImageCount) {
        core.imageCount[0] /= 3;
        core.sizeT[0] /= 3;
      }
      core.littleEndian[0] = true;
      core.interleaved[0] = true;
      core.indexed[0] = false;
      core.falseColor[0] = false;
      core.metadataComplete[0] = true;
      MetadataStore store = getMetadataStore();
      store.setImage(currentId, null, null, null);
      FormatTools.populatePixels(store, this);
      for (int i=0; i<core.sizeC[0]; i++) {
        store.setLogicalChannel(i, null, null, null, null, null, null, null,
          null, null, null, null, null, null, null, null, null, null, null,
          null, null, null, null, null, null);
      }
      return;
    }
    else in.seek(0);
    isJPEG = true;
    status("Calculating image offsets");
    Vector vs = new Vector();
    long pos = in.getFilePointer();
    boolean lastBoxFound = false;
    int length = 0;
    int box = 0;
    while (!lastBoxFound) {
      pos = in.getFilePointer();
      length = in.readInt();
      if (pos + length >= in.length() || length == 0) lastBoxFound = true;
      box = in.readInt();
      pos = in.getFilePointer();
      length -= 8;
      if (box == 0x6a703263) {
        vs.add(new Long(in.getFilePointer()));
      }
      if (!lastBoxFound) in.seek(pos + length);
    }
    status("Finding XML metadata");
    in.seek(((Long) vs.get(vs.size() - 1)).longValue());
    boolean found = false;
    long off = -1;
    byte[] buf = new byte[2048];
    while (!found && in.getFilePointer() < in.length()) {
      int read = 0;
      if (in.getFilePointer() == ((Long) vs.get(vs.size() - 1)).longValue()) {
        read = in.read(buf);
      }
      else {
        System.arraycopy(buf, buf.length - 10, buf, 0, 10);
        read = in.read(buf, 10, buf.length - 10);
      }
      if (read == buf.length) read -= 10;
      for (int i=0; i<read+9; i++) {
        if (buf[i] == (byte) 0xff && buf[i+1] == (byte) 0xd9) {
          found = true;
          off = in.getFilePointer() - (read + 10) + i;
          i = buf.length;
          break;
        }
      }
    }
    buf = null;
    status("Parsing XML");
    if (off > 0 && off < in.length() - 5) {
      in.seek(off + 5);
      byte[] b = new byte[(int) (in.length() - off - 5)];
      in.readFully(b);
      String xml = new String(b);
      xml = xml.substring(0, xml.lastIndexOf("</MetadataSeq>") + 14);
      xml = xml.replaceAll("<!--*-->", "");
      StringTokenizer st = new StringTokenizer(xml, "\r\n");
      while (st.hasMoreTokens()) {
        String token = st.nextToken().trim();
        if (token.indexOf("<") != -1) {
          String prefix = token.substring(1, token.indexOf(">")).trim();
          token = token.substring(token.indexOf(">") + 1);
          while (token.indexOf("<") != -1) {
            int start = token.indexOf("<");
            String s = token.substring(start + 1, token.indexOf(">", start));
            token = token.substring(token.indexOf(">", start));
            if (s.indexOf(" ") != -1) {
              String pre = s.substring(0, s.indexOf(" ")).trim();
              s = s.substring(s.indexOf(" ") + 1);
              while (s.indexOf("=") != -1) {
                int eq = s.indexOf("=");
                String key = s.substring(0, eq).trim();
                String value =
                  s.substring(eq + 2, s.indexOf("\"", eq + 2)).trim();
                if (key.indexOf("runtype") == -1) {
                  if (prefix.startsWith("Metadata_V1.2")) {
                    prefix = "";
                  }
                  String effectiveKey = prefix + " " + pre + " " + key;
                  if (!metadata.containsKey(effectiveKey)) {
                    addMeta(effectiveKey, value);
                    if (effectiveKey.endsWith("dTimeMSec value")) {
                      long v = (long) Double.parseDouble(value);
                      if (!ts.contains(new Long(v))) {
                        ts.add(new Long(v));
                      }
                    }
                    else if (effectiveKey.endsWith("dZPos value")) {
                      long v = (long) Double.parseDouble(value);
                      if (!zs.contains(new Long(v))) {
                        zs.add(new Long(v));
                      }
                    }
                    else if (effectiveKey.endsWith("uiComp value")) {
                      if (core.sizeC[0] == 0) {
                        core.sizeC[0] = Integer.parseInt(value);
                      }
                    }
                    else if (effectiveKey.endsWith("uiCount value")) {
                      if (core.sizeT[0] == 0) {
                        core.sizeT[0] = Integer.parseInt(value);
                      }
                    }
                    else if (effectiveKey.endsWith("TextInfoItem Text")) {
                      value = value.replaceAll("
", "\n");
                      StringTokenizer tokens = new StringTokenizer(value, "\n");
                      while (tokens.hasMoreTokens()) {
                        String t = tokens.nextToken().trim();
                        if (t.startsWith("Dimensions:")) {
                          t = t.substring(11);
                          StringTokenizer dims = new StringTokenizer(t, " x ");
                          while (dims.hasMoreTokens()) {
                            String dim = dims.nextToken().trim();
                            int idx = dim.indexOf("(");
                            int v = Integer.parseInt(dim.substring(idx + 1,
                              dim.indexOf(")", idx)));
                            if (dim.startsWith("XY")) {
                              numSeries = v;
                              if (numSeries > 1) {
                                int x = core.sizeX[0];
                                int y = core.sizeY[0];
                                int z = core.sizeZ[0];
                                int tSize = core.sizeT[0];
                                int c = core.sizeC[0];
                                core = new CoreMetadata(numSeries);
                                Arrays.fill(core.sizeX, x);
                                Arrays.fill(core.sizeY, y);
                                Arrays.fill(core.sizeZ, z);
                                Arrays.fill(core.sizeC, c);
                                Arrays.fill(core.sizeT, tSize);
                              }
                            }
                            else if (dim.startsWith("T")) {
                              Arrays.fill(core.sizeT, v);
                            }
                            else if (dim.startsWith("Z")) {
                              Arrays.fill(core.sizeZ, v);
                            }
                            else {
                              Arrays.fill(core.sizeC, v);
                            }
                          }
                          if (core.sizeZ[0] == 0) Arrays.fill(core.sizeZ, 1);
                          if (core.sizeC[0] == 0) Arrays.fill(core.sizeC, 1);
                          if (core.sizeT[0] == 0) Arrays.fill(core.sizeT, 1);
                          int count =
                            core.sizeZ[0] * core.sizeC[0] * core.sizeT[0];
                          Arrays.fill(core.imageCount, count);
                          Arrays.fill(core.currentOrder, "XYCZT");
                        }
                      }
                    }
                  }
                  else {
                    String v = (String) getMeta(effectiveKey);
                    boolean parse = v != null;
                    if (parse) {
                      for (int i=0; i<v.length(); i++) {
                        if (Character.isLetter(v.charAt(i)) ||
                          Character.isWhitespace(v.charAt(i)))
                        {
                          parse = false;
                          break;
                        }
                      }
                    }
                    if (parse) {
                      addMeta(effectiveKey, value);
                    }
                  }
                }
                s = s.substring(s.indexOf("\"", eq + 2) + 1);
              }
            }
          }
        }
      }
      b = null;
      xml = null;
      st = null;
    }
    status("Populating metadata");
    if (core.imageCount[0] == 0) {
      core.sizeZ[0] = zs.size() == 0 ? 1 : zs.size();
      core.sizeT[0] = ts.size() == 0 ? 1 : ts.size();
      core.sizeC[0] = (vs.size() + 1) / (core.sizeT[0] * core.sizeZ[0]);
      core.imageCount[0] = vs.size();
      while (core.imageCount[0] % core.sizeC[0] != 0) core.imageCount[0]--;
      while (core.sizeC[0] * core.sizeZ[0] * core.sizeT[0] > core.imageCount[0])
      {
        if (core.sizeZ[0] < core.sizeT[0]) core.sizeT[0]--;
        else core.sizeZ[0]--;
      }
    }
    if (core.sizeC[0] * core.sizeZ[0] * core.sizeT[0] != core.imageCount[0]) {
      core.sizeZ[0] = zs.size();
      core.sizeT[0] = ts.size();
      core.imageCount[0] = core.sizeC[0] * core.sizeZ[0] * core.sizeT[0];
    }
    core.pixelType[0] = FormatTools.UINT8;
    offsets = new long[1][2];
    offsets[0][0] = ((Long) vs.get(0)).longValue();
    offsets[0][1] = ((Long) vs.get(1)).longValue();
    BufferedImage img = openImage(0);
    Arrays.fill(core.sizeX, img.getWidth());
    Arrays.fill(core.sizeY, img.getHeight());
    if (core.sizeC[0] == 0) core.sizeC[0] = 1;
    int c = img.getRaster().getNumBands() * core.sizeC[0];
    Arrays.fill(core.sizeC, c);
    Arrays.fill(core.rgb, img.getRaster().getNumBands() > 1);
    Arrays.fill(core.pixelType, ImageTools.getPixelType(img));
    if (vs.size() < core.imageCount[0]) {
      Arrays.fill(core.imageCount, vs.size());
    }
    if (numSeries == 0) numSeries = 1;
    offsets = new long[numSeries][core.imageCount[0]];
    for (int i=0; i<core.sizeZ[0]*core.sizeT[0]; i++) {
      for (int j=0; j<numSeries; j++) {
        for (int k=0; k<core.sizeC[0]; k++) {
          offsets[j][i*core.sizeC[0] + k] = ((Long) vs.remove(0)).longValue();
        }
      }
    }
    String pixX = (String)
      getMeta("CalibrationSeq _SEQUENCE_INDEX=\"0\" dCalibration value");
    String pixZ = (String)
      getMeta("CalibrationSeq _SEQUENCE_INDEX=\"0\" dAspect value");
    float pixSizeX = 0f;
    float pixSizeZ = 0f;
    if (pixX != null && pixX.length() > 0) {
      pixSizeX = Float.parseFloat(pixX.trim());
    }
    if (pixZ != null && pixZ.length() > 0) {
      pixSizeZ = Float.parseFloat(pixZ.trim());
    }
    Arrays.fill(core.interleaved, false);
    Arrays.fill(core.littleEndian, true);
    Arrays.fill(core.metadataComplete, true);
    MetadataStore store = getMetadataStore();
    FormatTools.populatePixels(store, this);
    for (int i=0; i<numSeries; i++) {
      Integer ii = new Integer(i);
      store.setImage(currentId, null, null, ii);
      store.setDimensions(new Float(pixSizeX), new Float(pixSizeX),
        new Float(pixSizeZ), null, null, ii);
      for (int j=0; j<core.sizeC[0]; j++) {
        store.setLogicalChannel(j, null, null, null, null, null, null, null,
          null, null, null, null, null, null, null, null, null, null, null,
          null, null, null, null, null, ii);
      }
    }
    String prefix = "MetadataSeq _SEQUENCE_INDEX=\"0\" ";
    String gain = (String) getMeta(prefix + "dGain value");
    String voltage = (String) getMeta(prefix + "dLampVoltage value");
    String mag = (String) getMeta(prefix + "dObjectiveMag value");
    String na = (String) getMeta(prefix + "dObjectiveNA value");
    store.setDetector(null, null, null, null,
      gain == null ? null : new Float(gain),
      voltage == null ? null : new Float(voltage), null, null, null);
    store.setObjective(null, null, null, na == null ? null : new Float(na),
      mag == null ? null : new Float(mag), null, null);
  }

Output:
  protected void initFile(String id) throws FormatException, IOException {
    if (debug) debug("ND2Reader.initFile(" + id + ")");
    if (noJ2k) throw new FormatException(NO_J2K_MSG);
    super.initFile(id);
    in = new RandomAccessStream(id);
    if (in.read() == -38 && in.read() == -50) {
      isJPEG = false;
      in.seek(0);
      in.order(true);
      byte[] b = new byte[1024 * 1024];
      while (in.getFilePointer() < in.length()) {
        if (in.read() == -38 && in.read() == -50 && in.read() == -66 &&
          in.read() == 10)
        {
          int len = in.readInt() + in.readInt();
          if (len > b.length) {
            int size = b.length + b.length;
            if (size < len) size = len;
            b = new byte[size];
          }
          in.skipBytes(4);
          if (debug) {
            debug("Reading chunk of size " + len +
              " at position " + in.getFilePointer());
          }
          in.readFully(b, 0, len);
          if (len >= 12 && b[0] == 'I' && b[1] == 'm' && b[2] == 'a' &&
            b[3] == 'g' && b[4] == 'e' && b[5] == 'D' && b[6] == 'a' &&
            b[7] == 't' && b[8] == 'a' && b[9] == 'S' && b[10] == 'e' &&
            b[11] == 'q')
          {
            StringBuffer sb = new StringBuffer();
            int pt = 13;
            while (b[pt] != '!') {
              sb.append((char) b[pt]);
              pt++;
            }
            int ndx = Integer.parseInt(sb.toString());
            if (core.sizeC[0] == 0) {
              core.sizeC[0] = len / (core.sizeX[0] * core.sizeY[0] *
                FormatTools.getBytesPerPixel(core.pixelType[0]));
            }
            offsets[0][ndx] = in.getFilePointer() - len + sb.length() + 21;
            while (offsets[0][ndx] - in.getFilePointer() +
              len - 14 - sb.length() < 8)
            {
              offsets[0][ndx]++;
            }
          }
          else if (len >= 5 && b[0] == 'I' && b[1] == 'm' && b[2] == 'a' &&
            b[3] == 'g' && b[4] == 'e')
          {
            ND2Handler handler = new ND2Handler();
            int off = 0;
            for (int i=0; i<len; i++) {
              char c = (char) b[i];
              if (off == 0 && c == '!') off = i + 1;
              if (Character.isISOControl(c) || !Character.isDefined(c)) {
                b[i] = (byte) ' ';
              }
            }
            if (len - off >= 5 && b[off] == '<' && b[off + 1] == '?' &&
              b[off + 2] == 'x' && b[off + 3] == 'm' &&
              b[off + 4] == 'l')
            {
              ByteArrayInputStream s =
                new ByteArrayInputStream(b, off, len - off);
              try {
                SAXParser parser = SAX_FACTORY.newSAXParser();
                parser.parse(s, handler);
              }
              catch (ParserConfigurationException exc) {
                throw new FormatException(exc);
              }
              catch (SAXException exc) {
                throw new FormatException(exc);
              }
            }
          }
          if (core.imageCount[0] > 0 && offsets == null) {
            offsets = new long[1][core.imageCount[0]];
          }
          if (in.getFilePointer() < in.length() - 1) {
            if (in.read() != -38) in.skipBytes(15);
            else in.seek(in.getFilePointer() - 1);
          }
        }
      }
      if (core.sizeC[0] == 0) core.sizeC[0] = 1;
      core.currentOrder[0] = "XYCZT";
      core.rgb[0] = core.sizeC[0] > 1;
      if (core.sizeC[0] > 1 && adjustImageCount) {
        core.imageCount[0] /= 3;
        core.sizeT[0] /= 3;
      }
      core.littleEndian[0] = true;
      core.interleaved[0] = true;
      core.indexed[0] = false;
      core.falseColor[0] = false;
      core.metadataComplete[0] = true;
      MetadataStore store = getMetadataStore();
      store.setImage(currentId, null, null, null);
      FormatTools.populatePixels(store, this);
      for (int i=0; i<core.sizeC[0]; i++) {
        store.setLogicalChannel(i, null, null, null, null, null, null, null,
          null, null, null, null, null, null, null, null, null, null, null,
          null, null, null, null, null, null);
      }
      return;
    }
    else in.seek(0);
    isJPEG = true;
    status("Calculating image offsets");
    Vector vs = new Vector();
    long pos = in.getFilePointer();
    boolean lastBoxFound = false;
    int length = 0;
    int box = 0;
    while (!lastBoxFound) {
      pos = in.getFilePointer();
      length = in.readInt();
      if (pos + length >= in.length() || length == 0) lastBoxFound = true;
      box = in.readInt();
      pos = in.getFilePointer();
      length -= 8;
      if (box == 0x6a703263) {
        vs.add(new Long(in.getFilePointer()));
      }
      if (!lastBoxFound) in.seek(pos + length);
    }
    status("Finding XML metadata");
    in.seek(((Long) vs.get(vs.size() - 1)).longValue());
    boolean found = false;
    long off = -1;
    byte[] buf = new byte[2048];
    while (!found && in.getFilePointer() < in.length()) {
      int read = 0;
      if (in.getFilePointer() == ((Long) vs.get(vs.size() - 1)).longValue()) {
        read = in.read(buf);
      }
      else {
        System.arraycopy(buf, buf.length - 10, buf, 0, 10);
        read = in.read(buf, 10, buf.length - 10);
      }
      if (read == buf.length) read -= 10;
      for (int i=0; i<read+9; i++) {
        if (buf[i] == (byte) 0xff && buf[i+1] == (byte) 0xd9) {
          found = true;
          off = in.getFilePointer() - (read + 10) + i;
          i = buf.length;
          break;
        }
      }
    }
    buf = null;
    status("Parsing XML");
    if (off > 0 && off < in.length() - 5) {
      in.seek(off + 5);
      byte[] b = new byte[(int) (in.length() - off - 5)];
      in.readFully(b);
      String xml = new String(b);
      xml = xml.substring(0, xml.lastIndexOf("</MetadataSeq>") + 14);
      xml = xml.replaceAll("<!--*-->", "");
      StringTokenizer st = new StringTokenizer(xml, "\r\n");
      while (st.hasMoreTokens()) {
        String token = st.nextToken().trim();
        if (token.indexOf("<") != -1) {
          String prefix = token.substring(1, token.indexOf(">")).trim();
          token = token.substring(token.indexOf(">") + 1);
          while (token.indexOf("<") != -1) {
            int start = token.indexOf("<");
            String s = token.substring(start + 1, token.indexOf(">", start));
            token = token.substring(token.indexOf(">", start));
            if (s.indexOf(" ") != -1) {
              String pre = s.substring(0, s.indexOf(" ")).trim();
              s = s.substring(s.indexOf(" ") + 1);
              while (s.indexOf("=") != -1) {
                int eq = s.indexOf("=");
                String key = s.substring(0, eq).trim();
                String value =
                  s.substring(eq + 2, s.indexOf("\"", eq + 2)).trim();
                if (key.indexOf("runtype") == -1) {
                  if (prefix.startsWith("Metadata_V1.2")) {
                    prefix = "";
                  }
                  String effectiveKey = prefix + " " + pre + " " + key;
                  if (!metadata.containsKey(effectiveKey)) {
                    addMeta(effectiveKey, value);
                    if (effectiveKey.endsWith("dTimeMSec value")) {
                      long v = (long) Double.parseDouble(value);
                      if (!ts.contains(new Long(v))) {
                        ts.add(new Long(v));
                      }
                    }
                    else if (effectiveKey.endsWith("dZPos value")) {
                      long v = (long) Double.parseDouble(value);
                      if (!zs.contains(new Long(v))) {
                        zs.add(new Long(v));
                      }
                    }
                    else if (effectiveKey.endsWith("uiComp value")) {
                      if (core.sizeC[0] == 0) {
                        core.sizeC[0] = Integer.parseInt(value);
                      }
                    }
                    else if (effectiveKey.endsWith("uiCount value")) {
                      if (core.sizeT[0] == 0) {
                        core.sizeT[0] = Integer.parseInt(value);
                      }
                    }
                    else if (effectiveKey.endsWith("TextInfoItem Text")) {
                      value = value.replaceAll("
", "\n");
                      StringTokenizer tokens = new StringTokenizer(value, "\n");
                      while (tokens.hasMoreTokens()) {
                        String t = tokens.nextToken().trim();
                        if (t.startsWith("Dimensions:")) {
                          t = t.substring(11);
                          StringTokenizer dims = new StringTokenizer(t, " x ");
                          while (dims.hasMoreTokens()) {
                            String dim = dims.nextToken().trim();
                            int idx = dim.indexOf("(");
                            int v = Integer.parseInt(dim.substring(idx + 1,
                              dim.indexOf(")", idx)));
                            if (dim.startsWith("XY")) {
                              numSeries = v;
                              if (numSeries > 1) {
                                int x = core.sizeX[0];
                                int y = core.sizeY[0];
                                int z = core.sizeZ[0];
                                int tSize = core.sizeT[0];
                                int c = core.sizeC[0];
                                core = new CoreMetadata(numSeries);
                                Arrays.fill(core.sizeX, x);
                                Arrays.fill(core.sizeY, y);
                                Arrays.fill(core.sizeZ, z);
                                Arrays.fill(core.sizeC, c);
                                Arrays.fill(core.sizeT, tSize);
                              }
                            }
                            else if (dim.startsWith("T")) {
                              Arrays.fill(core.sizeT, v);
                            }
                            else if (dim.startsWith("Z")) {
                              Arrays.fill(core.sizeZ, v);
                            }
                            else {
                              Arrays.fill(core.sizeC, v);
                            }
                          }
                          if (core.sizeZ[0] == 0) Arrays.fill(core.sizeZ, 1);
                          if (core.sizeC[0] == 0) Arrays.fill(core.sizeC, 1);
                          if (core.sizeT[0] == 0) Arrays.fill(core.sizeT, 1);
                          int count =
                            core.sizeZ[0] * core.sizeC[0] * core.sizeT[0];
                          Arrays.fill(core.imageCount, count);
                          Arrays.fill(core.currentOrder, "XYCZT");
                        }
                      }
                    }
                  }
                  else {
                    String v = (String) getMeta(effectiveKey);
                    boolean parse = v != null;
                    if (parse) {
                      for (int i=0; i<v.length(); i++) {
                        if (Character.isLetter(v.charAt(i)) ||
                          Character.isWhitespace(v.charAt(i)))
                        {
                          parse = false;
                          break;
                        }
                      }
                    }
                    if (parse) {
                      addMeta(effectiveKey, value);
                    }
                  }
                }
                s = s.substring(s.indexOf("\"", eq + 2) + 1);
              }
            }
          }
        }
      }
      b = null;
      xml = null;
      st = null;
    }
    status("Populating metadata");
    if (core.imageCount[0] == 0) {
      core.sizeZ[0] = zs.size() == 0 ? 1 : zs.size();
      core.sizeT[0] = ts.size() == 0 ? 1 : ts.size();
      core.sizeC[0] = (vs.size() + 1) / (core.sizeT[0] * core.sizeZ[0]);
      core.imageCount[0] = vs.size();
      while (core.imageCount[0] % core.sizeC[0] != 0) core.imageCount[0]--;
      while (core.sizeC[0] * core.sizeZ[0] * core.sizeT[0] > core.imageCount[0])
      {
        if (core.sizeZ[0] < core.sizeT[0]) core.sizeT[0]--;
        else core.sizeZ[0]--;
      }
    }
    if (core.sizeC[0] * core.sizeZ[0] * core.sizeT[0] != core.imageCount[0]) {
      core.sizeZ[0] = zs.size();
      core.sizeT[0] = ts.size();
      core.imageCount[0] = core.sizeC[0] * core.sizeZ[0] * core.sizeT[0];
    }
    core.pixelType[0] = FormatTools.UINT8;
    offsets = new long[1][2];
    offsets[0][0] = ((Long) vs.get(0)).longValue();
    offsets[0][1] = ((Long) vs.get(1)).longValue();
    BufferedImage img = openImage(0);
    Arrays.fill(core.sizeX, img.getWidth());
    Arrays.fill(core.sizeY, img.getHeight());
    if (core.sizeC[0] == 0) core.sizeC[0] = 1;
    int c = img.getRaster().getNumBands() * core.sizeC[0];
    Arrays.fill(core.sizeC, c);
    Arrays.fill(core.rgb, img.getRaster().getNumBands() > 1);
    Arrays.fill(core.pixelType, ImageTools.getPixelType(img));
    if (vs.size() < core.imageCount[0]) {
      Arrays.fill(core.imageCount, vs.size());
    }
    if (numSeries == 0) numSeries = 1;
    offsets = new long[numSeries][core.imageCount[0]];
    for (int i=0; i<core.sizeZ[0]*core.sizeT[0]; i++) {
      for (int j=0; j<numSeries; j++) {
        for (int k=0; k<core.sizeC[0]; k++) {
          offsets[j][i*core.sizeC[0] + k] = ((Long) vs.remove(0)).longValue();
        }
      }
    }
    String pixX = (String)
      getMeta("CalibrationSeq _SEQUENCE_INDEX=\"0\" dCalibration value");
    String pixZ = (String)
      getMeta("CalibrationSeq _SEQUENCE_INDEX=\"0\" dAspect value");
    float pixSizeX = 0f;
    float pixSizeZ = 0f;
    if (pixX != null && pixX.length() > 0) {
      pixSizeX = Float.parseFloat(pixX.trim());
    }
    if (pixZ != null && pixZ.length() > 0) {
      pixSizeZ = Float.parseFloat(pixZ.trim());
    }
    Arrays.fill(core.interleaved, false);
    Arrays.fill(core.littleEndian, false);
    Arrays.fill(core.metadataComplete, true);
    MetadataStore store = getMetadataStore();
    FormatTools.populatePixels(store, this);
    for (int i=0; i<numSeries; i++) {
      Integer ii = new Integer(i);
      store.setImage(currentId, null, null, ii);
      store.setDimensions(new Float(pixSizeX), new Float(pixSizeX),
        new Float(pixSizeZ), null, null, ii);
      for (int j=0; j<core.sizeC[0]; j++) {
        store.setLogicalChannel(j, null, null, null, null, null, null, null,
          null, null, null, null, null, null, null, null, null, null, null,
          null, null, null, null, null, ii);
      }
    }
    String prefix = "MetadataSeq _SEQUENCE_INDEX=\"0\" ";
    String gain = (String) getMeta(prefix + "dGain value");
    String voltage = (String) getMeta(prefix + "dLampVoltage value");
    String mag = (String) getMeta(prefix + "dObjectiveMag value");
    String na = (String) getMeta(prefix + "dObjectiveNA value");
    store.setDetector(null, null, null, null,
      gain == null ? null : new Float(gain),
      voltage == null ? null : new Float(voltage), null, null, null);
    store.setObjective(null, null, null, na == null ? null : new Float(na),
      mag == null ? null : new Float(mag), null, null);
  }


Input:
    public void done(IJobChangeEvent event) {
      IStatus result = event.getResult();
      if(result.getSeverity() == IStatus.CANCEL) {
        return;
      } else if(!result.isOK()) {
        return;
      }
      if(projects.isEmpty()) {
        log.info("No Maven projects to import");
        if(collectedLocations.size()==1) {
          final String location = collectedLocations.get(0);
          DirectoryScanner projectScanner = new DirectoryScanner();
          projectScanner.setBasedir(location);
          projectScanner.setIncludes(new String[] {"**/.project"});
          projectScanner.scan();
          String[] projectFiles = projectScanner.getIncludedFiles();
          if(projectFiles!=null && projectFiles.length>0) {
            PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
              public void run() {
                boolean res = MessageDialog.openConfirm(PlatformUI.getWorkbench().getDisplay().getActiveShell(),
                    Messages.MavenProjectCheckoutJob_confirm_title,
                    Messages.MavenProjectCheckoutJob_confirm_message);
                if(res) {
                  IWizard wizard = new ExternalProjectImportWizard(collectedLocations.get(0));
                  WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(),
                      wizard);
                  dialog.open();
                } else {
                  cleanup(collectedLocations);
                }
              }
            });
            return;
          }
          PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
            public void run() {
              boolean res = MessageDialog.openConfirm(PlatformUI.getWorkbench().getDisplay().getActiveShell(),
                  Messages.MavenProjectCheckoutJob_confirm2_title,
                  Messages.MavenProjectCheckoutJob_confirm2_message);
              if(res) {
                Clipboard clipboard = new Clipboard(PlatformUI.getWorkbench().getDisplay());
                clipboard.setContents(new Object[] { location }, new Transfer[] { TextTransfer.getInstance() });
                NewProjectAction newProjectAction = new NewProjectAction(PlatformUI.getWorkbench().getActiveWorkbenchWindow());
                newProjectAction.run();
              } else {
                cleanup(collectedLocations);
              }
            }
          });
          return;
        }
        cleanup(collectedLocations);
      }
      if(checkoutAllProjects) {
        if(M2EUIPluginActivator.getDefault().getMavenDiscovery() != null) {
          final LifecycleMappingConfiguration mappingConfiguration = LifecycleMappingConfiguration.calculate(projects,
              configuration, new NullProgressMonitor());
          if(!mappingConfiguration.isMappingComplete()) {
            PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
              public void run() {
                MavenImportWizard wizard = new MavenImportWizard(configuration, collectedLocations,
                    mappingConfiguration);
                WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), wizard);
                int res = dialog.open();
                if(res == Window.CANCEL) {
                  cleanup(collectedLocations);
                }
              }
            });
            return;
          }
        }
        WorkspaceJob job = new AbstactCreateMavenProjectJob(Messages.MavenProjectCheckoutJob_job, workingSets) {
          @Override
          protected List<IProject> doCreateMavenProjects(IProgressMonitor monitor) throws CoreException {
            Set<MavenProjectInfo> projectSet = MavenPlugin.getProjectConfigurationManager().collectProjects(projects);
            List<IMavenProjectImportResult> results = MavenPlugin.getProjectConfigurationManager().importProjects(
                projectSet, configuration, monitor);
            return toProjects(results);
          }
        };
        ISchedulingRule rule = ResourcesPlugin.getWorkspace().getRuleFactory()
            .modifyRule(ResourcesPlugin.getWorkspace().getRoot());
        job.setRule(rule);
        job.schedule();
      } else {
        PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
          public void run() {
            MavenImportWizard wizard = new MavenImportWizard(configuration, collectedLocations);
            WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), wizard);
            int res = dialog.open();
            if(res == Window.CANCEL) {
              cleanup(collectedLocations);
            }
          }
        });
      }
    }

Output:
    public void done(IJobChangeEvent event) {
      IStatus result = event.getResult();
      if(result.getSeverity() == IStatus.CANCEL) {
        return;
      } else if(!result.isOK()) {
        return;
      }
      if(projects.isEmpty()) {
        log.info("No Maven projects to import");
        if(collectedLocations.size()==1) {
          final String location = collectedLocations.get(0);
          DirectoryScanner projectScanner = new DirectoryScanner();
          projectScanner.setBasedir(location);
          projectScanner.setIncludes(new String[] {"**/.project"});
          projectScanner.scan();
          String[] projectFiles = projectScanner.getIncludedFiles();
          if(projectFiles!=null && projectFiles.length>0) {
            PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
              public void run() {
                boolean res = MessageDialog.openConfirm(PlatformUI.getWorkbench().getDisplay().getActiveShell(),
                    Messages.MavenProjectCheckoutJob_confirm_title,
                    Messages.MavenProjectCheckoutJob_confirm_message);
                if(res) {
                  IWizard wizard = new ExternalProjectImportWizard(collectedLocations.get(0));
                  WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(),
                      wizard);
                  dialog.open();
                } else {
                  cleanup(collectedLocations);
                }
              }
            });
            return;
          }
          PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
            public void run() {
              boolean res = MessageDialog.openConfirm(PlatformUI.getWorkbench().getDisplay().getActiveShell(),
                  Messages.MavenProjectCheckoutJob_confirm2_title,
                  Messages.MavenProjectCheckoutJob_confirm2_message);
              if(res) {
                Clipboard clipboard = new Clipboard(PlatformUI.getWorkbench().getDisplay());
                clipboard.setContents(new Object[] { location }, new Transfer[] { TextTransfer.getInstance() });
                NewProjectAction newProjectAction = new NewProjectAction(PlatformUI.getWorkbench().getActiveWorkbenchWindow());
                newProjectAction.run();
              } else {
                cleanup(collectedLocations);
              }
            }
          });
          return;
        }
        cleanup(collectedLocations);
      }
      if(checkoutAllProjects) {
        if(M2EUIPluginActivator.getDefault().getMavenDiscovery() != null) {
          final LifecycleMappingConfiguration mappingConfiguration = LifecycleMappingConfiguration.calculate(projects,
              configuration, new NullProgressMonitor());
          if(!mappingConfiguration.isMappingComplete(true)) {
            PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
              public void run() {
                MavenImportWizard wizard = new MavenImportWizard(configuration, collectedLocations,
                    mappingConfiguration);
                WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), wizard);
                int res = dialog.open();
                if(res == Window.CANCEL) {
                  cleanup(collectedLocations);
                }
              }
            });
            return;
          }
        }
        WorkspaceJob job = new AbstactCreateMavenProjectJob(Messages.MavenProjectCheckoutJob_job, workingSets) {
          @Override
          protected List<IProject> doCreateMavenProjects(IProgressMonitor monitor) throws CoreException {
            Set<MavenProjectInfo> projectSet = MavenPlugin.getProjectConfigurationManager().collectProjects(projects);
            List<IMavenProjectImportResult> results = MavenPlugin.getProjectConfigurationManager().importProjects(
                projectSet, configuration, monitor);
            return toProjects(results);
          }
        };
        ISchedulingRule rule = ResourcesPlugin.getWorkspace().getRuleFactory()
            .modifyRule(ResourcesPlugin.getWorkspace().getRoot());
        job.setRule(rule);
        job.schedule();
      } else {
        PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
          public void run() {
            MavenImportWizard wizard = new MavenImportWizard(configuration, collectedLocations);
            WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), wizard);
            int res = dialog.open();
            if(res == Window.CANCEL) {
              cleanup(collectedLocations);
            }
          }
        });
      }
    }


Input:
	public void onBlockBreak(BlockBreakEvent e)
	{
		if (plugin.debug == true)
		{
			plugin.log.info("BLOCK_BREAK_EVENT: playerName="+e.getPlayer().getName()+",typeID="+e.getBlock().getTypeId());
		}
		plugin.logger.LogBlockBreak(e, e.getBlock().getTypeId());
		long timeStart = System.nanoTime();
		Player p = e.getPlayer();
		if (plugin.arena.IsArena(p.getLocation()))
		{
			if (GameMasterHandler.IsAtleastRank(p.getName(), Rank.BUILDER))
			{
				return;
			}
			p.sendMessage(ChatColor.BLUE+"[ARENA]: "+ChatColor.WHITE+"V arene nemuzes kopat!");
			e.setCancelled(true);
			return;
		}
		if(plugin.EventWorld.IsEventWorld(p.getLocation())&& GugaEventWorld.regionStatus())
		{
			if (GameMasterHandler.IsAtleastRank(p.getName(), Rank.EVENTER))
			{
				return;
			}
			p.sendMessage(ChatColor.BLUE+"[EVENTWORLD]: "+ChatColor.WHITE+"V EventWorldu nemuzes kopat!");
			e.setCancelled(true);
			return;
		}
		if (!GugaRegionHandler.CanInteract(p, e.getBlock().getX(), e.getBlock().getZ()))
		{
			if (!GameMasterHandler.IsAtleastRank(p.getName(), Rank.BUILDER))
			{
				e.setCancelled(true);
				GugaRegion region = GugaRegionHandler.GetRegionByCoords(e.getBlock().getX(), e.getBlock().getZ());
				p.sendMessage(ChatColor.BLUE+"[REGIONS]: "+"Tady nemuzes kopat! Nazev pozemku: " + region.GetName());
				return;
			}
		}
		if (!plugin.acc.UserIsLogged(p) && plugin.config.accountsModule)
		{
			e.setCancelled(true);
			p.sendMessage("******************************");
			if (plugin.acc.UserIsRegistered(p))
			{
				p.sendMessage("NEJSTE PRIHLASEN! Prihlaste se pomoci /login heslo");
			}
			else
			{
				p.sendMessage("NEJSTE ZAREGISTROVAN! Prosim zaregistrujte se /register heslo");
			}
			p.sendMessage("******************************");
			return;
		}
		GugaProfession prof = plugin.professions.get(p.getName());
		boolean canBreak = false;
		Block targetBlock;
		targetBlock = e.getBlock();
		if (prof == null)
		{
			int i = 0;
			while (i < allowedBlocksTier1.length)
			{
				if (e.getBlock().getTypeId() == allowedBlocksTier1[i])
				{
					canBreak = true;
					break;
				}
				i++;
			}
			if (canBreak)
			{
				Block blockAbove = targetBlock.getRelative(BlockFace.UP);
				if (blockAbove.getTypeId() == 55)
				{
					canBreak = false;
				}
			}
			if (GameMasterHandler.IsAtleastGM(p.getName()))
			{
				if(plugin.acc.UserIsLogged(p))
				{
					canBreak = true;
				}
			}
			if (!canBreak)
			{
				p.sendMessage(ChatColor.BLUE+"[RPG]: "+ChatColor.WHITE+"Musite byt alespon level 5, aby jste mohl kopat tento druh bloku!");
				e.setCancelled(true);
				return;
			}
		}
		else
		{
			int level = prof.GetLevel();
			if (level < 5)
			{
				int i = 0;
				while (i < allowedBlocksTier1.length)
				{
					if (e.getBlock().getTypeId() == allowedBlocksTier1[i])
					{
						canBreak = true;
						break;
					}
					i++;
				}
				if (canBreak)
				{
					Block blockAbove = targetBlock.getRelative(BlockFace.UP);
					if (blockAbove.getTypeId() == 55)
					{
						canBreak = false;
					}
				}
				if (GameMasterHandler.IsAtleastGM(p.getName()))
				{
					if(plugin.acc.UserIsLogged(p))
					{
						canBreak = true;
					}
				}
				if (!canBreak)
				{
					p.sendMessage(ChatColor.BLUE+"[RPG]: "+ChatColor.WHITE+"Musite byt alespon level 5, aby jste mohl kopat tento druh bloku!");
					e.setCancelled(true);
					return;
				}
			}
		}
		String chestOwner;
		int blockType = targetBlock.getTypeId();
		if (blockType == ID_CHEST)
		{
			chestOwner = plugin.chests.GetBlockOwner(targetBlock);
			if(chestOwner.matches("notFound"))
			{
			}
			else
			{
				e.setCancelled(true);
				if (chestOwner.matches(p.getName()))
				{
					p.sendMessage(ChatColor.BLUE+"[LOCKER]:"+ChatColor.WHITE+" Nemuzete rozbit zamcenou truhlu! Nejdrive ji odemknete.");
				}
				else
				{
					p.sendMessage(ChatColor.BLUE+"[LOCKER]:"+ChatColor.WHITE+" Nemuzete rozbit zamcenou truhlu! " + chestOwner + " je vlastnikem teto truhly.");
				}
			}
		}
		else if(blockType==ID_DISPENSER)
		{
			chestOwner = plugin.dispensers.GetBlockOwner(targetBlock);
			if(chestOwner.matches("notFound"))
			{
			}
			else
			{
				e.setCancelled(true);
				if (chestOwner.matches(p.getName()))
				{
					p.sendMessage(ChatColor.BLUE+"[LOCKER]:"+ChatColor.WHITE+" Nemuzete rozbit zamceny davkovac! Nejdrive jej odemknete.");
				}
				else
				{
					p.sendMessage(ChatColor.BLUE+"[LOCKER]:"+ChatColor.WHITE+" Nemuzete rozbit zamceny davkovac! " + chestOwner + " je vlastnikem tohoto davkovace.");
				}
			}
		}
		else if(blockType==ID_FURNANCE || blockType==ID_FURNANCE_BURNING)
		{
			chestOwner = plugin.furnances.GetBlockOwner(targetBlock);
			if(chestOwner.matches("notFound"))
			{
			}
			else
			{
				e.setCancelled(true);
				if (chestOwner.matches(p.getName()))
				{
					p.sendMessage(ChatColor.BLUE+"[LOCKER]:"+ChatColor.WHITE+" Nemuzete rozbit zamcenou pec! Nejdrive ji odemknete.");
				}
				else
				{
					p.sendMessage(ChatColor.BLUE+"[LOCKER]:"+ChatColor.WHITE+" Nemuzete rozbit zamcenou pec! " + chestOwner + " je vlastnikem teto pece.");
					}
				}
			}
			int typeId = targetBlock.getTypeId();
			if (!IsInstaBreakBlock(typeId))
			{
				prof.GainExperience(3);
			}
			if (typeId == 1)
			{
				GugaBonusDrop bonus = prof.CobbleStoneDrop();
				if (bonus == GugaBonusDrop.DIAMOND)
				{
					p.getWorld().dropItem(targetBlock.getLocation(), new ItemStack(264,1));
					prof.GainExperience(50);
					p.sendMessage(ChatColor.BLUE+"[RPG]: "+ChatColor.WHITE+"Nasel jste diamant!");
				}
				else if (bonus == GugaBonusDrop.GOLD)
				{
					p.getWorld().dropItem(targetBlock.getLocation(), new ItemStack(14,1));
					prof.GainExperience(40);
					p.sendMessage(ChatColor.BLUE+"[RPG]: "+ChatColor.WHITE+"Nasel jste zlato!");
				}
				else if (bonus == GugaBonusDrop.IRON)
				{
					p.getWorld().dropItem(targetBlock.getLocation(), new ItemStack(15,1));
					prof.GainExperience(30);
					p.sendMessage(ChatColor.BLUE+"[RPG]: "+ChatColor.WHITE+"Nasel jste zelezo!");
				}
			}

Output:
	public void onBlockBreak(BlockBreakEvent e)
	{
		if (plugin.debug == true)
		{
			plugin.log.info("BLOCK_BREAK_EVENT: playerName="+e.getPlayer().getName()+",typeID="+e.getBlock().getTypeId());
		}
		if(e.getPlayer().getItemInHand().getTypeId() == 271)
		{
			e.setCancelled(true);
			return;
		}
		plugin.logger.LogBlockBreak(e, e.getBlock().getTypeId());
		long timeStart = System.nanoTime();
		Player p = e.getPlayer();
		if (plugin.arena.IsArena(p.getLocation()))
		{
			if (GameMasterHandler.IsAtleastRank(p.getName(), Rank.BUILDER))
			{
				return;
			}
			p.sendMessage(ChatColor.BLUE+"[ARENA]: "+ChatColor.WHITE+"V arene nemuzes kopat!");
			e.setCancelled(true);
			return;
		}
		if(plugin.EventWorld.IsEventWorld(p.getLocation())&& GugaEventWorld.regionStatus())
		{
			if (GameMasterHandler.IsAtleastRank(p.getName(), Rank.EVENTER))
			{
				return;
			}
			p.sendMessage(ChatColor.BLUE+"[EVENTWORLD]: "+ChatColor.WHITE+"V EventWorldu nemuzes kopat!");
			e.setCancelled(true);
			return;
		}
		if (!GugaRegionHandler.CanInteract(p, e.getBlock().getX(), e.getBlock().getZ()))
		{
			if (!GameMasterHandler.IsAtleastRank(p.getName(), Rank.BUILDER))
			{
				e.setCancelled(true);
				GugaRegion region = GugaRegionHandler.GetRegionByCoords(e.getBlock().getX(), e.getBlock().getZ());
				p.sendMessage(ChatColor.BLUE+"[REGIONS]: "+"Tady nemuzes kopat! Nazev pozemku: " + region.GetName());
				return;
			}
		}
		if (!plugin.acc.UserIsLogged(p) && plugin.config.accountsModule)
		{
			e.setCancelled(true);
			p.sendMessage("******************************");
			if (plugin.acc.UserIsRegistered(p))
			{
				p.sendMessage("NEJSTE PRIHLASEN! Prihlaste se pomoci /login heslo");
			}
			else
			{
				p.sendMessage("NEJSTE ZAREGISTROVAN! Prosim zaregistrujte se /register heslo");
			}
			p.sendMessage("******************************");
			return;
		}
		GugaProfession prof = plugin.professions.get(p.getName());
		boolean canBreak = false;
		Block targetBlock;
		targetBlock = e.getBlock();
		if (prof == null)
		{
			int i = 0;
			while (i < allowedBlocksTier1.length)
			{
				if (e.getBlock().getTypeId() == allowedBlocksTier1[i])
				{
					canBreak = true;
					break;
				}
				i++;
			}
			if (canBreak)
			{
				Block blockAbove = targetBlock.getRelative(BlockFace.UP);
				if (blockAbove.getTypeId() == 55)
				{
					canBreak = false;
				}
			}
			if (GameMasterHandler.IsAtleastGM(p.getName()))
			{
				if(plugin.acc.UserIsLogged(p))
				{
					canBreak = true;
				}
			}
			if (!canBreak)
			{
				p.sendMessage(ChatColor.BLUE+"[RPG]: "+ChatColor.WHITE+"Musite byt alespon level 5, aby jste mohl kopat tento druh bloku!");
				e.setCancelled(true);
				return;
			}
		}
		else
		{
			int level = prof.GetLevel();
			if (level < 5)
			{
				int i = 0;
				while (i < allowedBlocksTier1.length)
				{
					if (e.getBlock().getTypeId() == allowedBlocksTier1[i])
					{
						canBreak = true;
						break;
					}
					i++;
				}
				if (canBreak)
				{
					Block blockAbove = targetBlock.getRelative(BlockFace.UP);
					if (blockAbove.getTypeId() == 55)
					{
						canBreak = false;
					}
				}
				if (GameMasterHandler.IsAtleastGM(p.getName()))
				{
					if(plugin.acc.UserIsLogged(p))
					{
						canBreak = true;
					}
				}
				if (!canBreak)
				{
					p.sendMessage(ChatColor.BLUE+"[RPG]: "+ChatColor.WHITE+"Musite byt alespon level 5, aby jste mohl kopat tento druh bloku!");
					e.setCancelled(true);
					return;
				}
			}
		}
		String chestOwner;
		int blockType = targetBlock.getTypeId();
		if (blockType == ID_CHEST)
		{
			chestOwner = plugin.chests.GetBlockOwner(targetBlock);
			if(chestOwner.matches("notFound"))
			{
			}
			else
			{
				e.setCancelled(true);
				if (chestOwner.matches(p.getName()))
				{
					p.sendMessage(ChatColor.BLUE+"[LOCKER]:"+ChatColor.WHITE+" Nemuzete rozbit zamcenou truhlu! Nejdrive ji odemknete.");
				}
				else
				{
					p.sendMessage(ChatColor.BLUE+"[LOCKER]:"+ChatColor.WHITE+" Nemuzete rozbit zamcenou truhlu! " + chestOwner + " je vlastnikem teto truhly.");
				}
			}
		}
		else if(blockType==ID_DISPENSER)
		{
			chestOwner = plugin.dispensers.GetBlockOwner(targetBlock);
			if(chestOwner.matches("notFound"))
			{
			}
			else
			{
				e.setCancelled(true);
				if (chestOwner.matches(p.getName()))
				{
					p.sendMessage(ChatColor.BLUE+"[LOCKER]:"+ChatColor.WHITE+" Nemuzete rozbit zamceny davkovac! Nejdrive jej odemknete.");
				}
				else
				{
					p.sendMessage(ChatColor.BLUE+"[LOCKER]:"+ChatColor.WHITE+" Nemuzete rozbit zamceny davkovac! " + chestOwner + " je vlastnikem tohoto davkovace.");
				}
			}
		}
		else if(blockType==ID_FURNANCE || blockType==ID_FURNANCE_BURNING)
		{
			chestOwner = plugin.furnances.GetBlockOwner(targetBlock);
			if(chestOwner.matches("notFound"))
			{
			}
			else
			{
				e.setCancelled(true);
				if (chestOwner.matches(p.getName()))
				{
					p.sendMessage(ChatColor.BLUE+"[LOCKER]:"+ChatColor.WHITE+" Nemuzete rozbit zamcenou pec! Nejdrive ji odemknete.");
				}
				else
				{
					p.sendMessage(ChatColor.BLUE+"[LOCKER]:"+ChatColor.WHITE+" Nemuzete rozbit zamcenou pec! " + chestOwner + " je vlastnikem teto pece.");
					}
				}
			}
			int typeId = targetBlock.getTypeId();
			if (!IsInstaBreakBlock(typeId))
			{
				prof.GainExperience(3);
			}
			if (typeId == 1)
			{
				GugaBonusDrop bonus = prof.CobbleStoneDrop();
				if (bonus == GugaBonusDrop.DIAMOND)
				{
					p.getWorld().dropItem(targetBlock.getLocation(), new ItemStack(264,1));
					prof.GainExperience(50);
					p.sendMessage(ChatColor.BLUE+"[RPG]: "+ChatColor.WHITE+"Nasel jste diamant!");
				}
				else if (bonus == GugaBonusDrop.GOLD)
				{
					p.getWorld().dropItem(targetBlock.getLocation(), new ItemStack(14,1));
					prof.GainExperience(40);
					p.sendMessage(ChatColor.BLUE+"[RPG]: "+ChatColor.WHITE+"Nasel jste zlato!");
				}
				else if (bonus == GugaBonusDrop.IRON)
				{
					p.getWorld().dropItem(targetBlock.getLocation(), new ItemStack(15,1));
					prof.GainExperience(30);
					p.sendMessage(ChatColor.BLUE+"[RPG]: "+ChatColor.WHITE+"Nasel jste zelezo!");
				}
			}


Input:
    private void safelyWriteObject(JsonGenerator generator, Object value) throws IOException {
        if (value != null && value.getClass().isArray()) {
            value = Arrays.asList((Object[]) value);
        }
        if (value instanceof Iterable) {
            generator.writeStartArray();
            for (Object subValue : (Iterable<?>) value) {
                safelyWriteObject(generator, subValue);
            }
            generator.writeEndArray();
        } else if (value instanceof Map) {
            generator.writeStartObject();
            for (Map.Entry<?, ?> entry : ((Map<?, ?>) value).entrySet()) {
                if (entry.getKey() == null)
                    generator.writeFieldName("null");
                else
                    generator.writeFieldName(entry.getKey().toString());
                safelyWriteObject(generator, entry.getValue());
            }
            generator.writeEndObject();
        } else if (value == null) {
            generator.writeNull();
        } else {
            try {
                generator.writeObject(value);
            } catch (IllegalStateException e) {
                logger.debug("Couldn't marshal '{}' of type '{}', had to be converted into a String", value, value.getClass());
                generator.writeString(value.toString());
            }
        }
    }

Output:
    private void safelyWriteObject(JsonGenerator generator, Object value) throws IOException {
        if (value != null && value.getClass().isArray()) {
            value = Arrays.asList((Object[]) value);
        }
        if (value instanceof Iterable) {
            generator.writeStartArray();
            for (Object subValue : (Iterable<?>) value) {
                safelyWriteObject(generator, subValue);
            }
            generator.writeEndArray();
        } else if (value instanceof Map) {
            generator.writeStartObject();
            for (Map.Entry<?, ?> entry : ((Map<?, ?>) value).entrySet()) {
                if (entry.getKey() == null)
                    generator.writeFieldName("null");
                else
                    generator.writeFieldName(entry.getKey().toString());
                safelyWriteObject(generator, entry.getValue());
            }
            generator.writeEndObject();
        } else if (value == null) {
            generator.writeNull();
        } else {
            try {
                generator.writeObject(value);
            } catch (IllegalStateException e) {
                logger.debug("Couldn't marshal '{}' of type '{}', had to be converted into a String",
                        value, value.getClass());
                generator.writeString(value.toString());
            }
        }
    }


Input:
    protected void doInvite(SipServletRequest invite) throws ServletException,
            IOException {
        log("doInvite");
        invite.createResponse(SipServletResponse.SC_RINGING).send();
        ServletContext servletContext = getServletContext();
        SdpParser sdpParser = (SdpParser)servletContext.getAttribute(
                SdpParser.class.getName());
        Charset charset = Charset.forName("UTF-8");
        Object contentObject = invite.getContent();
        String sdp;
        if (contentObject instanceof String)
            sdp = (String)contentObject;
        else
        {
            byte[] content = (byte[])contentObject;
            sdp = new String(content, charset);
        }
        RtpConnection rtpConnection = sdpParser.getRtpConnection(sdp);
        if (rtpConnection == null)
        {
            invite.createResponse(SipServletResponse.SC_NOT_ACCEPTABLE).send();
            return;
        }
        int audioPayloadType;
        List<Integer> payloadTypes = rtpConnection.getPayloadTypes();
        if (payloadTypes.contains(0))
            audioPayloadType = 0;
        else if (payloadTypes.contains(8))
            audioPayloadType = 8;
        else
        {
            invite.createResponse(SipServletResponse.SC_NOT_ACCEPTABLE).send();
            return;
        }
        if (!payloadTypes.contains(DTMF_PAYLOAD_TYPE))
        {
            invite.createResponse(SipServletResponse.SC_NOT_ACCEPTABLE).send();
            return;
        }
        int port = rtpConnection.getPort();
        DtmfSession dtmfSession = new DtmfSession(DTMF_PAYLOAD_TYPE,
                rtpConnection.getHost(), port, audioPayloadType);
        try
        {
            dtmfSession.init();
        }
        catch (Exception e)
        {
            Log.warn("cannot initialize dtmf session on port " + port, e);
            SipServletResponse resp = invite.createResponse(
                    SipServletResponse.SC_SERVER_INTERNAL_ERROR);
            resp.send();
            return;
        }
        invite.getApplicationSession(true).setAttribute(
                DtmfSession.class.getName(), dtmfSession);
        SipServletResponse resp =
            invite.createResponse(SipServletResponse.SC_OK);
        String sdpAnswer = "v=0\r\n"
            + "o=user1 123 456 IN IP4 192.168.2.149\r\n"
            + "s=-\r\n"
            + "c=IN IP4 192.168.2.149\r\n"
            + "t=0 0\r\n"
            + "m=audio " + dtmfSession.getLocalPort() + " RTP/AVP "
                + audioPayloadType + " " + DTMF_PAYLOAD_TYPE + "\r\n"
            + "a=rtpmap:0 PCMU/8000\r\n"
            + "a=rtpmap:" + DTMF_PAYLOAD_TYPE + " telephone-event/8000\r\n"
            + "a=fmtp:" + DTMF_PAYLOAD_TYPE + " 0-15\r\n";
        resp.setContent(sdpAnswer.getBytes(charset), "application/sdp");
        resp.send();
    }

Output:
    protected void doInvite(SipServletRequest invite) throws ServletException,
            IOException {
        log("doInvite");
        invite.createResponse(SipServletResponse.SC_RINGING).send();
        ServletContext servletContext = getServletContext();
        SdpParser sdpParser = (SdpParser)servletContext.getAttribute(
                SdpParser.class.getName());
        Charset charset = Charset.forName("UTF-8");
        Object contentObject = invite.getContent();
        String sdp;
        if (contentObject instanceof String)
            sdp = (String)contentObject;
        else
        {
            byte[] content = (byte[])contentObject;
            sdp = new String(content, charset);
        }
        RtpConnection rtpConnection = sdpParser.getRtpConnection(sdp);
        if (rtpConnection == null)
        {
            invite.createResponse(SipServletResponse.SC_NOT_ACCEPTABLE).send();
            return;
        }
        int audioPayloadType;
        List<Integer> payloadTypes = rtpConnection.getPayloadTypes();
        if (payloadTypes.contains(0))
            audioPayloadType = 0;
        else if (payloadTypes.contains(8))
            audioPayloadType = 8;
        else
        {
            invite.createResponse(SipServletResponse.SC_NOT_ACCEPTABLE).send();
            return;
        }
        if (!payloadTypes.contains(DTMF_PAYLOAD_TYPE))
        {
            invite.createResponse(SipServletResponse.SC_NOT_ACCEPTABLE).send();
            return;
        }
        int port = rtpConnection.getPort();
        DtmfSession dtmfSession = new DtmfSession(DTMF_PAYLOAD_TYPE,
                rtpConnection.getHost(), port, audioPayloadType);
        try
        {
            dtmfSession.init();
        }
        catch (Exception e)
        {
            Log.warn("cannot initialize dtmf session on port " + port, e);
            SipServletResponse resp = invite.createResponse(
                    SipServletResponse.SC_SERVER_INTERNAL_ERROR);
            resp.send();
            return;
        }
        invite.getApplicationSession(true).setAttribute(
                DtmfSession.class.getName(), dtmfSession);
        SipServletResponse resp =
            invite.createResponse(SipServletResponse.SC_OK);
        String sdpAnswer = "v=0\r\n"
            + "o=user1 123 456 IN IP4 127.0.0.1\r\n"
            + "s=-\r\n"
            + "c=IN IP4 127.0.0.1\r\n"
            + "t=0 0\r\n"
            + "m=audio " + dtmfSession.getLocalPort() + " RTP/AVP "
                + audioPayloadType + " " + DTMF_PAYLOAD_TYPE + "\r\n"
            + "a=rtpmap:0 PCMU/8000\r\n"
            + "a=rtpmap:" + DTMF_PAYLOAD_TYPE + " telephone-event/8000\r\n"
            + "a=fmtp:" + DTMF_PAYLOAD_TYPE + " 0-15\r\n";
        resp.setContent(sdpAnswer.getBytes(charset), "application/sdp");
        resp.send();
    }


Input:
	public String toString() {
		boolean isThisWeek = TaskActivityUtil.getCurrentWeek().includes(this);
		boolean isNextWeek = TaskActivityUtil.getNextWeek().includes(this);
		if (isDay() && (isThisWeek || isNextWeek)) {
			String day = "";
			switch (getStartDate().get(Calendar.DAY_OF_WEEK)) {
			case Calendar.MONDAY:
				day = "Monday";
				break;
			case Calendar.TUESDAY:
				day = "Tuesday";
				break;
			case Calendar.WEDNESDAY:
				day = "Wednesday";
				break;
			case Calendar.THURSDAY:
				day = "Thursday";
				break;
			case Calendar.FRIDAY:
				day = "Friday";
				break;
			case Calendar.SATURDAY:
				day = "Saturday";
				break;
			case Calendar.SUNDAY:
				day = "Sunday";
				break;
			}
			if (Calendar.getInstance().get(Calendar.DAY_OF_WEEK) == getStartDate().get(Calendar.DAY_OF_WEEK)) {
				return day + " - Today";
			} else {
				return day;
			}
		} else if (isThisWeek()) {
			return DESCRIPTION_THIS_WEEK;
		} else if (isNextWeek()) {
			return DESCRIPTION_NEXT_WEEK;
		} else if (isWeekAfterNext()) {
			return DESCRIPTION_WEEK_AFTER_NEXT;
		} else if (isPreviousWeek()) {
			return DESCRIPTION_PREVIOUS_WEEK;
		}
		return DateFormat.getDateInstance(DateFormat.MEDIUM).format(startDate.getTime());
	}

Output:
	public String toString() {
		boolean isThisWeek = TaskActivityUtil.getCurrentWeek().includes(this);
		Calendar endNextWeek = TaskActivityUtil.getCalendar();
		endNextWeek.add(Calendar.DAY_OF_YEAR, 7);
		boolean isNextWeek = TaskActivityUtil.getNextWeek().includes(this) && this.before(endNextWeek);
		if (isDay() && (isThisWeek || isNextWeek)) {
			String day = "";
			switch (getStartDate().get(Calendar.DAY_OF_WEEK)) {
			case Calendar.MONDAY:
				day = "Monday";
				break;
			case Calendar.TUESDAY:
				day = "Tuesday";
				break;
			case Calendar.WEDNESDAY:
				day = "Wednesday";
				break;
			case Calendar.THURSDAY:
				day = "Thursday";
				break;
			case Calendar.FRIDAY:
				day = "Friday";
				break;
			case Calendar.SATURDAY:
				day = "Saturday";
				break;
			case Calendar.SUNDAY:
				day = "Sunday";
				break;
			}
			if (Calendar.getInstance().get(Calendar.DAY_OF_WEEK) == getStartDate().get(Calendar.DAY_OF_WEEK)) {
				return day + " - Today";
			} else {
				return day;
			}
		} else if (isThisWeek()) {
			return DESCRIPTION_THIS_WEEK;
		} else if (isNextWeek()) {
			return DESCRIPTION_NEXT_WEEK;
		} else if (isWeekAfterNext()) {
			return DESCRIPTION_WEEK_AFTER_NEXT;
		} else if (isPreviousWeek()) {
			return DESCRIPTION_PREVIOUS_WEEK;
		}
		return DateFormat.getDateInstance(DateFormat.MEDIUM).format(startDate.getTime());
	}


Input:
    public void paint(Graphics g) {
        mHeight = 0;
        iHeight = 0;
        if (messagesWidth == 0) {
            messagesWidth = getListWidth();
        }
        beginPaint();
       PopUp.getInstance().init(g, width, height);
        int count = updateLayout();
        setAbsOrg(g, 0, 0);
        g.setColor(ColorTheme.getColor(ColorTheme.LIST_BGND));
        g.fillRect(0, 0, width, height);
        if (mainbar != null) {
            mHeight = mainbar.getVHeight();
        }
        if (infobar != null) {
            setInfo();
            iHeight = infobar.getVHeight();
        }
        if (paintTop) {
            if (reverse) {
                if (infobar != null) {
                    iHeight = infobar.getVHeight();
                    list_top = iHeight;
                    drawInfoPanel(g);
                }
            } else {
                if (mainbar != null) {
                    list_top = mHeight;
                    drawMainPanel(g);
                }
            }
        }
        if (paintBottom) {
            if (reverse) {
                if (mainbar != null) {
                    list_bottom = mHeight;
                }
            } else {
                list_bottom = iHeight;
            }
        }
        winHeight = height - list_top - list_bottom;
        boolean scroll = (listHeight > winHeight);
        if (count == 0) {
            cursor = (cursor == -1) ? -1 : 0;
            win_top = 0;
        } else if (cursor >= count) {
            cursor = count - 1;
            stickyWindow = true;
        }
        if (updateLayout() > 0 && stickyWindow) {
            fitCursorByTop();
        }
        int itemMaxWidth = (scroll) ? (width - scrollbar.getScrollWidth()) : (width);
        int itemIndex = win_top > 0 ? getElementIndexAt(win_top) : 0;
        int displayedIndex = 0;
        int displayedBottom = list_top;
        int baloon = -1;
        while (itemIndex < count) {
            int itemYpos = itemLayoutY[itemIndex] - win_top;
            if (itemYpos >= winHeight) {
                break;
            }
            VirtualElement el = getItemRef(itemIndex);
            boolean sel = (itemIndex == cursor);
            if (el != null) {
                int lh = el.getVHeight();
                setAbsOrg(g, 0, list_top);
                g.setClip(0, 0, itemMaxWidth, winHeight);
                g.translate(0, itemYpos);
                g.setColor(el.getColorBGnd());
                if (sel) {
                    drawCursor(g, itemMaxWidth, lh);
                    baloon = g.getTranslateY();
                } else {
                    {
                        g.fillRect(0, 0, itemMaxWidth, lh);
                    }
                }
                g.setColor(el.getColor());
                g.clipRect(0, 0, itemMaxWidth, lh);
                el.drawItem(g, (sel) ? offset : 0, sel);
                displayedBottom = list_top + itemYpos + lh;
            }
            itemIndex++;
        }
        int clrH = height - displayedBottom;
        if (clrH > 0
                ) {
            setAbsOrg(g, 0, displayedBottom);
            g.setClip(0, 0, itemMaxWidth, clrH);
            g.setColor(ColorTheme.getColor(ColorTheme.LIST_BGND));
            g.fillRect(0, 0, itemMaxWidth, clrH);
        }
        if (scroll) {
            setAbsOrg(g, 0, list_top);
            g.setClip(0, 0, width, winHeight);
            scrollbar.setPostion(win_top);
            scrollbar.setSize(listHeight);
            scrollbar.setWindowSize(winHeight);
            scrollbar.draw(g);
        } else {
            scrollbar.setSize(0);
        }
        setAbsClip(g, width, height);
if (paintBottom) {
            if (reverse) {
        if (mainbar != null) {
            setAbsOrg(g, 0, height - mHeight);
            drawMainPanel(g);
            CommandsPointer.init(width, height, mHeight);
        }
    } else {
        if (infobar != null) {
            setAbsOrg(g, 0, height - iHeight);
            drawInfoPanel(g);
            CommandsPointer.init(width, height, iHeight);
        }
    }
            setAbsClip(g, width, height);
            if (sd.roster.messageCount > 0) {
                drawEnvelop(g);
            }
            if (System.currentTimeMillis() - sd.getTrafficIn() < 2000) {
                drawTraffic(g, false);
            }
            if (System.currentTimeMillis() - sd.getTrafficOut() < 2000) {
                drawTraffic(g, true);
            }
        }
        setAbsClip(g, width, height);
        drawPopUp(g);
        reconnectWindow.getInstance().draw(g, width, height);
    }

Output:
    public synchronized void paint(Graphics g) {
        mHeight = 0;
        iHeight = 0;
        if (messagesWidth == 0) {
            messagesWidth = getListWidth();
        }
        beginPaint();
       PopUp.getInstance().init(g, width, height);
        int count = updateLayout();
        setAbsOrg(g, 0, 0);
        g.setColor(ColorTheme.getColor(ColorTheme.LIST_BGND));
        g.fillRect(0, 0, width, height);
        if (mainbar != null) {
            mHeight = mainbar.getVHeight();
        }
        if (infobar != null) {
            setInfo();
            iHeight = infobar.getVHeight();
        }
        if (paintTop) {
            if (reverse) {
                if (infobar != null) {
                    iHeight = infobar.getVHeight();
                    list_top = iHeight;
                    drawInfoPanel(g);
                }
            } else {
                if (mainbar != null) {
                    list_top = mHeight;
                    drawMainPanel(g);
                }
            }
        }
        if (paintBottom) {
            if (reverse) {
                if (mainbar != null) {
                    list_bottom = mHeight;
                }
            } else {
                list_bottom = iHeight;
            }
        }
        winHeight = height - list_top - list_bottom;
        boolean scroll = (listHeight > winHeight);
        if (count == 0) {
            cursor = (cursor == -1) ? -1 : 0;
            win_top = 0;
        } else if (cursor >= count) {
            cursor = count - 1;
            stickyWindow = true;
        }
        if (updateLayout() > 0 && stickyWindow) {
            fitCursorByTop();
        }
        int itemMaxWidth = (scroll) ? (width - scrollbar.getScrollWidth()) : (width);
        int itemIndex = win_top > 0 ? getElementIndexAt(win_top) : 0;
        int displayedIndex = 0;
        int displayedBottom = list_top;
        int baloon = -1;
        while (itemIndex < itemLayoutY.length) {
            int itemYpos = itemLayoutY[itemIndex] - win_top;
            if (itemYpos >= winHeight) {
                break;
            }
            VirtualElement el = getItemRef(itemIndex);
            boolean sel = (itemIndex == cursor);
            if (el != null) {
                int lh = el.getVHeight();
                setAbsOrg(g, 0, list_top);
                g.setClip(0, 0, itemMaxWidth, winHeight);
                g.translate(0, itemYpos);
                g.setColor(el.getColorBGnd());
                if (sel) {
                    drawCursor(g, itemMaxWidth, lh);
                    baloon = g.getTranslateY();
                } else {
                    {
                        g.fillRect(0, 0, itemMaxWidth, lh);
                    }
                }
                g.setColor(el.getColor());
                g.clipRect(0, 0, itemMaxWidth, lh);
                el.drawItem(g, (sel) ? offset : 0, sel);
                displayedBottom = list_top + itemYpos + lh;
            }
            itemIndex++;
        }
        int clrH = height - displayedBottom;
        if (clrH > 0
                ) {
            setAbsOrg(g, 0, displayedBottom);
            g.setClip(0, 0, itemMaxWidth, clrH);
            g.setColor(ColorTheme.getColor(ColorTheme.LIST_BGND));
            g.fillRect(0, 0, itemMaxWidth, clrH);
        }
        if (scroll) {
            setAbsOrg(g, 0, list_top);
            g.setClip(0, 0, width, winHeight);
            scrollbar.setPostion(win_top);
            scrollbar.setSize(listHeight);
            scrollbar.setWindowSize(winHeight);
            scrollbar.draw(g);
        } else {
            scrollbar.setSize(0);
        }
        setAbsClip(g, width, height);
if (paintBottom) {
            if (reverse) {
        if (mainbar != null) {
            setAbsOrg(g, 0, height - mHeight);
            drawMainPanel(g);
            CommandsPointer.init(width, height, mHeight);
        }
    } else {
        if (infobar != null) {
            setAbsOrg(g, 0, height - iHeight);
            drawInfoPanel(g);
            CommandsPointer.init(width, height, iHeight);
        }
    }
            setAbsClip(g, width, height);
            if (sd.roster.messageCount > 0) {
                drawEnvelop(g);
            }
            if (System.currentTimeMillis() - sd.getTrafficIn() < 2000) {
                drawTraffic(g, false);
            }
            if (System.currentTimeMillis() - sd.getTrafficOut() < 2000) {
                drawTraffic(g, true);
            }
        }
        setAbsClip(g, width, height);
        drawPopUp(g);
        reconnectWindow.getInstance().draw(g, width, height);
    }


Input:
    public TestResult perform()
    {
        byte[]    data = { 0, 1, 0, 1, 0, 0, 1 };
        DERObject    values[] = {
                new BERConstructedOctetString(data),
                new BERSequence(new DERPrintableString("hello world")),
                new BERSet(new DERPrintableString("hello world")),
                new BERTaggedObject(0, new DERPrintableString("hello world")),
                new DERApplicationSpecific(0, data),
                new DERBitString(data),
                new DERBMPString("hello world"),
                new DERBoolean(true),
                new DERBoolean(false),
                new DEREnumerated(100),
                new DERGeneralizedTime("20070315173729Z"),
                new DERGeneralString("hello world"),
                new DERIA5String("hello"),
                new DERInteger(1000),
                new DERNull(),
                new DERNumericString("123456"),
                new DERObjectIdentifier("1.1.1.10000.1"),
                new DEROctetString(data),
                new DERPrintableString("hello world"),
                new DERSequence(new DERPrintableString("hello world")),
                new DERSet(new DERPrintableString("hello world")),
                new DERT61String("hello world"),
                new DERTaggedObject(0, new DERPrintableString("hello world")),
                new DERUniversalString(data),
                new DERUnknownTag(0xff & (~(DERTags.TAGGED | DERTags.APPLICATION)), data),
                new DERUTCTime(new Date()),
                new DERUTF8String("hello world"),
                new DERVisibleString("hello world")
            };
        try
        {
            ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
            ASN1OutputStream        aOut = new ASN1OutputStream(bOut);
            for (int i = 0; i != values.length; i++)
            {
                aOut.writeObject(values[i]);
            }
            DERObject[] readValues = new DERObject[values.length];
            ByteArrayInputStream    bIn = new ByteArrayInputStream(bOut.toByteArray());
            ASN1InputStream         aIn = new ASN1InputStream(bIn);
            for (int i = 0; i != values.length; i++)
            {
                DERObject   o = aIn.readObject();
                if (!o.equals(values[i]))
                {
                    return new SimpleTestResult(false, getName() + ": Failed equality test for " + o);
                }
                if (o.hashCode() != values[i].hashCode())
                {
                    return new SimpleTestResult(false, getName() + ": Failed hashCode test for " + o);
                }
            }
        }
        catch (Exception e)
        {
            return new SimpleTestResult(false, getName() + ": Failed - exception " + e.toString(), e);
        }
        return new SimpleTestResult(true, getName() + ": Okay");
    }

Output:
    public TestResult perform()
    {
        byte[]    data = { 0, 1, 0, 1, 0, 0, 1 };
        DERObject    values[] = {
                new BERConstructedOctetString(data),
                new BERSequence(new DERPrintableString("hello world")),
                new BERSet(new DERPrintableString("hello world")),
                new BERTaggedObject(0, new DERPrintableString("hello world")),
                new DERApplicationSpecific(0, data),
                new DERBitString(data),
                new DERBMPString("hello world"),
                new DERBoolean(true),
                new DERBoolean(false),
                new DEREnumerated(100),
                new DERGeneralizedTime("20070315173729Z"),
                new DERGeneralString("hello world"),
                new DERIA5String("hello"),
                new DERInteger(1000),
                new DERNull(),
                new DERNumericString("123456"),
                new DERObjectIdentifier("1.1.1.10000.1"),
                new DEROctetString(data),
                new DERPrintableString("hello world"),
                new DERSequence(new DERPrintableString("hello world")),
                new DERSet(new DERPrintableString("hello world")),
                new DERT61String("hello world"),
                new DERTaggedObject(0, new DERPrintableString("hello world")),
                new DERUniversalString(data),
                new DERUnknownTag(0xff & (~(DERTags.TAGGED | DERTags.APPLICATION)), data),
                new DERUTCTime(new Date()),
                new DERUTF8String("hello world"),
                new DERVisibleString("hello world")
            };
        try
        {
            ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
            ASN1OutputStream        aOut = new ASN1OutputStream(bOut);
            for (int i = 0; i != values.length; i++)
            {
                aOut.writeObject(values[i]);
            }
            DERObject[] readValues = new DERObject[values.length];
            ByteArrayInputStream    bIn = new ByteArrayInputStream(bOut.toByteArray());
            ASN1InputStream         aIn = new ASN1InputStream(bIn);
            for (int i = 0; i != values.length; i++)
            {
                DERObject   o = aIn.readObject();
                if (!o.equals(values[i]))
                {
                    return new SimpleTestResult(false, getName() + ": Failed equality test for " + o.getClass());
                }
                if (o.hashCode() != values[i].hashCode())
                {
                    return new SimpleTestResult(false, getName() + ": Failed hashCode test for " + o.getClass());
                }
            }
        }
        catch (Exception e)
        {
            return new SimpleTestResult(false, getName() + ": Failed - exception " + e.toString(), e);
        }
        return new SimpleTestResult(true, getName() + ": Okay");
    }