<commit_before>package eu.ydp.empiria.player.client.controller.data;

import com.google.gwt.dom.client.Document;
import com.google.gwt.xml.client.Element;
import com.google.gwt.xml.client.Node;
import com.google.gwt.xml.client.NodeList;

import eu.ydp.empiria.player.client.util.XMLUtils;

/**
 * Responsible for putting meta nodes into HTML Document.
 * 
 * @author <NAME>
 */
public class MetaDescriptionManager {

	public void processDocument(Element documentElement){
		Element metaDescriptionNode = XMLUtils.getFirstElementWithTagName(documentElement, "metaDescription");
		NodeList metaNodes = metaDescriptionNode.getElementsByTagName("meta");
		com.google.gwt.dom.client.Element htmlHeadNode = Document.get().getElementsByTagName("head").getItem(0);
		for (int n = 0 ; n < metaNodes.getLength() ; n ++){
			com.google.gwt.dom.client.Element currElement = convertToDomElement((Element)metaNodes.item(n));
			htmlHeadNode.appendChild(currElement);
		}
	}
	
	private com.google.gwt.dom.client.Element convertToDomElement(Element xmlElement){
		com.google.gwt.dom.client.Element domElement = Document.get().createElement(xmlElement.getNodeName());
		for (int a = 0 ; a < xmlElement.getAttributes().getLength() ; a ++){
			Node currAttr = xmlElement.getAttributes().item(a);
			domElement.setAttribute(currAttr.getNodeName(), currAttr.getNodeValue());			
		}
		return domElement;
	}
}
<commit_msg>fix npe bug 67082<commit_after>package eu.ydp.empiria.player.client.controller.data;

import com.google.gwt.dom.client.Document;
import com.google.gwt.xml.client.Element;
import com.google.gwt.xml.client.Node;
import com.google.gwt.xml.client.NodeList;

import eu.ydp.empiria.player.client.util.XMLUtils;

/**
 * Responsible for putting meta nodes into HTML Document.
 * 
 * @author <NAME>
 */
public class MetaDescriptionManager {

	public void processDocument(Element documentElement){
		Element metaDescriptionNode = XMLUtils.getFirstElementWithTagName(documentElement, "metaDescription");
		if (metaDescriptionNode != null){
			NodeList metaNodes = metaDescriptionNode.getElementsByTagName("meta");
			com.google.gwt.dom.client.Element htmlHeadNode = Document.get().getElementsByTagName("head").getItem(0);
			for (int n = 0 ; n < metaNodes.getLength() ; n ++){
				com.google.gwt.dom.client.Element currElement = convertToDomElement((Element)metaNodes.item(n));
				htmlHeadNode.appendChild(currElement);
			}
		}
	}
	
	private com.google.gwt.dom.client.Element convertToDomElement(Element xmlElement){
		com.google.gwt.dom.client.Element domElement = Document.get().createElement(xmlElement.getNodeName());
		for (int a = 0 ; a < xmlElement.getAttributes().getLength() ; a ++){
			Node currAttr = xmlElement.getAttributes().item(a);
			domElement.setAttribute(currAttr.getNodeName(), currAttr.getNodeValue());			
		}
		return domElement;
	}
}

{'fraction_non_alphanumeric': 0.12808219178082192, 'fraction_numerical': 0.003767123287671233, 'mean_word_length': 4.521739130434782, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 14}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6039231', 'n_tokens_mistral': 949, 'n_tokens_neox': 904, 'n_words': 148}