⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 propertiessettings.java

📁 struts 2 核心包 的源码 有错误是难免的
💻 JAVA
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   PropertiesSettings.java

package org.apache.struts2.config;

import com.opensymphony.xwork2.util.location.*;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.Iterator;
import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts2.StrutsException;
import org.apache.struts2.util.ClassLoaderUtils;

// Referenced classes of package org.apache.struts2.config:
//			Settings

class PropertiesSettings extends Settings
{

	LocatableProperties settings;
	static Log LOG = LogFactory.getLog(org/apache/struts2/config/PropertiesSettings);

	public PropertiesSettings(String name)
	{
		InputStream in;
		Exception exception;
		URL settingsUrl = ClassLoaderUtils.getResource((new StringBuilder()).append(name).append(".properties").toString(), getClass());
		if (settingsUrl == null)
		{
			LOG.debug((new StringBuilder()).append(name).append(".properties missing").toString());
			settings = new LocatableProperties();
			return;
		}
		settings = new LocatableProperties(new LocationImpl(null, settingsUrl.toString()));
		in = null;
		try
		{
			in = settingsUrl.openStream();
			settings.load(in);
		}
		catch (IOException e)
		{
			throw new StrutsException((new StringBuilder()).append("Could not load ").append(name).append(".properties:").append(e).toString(), e);
		}
		finally
		{
			if (in == null) goto _L0; else goto _L0
		}
		if (in != null)
			try
			{
				in.close();
			}
			catch (IOException io)
			{
				LOG.warn("Unable to close input stream", io);
			}
		break MISSING_BLOCK_LABEL_211;
		try
		{
			in.close();
		}
		catch (IOException io)
		{
			LOG.warn("Unable to close input stream", io);
		}
		throw exception;
	}

	public void setImpl(String aName, String aValue)
	{
		settings.setProperty(aName, aValue);
	}

	public String getImpl(String aName)
		throws IllegalArgumentException
	{
		String setting = settings.getProperty(aName);
		if (setting == null)
			throw new IllegalArgumentException((new StringBuilder()).append("No such setting:").append(aName).toString());
		else
			return setting;
	}

	public Location getLocationImpl(String aName)
		throws IllegalArgumentException
	{
		Location loc = settings.getPropertyLocation(aName);
		if (loc == null && !settings.containsKey(aName))
			throw new IllegalArgumentException((new StringBuilder()).append("No such setting:").append(aName).toString());
		else
			return loc;
	}

	public boolean isSetImpl(String aName)
	{
		return settings.get(aName) != null;
	}

	public Iterator listImpl()
	{
		return settings.keySet().iterator();
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -