You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wookie.apache.org by sc...@apache.org on 2010/04/17 20:52:10 UTC

svn commit: r935228 - in /incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl: ContentEntity.java WidgetManifestModel.java

Author: scottbw
Date: Sat Apr 17 18:52:09 2010
New Revision: 935228

URL: http://svn.apache.org/viewvc?rev=935228&view=rev
Log:
D'oh forgot to include these with the last changeset

Modified:
    incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/ContentEntity.java
    incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/WidgetManifestModel.java

Modified: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/ContentEntity.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/ContentEntity.java?rev=935228&r1=935227&r2=935228&view=diff
==============================================================================
--- incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/ContentEntity.java (original)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/ContentEntity.java Sat Apr 17 18:52:09 2010
@@ -58,7 +58,7 @@ public class ContentEntity extends Abstr
 	}
 
 	public void setCharSet(String charSet) {
-		if (isSupported(charSet, IW3CXMLConfiguration.SUPPORTED_ENCODINGS)) fCharSet = charSet;
+		fCharSet = charSet;
 	}
 
 	public String getType() {
@@ -77,7 +77,7 @@ public class ContentEntity extends Abstr
 
 	}
 
-	public void fromXML(Element element, String[] locales, ZipFile zip) throws BadManifestException {
+	public void fromXML(Element element, String[] locales, String[] encodings, ZipFile zip) throws BadManifestException {
 		
 		// Src
 		fSrc = UnicodeUtils.normalizeSpaces(element.getAttributeValue(IW3CXMLConfiguration.SOURCE_ATTRIBUTE));
@@ -110,8 +110,8 @@ public class ContentEntity extends Abstr
 		
 		// Charset encoding. Use encoding attribute by preference, and the use the charset parameter of the content type
 		String charset = UnicodeUtils.normalizeSpaces(element.getAttributeValue(IW3CXMLConfiguration.CHARSET_ATTRIBUTE));
-		setCharSet(charset);
-		if (getCharSet()==null) setCharSet(charsetParameter);		
+		if (isSupported(charset, encodings)) setCharSet(charset);
+		if (getCharSet()==null && isSupported(charsetParameter, encodings)) setCharSet(charsetParameter);		
 		if (getCharSet()==null) setCharSet(IW3CXMLConfiguration.DEFAULT_CHARSET);
 	}
 	

Modified: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/WidgetManifestModel.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/WidgetManifestModel.java?rev=935228&r1=935227&r2=935228&view=diff
==============================================================================
--- incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/WidgetManifestModel.java (original)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/impl/WidgetManifestModel.java Sat Apr 17 18:52:09 2010
@@ -72,6 +72,8 @@ public class WidgetManifestModel impleme
 	private List<IFeatureEntity> fFeaturesList;
 	private List<IPreferenceEntity> fPreferencesList;
 	
+	private String[] supportedEncodings;
+	
 	private ZipFile zip;
 	
 	/**
@@ -81,10 +83,11 @@ public class WidgetManifestModel impleme
 	 * @throws IOException
 	 * @throws BadManifestException
 	 */
-	public WidgetManifestModel (String xmlText, String[] locales, String[] features, ZipFile zip) throws JDOMException, IOException, BadManifestException {		
+	public WidgetManifestModel (String xmlText, String[] locales, String[] features, String[] encodings, ZipFile zip) throws JDOMException, IOException, BadManifestException {		
 		super();		
 		this.zip = zip;
 		this.features = features;
+		this.supportedEncodings = encodings;
 		fNamesList = new ArrayList<INameEntity>();
 		fDescriptionsList = new ArrayList<IDescriptionEntity>();
 		fLicensesList = new ArrayList<ILicenseEntity>();
@@ -375,8 +378,8 @@ public class WidgetManifestModel impleme
 			if(tag.equals(IW3CXMLConfiguration.CONTENT_ELEMENT)) {	
 				if (!foundContent){
 					foundContent = true;
-					IContentEntity aContent = new ContentEntity();						
-					aContent.fromXML(child,locales,zip);
+					IContentEntity aContent = new ContentEntity();	
+					aContent.fromXML(child,locales,supportedEncodings,zip);
 					if (aContent.getSrc()!=null) fContentList.add(aContent);
 				}
 			}