You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@archiva.apache.org by br...@apache.org on 2012/01/22 23:57:03 UTC
svn commit: r1234639 -
/archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultCommonServices.java
Author: brett
Date: Sun Jan 22 22:57:02 2012
New Revision: 1234639
URL: http://svn.apache.org/viewvc?rev=1234639&view=rev
Log:
remove JDK 6 specific API
Modified:
archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultCommonServices.java
Modified: archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultCommonServices.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultCommonServices.java?rev=1234639&r1=1234638&r2=1234639&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultCommonServices.java (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultCommonServices.java Sun Jan 22 22:57:02 2012
@@ -22,6 +22,7 @@ import org.apache.archiva.rest.api.servi
import org.apache.archiva.rest.api.services.CommonServices;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
+import org.codehaus.plexus.util.StringInputStream;
import org.codehaus.redback.rest.api.services.RedbackServiceException;
import org.codehaus.redback.rest.api.services.UtilServices;
import org.slf4j.Logger;
@@ -30,6 +31,7 @@ import org.springframework.stereotype.Se
import javax.inject.Inject;
import javax.ws.rs.core.Response;
+import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.StringReader;
@@ -145,12 +147,11 @@ public class DefaultCommonServices
private void loadFromString( String propsStr, Properties properties )
throws ArchivaRestServiceException
{
-
- StringReader stringReader = null;
+ InputStream inputStream = null;
try
{
- stringReader = new StringReader( propsStr );
- properties.load( stringReader );
+ inputStream = new ByteArrayInputStream( propsStr.getBytes() );
+ properties.load( inputStream );
}
catch ( IOException e )
{
@@ -159,7 +160,7 @@ public class DefaultCommonServices
}
finally
{
- IOUtils.closeQuietly( stringReader );
+ IOUtils.closeQuietly( inputStream );
}
}
}
Re: svn commit: r1234639 - /archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultCommonServices.java
Posted by Brett Porter <br...@apache.org>.
On 23/01/2012, at 10:55 AM, Olivier Lamy wrote:
> Thanks Brett !
>
> I tried animal sniffer to prevent that but have a weird issue and
> didn't get time to investigate.
>
> see https://gist.github.com/1659445
In the test repository, there are "fake" files - so that's a 0-byte JAR, just to test there being a file there. it probably should be an empty JAR instead of a 0-byte file.
But animal sniffer shouldn't be trying to check signatures on that stuff anyway - it's just that it's in target/classes so it can be easily JARred and reused.
I think I'll change the test-repository to a ZIP which is more correct (the faster solution would be to skip animal sniffer in that project, which I can also do).
- Brett
--
Brett Porter
brett@apache.org
http://brettporter.wordpress.com/
http://au.linkedin.com/in/brettporter
http://twitter.com/brettporter
Re: svn commit: r1234639 - /archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultCommonServices.java
Posted by Olivier Lamy <ol...@apache.org>.
Thanks Brett !
I tried animal sniffer to prevent that but have a weird issue and
didn't get time to investigate.
see https://gist.github.com/1659445
2012/1/22 <br...@apache.org>:
> Author: brett
> Date: Sun Jan 22 22:57:02 2012
> New Revision: 1234639
>
> URL: http://svn.apache.org/viewvc?rev=1234639&view=rev
> Log:
> remove JDK 6 specific API
>
> Modified:
> archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultCommonServices.java
>
> Modified: archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultCommonServices.java
> URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultCommonServices.java?rev=1234639&r1=1234638&r2=1234639&view=diff
> ==============================================================================
> --- archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultCommonServices.java (original)
> +++ archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultCommonServices.java Sun Jan 22 22:57:02 2012
> @@ -22,6 +22,7 @@ import org.apache.archiva.rest.api.servi
> import org.apache.archiva.rest.api.services.CommonServices;
> import org.apache.commons.io.IOUtils;
> import org.apache.commons.lang.StringUtils;
> +import org.codehaus.plexus.util.StringInputStream;
> import org.codehaus.redback.rest.api.services.RedbackServiceException;
> import org.codehaus.redback.rest.api.services.UtilServices;
> import org.slf4j.Logger;
> @@ -30,6 +31,7 @@ import org.springframework.stereotype.Se
>
> import javax.inject.Inject;
> import javax.ws.rs.core.Response;
> +import java.io.ByteArrayInputStream;
> import java.io.IOException;
> import java.io.InputStream;
> import java.io.StringReader;
> @@ -145,12 +147,11 @@ public class DefaultCommonServices
> private void loadFromString( String propsStr, Properties properties )
> throws ArchivaRestServiceException
> {
> -
> - StringReader stringReader = null;
> + InputStream inputStream = null;
> try
> {
> - stringReader = new StringReader( propsStr );
> - properties.load( stringReader );
> + inputStream = new ByteArrayInputStream( propsStr.getBytes() );
> + properties.load( inputStream );
> }
> catch ( IOException e )
> {
> @@ -159,7 +160,7 @@ public class DefaultCommonServices
> }
> finally
> {
> - IOUtils.closeQuietly( stringReader );
> + IOUtils.closeQuietly( inputStream );
> }
> }
> }
>
>
--
Olivier Lamy
Talend: http://coders.talend.com
http://twitter.com/olamy | http://linkedin.com/in/olamy