<commit_before>package org.torquebox.messaging.deployers;

import java.io.InputStream;
import java.util.Map;

import org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer;
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
import org.jboss.virtual.VirtualFile;
import org.torquebox.messaging.metadata.QueueMetaData;
import org.torquebox.messaging.metadata.QueuesMetaData;
import org.yaml.snakeyaml.Yaml;

public class QueuesYamlParsingDeployer extends AbstractVFSParsingDeployer<QueuesMetaData>{

	public QueuesYamlParsingDeployer() {
		super( QueuesMetaData.class );
		setName( "queues.yml" );
	}

	@SuppressWarnings("unchecked")
	@Override
	protected QueuesMetaData parse(VFSDeploymentUnit unit, VirtualFile file, QueuesMetaData root) throws Exception {
		InputStream in = null;
		
		QueuesMetaData queues = unit.getAttachment( QueuesMetaData.class );
		if ( queues == null ) {
			queues = new QueuesMetaData();
			unit.addAttachment( QueuesMetaData.class, queues );
		}
		
		try {
			in = file.openStream();
			Yaml yaml = new Yaml();
			Map<String, Map<String,Object>> data = (Map<String, Map<String, Object>>) yaml.load( in );
			
			for ( String queueName : data.keySet() ) {
				log.info( "Read configuration for queue [" + queueName + "]" );
				QueueMetaData queue = new QueueMetaData( queueName );
				queues.addQueue( queue );
			}
		} finally {
			if ( in != null ) {
				in.close();
			}
		}
		return null;
	}

}<commit_msg>Fix for TORQUE-72.  Check that object is loaded and non-NULL from queues.yml.<commit_after>package org.torquebox.messaging.deployers;

import java.io.InputStream;
import java.util.Map;

import org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer;
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
import org.jboss.virtual.VirtualFile;
import org.torquebox.messaging.metadata.QueueMetaData;
import org.torquebox.messaging.metadata.QueuesMetaData;
import org.yaml.snakeyaml.Yaml;

public class QueuesYamlParsingDeployer extends
		AbstractVFSParsingDeployer<QueuesMetaData> {

	public QueuesYamlParsingDeployer() {
		super(QueuesMetaData.class);
		setName("queues.yml");
	}

	@SuppressWarnings("unchecked")
	@Override
	protected QueuesMetaData parse(VFSDeploymentUnit unit, VirtualFile file,
			QueuesMetaData root) throws Exception {
		InputStream in = null;

		QueuesMetaData queues = unit.getAttachment(QueuesMetaData.class);
		if (queues == null) {
			queues = new QueuesMetaData();
			unit.addAttachment(QueuesMetaData.class, queues);
		}

		try {
			in = file.openStream();
			Yaml yaml = new Yaml();
			Map<String, Map<String, Object>> data = (Map<String, Map<String, Object>>) yaml
					.load(in);

			if (data != null) {
				for (String queueName : data.keySet()) {
					log
							.info("Read configuration for queue [" + queueName
									+ "]");
					QueueMetaData queue = new QueueMetaData(queueName);
					queues.addQueue(queue);
				}
			}
		} finally {
			if (in != null) {
				in.close();
			}
		}
		return null;
	}

}
{'fraction_non_alphanumeric': 0.11630218687872763, 'fraction_numerical': 0.0006626905235255136, 'mean_word_length': 4.277972027972028, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '4673708', 'n_tokens_mistral': 1140, 'n_tokens_neox': 1015, 'n_words': 201}