Skip to content

Commit 721894a

Browse files
Lauris Kaplinskimetsma
authored andcommitted
Fixed JNI loading and added exception messages to CDoc1Reader::getLockForCert
1 parent 8e6d7b7 commit 721894a

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

cdoc/CDoc1Reader.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,11 @@ CDoc1Reader::getLockForCert(const std::vector<uint8_t>& cert)
102102
}
103103
break;
104104
default:
105+
setLastError("Method not supported");
105106
return libcdoc::NOT_SUPPORTED;
106107
}
107108
}
109+
setLastError("No lock found with certificate key");
108110
return libcdoc::NOT_FOUND;
109111
}
110112

examples/java/src/main/java/ee/ria/cdoc/CDocTool.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public static String getArg(int arg_idx, String[] args) {
3333
}
3434

3535
// Make logger static to ensure that it is not garbage-collected as long as it is atached to library
36-
private static final JavaLogger logger = new JavaLogger();
36+
private static JavaLogger logger;
3737

3838
public static void main(String[] args) {
3939
System.out.println("Starting app...");
@@ -125,6 +125,7 @@ public static void main(String[] args) {
125125
System.load(lib.getAbsolutePath());
126126
System.out.println("Library loaded");
127127

128+
logger = new JavaLogger();
128129
//ConsoleLogger logger = new ConsoleLogger();
129130
logger.SetMinLogLevel(ILogger.LogLevel.LEVEL_TRACE);
130131
ILogger.addLogger(logger);

0 commit comments

Comments
 (0)