Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDJ Houghton2009-04-01 10:37:09 -0400
committerDJ Houghton2009-04-01 10:37:09 -0400
commit2a014d7ab22803a621caa89e0434d4a05028093d (patch)
treed21259cc483b1670e7330fb0d65f521321636e08
parent5bcdc270280b094eced03fd6ccd40f9886aad96b (diff)
downloadrt.equinox.p2-2a014d7ab22803a621caa89e0434d4a05028093d.tar.gz
rt.equinox.p2-2a014d7ab22803a621caa89e0434d4a05028093d.tar.xz
rt.equinox.p2-2a014d7ab22803a621caa89e0434d4a05028093d.zip
Bug 270535 - New p2.repository bundle uses 1.5 methodsv20090401-1036
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/.classpath2
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/.settings/org.eclipse.jdt.core.prefs3
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/FileReader.java18
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/ProgressStatistics.java18
5 files changed, 22 insertions, 21 deletions
diff --git a/bundles/org.eclipse.equinox.p2.repository/.classpath b/bundles/org.eclipse.equinox.p2.repository/.classpath
index 64c5e31b7..2fbb7a23e 100644
--- a/bundles/org.eclipse.equinox.p2.repository/.classpath
+++ b/bundles/org.eclipse.equinox.p2.repository/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
diff --git a/bundles/org.eclipse.equinox.p2.repository/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.repository/.settings/org.eclipse.jdt.core.prefs
index 4a6dee366..ee1efde02 100644
--- a/bundles/org.eclipse.equinox.p2.repository/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/org.eclipse.equinox.p2.repository/.settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,4 @@
-#Fri Feb 06 10:55:56 EST 2009
+#Wed Apr 01 10:10:38 EDT 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
org.eclipse.jdt.core.builder.duplicateResourceTask=warning
@@ -160,7 +160,6 @@ org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
org.eclipse.jdt.core.formatter.indentation.size=4
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
diff --git a/bundles/org.eclipse.equinox.p2.repository/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.repository/META-INF/MANIFEST.MF
index e7b682c74..3fec7d7fa 100644
--- a/bundles/org.eclipse.equinox.p2.repository/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.repository/META-INF/MANIFEST.MF
@@ -9,7 +9,7 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ecf,
org.eclipse.equinox.p2.core
Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: J2SE-1.5,
+Bundle-RequiredExecutionEnvironment: J2SE-1.4,
CDC-1.1/Foundation-1.1
Bundle-Vendor: %providerName
Import-Package: org.eclipse.equinox.internal.p2.repository.helpers,
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/FileReader.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/FileReader.java
index c71772ec3..f9bf43efe 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/FileReader.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/FileReader.java
@@ -294,18 +294,16 @@ public class FileReader extends FileTransferJob implements IFileTransferListener
}
/**
- * Flushes a Flushable, and Closes a Closeable - errors are ignored.
- * @param stream
+ * Closes input and output streams
+ * @param aStream
*/
- public static void hardClose(Closeable stream) {
- if (stream != null) {
+ public static void hardClose(Object aStream) {
+ if (aStream != null) {
try {
- if (stream instanceof Flushable)
- ((Flushable) stream).flush();
- } catch (IOException e) { /* ignore */
- }
- try {
- stream.close();
+ if (aStream instanceof OutputStream)
+ ((OutputStream) aStream).close();
+ else if (aStream instanceof InputStream)
+ ((InputStream) aStream).close();
} catch (IOException e) { /* ignore */
}
}
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/ProgressStatistics.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/ProgressStatistics.java
index 839dbb1bd..f34a6c17f 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/ProgressStatistics.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/ProgressStatistics.java
@@ -7,6 +7,7 @@
******************************************************************************/
package org.eclipse.equinox.internal.p2.repository;
+import java.text.NumberFormat;
import java.util.*;
import java.util.Map.Entry;
import org.eclipse.osgi.util.NLS;
@@ -17,6 +18,7 @@ import org.eclipse.osgi.util.NLS;
* in progress monitoring is provided.
*
* @author thomas.hallgren@cloudsmith.com
+ * @author henrik.lindberg@cloudsmith.com (adaption to java 1.4)
*/
public class ProgressStatistics {
private static final int DEFAULT_REPORT_INTERVAL = 1000;
@@ -26,13 +28,15 @@ public class ProgressStatistics {
private static final int SPEED_RESOLUTION = 1000;
private static String convert(long amount) {
+ NumberFormat fmt = NumberFormat.getInstance();
if (amount < 1024)
- return String.format(Locale.US, "%dB", new Object[] {Long.valueOf(amount)}); //$NON-NLS-1$
+ return fmt.format(amount) + "B"; //$NON-NLS-1$
+ fmt.setMaximumFractionDigits(2);
if (amount < 1024 * 1024)
- return String.format(Locale.US, "%.2fkB", new Object[] {Double.valueOf(((double) amount) / 1024)}); //$NON-NLS-1$
+ return fmt.format(((double) amount) / 1024) + "kB"; //$NON-NLS-1$
- return String.format(Locale.US, "%.2fMB", new Object[] {Double.valueOf(((double) amount) / (1024 * 1024))}); //$NON-NLS-1$
+ return fmt.format(((double) amount) / (1024 * 1024)) + "MB"; //$NON-NLS-1$
}
private final String m_fileName;
@@ -88,7 +92,7 @@ public class ProgressStatistics {
removeObsoleteRecentSpeedData(getDuration() / SPEED_RESOLUTION);
long dur = 0L;
long amount = 0L;
- SortedMap relevantData = m_recentSpeedMap.headMap(Long.valueOf(m_recentSpeedMapKey));
+ SortedMap relevantData = m_recentSpeedMap.headMap(new Long(m_recentSpeedMapKey));
Iterator itor = relevantData.entrySet().iterator();
while (itor.hasNext()) {
@@ -138,13 +142,13 @@ public class ProgressStatistics {
}
synchronized private void registerRecentSpeed(long key, long inc) {
- Long keyL = Long.valueOf(key);
+ Long keyL = new Long(key);
Long currentValueL = (Long) m_recentSpeedMap.get(keyL);
long currentValue = 0L;
if (currentValueL != null)
currentValue = currentValueL.longValue();
- m_recentSpeedMap.put(keyL, Long.valueOf(inc + currentValue));
+ m_recentSpeedMap.put(keyL, new Long(inc + currentValue));
if (m_recentSpeedMapKey != key) {
m_recentSpeedMapKey = key;
@@ -154,6 +158,6 @@ public class ProgressStatistics {
synchronized private void removeObsoleteRecentSpeedData(long lastKey) {
long threshold = lastKey - SPEED_INTERVAL / SPEED_RESOLUTION;
- m_recentSpeedMap.headMap(Long.valueOf(threshold)).clear();
+ m_recentSpeedMap.headMap(new Long(threshold)).clear();
}
}

Back to the top