diff --git a/aws-sdk-java-archetype-master/src/main/resources/archetype-resources/src/main/java/AwsSdkSample.java b/aws-sdk-java-archetype-master/src/main/resources/archetype-resources/src/main/java/AwsSdkSample.java index ff0a1db21..b53affd6c 100644 --- a/aws-sdk-java-archetype-master/src/main/resources/archetype-resources/src/main/java/AwsSdkSample.java +++ b/aws-sdk-java-archetype-master/src/main/resources/archetype-resources/src/main/java/AwsSdkSample.java @@ -1,6 +1,3 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) /* * Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved. * diff --git a/aws-toolkit-eclipse-master/bundles/com.amazonaws.eclipse.core/src/com/amazonaws/eclipse/core/egit/RepositorySelection.java b/aws-toolkit-eclipse-master/bundles/com.amazonaws.eclipse.core/src/com/amazonaws/eclipse/core/egit/RepositorySelection.java index 0c5a94c97..b5fbb1a2d 100644 --- a/aws-toolkit-eclipse-master/bundles/com.amazonaws.eclipse.core/src/com/amazonaws/eclipse/core/egit/RepositorySelection.java +++ b/aws-toolkit-eclipse-master/bundles/com.amazonaws.eclipse.core/src/com/amazonaws/eclipse/core/egit/RepositorySelection.java @@ -67,22 +67,17 @@ public RepositorySelection(final URIish uri, final RemoteConfig config) { * selection */ public URIish getURI(boolean pushMode) { - if (isConfigSelected()) - if (pushMode) { - if (config.getPushURIs().size() > 0) - return config.getPushURIs().get(0); - else if (config.getURIs().size() > 0) - return config.getURIs().get(0); - else - return null; - } else { - if (config.getURIs().size() > 0) - return config.getURIs().get(0); - else if (config.getPushURIs().size() > 0) - return config.getPushURIs().get(0); - else - return null; + if (isConfigSelected()) { + boolean pushOptions = config.getPushURIs().size() > 0; + boolean uriOptions = config.getURIs().size() > 0; + URIish returnOption = null; + if ((pushOptions && pushMode) || (!pushMode && !uriOptions)) { + returnOption = config.getPushURIs().get(0); + } else if ((!pushOptions && pushMode) || (!pushMode && !pushOptions)) { + returnOption = config.getURIs().get(0); } + return returnOption; + } return uri; } @@ -184,4 +179,4 @@ else if (config != null) return config.hashCode(); return 31; } -} \ No newline at end of file +} diff --git a/aws-toolkit-eclipse-master/bundles/com.amazonaws.eclipse.sdk.ui/samples/AmazonEC2SpotInstances-Advanced/InlineTaggingCodeSampleApp.java b/aws-toolkit-eclipse-master/bundles/com.amazonaws.eclipse.sdk.ui/samples/AmazonEC2SpotInstances-Advanced/InlineTaggingCodeSampleApp.java index 0c48af7e4..57a748aa3 100644 --- a/aws-toolkit-eclipse-master/bundles/com.amazonaws.eclipse.sdk.ui/samples/AmazonEC2SpotInstances-Advanced/InlineTaggingCodeSampleApp.java +++ b/aws-toolkit-eclipse-master/bundles/com.amazonaws.eclipse.sdk.ui/samples/AmazonEC2SpotInstances-Advanced/InlineTaggingCodeSampleApp.java @@ -66,7 +66,7 @@ public class InlineTaggingCodeSampleApp { * credentials from. * https://console.aws.amazon.com/iam/home?#security_credential * - * WARNING: + * WARNING: * To avoid accidental leakage of your credentials, DO NOT keep * the credentials file in your source directory. */ @@ -93,9 +93,9 @@ public static void main(String[] args) { } // Create the AmazonEC2Client object so we can call various APIs. - AmazonEC2 ec2 = AmazonEC2ClientBuilder.standard() - .withCredentials(new AWSStaticCredentialsProvider(credentials)) - .withRegion("us-west-2") + AmazonEC2 ec2 = AmazonEC2ClientBuilder.standard() + .withCredentials(new AWSStaticCredentialsProvider(credentials)) + .withRegion("us-west-2") .build(); // Initializes a Spot Instance Request @@ -149,20 +149,11 @@ public static void main(String[] args) { // Create a tag request for requests. CreateTagsRequest createTagsRequest_requests = new CreateTagsRequest(); + createTagsRequest_requests.setResources(spotInstanceRequestIds); createTagsRequest_requests.setTags(requestTags); - // Try to tag the Spot request submitted. - try { - ec2.createTags(createTagsRequest_requests); - } catch (AmazonServiceException e) { - // Write out any exceptions that may have occurred. - System.out.println("Error terminating instances"); - System.out.println("Caught Exception: " + e.getMessage()); - System.out.println("Reponse Status Code: " + e.getStatusCode()); - System.out.println("Error Code: " + e.getErrorCode()); - System.out.println("Request ID: " + e.getRequestId()); - } + handleException(createTagsRequest_requests, ec2); //============================================================================================// //=========================== Determining the State of the Spot Request ======================// @@ -228,18 +219,8 @@ public static void main(String[] args) { createTagsRequest_instances.setResources(instanceIds); createTagsRequest_instances.setTags(instanceTags); - // Try to tag the Spot instance started. - try { - ec2.createTags(createTagsRequest_instances); - } catch (AmazonServiceException e) { - // Write out any exceptions that may have occurred. - System.out.println("Error terminating instances"); - System.out.println("Caught Exception: " + e.getMessage()); - System.out.println("Reponse Status Code: " + e.getStatusCode()); - System.out.println("Error Code: " + e.getErrorCode()); - System.out.println("Request ID: " + e.getRequestId()); - } - + handleException(createTagsRequest_instances, ec2); + //============================================================================================// //====================================== Canceling the Request ==============================// //============================================================================================// @@ -274,5 +255,18 @@ public static void main(String[] args) { } } - + + private static void handleException(CreateTagsRequest createTagsRequest_requests, AmazonEC2 ec2) { + // Try to tag the Spot request submitted. + try { + ec2.createTags(createTagsRequest_requests); + } catch (AmazonServiceException e) { + // Write out any exceptions that may have occurred. + System.out.println("Error terminating instances"); + System.out.println("Caught Exception: " + e.getMessage()); + System.out.println("Reponse Status Code: " + e.getStatusCode()); + System.out.println("Error Code: " + e.getErrorCode()); + System.out.println("Request ID: " + e.getRequestId()); + } + } }