<commit_before>/*
 * Copyright 2008 Wyona
 */

package org.wyona.yanel.impl.resources.pagenotfound;

import org.wyona.yanel.impl.resources.BasicXMLResource;

import java.io.ByteArrayInputStream;
import java.io.InputStream;

import org.apache.log4j.Logger;


/**
 * A simple Resource which extends BasicXMLResource
 */
public class PageNotFoundResource extends BasicXMLResource {
    
    private static Logger log = Logger.getLogger(PageNotFoundResource.class);
    
    /*
     * This method overrides the method to create the InputStream called by BasicXMLResource
     * Since you extend the BasicXMLResource this has to contain well-formed xml.
     * Should return a InputStream which contains XML. 
     * Use String, StingBuffer, dom, jdom, org.apache.commons.io.IOUtils and so on to generate the XML.
     */
    protected InputStream getContentXML(String viewId) {
        if (log.isDebugEnabled()) {
            log.debug("requested viewId: " + viewId);
        }
        StringBuffer sb = new StringBuffer("<?xml version=\"1.0\"?>");
        sb.append("<page-not-found>");
        sb.append("</page-not-found>");
        return new ByteArrayInputStream(sb.toString().getBytes());
    }
}<commit_msg>XML refactored<commit_after>/*
 * Copyright 2008 Wyona
 */

package org.wyona.yanel.impl.resources.pagenotfound;

import org.wyona.yanel.impl.resources.BasicXMLResource;

import java.io.ByteArrayInputStream;
import java.io.InputStream;

import org.apache.log4j.Logger;


/**
 * Page not found resource
 */
public class PageNotFoundResource extends BasicXMLResource {
    
    private static Logger log = Logger.getLogger(PageNotFoundResource.class);
    
    /**
     * Generate XML
     */
    protected InputStream getContentXML(String viewId) {
        if (log.isDebugEnabled()) {
            log.debug("requested viewId: " + viewId);
        }
        StringBuffer sb = new StringBuffer("<?xml version=\"1.0\"?>");
        sb.append("<yanel xmlns=\"http://www.wyona.org/yanel/1.0\" servlet-context-real-path=\"TBD\">");
        sb.append("<request>TBD</request>");
        sb.append("<session>TBD</session>");
        sb.append("<resource>TBD</resource>");
        sb.append("<exception status=\"404\">");
        sb.append("Resource not found exception: " + getPath());
        sb.append("</exception>");
        sb.append("</yanel>");
        return new ByteArrayInputStream(sb.toString().getBytes());
    }
}
{'fraction_non_alphanumeric': 0.13443298969072165, 'fraction_numerical': 0.007835051546391752, 'mean_word_length': 3.1899827288428324, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 2, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, 'xml': 4}, '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': '3146985', 'n_tokens_mistral': 711, 'n_tokens_neox': 699, 'n_words': 155}