diff options
author | Steffen Pingel | 2011-11-24 12:50:37 +0000 |
---|---|---|
committer | Steffen Pingel | 2011-11-24 12:50:37 +0000 |
commit | a471ecb8a423d0327c82d8a132945bf61d4901ac (patch) | |
tree | 75d6b1ba26a07c044b8e92de410b2b50a6bc061b /org.eclipse.mylyn.tests.util | |
parent | f86f0941bcf02484938212277431ae2811902ca4 (diff) | |
download | org.eclipse.mylyn.tasks-a471ecb8a423d0327c82d8a132945bf61d4901ac.tar.gz org.eclipse.mylyn.tasks-a471ecb8a423d0327c82d8a132945bf61d4901ac.tar.xz org.eclipse.mylyn.tasks-a471ecb8a423d0327c82d8a132945bf61d4901ac.zip |
REOPENED - bug 356790: configure all projects for Unix file endings
https://bugs.eclipse.org/bugs/show_bug.cgi?id=356790
Change-Id: Ib444d398f20055df85a2c85c628f2c7c5df2e81c
Diffstat (limited to 'org.eclipse.mylyn.tests.util')
-rw-r--r-- | org.eclipse.mylyn.tests.util/.settings/org.eclipse.core.runtime.prefs | 2 | ||||
-rw-r--r-- | org.eclipse.mylyn.tests.util/src/org/eclipse/mylyn/tests/util/UrlBuilder.java | 152 |
2 files changed, 78 insertions, 76 deletions
diff --git a/org.eclipse.mylyn.tests.util/.settings/org.eclipse.core.runtime.prefs b/org.eclipse.mylyn.tests.util/.settings/org.eclipse.core.runtime.prefs new file mode 100644 index 000000000..5a0ad22d2 --- /dev/null +++ b/org.eclipse.mylyn.tests.util/.settings/org.eclipse.core.runtime.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +line.separator=\n diff --git a/org.eclipse.mylyn.tests.util/src/org/eclipse/mylyn/tests/util/UrlBuilder.java b/org.eclipse.mylyn.tests.util/src/org/eclipse/mylyn/tests/util/UrlBuilder.java index f0698abf1..66299e892 100644 --- a/org.eclipse.mylyn.tests.util/src/org/eclipse/mylyn/tests/util/UrlBuilder.java +++ b/org.eclipse.mylyn.tests.util/src/org/eclipse/mylyn/tests/util/UrlBuilder.java @@ -1,76 +1,76 @@ -/*******************************************************************************
- * Copyright (c) 2009, 2010 Tasktop Technologies 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-package org.eclipse.mylyn.tests.util;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
-
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-
-/**
- * A builder class for constructing {@link TaskRepository task repository} URLs.
- *
- * @author David Green
- * @since 3.5
- */
-public class UrlBuilder {
- private final StringBuilder buf = new StringBuilder(512);
-
- private UrlBuilder() {
- }
-
- public static UrlBuilder build(TaskRepository repository) {
- UrlBuilder builder = new UrlBuilder();
- String url = repository.getRepositoryUrl();
- if (url.endsWith("/")) {
- url = url.substring(0, url.length() - 1);
- }
- return builder.append(url);
- }
-
- public UrlBuilder append(String urlSegment) {
- buf.append(urlSegment);
- return this;
- }
-
- public UrlBuilder parameter(String name, Object value) {
- return parameter(name, value == null ? null : value.toString());
- }
-
- public UrlBuilder parameter(String name, String value) {
- int indexOfQ = buf.indexOf("?");
- if (indexOfQ == -1) {
- buf.append("?");
- } else {
- buf.append("&");
- }
- buf.append(name);
- buf.append('=');
- if (value != null) {
- buf.append(encode(value));
- }
- return this;
- }
-
- private String encode(String value) {
- try {
- return URLEncoder.encode(value, "UTF-8");
- } catch (UnsupportedEncodingException e) {
- throw new IllegalStateException(e);
- }
- }
-
- @Override
- public String toString() {
- return buf.toString();
- }
-
-}
+/******************************************************************************* + * Copyright (c) 2009, 2010 Tasktop Technologies 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tasktop Technologies - initial API and implementation + *******************************************************************************/ +package org.eclipse.mylyn.tests.util; + +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; + +import org.eclipse.mylyn.tasks.core.TaskRepository; + +/** + * A builder class for constructing {@link TaskRepository task repository} URLs. + * + * @author David Green + * @since 3.5 + */ +public class UrlBuilder { + private final StringBuilder buf = new StringBuilder(512); + + private UrlBuilder() { + } + + public static UrlBuilder build(TaskRepository repository) { + UrlBuilder builder = new UrlBuilder(); + String url = repository.getRepositoryUrl(); + if (url.endsWith("/")) { + url = url.substring(0, url.length() - 1); + } + return builder.append(url); + } + + public UrlBuilder append(String urlSegment) { + buf.append(urlSegment); + return this; + } + + public UrlBuilder parameter(String name, Object value) { + return parameter(name, value == null ? null : value.toString()); + } + + public UrlBuilder parameter(String name, String value) { + int indexOfQ = buf.indexOf("?"); + if (indexOfQ == -1) { + buf.append("?"); + } else { + buf.append("&"); + } + buf.append(name); + buf.append('='); + if (value != null) { + buf.append(encode(value)); + } + return this; + } + + private String encode(String value) { + try { + return URLEncoder.encode(value, "UTF-8"); + } catch (UnsupportedEncodingException e) { + throw new IllegalStateException(e); + } + } + + @Override + public String toString() { + return buf.toString(); + } + +} |