Skip to content

Commit

Permalink
created 'JavaNetUriAccess' interface and added getter setter for the …
Browse files Browse the repository at this point in the history
…same in SharedSceret class
  • Loading branch information
Harsh4902 committed Jun 7, 2024
1 parent 1cbd9bc commit a2b9067
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 10 deletions.
1 change: 0 additions & 1 deletion output.txt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package jdk.internal.misc;

public interface JavaNetUriAccess {
// We can add more necessary methods here
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public class SharedSecrets {
private static JavaObjectInputStreamAccess javaObjectInputStreamAccess;
private static JavaObjectInputFilterAccess javaObjectInputFilterAccess;
private static JavaObjectInputStreamReadString javaObjectInputStreamReadString;
private static JavaNetUriAccess javaNetUriAccess;

// (required for EnumSet ops)
public static JavaLangAccess getJavaLangAccess() {
Expand Down Expand Up @@ -207,4 +208,12 @@ public static JavaObjectInputStreamReadString getJavaObjectInputStreamReadString
public static void setJavaObjectInputStreamReadString(JavaObjectInputStreamReadString access) {
javaObjectInputStreamReadString = access;
}

public static void setJavaNetUriAccess(JavaNetUriAccess jnua) {
javaNetUriAccess = jnua;
}

public static JavaNetUriAccess getJavaNetUriAccess() {
return javaNetUriAccess;
}
}
21 changes: 12 additions & 9 deletions src/tests/gov/nasa/jpf/test/java/io/FileTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,18 @@ public void testEquals() {

@Test
public void testToURI(){
File file = new File("testfile.txt");
URI expectedURI = null;
try {
expectedURI = new File(file.getAbsolutePath()).toURI();
} catch (Exception e) {
fail("URISyntaxException thrown while constructing expected URI");
if(verifyNoPropertyViolation()){
File file = new File("testfile.txt");
URI expectedURI = null;
try {
expectedURI = new URI("file:" + file.getAbsolutePath());
} catch (URISyntaxException e) {
fail("URISyntaxException thrown while constructing expected URI");
}

URI actualURI = file.toURI();
System.out.println(actualURI);
assertEquals("The URIs should be equal",expectedURI,actualURI);
}

URI actualURI = file.toURI();
assertEquals("The URIs should be equal",expectedURI,actualURI);
}
}

0 comments on commit a2b9067

Please sign in to comment.