Skip to content
Merged

Dev #311

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
3e422ed
fix for issue 188, broker properties mapper
Mar 6, 2013
32b0c8b
fix for issue 189, unicode issues in BrokeredMessage
Mar 6, 2013
7595d28
fix for issue 191, unicode issues in BlobOperationRestProxy.java
Mar 6, 2013
dbff29a
update the unicode issues in HmacSHA256Sign file, issue 192#.
Mar 7, 2013
3ff10d5
fix base64 string adapter encoding issue, issue #193.
Mar 7, 2013
225aa9a
fix issue #194, unicode issue in DefaultEdmValueConverter.java
Mar 7, 2013
0ecdd94
add the missing DefaultEdmValueConverter.java file
Mar 7, 2013
171f6ad
Merge pull request #23 from gcheng/global
Mar 7, 2013
bd596d9
Merge pull request #288 from gcheng/dev
Mar 7, 2013
6aea867
Merge branch 'release' of https://github.com/WindowsAzure/azure-sdk-f…
Mar 9, 2013
be09f31
throw exception when you create or update null message.
Mar 11, 2013
bff956b
Merge pull request #24 from gcheng/global
Mar 12, 2013
ab6b488
Merge pull request #293 from gcheng/dev
Mar 12, 2013
fb2b701
Merge pull request #295 from WindowsAzure/release
Mar 14, 2013
75d7a8c
Merge pull request #296 from WindowsAzure/master
Mar 14, 2013
c8561a2
fix the global date parsing issue.
Mar 22, 2013
cce6e7c
fix the javadoc documentation issue.
Mar 22, 2013
ff2397d
Merge branch 'dev' of https://github.com/gcheng/azure-sdk-for-java in…
Mar 22, 2013
42d86ee
Merge pull request #27 from WindowsAzure/dev
Mar 22, 2013
e6b0f5b
Merge branch 'dev' of https://github.com/gcheng/azure-sdk-for-java in…
Mar 22, 2013
dcd468f
Merge pull request #25 from gcheng/global
Mar 22, 2013
087ec84
Merge pull request #26 from gcheng/packagedoc
Mar 22, 2013
405d480
Merge pull request #300 from gcheng/dev
Mar 22, 2013
dcc2a07
Updating version number to 0.4.2
jcookems Mar 25, 2013
81f1269
Merge pull request #302 from jcookems/dev
jcookems Mar 25, 2013
3e76780
fix the failure of a few global unit tests.
Mar 25, 2013
38a9727
Merge pull request #28 from gcheng/global
Mar 25, 2013
9d7c79c
Merge pull request #304 from gcheng/dev
Mar 25, 2013
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ within your project you can also have them installed by the Java package manager
<dependency>
<groupId>com.microsoft.windowsazure</groupId>
<artifactId>microsoft-windowsazure-api</artifactId>
<version>0.4.1</version>
<version>0.4.2</version>
</dependency>

##Minimum Requirements
Expand Down
4 changes: 2 additions & 2 deletions microsoft-azure-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.microsoft.windowsazure</groupId>
<artifactId>microsoft-windowsazure-api</artifactId>
<version>0.4.1</version>
<version>0.4.2</version>
<packaging>jar</packaging>

<name>Microsoft Windows Azure Client API</name>
Expand Down Expand Up @@ -169,7 +169,7 @@
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8</version>
<configuration>
<excludePackageNames>*.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization</excludePackageNames>
<excludePackageNames>*.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.storage</excludePackageNames>
<bottom><![CDATA[<code>/**
<br/>* Copyright Microsoft Corporation
<br/>*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
* Copyright Microsoft Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.microsoft.windowsazure.serviceruntime;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
* Copyright Microsoft Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.microsoft.windowsazure.serviceruntime;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package com.microsoft.windowsazure.services.blob.implementation;

import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Map;

Expand Down Expand Up @@ -808,7 +809,8 @@ public void breakLease(String container, String blob, String leaseId) throws Ser

@Override
@Deprecated
public void breakLease(String container, String blob, String leaseId, BlobServiceOptions options) throws ServiceException {
public void breakLease(String container, String blob, String leaseId, BlobServiceOptions options)
throws ServiceException {
breakLease(container, blob, options);
}

Expand All @@ -819,8 +821,8 @@ public BreakLeaseResult breakLease(String container, String blob) throws Service

@Override
public BreakLeaseResult breakLease(String container, String blob, BlobServiceOptions options)
throws ServiceException {
ClientResponse response = doLeaseOperation("break", container, blob, null, options, null);
throws ServiceException {
ClientResponse response = doLeaseOperation("break", container, blob, null, options, null);

BreakLeaseResult result = new BreakLeaseResult();
result.setRemainingLeaseTimeInSeconds(Integer.parseInt(response.getHeaders().getFirst("x-ms-lease-time")));
Expand All @@ -836,7 +838,8 @@ private AcquireLeaseResult putLeaseImpl(String leaseAction, String container, St
return result;
}

private ClientResponse doLeaseOperation(String leaseAction, String container, String blob, String leaseId, BlobServiceOptions options, AccessCondition accessCondition) {
private ClientResponse doLeaseOperation(String leaseAction, String container, String blob, String leaseId,
BlobServiceOptions options, AccessCondition accessCondition) {
String path = createPathFromContainer(container);
WebResource webResource = getResource(options).path(path).path(blob).queryParam("comp", "lease");

Expand Down Expand Up @@ -941,7 +944,12 @@ public void createBlobBlock(String container, String blob, String blockId, Input
CreateBlobBlockOptions options) throws ServiceException {
String path = createPathFromContainer(container);
WebResource webResource = getResource(options).path(path).path(blob).queryParam("comp", "block");
webResource = addOptionalQueryParam(webResource, "blockid", new String(Base64.encode(blockId)));
try {
webResource = addOptionalQueryParam(webResource, "blockid", new String(Base64.encode(blockId), "UTF-8"));
}
catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}

Builder builder = webResource.header("x-ms-version", API_VERSION);
builder = addOptionalHeader(builder, "x-ms-lease-id", options.getLeaseId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
* Copyright Microsoft Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.microsoft.windowsazure.services.blob.implementation;

Expand All @@ -33,8 +33,8 @@ public String sign(String stringToSign) {

Mac hmac = Mac.getInstance("hmacSHA256");
hmac.init(new SecretKeySpec(Base64.decode(accessKey), "hmacSHA256"));
byte[] digest = hmac.doFinal(stringToSign.getBytes("UTF8"));
return new String(Base64.encode(digest));
byte[] digest = hmac.doFinal(stringToSign.getBytes("UTF-8"));
return new String(Base64.encode(digest), "UTF-8");
}
catch (Exception e) {
throw new IllegalArgumentException("accessKey", e);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<html>
<head />
<body>This package contains the core classes across difference services.
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<html>
<head />
<body>This package contains the blob service core class and interface,
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
* Copyright Microsoft Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.microsoft.windowsazure.services.core.utils.pipeline;

Expand All @@ -25,7 +25,7 @@ public class Base64StringAdapter extends XmlAdapter<String, String> {

@Override
public String marshal(String arg0) throws Exception {
return new String(Base64.encode(arg0));
return new String(Base64.encode(arg0), "UTF-8");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<html>
<head />
<body>This package contains the media service OData operation class, interface, and utility classes.
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<html>
<head />
<body>This package contains the media service data transfer object classes.
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<html>
<head />
<body>This package contains the media services, interface, and associated configuration and utility classes.
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ public QueueRestProxy(HttpURLConnectionClient channel, ServiceFilter[] filters,
public QueueContract withFilter(ServiceFilter filter) {
ServiceFilter[] newFilters = Arrays.copyOf(filters, filters.length + 1);
newFilters[filters.length] = filter;
return new QueueRestProxy(this.channel, newFilters, this.accountName, this.url, this.sharedKeyFilter, this.dateMapper);
return new QueueRestProxy(this.channel, newFilters, this.accountName, this.url, this.sharedKeyFilter,
this.dateMapper);
}

private void ThrowIfError(ClientResponse r) {
Expand Down Expand Up @@ -261,7 +262,10 @@ public void createMessage(String queue, String messageText) throws ServiceExcept
@Override
public void createMessage(String queue, String messageText, CreateMessageOptions options) throws ServiceException {
if (queue == null)
throw new NullPointerException();
throw new NullPointerException("queue");
if (messageText == null) {
throw new NullPointerException("messageText");
}

WebResource webResource = getResource(options).path(queue).path("messages");
webResource = addOptionalQueryParam(webResource, "visibilitytimeout", options.getVisibilityTimeoutInSeconds());
Expand All @@ -286,9 +290,11 @@ public UpdateMessageResult updateMessage(String queue, String messageId, String
public UpdateMessageResult updateMessage(String queue, String messageId, String popReceipt, String messageText,
int visibilityTimeoutInSeconds, QueueServiceOptions options) throws ServiceException {
if (queue == null)
throw new NullPointerException();
throw new NullPointerException("queue");
if (messageId == null)
throw new NullPointerException();
throw new NullPointerException("messageId");
if (messageText == null)
throw new NullPointerException("messageText");

WebResource webResource = getResource(options).path(queue).path("messages").path(messageId);
webResource = addOptionalQueryParam(webResource, "popreceipt", popReceipt);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
import java.text.SimpleDateFormat;
import java.util.Locale;

import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.JsonParseException;
Expand All @@ -26,9 +28,12 @@
public class BrokerPropertiesMapper {

public BrokerProperties fromString(String value) throws IllegalArgumentException {

ObjectMapper mapper = new ObjectMapper();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US);
mapper.setDateFormat(simpleDateFormat);
try {
return mapper.readValue(value.getBytes(), BrokerProperties.class);
return mapper.readValue(value.getBytes("UTF-8"), BrokerProperties.class);
}
catch (JsonParseException e) {
throw new IllegalArgumentException(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
* Copyright Microsoft Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.microsoft.windowsazure.services.serviceBus.implementation;

Expand All @@ -19,6 +19,7 @@
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;

public class CustomPropertiesMapper {
Expand Down Expand Up @@ -53,14 +54,14 @@ else if (type == Boolean.class) {
return value.toString();
}
else if (Calendar.class.isAssignableFrom(type)) {
DateFormat format = new SimpleDateFormat(RFC_1123);
DateFormat format = new SimpleDateFormat(RFC_1123, Locale.US);
Calendar calendar = (Calendar) value;
format.setTimeZone(calendar.getTimeZone());
String formatted = format.format(calendar.getTime());
return "\"" + formatted + "\"";
}
else if (Date.class.isAssignableFrom(type)) {
DateFormat format = new SimpleDateFormat(RFC_1123);
DateFormat format = new SimpleDateFormat(RFC_1123, Locale.US);
format.setTimeZone(TimeZone.getTimeZone("GMT"));
String formatted = format.format((Date) value);
return "\"" + formatted + "\"";
Expand All @@ -78,7 +79,7 @@ public Object fromString(String value) throws ParseException {
if (value.startsWith("\"") && value.endsWith("\"")) {
String text = value.substring(1, value.length() - 1);
if (isRFC1123(text)) {
SimpleDateFormat format = new SimpleDateFormat(RFC_1123);
SimpleDateFormat format = new SimpleDateFormat(RFC_1123, Locale.US);
return format.parse(text);
}

Expand All @@ -103,7 +104,7 @@ private boolean isRFC1123(String text) {
return false;
}
try {
SimpleDateFormat format = new SimpleDateFormat(RFC_1123);
SimpleDateFormat format = new SimpleDateFormat(RFC_1123, Locale.US);
format.parse(text);
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
Expand Down Expand Up @@ -70,7 +71,12 @@ public BrokeredMessage(byte[] body) {
*/
public BrokeredMessage(String body) {
this(new BrokerProperties());
this.body = (body == null) ? null : new ByteArrayInputStream(body.getBytes());
try {
this.body = (body == null) ? null : new ByteArrayInputStream(body.getBytes("UTF-8"));
}
catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import com.microsoft.windowsazure.services.core.Builder;
import com.microsoft.windowsazure.services.core.UserAgentFilter;
import com.microsoft.windowsazure.services.table.implementation.AtomReaderWriter;
import com.microsoft.windowsazure.services.table.implementation.DefaultEdmValueConterter;
import com.microsoft.windowsazure.services.table.implementation.DefaultEdmValueConverter;
import com.microsoft.windowsazure.services.table.implementation.DefaultXMLStreamFactory;
import com.microsoft.windowsazure.services.table.implementation.HttpReaderWriter;
import com.microsoft.windowsazure.services.table.implementation.MimeReaderWriter;
Expand All @@ -39,7 +39,7 @@ public void register(Builder.Registry registry) {
registry.add(AtomReaderWriter.class);
registry.add(MimeReaderWriter.class);
registry.add(HttpReaderWriter.class);
registry.add(EdmValueConverter.class, DefaultEdmValueConterter.class);
registry.add(EdmValueConverter.class, DefaultEdmValueConverter.class);
registry.add(UserAgentFilter.class);
}
}
Loading