Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDani Megert2012-02-29 15:52:52 +0000
committerDani Megert2012-02-29 15:52:52 +0000
commit0944c704064c5b72d2a9b530b0838542d3dfb427 (patch)
tree11c4bc3b62c220690a43833fc1a8324721082f60
parentc92774e8786b3fdcb26929a642f1bf2d91fbde6b (diff)
downloadeclipse.platform.ua-0944c704064c5b72d2a9b530b0838542d3dfb427.tar.gz
eclipse.platform.ua-0944c704064c5b72d2a9b530b0838542d3dfb427.tar.xz
eclipse.platform.ua-0944c704064c5b72d2a9b530b0838542d3dfb427.zip
Fixed bug 372366: org.eclipse.help.webapp/NetworkHelpStatus.html appears
corrupt in NL (Japanese, Korean, S.Chinese, T.Chinese)
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/StatusProducer.java41
1 files changed, 26 insertions, 15 deletions
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/StatusProducer.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/StatusProducer.java
index 43cb7bbd4..c6f629106 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/StatusProducer.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/StatusProducer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 IBM Corporation and others.
+ * Copyright (c) 2009, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -14,13 +14,13 @@ package org.eclipse.help.internal.webapp;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Locale;
-import org.eclipse.core.runtime.Platform;
import org.eclipse.help.IHelpContentProducer;
import org.eclipse.help.internal.base.HelpBasePlugin;
import org.eclipse.help.internal.base.MissingContentManager;
@@ -30,6 +30,8 @@ import org.eclipse.help.internal.util.ProductPreferences;
import org.eclipse.help.internal.webapp.data.UrlUtil;
import org.eclipse.help.internal.webapp.data.WebappPreferences;
+import org.eclipse.core.runtime.Platform;
+
public class StatusProducer implements IHelpContentProducer {
@@ -95,7 +97,7 @@ public class StatusProducer implements IHelpContentProducer {
return getNetworkOKPage(locale);
}
}
-
+
// If this is a call from an invalid topic,
// check to see if a predefined error page exists
// in the preferences
@@ -208,9 +210,9 @@ public class StatusProducer implements IHelpContentProducer {
pageBuffer.append(tab(3)+ "</p>\n"); //$NON-NLS-1$
pageBuffer.append(END_BODY_HTML);
- }
- ByteArrayInputStream bais = new ByteArrayInputStream(pageBuffer.toString().getBytes());
- return bais;
+ }
+
+ return getBytes(pageBuffer);
}
public void addCloseLink(Locale locale, StringBuffer pageBuffer) {
@@ -233,8 +235,8 @@ public class StatusProducer implements IHelpContentProducer {
pageBuffer.append(WebappResources.getString("networkHelpAvailableDetails", locale)); //$NON-NLS-1$
pageBuffer.append("</p>\n"); //$NON-NLS-1$
pageBuffer.append(END_BODY_HTML);
- ByteArrayInputStream bais = new ByteArrayInputStream(pageBuffer.toString().getBytes());
- return bais;
+
+ return getBytes(pageBuffer);
}
private InputStream getMissingTopicPage(String topicPath, Locale locale) {
@@ -255,8 +257,8 @@ public class StatusProducer implements IHelpContentProducer {
pageBuffer.append("</a>\n"); //$NON-NLS-1$
pageBuffer.append(tab(3) + "</p>\n"); //$NON-NLS-1$
pageBuffer.append(END_BODY_HTML);
- ByteArrayInputStream bais = new ByteArrayInputStream(pageBuffer.toString().getBytes());
- return bais;
+
+ return getBytes(pageBuffer);
}
/*
@@ -308,8 +310,8 @@ public class StatusProducer implements IHelpContentProducer {
pageBuffer.append(tab(3)+ "</p>\n"); //$NON-NLS-1$
}
pageBuffer.append(END_BODY_HTML);
- ByteArrayInputStream bais = new ByteArrayInputStream(pageBuffer.toString().getBytes());
- return bais;
+
+ return getBytes(pageBuffer);
}
@@ -329,8 +331,8 @@ public class StatusProducer implements IHelpContentProducer {
pageBuffer.append(WebappResources.getString("allBooksInstalled", locale)); //$NON-NLS-1$
pageBuffer.append("</p>\n"); //$NON-NLS-1$
pageBuffer.append(END_BODY_HTML);
- ByteArrayInputStream bais = new ByteArrayInputStream(pageBuffer.toString().getBytes());
- return bais;
+
+ return getBytes(pageBuffer);
}
/*
@@ -402,5 +404,14 @@ public class StatusProducer implements IHelpContentProducer {
tabs+=TAB;
return tabs;
}
-
+
+ private static InputStream getBytes(StringBuffer pageBuffer) {
+ try {
+ return new ByteArrayInputStream(pageBuffer.toString().getBytes("UTF-8")); //$NON-NLS-1$
+ } catch (UnsupportedEncodingException e) {
+ HelpWebappPlugin.logError("JRE error: UTF-8 encoding not supported", e); //$NON-NLS-1$
+ return new ByteArrayInputStream(pageBuffer.toString().getBytes());
+ }
+ }
+
}

Back to the top