This is an automated email from the ASF dual-hosted git repository.

qiaojialin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 85d3bf9  cherry pick from rel/0.9
85d3bf9 is described below

commit 85d3bf9f2d2e3c6f68061c5dece194a8b1c1659f
Author: qiaojialin <[email protected]>
AuthorDate: Wed Nov 20 17:13:41 2019 +0800

    cherry pick from rel/0.9
---
 .mvn/wrapper/MavenWrapperDownloader.java | 60 ++++++++++++++++++++------------
 LICENSE                                  |  7 ++++
 2 files changed, 44 insertions(+), 23 deletions(-)

diff --git a/.mvn/wrapper/MavenWrapperDownloader.java 
b/.mvn/wrapper/MavenWrapperDownloader.java
index afb969b..311a9d7 100644
--- a/.mvn/wrapper/MavenWrapperDownloader.java
+++ b/.mvn/wrapper/MavenWrapperDownloader.java
@@ -1,30 +1,31 @@
 /*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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
+ * Copyright 2007-present the original author or authors.
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * 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
  *
- * 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.
+ *      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.
  */
+import java.net.*;
+import java.io.*;
+import java.nio.channels.*;
 import java.util.Properties;
 
 public class MavenWrapperDownloader {
 
+  private static final String WRAPPER_VERSION = "0.5.5";
   /**
    * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' 
is provided.
    */
-  private static final String DEFAULT_DOWNLOAD_URL =
-      
"https://repo1.maven.org/maven2/io/takari/maven-wrapper/0.5.3/maven-wrapper-0.5.3.jar";;
+  private static final String DEFAULT_DOWNLOAD_URL = 
"https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/";
+      + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
 
   /**
    * Path to the maven-wrapper.properties file, which might contain a 
downloadUrl property to
@@ -45,13 +46,15 @@ public class MavenWrapperDownloader {
   private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
 
   public static void main(String args[]) {
+    System.out.println("- Downloader started");
     File baseDirectory = new File(args[0]);
+    System.out.println("- Using base directory: " + 
baseDirectory.getAbsolutePath());
 
     // If the maven-wrapper.properties exists, read it and check if it 
contains a custom
     // wrapperUrl parameter.
     File mavenWrapperPropertyFile = new File(baseDirectory, 
MAVEN_WRAPPER_PROPERTIES_PATH);
     String url = DEFAULT_DOWNLOAD_URL;
-    if (mavenWrapperPropertyFile.exists()) {
+    if(mavenWrapperPropertyFile.exists()) {
       FileInputStream mavenWrapperPropertyFileInputStream = null;
       try {
         mavenWrapperPropertyFileInputStream = new 
FileInputStream(mavenWrapperPropertyFile);
@@ -59,9 +62,10 @@ public class MavenWrapperDownloader {
         mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
         url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, 
url);
       } catch (IOException e) {
+        System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH 
+ "'");
       } finally {
         try {
-          if (mavenWrapperPropertyFileInputStream != null) {
+          if(mavenWrapperPropertyFileInputStream != null) {
             mavenWrapperPropertyFileInputStream.close();
           }
         } catch (IOException e) {
@@ -69,13 +73,13 @@ public class MavenWrapperDownloader {
         }
       }
     }
+    System.out.println("- Downloading from: " + url);
 
     File outputFile = new File(baseDirectory.getAbsolutePath(), 
MAVEN_WRAPPER_JAR_PATH);
-    if (!outputFile.getParentFile().exists()) {
-      if (!outputFile.getParentFile().mkdirs()) {
+    if(!outputFile.getParentFile().exists()) {
+      if(!outputFile.getParentFile().mkdirs()) {
         System.out.println(
-            "- ERROR creating output direcrory '" + 
outputFile.getParentFile().getAbsolutePath()
-                + "'");
+            "- ERROR creating output directory '" + 
outputFile.getParentFile().getAbsolutePath() + "'");
       }
     }
     System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
@@ -91,6 +95,16 @@ public class MavenWrapperDownloader {
   }
 
   private static void downloadFileFromURL(String urlString, File destination) 
throws Exception {
+    if (System.getenv("MVNW_USERNAME") != null && 
System.getenv("MVNW_PASSWORD") != null) {
+      String username = System.getenv("MVNW_USERNAME");
+      char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
+      Authenticator.setDefault(new Authenticator() {
+        @Override
+        protected PasswordAuthentication getPasswordAuthentication() {
+          return new PasswordAuthentication(username, password);
+        }
+      });
+    }
     URL website = new URL(urlString);
     ReadableByteChannel rbc;
     rbc = Channels.newChannel(website.openStream());
@@ -100,4 +114,4 @@ public class MavenWrapperDownloader {
     rbc.close();
   }
 
-}
+}
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
index 820bcc8..18a4690 100644
--- a/LICENSE
+++ b/LICENSE
@@ -217,6 +217,13 @@ The following classes are modified from Apache Hive, which 
is under Apache Licen
 
 ------------
 
+The following class is copied from maven-wrapper 
(https://github.com/takari/maven-wrapper),
+which is under Apache License 2.0:
+
+./.mvn/wrapper/MavenWrapperDownloader.java
+
+------------
+
 The following class is modified from Apache commons-collections
 
 ./tsfile/src/main/java/org/apache/iotdb/tsfile/utils/Murmur128Hash.java

Reply via email to