felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mccu...@apache.org
Subject svn commit: r1363873 - in /felix/trunk/bundleplugin/src/main/java/aQute: bnd/component/AnnotationReader.java bnd/osgi/Macro.java lib/json/Decoder.java lib/json/Encoder.java
Date Fri, 20 Jul 2012 16:50:39 GMT
Author: mcculls
Date: Fri Jul 20 16:50:39 2012
New Revision: 1363873

URL: http://svn.apache.org/viewvc?rev=1363873&view=rev
Log:
bndlib fixes

Modified:
    felix/trunk/bundleplugin/src/main/java/aQute/bnd/component/AnnotationReader.java
    felix/trunk/bundleplugin/src/main/java/aQute/bnd/osgi/Macro.java
    felix/trunk/bundleplugin/src/main/java/aQute/lib/json/Decoder.java
    felix/trunk/bundleplugin/src/main/java/aQute/lib/json/Encoder.java

Modified: felix/trunk/bundleplugin/src/main/java/aQute/bnd/component/AnnotationReader.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/aQute/bnd/component/AnnotationReader.java?rev=1363873&r1=1363872&r2=1363873&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/aQute/bnd/component/AnnotationReader.java (original)
+++ felix/trunk/bundleplugin/src/main/java/aQute/bnd/component/AnnotationReader.java Fri Jul
20 16:50:39 2012
@@ -27,7 +27,7 @@ import aQute.lib.collections.*;
 public class AnnotationReader extends ClassDataCollector {
 	final static TypeRef[]		EMPTY					= new TypeRef[0];
 	final static Pattern		PROPERTY_PATTERN		= Pattern
-																.compile("\\s*([^=\\s:]+)\\s*(?::\\s*(Boolean|Byte|Char|Short|Integer|Long|Float|Double|String)\\s*)?=(.*)");
+																.compile("\\s*([^=\\s:]+)\\s*(?::\\s*(Boolean|Byte|Character|Short|Integer|Long|Float|Double|String)\\s*)?=(.*)");
 
 	public static final Version	V1_1					= new Version("1.1.0");																											
// "1.1.0"
 	public static final Version	V1_2					= new Version("1.2.0");																											
// "1.1.0"

Modified: felix/trunk/bundleplugin/src/main/java/aQute/bnd/osgi/Macro.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/aQute/bnd/osgi/Macro.java?rev=1363873&r1=1363872&r2=1363873&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/aQute/bnd/osgi/Macro.java (original)
+++ felix/trunk/bundleplugin/src/main/java/aQute/bnd/osgi/Macro.java Fri Jul 20 16:50:39 2012
@@ -590,11 +590,11 @@ public class Macro {
 			throw new IllegalArgumentException(
 					"the ${ls} macro directory parameter points to a file instead of a directory: " + dir);
 
-		List<File> files = new ArrayList<File>(new SortedList<File>(dir.listFiles()));
+		Collection<File> files = new ArrayList<File>(new SortedList<File>(dir.listFiles()));
 
 		for (int i = 2; i < args.length; i++) {
 			Instructions filters = new Instructions(args[i]);
-			filters.select(files, true);
+			files = filters.select(files, true);
 		}
 
 		List<String> result = new ArrayList<String>();

Modified: felix/trunk/bundleplugin/src/main/java/aQute/lib/json/Decoder.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/aQute/lib/json/Decoder.java?rev=1363873&r1=1363872&r2=1363873&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/aQute/lib/json/Decoder.java (original)
+++ felix/trunk/bundleplugin/src/main/java/aQute/lib/json/Decoder.java Fri Jul 20 16:50:39
2012
@@ -4,6 +4,7 @@ import java.io.*;
 import java.lang.reflect.*;
 import java.security.*;
 import java.util.*;
+import java.util.zip.*;
 
 import aQute.lib.converter.*;
 
@@ -16,6 +17,7 @@ public class Decoder implements Closeabl
 	String				encoding	= "UTF-8";
 
 	boolean				strict;
+	boolean inflate;
 
 	Decoder(JSONCodec codec) {
 		this.codec = codec;
@@ -26,6 +28,10 @@ public class Decoder implements Closeabl
 	}
 
 	public Decoder from(InputStream in) throws Exception {
+	
+		if ( inflate)
+			in  = new InflaterInputStream(in);
+		
 		return from(new InputStreamReader(in, encoding));
 	}
 
@@ -140,4 +146,11 @@ public class Decoder implements Closeabl
 			extra = new HashMap<String,Object>();
 		return extra;
 	}
+	
+	public Decoder inflate() {
+		if ( reader != null)
+			throw new IllegalStateException("Reader already set, inflate must come before from()");
+		inflate = true;
+		return this;
+	}
 }

Modified: felix/trunk/bundleplugin/src/main/java/aQute/lib/json/Encoder.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/aQute/lib/json/Encoder.java?rev=1363873&r1=1363872&r2=1363873&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/aQute/lib/json/Encoder.java (original)
+++ felix/trunk/bundleplugin/src/main/java/aQute/lib/json/Encoder.java Fri Jul 20 16:50:39
2012
@@ -4,6 +4,7 @@ import java.io.*;
 import java.lang.reflect.*;
 import java.security.*;
 import java.util.*;
+import java.util.zip.*;
 
 public class Encoder implements Appendable, Closeable, Flushable {
 	final JSONCodec	codec;
@@ -11,7 +12,8 @@ public class Encoder implements Appendab
 	MessageDigest	digest;
 	boolean			writeDefaults;
 	String			encoding	= "UTF-8";
-
+	boolean deflate;
+	
 	Encoder(JSONCodec codec) {
 		this.codec = codec;
 	}
@@ -21,6 +23,7 @@ public class Encoder implements Appendab
 			to();
 
 		codec.encode(this, object, null, new IdentityHashMap<Object,Type>());
+		flush();
 		return this;
 	}
 
@@ -53,6 +56,9 @@ public class Encoder implements Appendab
 	}
 
 	public Encoder to(OutputStream out) throws IOException {
+		if ( deflate)
+			out = new DeflaterOutputStream(out);
+		
 		return to(new OutputStreamWriter(out, encoding));
 	}
 
@@ -109,4 +115,10 @@ public class Encoder implements Appendab
 			((Flushable) app).flush();
 		}
 	}
+	public Encoder deflate() {
+		if ( app != null)
+			throw new IllegalStateException("Writer already set, deflate must come before to(...)");
+		deflate = true;
+		return this;
+	}
 }



Mime
View raw message