Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graal migration #58

Merged
Merged
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
19 changes: 19 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 4 additions & 6 deletions .mvn/wrapper/MavenWrapperDownloader.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,12 @@ public class MavenWrapperDownloader {
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
* use instead of the default one.
*/
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
".mvn/wrapper/maven-wrapper.properties";
private static final String MAVEN_WRAPPER_PROPERTIES_PATH = ".mvn/wrapper/maven-wrapper.properties";

/**
* Path where the maven-wrapper.jar will be saved to.
*/
private static final String MAVEN_WRAPPER_JAR_PATH =
".mvn/wrapper/maven-wrapper.jar";
private static final String MAVEN_WRAPPER_JAR_PATH = ".mvn/wrapper/maven-wrapper.jar";

/**
* Name of the property which should be used to override the default download url for the wrapper.
Expand Down Expand Up @@ -89,7 +87,7 @@ public static void main(String args[]) {
System.out.println("Done");
System.exit(0);
} catch (Throwable e) {
System.out.println("- Error downloading");
System.out.println("-Error downloading");
e.printStackTrace();
System.exit(1);
}
Expand All @@ -111,8 +109,8 @@ protected PasswordAuthentication getPasswordAuthentication() {
rbc = Channels.newChannel(website.openStream());
FileOutputStream fos = new FileOutputStream(destination);
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
fos.close();
rbc.close();
fos.close();
}

}
19 changes: 16 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.7</version>
<version>3.0.4</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.uci</groupId>
<artifactId>utils</artifactId>
<!--For Development we are using SNAPSHOT with version-->
<version>2.2.5</version>
<version>2.2.6</version>

<!-- On changing, Set version in build-deploy.yml to delete the previous packages if exists and deploy new package for the specified version -->

<name>utils</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>11</java.version>
<java.version>17</java.version>
<mockwebserver.version>4.7.2</mockwebserver.version>
<okhttp3.version>4.7.2</okhttp3.version>
</properties>
Expand Down Expand Up @@ -66,6 +66,19 @@
</dependency>


<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.14.1</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>


<!-- https://mvnrepository.com/artifact/javax.ws.rs/javax.ws.rs-api -->
<dependency>
<groupId>javax.ws.rs</groupId>
Expand Down
25 changes: 14 additions & 11 deletions src/main/java/com/uci/utils/bot/util/BotUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ public static String getBotValid(String status, String startDate, String endDate
* @return
*/
public static Boolean checkBotValidFromJsonNode(JsonNode data) {
String status = data.findValue("status").asText();
String startDate = data.findValue("startDate").asText();
String endDate = data.findValue("endDate").asText();
String botstatus = data.findValue("status").asText();
String botstartDate = data.findValue("startDate").asText();
String botendDate = data.findValue("endDate").asText();

log.info("Bot Status: "+status+", Start Date: "+startDate+", End Date: "+endDate);
log.info("Bot Status: "+botstatus+", Start Date: "+botstartDate+", End Date: "+botendDate);

return checkBotValid(status, startDate, endDate);
return checkBotValid(botstatus, botstartDate, botendDate);
}

/**
Expand All @@ -99,14 +99,17 @@ public static Boolean checkBotValidFromJsonNode(JsonNode data) {
* @return
*/
public static Boolean checkBotValid(String status, String startDate, String endDate) {
if(checkBotLiveStatus(status) && checkBotStartDateValid(startDate)
&& checkBotEndDateValid(endDate)
&& !(startDate == null || startDate == "null" || startDate.isEmpty())) {
return true;
}
return false;
boolean isBotValid = checkBotLiveStatus(status) &&
checkBotStartDateValid(startDate) &&
checkBotEndDateValid(endDate) &&
startDate != null &&
!startDate.equals("null") &&
!startDate.isEmpty();

return isBotValid;
}


/**
* Check if bot' status is live/enabled
* @param status
Expand Down
38 changes: 25 additions & 13 deletions src/main/java/com/uci/utils/bot/util/FileUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,15 @@ public static String getUploadedFileName(String mimeType, String name) {
* @return
*/
public static String validateFileSizeByInputBytes(byte[] inputBytes, Double maxSizeForMedia) {
/* Discard if file size is greater than MAX_SIZE_FOR_MEDIA */
if (maxSizeForMedia != null && inputBytes.length > maxSizeForMedia) {
return "file size is greater than limit : " + inputBytes.length;
String errorMessage = "File size is greater than the limit: " + inputBytes.length;
return errorMessage;
}

return "";
}


/**
* Function to get Mime type of file from url
* @param url
Expand Down Expand Up @@ -199,19 +201,29 @@ public static boolean isFileTypeDocument(String mime_type) {
* @param mime_type
* @return
*/
// public static boolean isValidFileType(String mime_type) {
// ArrayList<String> list = getImageFileTypes();
// list.addAll(getAudioFileTypes());
// list.addAll(getVideoFileTypes());
// list.addAll(getDocumentFileTypes());
// for(int i=0; i < list.size(); i++) {
// if(list.get(i).equals(mime_type)) {
// return true;
// }
// }
// return false;
// }
public static boolean isValidFileType(String mime_type) {
ArrayList<String> list = getImageFileTypes();
list.addAll(getAudioFileTypes());
list.addAll(getVideoFileTypes());
list.addAll(getDocumentFileTypes());
for(int i=0; i < list.size(); i++) {
if(list.get(i).equals(mime_type)) {
return true;
}
}
return false;
ArrayList<String> validFileTypes = new ArrayList<>();
validFileTypes.addAll(getImageFileTypes());
validFileTypes.addAll(getAudioFileTypes());
validFileTypes.addAll(getVideoFileTypes());
validFileTypes.addAll(getDocumentFileTypes());

return validFileTypes.contains(mime_type);
}



/**
* Get Image file types list
* @return
Expand Down