Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
target
node_modules
.idea
.vscode
*.iml

*.pydevproject
Expand Down
8 changes: 8 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
# Changes to the SDK
### Version 3.0.0
1. Replaced custom OAuth2 implementation with Azure Identity `TokenCredential` support.
2. Updated `ADLStoreClient` factory methods to accept Azure Identity credentials and added dependency on `com.azure:azure-identity` 1.17.0.
3. Updated live service tests to authenticate with `DefaultAzureCredential`.
4. Removed the deprecated `oauth2` module now that Azure Identity is the sole authentication mechanism.
5. Added an API to override the `TokenRequestContext` used for Azure Identity token acquisition with a default scope of `https://datalake.azure.net/.default`.
6. Simplified static access token handling to rely on caller-managed expiry.

### Version 2.3.10
1. Update log4j to mitigate CVE-2021-44228. Also update junit.
2. ERRATA: This impacts only tests in this repository. SLF4J(See http://slf4j.org/log4shell.html) interface is used for logging and if log4j is available, it can be used depending on customer configuration. The version depends on customer application built using the sdk. Previous versions of sdk(<2.3.10) are not impacted by log4j CVE
Expand Down
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# Azure Datalake Store client for Java


- For an introduction to Azure Data Lake, see here: https://azure.microsoft.com/en-us/services/data-lake-store/

- For getting started introduction to the SDK, see here: https://github.com/Azure-samples/data-lake-store-java-upload-download-get-started

- For the SDK Javadoc, see here: http://azure.github.io/azure-data-lake-store-java/javadoc




## Dependency maintenance
- To refresh dependencies to the latest stable releases, run `mvn versions:use-latest-releases -DincludeScope=compile "-Dmaven.version.ignore=.*-alpha.*,.*-beta.*,.*-rc.*"` from the project root.
- Review the resulting changes in `pom.xml` before committing to confirm no prerelease versions slipped through.
12 changes: 12 additions & 0 deletions config/checkstyle/unused-imports.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
<module name="TreeWalker">
<module name="com.puppycrawl.tools.checkstyle.checks.imports.UnusedImportsCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.imports.RedundantImportCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.coding.EqualsHashCodeCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.design.HideUtilityClassConstructorCheck"/>
</module>
</module>
13 changes: 13 additions & 0 deletions config/pmd/ruleset.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="Azure Data Lake Store PMD Rules"
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.net/ruleset_2_0_0.xsd">
<description>Rules focused on catching unused code and common correctness issues.</description>

<rule ref="category/java/bestpractices.xml/UnusedPrivateField"/>
<rule ref="category/java/bestpractices.xml/UnusedPrivateMethod"/>
<rule ref="category/java/bestpractices.xml/UnusedLocalVariable"/>
<rule ref="category/java/bestpractices.xml/UnusedImports"/>
<rule ref="category/java/errorprone.xml/BrokenNullCheck"/>
</ruleset>
139 changes: 120 additions & 19 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jackson.version>2.20.0</jackson.version>
<maven.compiler.release>8</maven.compiler.release>
</properties>

<build>
Expand All @@ -56,31 +58,43 @@
<include>**/*.properties</include>
</includes>
</testResource>
<testResource>
<directory>src/test/resources</directory>
<filtering>false</filtering>
</testResource>
</testResources>


<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<version>3.14.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<release>${maven.compiler.release}</release>
<failOnWarning>true</failOnWarning>
<showWarnings>true</showWarnings>
<compilerArgs>
<arg>-Xlint:all</arg>
<!-- Suppress annotation processing warnings triggered by generated sources -->
<arg>-Xlint:-processing</arg>
<!-- Suppress JDK warnings about legacy source/target flags when using the release option -->
<arg>-Xlint:-options</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
<version>3.1.4</version>
<configuration>
<createChecksum>true</createChecksum>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.5</version>
<version>3.4.2</version>
<configuration>
<archive>
<manifest>
Expand All @@ -96,7 +110,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.0</version>
<version>3.3.1</version>
<executions>
<execution>
<id>attach-sources</id>
Expand All @@ -109,7 +123,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.1</version>
<version>3.12.0</version>
<configuration>
<quiet>true</quiet> <!-- only show warnings and errors during build -->
</configuration>
Expand All @@ -125,7 +139,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M7</version>
<version>3.5.4</version>
<configuration>
<useFile>true</useFile>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
Expand All @@ -134,7 +148,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<version>3.3.1</version>
<executions>
<execution>
<id>copy-resources</id>
Expand All @@ -152,6 +166,13 @@
<exclude>.gitignore</exclude>
</excludes>
</resource>
<resource>
<directory>src/test/resources</directory>
<filtering>false</filtering>
<includes>
<include>log4j2.xml</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
Expand All @@ -164,61 +185,141 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.8.6</version>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.21</version>
<version>2.0.17</version>
</dependency>
<dependency>
<groupId>org.wildfly.openssl</groupId>
<artifactId>wildfly-openssl</artifactId>
<version>1.0.7.Final</version>
<version>2.2.5.Final</version>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-identity</artifactId>
<version>1.18.0</version>
</dependency>

<!-- Test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>mockwebserver</artifactId>
<version>3.2.0</version>
<version>5.1.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.15.0</version>
<artifactId>log4j-slf4j2-impl</artifactId>
<version>2.25.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.17.0</version>
<version>2.25.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.17.1</version>
<version>2.25.2</version>
<scope>test</scope>
</dependency>
</dependencies>

<profiles>
<profile>
<id>java11</id>
<properties>
<maven.compiler.release>11</maven.compiler.release>
</properties>
</profile>
<profile>
<id>java17</id>
<properties>
<maven.compiler.release>17</maven.compiler.release>
</properties>
</profile>
<profile>
<id>java21</id>
<properties>
<maven.compiler.release>21</maven.compiler.release>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.6.0</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>11.1.0</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>check-unused-imports</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
<configuration>
<failOnViolation>true</failOnViolation>
<configLocation>config/checkstyle/unused-imports.xml</configLocation>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
<consoleOutput>true</consoleOutput>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.27.0</version>
<configuration>
<targetJdk>21</targetJdk>
<printFailingErrors>true</printFailingErrors>
<rulesets>
<ruleset>config/pmd/ruleset.xml</ruleset>
</rulesets>
</configuration>
<executions>
<execution>
<id>pmd-check</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>adlsRelease</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<version>3.2.8</version>
<executions>
<execution>
<id>sign-artifacts</id>
Expand Down
24 changes: 24 additions & 0 deletions scripts/validate-lts.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
param(
[string]$MavenExecutable = "mvn"
)

$commands = @(
@{ Name = "Java 8"; Args = @("clean", "compile", "-DskipTests") },
@{ Name = "Java 11"; Args = @("-Pjava11", "clean", "compile", "-DskipTests") },
@{ Name = "Java 17"; Args = @("-Pjava17", "clean", "compile", "-DskipTests") },
@{ Name = "Java 21"; Args = @("-Pjava21", "clean", "compile", "-DskipTests") },
@{ Name = "Restore Java 8"; Args = @("clean", "compile", "-DskipTests") }
)

foreach ($command in $commands) {
Write-Host "==> Building with $($command.Name)" -ForegroundColor Cyan
Write-Host " $MavenExecutable $($command.Args -join ' ')" -ForegroundColor DarkGray

& $MavenExecutable @($command.Args)
if ($LASTEXITCODE -ne 0) {
Write-Error "Build failed for $($command.Name)"
exit $LASTEXITCODE
}
}

Write-Host "All LTS compilation checks completed successfully." -ForegroundColor Green
13 changes: 13 additions & 0 deletions src/main/java/com/microsoft/azure/datalake/store/ADLException.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*/
public class ADLException extends IOException {

private static final long serialVersionUID = 1L;

/**
* the HTTP response code returned by the server
*/
Expand Down Expand Up @@ -65,10 +67,21 @@ public class ADLException extends IOException {
*/
public String remoteExceptionJavaClassName = null;

/**
* Creates a new exception with the supplied message.
*
* @param message description of the failure condition.
*/
public ADLException(String message) {
super(message);
}

/**
* Creates a new exception with the supplied message and root cause.
*
* @param message description of the failure condition.
* @param initCause underlying exception that triggered this failure.
*/
public ADLException(String message, Throwable initCause) {
super(message, initCause);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,11 @@ public void close() throws IOException {
streamClosed = true;
buffer = null; // de-reference the buffer so it can be GC'ed sooner
}


/**
* Returns the fully qualified path for the file backing this stream.
*
* @return path of the file represented by the stream.
*/
public String getFilename() {
return this.filename;
}
Expand Down
Loading