id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1 value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
143,200 | adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/manager/HBCIUtils.java | HBCIUtils.exception2StringShort | public static String exception2StringShort(Exception e) {
StringBuffer st = new StringBuffer();
Throwable e2 = e;
while (e2 != null) {
String exClass = e2.getClass().getName();
String msg = e2.getMessage();
if (msg != null) {
st.setLength(0);
st.append(exClass);
st.append(": ");
st.append(msg);
}
e2 = e2.getCause();
}
return st.toString().trim();
} | java | public static String exception2StringShort(Exception e) {
StringBuffer st = new StringBuffer();
Throwable e2 = e;
while (e2 != null) {
String exClass = e2.getClass().getName();
String msg = e2.getMessage();
if (msg != null) {
st.setLength(0);
st.append(exClass);
st.append(": ");
st.append(msg);
}
e2 = e2.getCause();
}
return st.toString().trim();
} | [
"public",
"static",
"String",
"exception2StringShort",
"(",
"Exception",
"e",
")",
"{",
"StringBuffer",
"st",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"Throwable",
"e2",
"=",
"e",
";",
"while",
"(",
"e2",
"!=",
"null",
")",
"{",
"String",
"exClass",
"=",
"e2",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
";",
"String",
"msg",
"=",
"e2",
".",
"getMessage",
"(",
")",
";",
"if",
"(",
"msg",
"!=",
"null",
")",
"{",
"st",
".",
"setLength",
"(",
"0",
")",
";",
"st",
".",
"append",
"(",
"exClass",
")",
";",
"st",
".",
"append",
"(",
"\": \"",
")",
";",
"st",
".",
"append",
"(",
"msg",
")",
";",
"}",
"e2",
"=",
"e2",
".",
"getCause",
"(",
")",
";",
"}",
"return",
"st",
".",
"toString",
"(",
")",
".",
"trim",
"(",
")",
";",
"}"
] | Extrahieren der root-Exception aus einer Exception-Chain.
@param e Exception
@return String mit Infos zur root-Exception | [
"Extrahieren",
"der",
"root",
"-",
"Exception",
"aus",
"einer",
"Exception",
"-",
"Chain",
"."
] | 5e24f7e429d6b555e1d993196b4cf1adda6433cf | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/manager/HBCIUtils.java#L280-L298 |
143,201 | adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/manager/HBCIUtils.java | HBCIUtils.data2hex | public static String data2hex(byte[] data) {
StringBuffer ret = new StringBuffer();
for (int i = 0; i < data.length; i++) {
String st = Integer.toHexString(data[i]);
if (st.length() == 1) {
st = '0' + st;
}
st = st.substring(st.length() - 2);
ret.append(st).append(" ");
}
return ret.toString();
} | java | public static String data2hex(byte[] data) {
StringBuffer ret = new StringBuffer();
for (int i = 0; i < data.length; i++) {
String st = Integer.toHexString(data[i]);
if (st.length() == 1) {
st = '0' + st;
}
st = st.substring(st.length() - 2);
ret.append(st).append(" ");
}
return ret.toString();
} | [
"public",
"static",
"String",
"data2hex",
"(",
"byte",
"[",
"]",
"data",
")",
"{",
"StringBuffer",
"ret",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"data",
".",
"length",
";",
"i",
"++",
")",
"{",
"String",
"st",
"=",
"Integer",
".",
"toHexString",
"(",
"data",
"[",
"i",
"]",
")",
";",
"if",
"(",
"st",
".",
"length",
"(",
")",
"==",
"1",
")",
"{",
"st",
"=",
"'",
"'",
"+",
"st",
";",
"}",
"st",
"=",
"st",
".",
"substring",
"(",
"st",
".",
"length",
"(",
")",
"-",
"2",
")",
";",
"ret",
".",
"append",
"(",
"st",
")",
".",
"append",
"(",
"\" \"",
")",
";",
"}",
"return",
"ret",
".",
"toString",
"(",
")",
";",
"}"
] | Wandelt ein Byte-Array in eine entsprechende hex-Darstellung um.
@param data das Byte-Array, für das eine Hex-Darstellung erzeugt werden soll
@return einen String, der für jedes Byte aus <code>data</code>
zwei Zeichen (0-9,A-F) enthält. | [
"Wandelt",
"ein",
"Byte",
"-",
"Array",
"in",
"eine",
"entsprechende",
"hex",
"-",
"Darstellung",
"um",
"."
] | 5e24f7e429d6b555e1d993196b4cf1adda6433cf | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/manager/HBCIUtils.java#L307-L320 |
143,202 | adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/manager/HBCIUtils.java | HBCIUtils.string2Ints | private static int[] string2Ints(String st, int target_length) {
int[] numbers = new int[target_length];
int st_len = st.length();
char ch;
for (int i = 0; i < st_len; i++) {
ch = st.charAt(i);
numbers[target_length - st_len + i] = ch - '0';
}
return numbers;
} | java | private static int[] string2Ints(String st, int target_length) {
int[] numbers = new int[target_length];
int st_len = st.length();
char ch;
for (int i = 0; i < st_len; i++) {
ch = st.charAt(i);
numbers[target_length - st_len + i] = ch - '0';
}
return numbers;
} | [
"private",
"static",
"int",
"[",
"]",
"string2Ints",
"(",
"String",
"st",
",",
"int",
"target_length",
")",
"{",
"int",
"[",
"]",
"numbers",
"=",
"new",
"int",
"[",
"target_length",
"]",
";",
"int",
"st_len",
"=",
"st",
".",
"length",
"(",
")",
";",
"char",
"ch",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"st_len",
";",
"i",
"++",
")",
"{",
"ch",
"=",
"st",
".",
"charAt",
"(",
"i",
")",
";",
"numbers",
"[",
"target_length",
"-",
"st_len",
"+",
"i",
"]",
"=",
"ch",
"-",
"'",
"'",
";",
"}",
"return",
"numbers",
";",
"}"
] | Used to convert a blz or an account number to an array of ints, one
array element per digit. | [
"Used",
"to",
"convert",
"a",
"blz",
"or",
"an",
"account",
"number",
"to",
"an",
"array",
"of",
"ints",
"one",
"array",
"element",
"per",
"digit",
"."
] | 5e24f7e429d6b555e1d993196b4cf1adda6433cf | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/manager/HBCIUtils.java#L568-L579 |
143,203 | adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/manager/HBCIUtils.java | HBCIUtils.string2BigDecimal | public static BigDecimal string2BigDecimal(String st) {
BigDecimal result = new BigDecimal(st);
result.setScale(2, BigDecimal.ROUND_HALF_EVEN);
return result;
} | java | public static BigDecimal string2BigDecimal(String st) {
BigDecimal result = new BigDecimal(st);
result.setScale(2, BigDecimal.ROUND_HALF_EVEN);
return result;
} | [
"public",
"static",
"BigDecimal",
"string2BigDecimal",
"(",
"String",
"st",
")",
"{",
"BigDecimal",
"result",
"=",
"new",
"BigDecimal",
"(",
"st",
")",
";",
"result",
".",
"setScale",
"(",
"2",
",",
"BigDecimal",
".",
"ROUND_HALF_EVEN",
")",
";",
"return",
"result",
";",
"}"
] | Konvertiert einen String in einen BigDecimal-Wert mit zwei Nachkommastellen.
@param st String, der konvertiert werden soll (Format "<code>1234.56</code>");
@return BigDecimal-Wert | [
"Konvertiert",
"einen",
"String",
"in",
"einen",
"BigDecimal",
"-",
"Wert",
"mit",
"zwei",
"Nachkommastellen",
"."
] | 5e24f7e429d6b555e1d993196b4cf1adda6433cf | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/manager/HBCIUtils.java#L713-L717 |
143,204 | IBM-Cloud/gp-java-client | src/main/java/com/ibm/g11n/pipeline/client/rb/CloudResourceBundle.java | CloudResourceBundle.loadBundle | static CloudResourceBundle loadBundle(ServiceAccount serviceAccount, String bundleId, Locale locale) {
CloudResourceBundle crb = null;
ServiceClient client = ServiceClient.getInstance(serviceAccount);
try {
Map<String, String> resStrings = client.getResourceStrings(bundleId, locale.toLanguageTag(), false);
crb = new CloudResourceBundle(resStrings);
} catch (ServiceException e) {
logger.info("Could not fetch resource data for " + locale
+ " from the translation bundle " + bundleId + ": " + e.getMessage());
}
return crb;
} | java | static CloudResourceBundle loadBundle(ServiceAccount serviceAccount, String bundleId, Locale locale) {
CloudResourceBundle crb = null;
ServiceClient client = ServiceClient.getInstance(serviceAccount);
try {
Map<String, String> resStrings = client.getResourceStrings(bundleId, locale.toLanguageTag(), false);
crb = new CloudResourceBundle(resStrings);
} catch (ServiceException e) {
logger.info("Could not fetch resource data for " + locale
+ " from the translation bundle " + bundleId + ": " + e.getMessage());
}
return crb;
} | [
"static",
"CloudResourceBundle",
"loadBundle",
"(",
"ServiceAccount",
"serviceAccount",
",",
"String",
"bundleId",
",",
"Locale",
"locale",
")",
"{",
"CloudResourceBundle",
"crb",
"=",
"null",
";",
"ServiceClient",
"client",
"=",
"ServiceClient",
".",
"getInstance",
"(",
"serviceAccount",
")",
";",
"try",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"resStrings",
"=",
"client",
".",
"getResourceStrings",
"(",
"bundleId",
",",
"locale",
".",
"toLanguageTag",
"(",
")",
",",
"false",
")",
";",
"crb",
"=",
"new",
"CloudResourceBundle",
"(",
"resStrings",
")",
";",
"}",
"catch",
"(",
"ServiceException",
"e",
")",
"{",
"logger",
".",
"info",
"(",
"\"Could not fetch resource data for \"",
"+",
"locale",
"+",
"\" from the translation bundle \"",
"+",
"bundleId",
"+",
"\": \"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"return",
"crb",
";",
"}"
] | Package local factory method creating a new CloundResourceBundle instance
for the specified service account, bundle ID and locale.
@param serviceAccount The service account for IBM Globalization Pipeline
@param bundleId The bundle ID
@param locale The locale
@return An instance of CloundResourceBundle. | [
"Package",
"local",
"factory",
"method",
"creating",
"a",
"new",
"CloundResourceBundle",
"instance",
"for",
"the",
"specified",
"service",
"account",
"bundle",
"ID",
"and",
"locale",
"."
] | b015a081d7a7313bc48c448087fbc07bce860427 | https://github.com/IBM-Cloud/gp-java-client/blob/b015a081d7a7313bc48c448087fbc07bce860427/src/main/java/com/ibm/g11n/pipeline/client/rb/CloudResourceBundle.java#L50-L61 |
143,205 | Chorus-bdd/Chorus | interpreter/chorus-parser/src/main/java/org/chorusbdd/chorus/parser/DirectiveParser.java | DirectiveParser.checkDirectivesForKeyword | public void checkDirectivesForKeyword(DirectiveParser directiveParser, KeyWord keyWord) throws ParseException {
checkNoStepDirectiveBeforeKeyword(directiveParser, keyWord);
checkForInvalidKeywordDirective(directiveParser, keyWord);
} | java | public void checkDirectivesForKeyword(DirectiveParser directiveParser, KeyWord keyWord) throws ParseException {
checkNoStepDirectiveBeforeKeyword(directiveParser, keyWord);
checkForInvalidKeywordDirective(directiveParser, keyWord);
} | [
"public",
"void",
"checkDirectivesForKeyword",
"(",
"DirectiveParser",
"directiveParser",
",",
"KeyWord",
"keyWord",
")",
"throws",
"ParseException",
"{",
"checkNoStepDirectiveBeforeKeyword",
"(",
"directiveParser",
",",
"keyWord",
")",
";",
"checkForInvalidKeywordDirective",
"(",
"directiveParser",
",",
"keyWord",
")",
";",
"}"
] | If a keyword supports directives, then we can have one more more 'keyword' directives but no 'step' directives before a keyword | [
"If",
"a",
"keyword",
"supports",
"directives",
"then",
"we",
"can",
"have",
"one",
"more",
"more",
"keyword",
"directives",
"but",
"no",
"step",
"directives",
"before",
"a",
"keyword"
] | 1eea7ca858876bce821bb49b43fd5b6ba1737997 | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-parser/src/main/java/org/chorusbdd/chorus/parser/DirectiveParser.java#L98-L101 |
143,206 | Chorus-bdd/Chorus | interpreter/chorus-parser/src/main/java/org/chorusbdd/chorus/parser/DirectiveParser.java | DirectiveParser.checkForUnprocessedDirectives | public void checkForUnprocessedDirectives() throws ParseException {
List<LineNumberAndDirective> remaining = new LinkedList<>();
remaining.addAll(bufferedKeyWordDirectives);
remaining.addAll(bufferedStepDirectives);
if (!remaining.isEmpty()) {
LineNumberAndDirective exampleError = remaining.get(0);
throw new ParseException("Invalid trailing directive [" + exampleError.getDirective() + "]", exampleError.getLine());
}
} | java | public void checkForUnprocessedDirectives() throws ParseException {
List<LineNumberAndDirective> remaining = new LinkedList<>();
remaining.addAll(bufferedKeyWordDirectives);
remaining.addAll(bufferedStepDirectives);
if (!remaining.isEmpty()) {
LineNumberAndDirective exampleError = remaining.get(0);
throw new ParseException("Invalid trailing directive [" + exampleError.getDirective() + "]", exampleError.getLine());
}
} | [
"public",
"void",
"checkForUnprocessedDirectives",
"(",
")",
"throws",
"ParseException",
"{",
"List",
"<",
"LineNumberAndDirective",
">",
"remaining",
"=",
"new",
"LinkedList",
"<>",
"(",
")",
";",
"remaining",
".",
"addAll",
"(",
"bufferedKeyWordDirectives",
")",
";",
"remaining",
".",
"addAll",
"(",
"bufferedStepDirectives",
")",
";",
"if",
"(",
"!",
"remaining",
".",
"isEmpty",
"(",
")",
")",
"{",
"LineNumberAndDirective",
"exampleError",
"=",
"remaining",
".",
"get",
"(",
"0",
")",
";",
"throw",
"new",
"ParseException",
"(",
"\"Invalid trailing directive [\"",
"+",
"exampleError",
".",
"getDirective",
"(",
")",
"+",
"\"]\"",
",",
"exampleError",
".",
"getLine",
"(",
")",
")",
";",
"}",
"}"
] | this catches for any unprocessed directives at the end of parsing | [
"this",
"catches",
"for",
"any",
"unprocessed",
"directives",
"at",
"the",
"end",
"of",
"parsing"
] | 1eea7ca858876bce821bb49b43fd5b6ba1737997 | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-parser/src/main/java/org/chorusbdd/chorus/parser/DirectiveParser.java#L166-L174 |
143,207 | Chorus-bdd/Chorus | interpreter/chorus-remoting/src/main/java/org/chorusbdd/chorus/remoting/jmx/ChorusHandlerJmxExporter.java | ChorusHandlerJmxExporter.export | public ChorusHandlerJmxExporter export() {
if (Boolean.getBoolean(JMX_EXPORTER_ENABLED_PROPERTY)) {
//export this object as an MBean
if (exported.getAndSet(true) == false) {
try {
log.info(String.format("Exporting ChorusHandlerJmxExporter with jmx name (%s)", JMX_EXPORTER_NAME));
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
mbs.registerMBean(this, new ObjectName(JMX_EXPORTER_NAME));
} catch (Exception e) {
throw new ChorusException(String.format("Failed to export ChorusHandlerJmxExporter with jmx name (%s)", JMX_EXPORTER_NAME), e);
}
}
} else {
log.info(String.format("Will not export ChorusHandlerJmxExporter : '%s' system property must be set to true.",
JMX_EXPORTER_ENABLED_PROPERTY)
);
}
return this;
} | java | public ChorusHandlerJmxExporter export() {
if (Boolean.getBoolean(JMX_EXPORTER_ENABLED_PROPERTY)) {
//export this object as an MBean
if (exported.getAndSet(true) == false) {
try {
log.info(String.format("Exporting ChorusHandlerJmxExporter with jmx name (%s)", JMX_EXPORTER_NAME));
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
mbs.registerMBean(this, new ObjectName(JMX_EXPORTER_NAME));
} catch (Exception e) {
throw new ChorusException(String.format("Failed to export ChorusHandlerJmxExporter with jmx name (%s)", JMX_EXPORTER_NAME), e);
}
}
} else {
log.info(String.format("Will not export ChorusHandlerJmxExporter : '%s' system property must be set to true.",
JMX_EXPORTER_ENABLED_PROPERTY)
);
}
return this;
} | [
"public",
"ChorusHandlerJmxExporter",
"export",
"(",
")",
"{",
"if",
"(",
"Boolean",
".",
"getBoolean",
"(",
"JMX_EXPORTER_ENABLED_PROPERTY",
")",
")",
"{",
"//export this object as an MBean",
"if",
"(",
"exported",
".",
"getAndSet",
"(",
"true",
")",
"==",
"false",
")",
"{",
"try",
"{",
"log",
".",
"info",
"(",
"String",
".",
"format",
"(",
"\"Exporting ChorusHandlerJmxExporter with jmx name (%s)\"",
",",
"JMX_EXPORTER_NAME",
")",
")",
";",
"MBeanServer",
"mbs",
"=",
"ManagementFactory",
".",
"getPlatformMBeanServer",
"(",
")",
";",
"mbs",
".",
"registerMBean",
"(",
"this",
",",
"new",
"ObjectName",
"(",
"JMX_EXPORTER_NAME",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"ChorusException",
"(",
"String",
".",
"format",
"(",
"\"Failed to export ChorusHandlerJmxExporter with jmx name (%s)\"",
",",
"JMX_EXPORTER_NAME",
")",
",",
"e",
")",
";",
"}",
"}",
"}",
"else",
"{",
"log",
".",
"info",
"(",
"String",
".",
"format",
"(",
"\"Will not export ChorusHandlerJmxExporter : '%s' system property must be set to true.\"",
",",
"JMX_EXPORTER_ENABLED_PROPERTY",
")",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Call this method once all handlers are fully initialized, to register the chorus remoting JMX bean
and make all chorus handlers accessible remotely | [
"Call",
"this",
"method",
"once",
"all",
"handlers",
"are",
"fully",
"initialized",
"to",
"register",
"the",
"chorus",
"remoting",
"JMX",
"bean",
"and",
"make",
"all",
"chorus",
"handlers",
"accessible",
"remotely"
] | 1eea7ca858876bce821bb49b43fd5b6ba1737997 | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-remoting/src/main/java/org/chorusbdd/chorus/remoting/jmx/ChorusHandlerJmxExporter.java#L135-L153 |
143,208 | adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/protocol/SF.java | SF.createAndAppendNewChildContainer | protected MultipleSyntaxElements createAndAppendNewChildContainer(Node ref, Document document) {
MultipleSyntaxElements ret = null;
if (((Element) ref).getAttribute("minnum").equals("0")) {
log.trace("will not create container " + getPath() + " -> " + ((Element) ref).getAttribute("type") + " " +
"with minnum=0");
} else {
ret = super.createAndAppendNewChildContainer(ref, document);
}
return ret;
} | java | protected MultipleSyntaxElements createAndAppendNewChildContainer(Node ref, Document document) {
MultipleSyntaxElements ret = null;
if (((Element) ref).getAttribute("minnum").equals("0")) {
log.trace("will not create container " + getPath() + " -> " + ((Element) ref).getAttribute("type") + " " +
"with minnum=0");
} else {
ret = super.createAndAppendNewChildContainer(ref, document);
}
return ret;
} | [
"protected",
"MultipleSyntaxElements",
"createAndAppendNewChildContainer",
"(",
"Node",
"ref",
",",
"Document",
"document",
")",
"{",
"MultipleSyntaxElements",
"ret",
"=",
"null",
";",
"if",
"(",
"(",
"(",
"Element",
")",
"ref",
")",
".",
"getAttribute",
"(",
"\"minnum\"",
")",
".",
"equals",
"(",
"\"0\"",
")",
")",
"{",
"log",
".",
"trace",
"(",
"\"will not create container \"",
"+",
"getPath",
"(",
")",
"+",
"\" -> \"",
"+",
"(",
"(",
"Element",
")",
"ref",
")",
".",
"getAttribute",
"(",
"\"type\"",
")",
"+",
"\" \"",
"+",
"\"with minnum=0\"",
")",
";",
"}",
"else",
"{",
"ret",
"=",
"super",
".",
"createAndAppendNewChildContainer",
"(",
"ref",
",",
"document",
")",
";",
"}",
"return",
"ret",
";",
"}"
] | diesen). | [
"diesen",
")",
"."
] | 5e24f7e429d6b555e1d993196b4cf1adda6433cf | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/protocol/SF.java#L60-L71 |
143,209 | adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/protocol/SF.java | SF.getRefSegId | private String[] getRefSegId(Node segref, Document document) {
String segname = ((Element) segref).getAttribute("type");
// versuch, daten aus dem cache zu lesen
String[] ret = new String[]{"", ""};
// segid noch nicht im cache
Element segdef = document.getElementById(segname);
NodeList valueElems = segdef.getElementsByTagName("value");
int len = valueElems.getLength();
for (int i = 0; i < len; i++) {
// alle value-elemente durchlaufen und seghead.code und
// seghead.version ermitteln
Node valueNode = valueElems.item(i);
if (valueNode.getNodeType() == Node.ELEMENT_NODE) {
String pathAttr = ((Element) valueNode).getAttribute("path");
if (pathAttr.equals("SegHead.code")) {
// code gefunden
ret[0] = valueNode.getFirstChild().getNodeValue();
} else if (pathAttr.equals("SegHead.version")) {
// version gefunden
ret[1] = valueNode.getFirstChild().getNodeValue();
}
}
}
return ret;
} | java | private String[] getRefSegId(Node segref, Document document) {
String segname = ((Element) segref).getAttribute("type");
// versuch, daten aus dem cache zu lesen
String[] ret = new String[]{"", ""};
// segid noch nicht im cache
Element segdef = document.getElementById(segname);
NodeList valueElems = segdef.getElementsByTagName("value");
int len = valueElems.getLength();
for (int i = 0; i < len; i++) {
// alle value-elemente durchlaufen und seghead.code und
// seghead.version ermitteln
Node valueNode = valueElems.item(i);
if (valueNode.getNodeType() == Node.ELEMENT_NODE) {
String pathAttr = ((Element) valueNode).getAttribute("path");
if (pathAttr.equals("SegHead.code")) {
// code gefunden
ret[0] = valueNode.getFirstChild().getNodeValue();
} else if (pathAttr.equals("SegHead.version")) {
// version gefunden
ret[1] = valueNode.getFirstChild().getNodeValue();
}
}
}
return ret;
} | [
"private",
"String",
"[",
"]",
"getRefSegId",
"(",
"Node",
"segref",
",",
"Document",
"document",
")",
"{",
"String",
"segname",
"=",
"(",
"(",
"Element",
")",
"segref",
")",
".",
"getAttribute",
"(",
"\"type\"",
")",
";",
"// versuch, daten aus dem cache zu lesen",
"String",
"[",
"]",
"ret",
"=",
"new",
"String",
"[",
"]",
"{",
"\"\"",
",",
"\"\"",
"}",
";",
"// segid noch nicht im cache",
"Element",
"segdef",
"=",
"document",
".",
"getElementById",
"(",
"segname",
")",
";",
"NodeList",
"valueElems",
"=",
"segdef",
".",
"getElementsByTagName",
"(",
"\"value\"",
")",
";",
"int",
"len",
"=",
"valueElems",
".",
"getLength",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"// alle value-elemente durchlaufen und seghead.code und",
"// seghead.version ermitteln",
"Node",
"valueNode",
"=",
"valueElems",
".",
"item",
"(",
"i",
")",
";",
"if",
"(",
"valueNode",
".",
"getNodeType",
"(",
")",
"==",
"Node",
".",
"ELEMENT_NODE",
")",
"{",
"String",
"pathAttr",
"=",
"(",
"(",
"Element",
")",
"valueNode",
")",
".",
"getAttribute",
"(",
"\"path\"",
")",
";",
"if",
"(",
"pathAttr",
".",
"equals",
"(",
"\"SegHead.code\"",
")",
")",
"{",
"// code gefunden",
"ret",
"[",
"0",
"]",
"=",
"valueNode",
".",
"getFirstChild",
"(",
")",
".",
"getNodeValue",
"(",
")",
";",
"}",
"else",
"if",
"(",
"pathAttr",
".",
"equals",
"(",
"\"SegHead.version\"",
")",
")",
"{",
"// version gefunden",
"ret",
"[",
"1",
"]",
"=",
"valueNode",
".",
"getFirstChild",
"(",
")",
".",
"getNodeValue",
"(",
")",
";",
"}",
"}",
"}",
"return",
"ret",
";",
"}"
] | erfolgen muss. | [
"erfolgen",
"muss",
"."
] | 5e24f7e429d6b555e1d993196b4cf1adda6433cf | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/protocol/SF.java#L138-L165 |
143,210 | Chorus-bdd/Chorus | interpreter/chorus-handlerconfig/src/main/java/org/chorusbdd/chorus/handlerconfig/configproperty/ConfigPropertyUtils.java | ConfigPropertyUtils.createValidationPatternFromEnumType | public static <T extends Enum<T>> Pattern createValidationPatternFromEnumType(Class<T> enumType) {
String regEx = Stream.of(enumType.getEnumConstants())
.map(Enum::name)
.collect(Collectors.joining("|", "(?i)", ""));
//Enum constants may contain $ which needs to be escaped
regEx = regEx.replace("$", "\\$");
return Pattern.compile(regEx);
} | java | public static <T extends Enum<T>> Pattern createValidationPatternFromEnumType(Class<T> enumType) {
String regEx = Stream.of(enumType.getEnumConstants())
.map(Enum::name)
.collect(Collectors.joining("|", "(?i)", ""));
//Enum constants may contain $ which needs to be escaped
regEx = regEx.replace("$", "\\$");
return Pattern.compile(regEx);
} | [
"public",
"static",
"<",
"T",
"extends",
"Enum",
"<",
"T",
">",
">",
"Pattern",
"createValidationPatternFromEnumType",
"(",
"Class",
"<",
"T",
">",
"enumType",
")",
"{",
"String",
"regEx",
"=",
"Stream",
".",
"of",
"(",
"enumType",
".",
"getEnumConstants",
"(",
")",
")",
".",
"map",
"(",
"Enum",
"::",
"name",
")",
".",
"collect",
"(",
"Collectors",
".",
"joining",
"(",
"\"|\"",
",",
"\"(?i)\"",
",",
"\"\"",
")",
")",
";",
"//Enum constants may contain $ which needs to be escaped",
"regEx",
"=",
"regEx",
".",
"replace",
"(",
"\"$\"",
",",
"\"\\\\$\"",
")",
";",
"return",
"Pattern",
".",
"compile",
"(",
"regEx",
")",
";",
"}"
] | Create a regular expression which will match any of the values from the supplied enum type | [
"Create",
"a",
"regular",
"expression",
"which",
"will",
"match",
"any",
"of",
"the",
"values",
"from",
"the",
"supplied",
"enum",
"type"
] | 1eea7ca858876bce821bb49b43fd5b6ba1737997 | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-handlerconfig/src/main/java/org/chorusbdd/chorus/handlerconfig/configproperty/ConfigPropertyUtils.java#L35-L44 |
143,211 | adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/GV/generators/GenKUmsAllCamt05200107.java | GenKUmsAllCamt05200107.createDay | private AccountReport22 createDay(BTag tag) throws Exception {
AccountReport22 report = new AccountReport22();
if (tag != null) {
report.getBal().add(this.createSaldo(tag.start, true));
report.getBal().add(this.createSaldo(tag.end, false));
}
if (tag != null && tag.my != null) {
CashAccount36 acc = new CashAccount36();
AccountIdentification4Choice id = new AccountIdentification4Choice();
id.setIBAN(tag.my.iban);
acc.setId(id);
acc.setCcy(tag.my.curr);
BranchAndFinancialInstitutionIdentification5 svc = new BranchAndFinancialInstitutionIdentification5();
FinancialInstitutionIdentification8 inst = new FinancialInstitutionIdentification8();
svc.setFinInstnId(inst);
inst.setBICFI(tag.my.bic);
report.setAcct(acc);
}
return report;
} | java | private AccountReport22 createDay(BTag tag) throws Exception {
AccountReport22 report = new AccountReport22();
if (tag != null) {
report.getBal().add(this.createSaldo(tag.start, true));
report.getBal().add(this.createSaldo(tag.end, false));
}
if (tag != null && tag.my != null) {
CashAccount36 acc = new CashAccount36();
AccountIdentification4Choice id = new AccountIdentification4Choice();
id.setIBAN(tag.my.iban);
acc.setId(id);
acc.setCcy(tag.my.curr);
BranchAndFinancialInstitutionIdentification5 svc = new BranchAndFinancialInstitutionIdentification5();
FinancialInstitutionIdentification8 inst = new FinancialInstitutionIdentification8();
svc.setFinInstnId(inst);
inst.setBICFI(tag.my.bic);
report.setAcct(acc);
}
return report;
} | [
"private",
"AccountReport22",
"createDay",
"(",
"BTag",
"tag",
")",
"throws",
"Exception",
"{",
"AccountReport22",
"report",
"=",
"new",
"AccountReport22",
"(",
")",
";",
"if",
"(",
"tag",
"!=",
"null",
")",
"{",
"report",
".",
"getBal",
"(",
")",
".",
"add",
"(",
"this",
".",
"createSaldo",
"(",
"tag",
".",
"start",
",",
"true",
")",
")",
";",
"report",
".",
"getBal",
"(",
")",
".",
"add",
"(",
"this",
".",
"createSaldo",
"(",
"tag",
".",
"end",
",",
"false",
")",
")",
";",
"}",
"if",
"(",
"tag",
"!=",
"null",
"&&",
"tag",
".",
"my",
"!=",
"null",
")",
"{",
"CashAccount36",
"acc",
"=",
"new",
"CashAccount36",
"(",
")",
";",
"AccountIdentification4Choice",
"id",
"=",
"new",
"AccountIdentification4Choice",
"(",
")",
";",
"id",
".",
"setIBAN",
"(",
"tag",
".",
"my",
".",
"iban",
")",
";",
"acc",
".",
"setId",
"(",
"id",
")",
";",
"acc",
".",
"setCcy",
"(",
"tag",
".",
"my",
".",
"curr",
")",
";",
"BranchAndFinancialInstitutionIdentification5",
"svc",
"=",
"new",
"BranchAndFinancialInstitutionIdentification5",
"(",
")",
";",
"FinancialInstitutionIdentification8",
"inst",
"=",
"new",
"FinancialInstitutionIdentification8",
"(",
")",
";",
"svc",
".",
"setFinInstnId",
"(",
"inst",
")",
";",
"inst",
".",
"setBICFI",
"(",
"tag",
".",
"my",
".",
"bic",
")",
";",
"report",
".",
"setAcct",
"(",
"acc",
")",
";",
"}",
"return",
"report",
";",
"}"
] | Erzeugt den Header des Buchungstages.
@param tag der Tag.
@return der Header des Buchungstages.
@throws Exception | [
"Erzeugt",
"den",
"Header",
"des",
"Buchungstages",
"."
] | 5e24f7e429d6b555e1d993196b4cf1adda6433cf | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/GV/generators/GenKUmsAllCamt05200107.java#L241-L265 |
143,212 | adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/GV/generators/GenKUmsAllCamt05200107.java | GenKUmsAllCamt05200107.createSaldo | private CashBalance8 createSaldo(Saldo saldo, boolean start) throws Exception {
CashBalance8 bal = new CashBalance8();
BalanceType13 bt = new BalanceType13();
bt.setCdOrPrtry(new BalanceType10Choice());
bt.getCdOrPrtry().setCd(start ? "PRCD" : "CLBD");
bal.setTp(bt);
ActiveOrHistoricCurrencyAndAmount amt = new ActiveOrHistoricCurrencyAndAmount();
bal.setAmt(amt);
if (saldo != null && saldo.value != null) {
amt.setCcy(saldo.value.getCurr());
amt.setValue(saldo.value.getBigDecimalValue());
}
long ts = saldo != null && saldo.timestamp != null ? saldo.timestamp.getTime() : 0;
// Startsaldo ist in CAMT der Endsaldo vom Vortag. Daher muessen wir noch einen Tag abziehen
if (start && ts > 0)
ts -= 24 * 60 * 60 * 1000L;
DateAndDateTime2Choice date = new DateAndDateTime2Choice();
date.setDt(this.createCalendar(ts));
bal.setDt(date);
return bal;
} | java | private CashBalance8 createSaldo(Saldo saldo, boolean start) throws Exception {
CashBalance8 bal = new CashBalance8();
BalanceType13 bt = new BalanceType13();
bt.setCdOrPrtry(new BalanceType10Choice());
bt.getCdOrPrtry().setCd(start ? "PRCD" : "CLBD");
bal.setTp(bt);
ActiveOrHistoricCurrencyAndAmount amt = new ActiveOrHistoricCurrencyAndAmount();
bal.setAmt(amt);
if (saldo != null && saldo.value != null) {
amt.setCcy(saldo.value.getCurr());
amt.setValue(saldo.value.getBigDecimalValue());
}
long ts = saldo != null && saldo.timestamp != null ? saldo.timestamp.getTime() : 0;
// Startsaldo ist in CAMT der Endsaldo vom Vortag. Daher muessen wir noch einen Tag abziehen
if (start && ts > 0)
ts -= 24 * 60 * 60 * 1000L;
DateAndDateTime2Choice date = new DateAndDateTime2Choice();
date.setDt(this.createCalendar(ts));
bal.setDt(date);
return bal;
} | [
"private",
"CashBalance8",
"createSaldo",
"(",
"Saldo",
"saldo",
",",
"boolean",
"start",
")",
"throws",
"Exception",
"{",
"CashBalance8",
"bal",
"=",
"new",
"CashBalance8",
"(",
")",
";",
"BalanceType13",
"bt",
"=",
"new",
"BalanceType13",
"(",
")",
";",
"bt",
".",
"setCdOrPrtry",
"(",
"new",
"BalanceType10Choice",
"(",
")",
")",
";",
"bt",
".",
"getCdOrPrtry",
"(",
")",
".",
"setCd",
"(",
"start",
"?",
"\"PRCD\"",
":",
"\"CLBD\"",
")",
";",
"bal",
".",
"setTp",
"(",
"bt",
")",
";",
"ActiveOrHistoricCurrencyAndAmount",
"amt",
"=",
"new",
"ActiveOrHistoricCurrencyAndAmount",
"(",
")",
";",
"bal",
".",
"setAmt",
"(",
"amt",
")",
";",
"if",
"(",
"saldo",
"!=",
"null",
"&&",
"saldo",
".",
"value",
"!=",
"null",
")",
"{",
"amt",
".",
"setCcy",
"(",
"saldo",
".",
"value",
".",
"getCurr",
"(",
")",
")",
";",
"amt",
".",
"setValue",
"(",
"saldo",
".",
"value",
".",
"getBigDecimalValue",
"(",
")",
")",
";",
"}",
"long",
"ts",
"=",
"saldo",
"!=",
"null",
"&&",
"saldo",
".",
"timestamp",
"!=",
"null",
"?",
"saldo",
".",
"timestamp",
".",
"getTime",
"(",
")",
":",
"0",
";",
"// Startsaldo ist in CAMT der Endsaldo vom Vortag. Daher muessen wir noch einen Tag abziehen",
"if",
"(",
"start",
"&&",
"ts",
">",
"0",
")",
"ts",
"-=",
"24",
"*",
"60",
"*",
"60",
"*",
"1000L",
";",
"DateAndDateTime2Choice",
"date",
"=",
"new",
"DateAndDateTime2Choice",
"(",
")",
";",
"date",
".",
"setDt",
"(",
"this",
".",
"createCalendar",
"(",
"ts",
")",
")",
";",
"bal",
".",
"setDt",
"(",
"date",
")",
";",
"return",
"bal",
";",
"}"
] | Erzeugt ein Saldo-Objekt.
@param saldo das HBCI4Java-Saldo-Objekt.
@param start true, wenn es ein Startsaldo ist.
@return das CAMT-Saldo-Objekt.
@throws Exception | [
"Erzeugt",
"ein",
"Saldo",
"-",
"Objekt",
"."
] | 5e24f7e429d6b555e1d993196b4cf1adda6433cf | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/GV/generators/GenKUmsAllCamt05200107.java#L275-L302 |
143,213 | adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/GV/generators/GenKUmsAllCamt05200107.java | GenKUmsAllCamt05200107.createCalendar | private XMLGregorianCalendar createCalendar(Long timestamp) throws Exception {
DatatypeFactory df = DatatypeFactory.newInstance();
GregorianCalendar cal = new GregorianCalendar();
cal.setTimeInMillis(timestamp != null ? timestamp.longValue() : System.currentTimeMillis());
return df.newXMLGregorianCalendar(cal);
} | java | private XMLGregorianCalendar createCalendar(Long timestamp) throws Exception {
DatatypeFactory df = DatatypeFactory.newInstance();
GregorianCalendar cal = new GregorianCalendar();
cal.setTimeInMillis(timestamp != null ? timestamp.longValue() : System.currentTimeMillis());
return df.newXMLGregorianCalendar(cal);
} | [
"private",
"XMLGregorianCalendar",
"createCalendar",
"(",
"Long",
"timestamp",
")",
"throws",
"Exception",
"{",
"DatatypeFactory",
"df",
"=",
"DatatypeFactory",
".",
"newInstance",
"(",
")",
";",
"GregorianCalendar",
"cal",
"=",
"new",
"GregorianCalendar",
"(",
")",
";",
"cal",
".",
"setTimeInMillis",
"(",
"timestamp",
"!=",
"null",
"?",
"timestamp",
".",
"longValue",
"(",
")",
":",
"System",
".",
"currentTimeMillis",
"(",
")",
")",
";",
"return",
"df",
".",
"newXMLGregorianCalendar",
"(",
"cal",
")",
";",
"}"
] | Erzeugt ein Calendar-Objekt.
@param timestamp der Zeitstempel.
@return das Calendar-Objekt.
@throws Exception | [
"Erzeugt",
"ein",
"Calendar",
"-",
"Objekt",
"."
] | 5e24f7e429d6b555e1d993196b4cf1adda6433cf | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/GV/generators/GenKUmsAllCamt05200107.java#L311-L316 |
143,214 | Chorus-bdd/Chorus | interpreter/chorus-handlers/src/main/java/org/chorusbdd/chorus/handlers/timers/TimersHandler.java | TimersHandler.waitForSeconds | @Step(".*wait (?:for )?([0-9]*) seconds?.*")
@Documentation(order = 10, description = "Wait for a number of seconds", example = "And I wait for 6 seconds")
public void waitForSeconds(int seconds) {
try {
Thread.sleep(seconds * 1000);
} catch (InterruptedException e) {
log.error("Thread interrupted while sleeping", e);
}
} | java | @Step(".*wait (?:for )?([0-9]*) seconds?.*")
@Documentation(order = 10, description = "Wait for a number of seconds", example = "And I wait for 6 seconds")
public void waitForSeconds(int seconds) {
try {
Thread.sleep(seconds * 1000);
} catch (InterruptedException e) {
log.error("Thread interrupted while sleeping", e);
}
} | [
"@",
"Step",
"(",
"\".*wait (?:for )?([0-9]*) seconds?.*\"",
")",
"@",
"Documentation",
"(",
"order",
"=",
"10",
",",
"description",
"=",
"\"Wait for a number of seconds\"",
",",
"example",
"=",
"\"And I wait for 6 seconds\"",
")",
"public",
"void",
"waitForSeconds",
"(",
"int",
"seconds",
")",
"{",
"try",
"{",
"Thread",
".",
"sleep",
"(",
"seconds",
"*",
"1000",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"log",
".",
"error",
"(",
"\"Thread interrupted while sleeping\"",
",",
"e",
")",
";",
"}",
"}"
] | Simple timer to make the calling thread sleep
@param seconds the number of seconds that the thread will sleep for | [
"Simple",
"timer",
"to",
"make",
"the",
"calling",
"thread",
"sleep"
] | 1eea7ca858876bce821bb49b43fd5b6ba1737997 | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-handlers/src/main/java/org/chorusbdd/chorus/handlers/timers/TimersHandler.java#L48-L56 |
143,215 | adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/GV/SepaUtil.java | SepaUtil.createCalendar | public static XMLGregorianCalendar createCalendar(String isoDate) throws Exception {
if (isoDate == null) {
SimpleDateFormat format = new SimpleDateFormat(DATETIME_FORMAT);
isoDate = format.format(new Date());
}
DatatypeFactory df = DatatypeFactory.newInstance();
return df.newXMLGregorianCalendar(isoDate);
} | java | public static XMLGregorianCalendar createCalendar(String isoDate) throws Exception {
if (isoDate == null) {
SimpleDateFormat format = new SimpleDateFormat(DATETIME_FORMAT);
isoDate = format.format(new Date());
}
DatatypeFactory df = DatatypeFactory.newInstance();
return df.newXMLGregorianCalendar(isoDate);
} | [
"public",
"static",
"XMLGregorianCalendar",
"createCalendar",
"(",
"String",
"isoDate",
")",
"throws",
"Exception",
"{",
"if",
"(",
"isoDate",
"==",
"null",
")",
"{",
"SimpleDateFormat",
"format",
"=",
"new",
"SimpleDateFormat",
"(",
"DATETIME_FORMAT",
")",
";",
"isoDate",
"=",
"format",
".",
"format",
"(",
"new",
"Date",
"(",
")",
")",
";",
"}",
"DatatypeFactory",
"df",
"=",
"DatatypeFactory",
".",
"newInstance",
"(",
")",
";",
"return",
"df",
".",
"newXMLGregorianCalendar",
"(",
"isoDate",
")",
";",
"}"
] | Erzeugt ein neues XMLCalender-Objekt.
@param isoDate optional. Das zu verwendende Datum.
Wird es weggelassen, dann wird das aktuelle Datum (mit Uhrzeit) verwendet.
@return das XML-Calendar-Objekt.
@throws Exception | [
"Erzeugt",
"ein",
"neues",
"XMLCalender",
"-",
"Objekt",
"."
] | 5e24f7e429d6b555e1d993196b4cf1adda6433cf | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/GV/SepaUtil.java#L37-L45 |
143,216 | adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/GV/SepaUtil.java | SepaUtil.format | public static String format(XMLGregorianCalendar cal, String format) {
if (cal == null)
return null;
if (format == null)
format = DATE_FORMAT;
SimpleDateFormat df = new SimpleDateFormat(format);
return df.format(cal.toGregorianCalendar().getTime());
} | java | public static String format(XMLGregorianCalendar cal, String format) {
if (cal == null)
return null;
if (format == null)
format = DATE_FORMAT;
SimpleDateFormat df = new SimpleDateFormat(format);
return df.format(cal.toGregorianCalendar().getTime());
} | [
"public",
"static",
"String",
"format",
"(",
"XMLGregorianCalendar",
"cal",
",",
"String",
"format",
")",
"{",
"if",
"(",
"cal",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"format",
"==",
"null",
")",
"format",
"=",
"DATE_FORMAT",
";",
"SimpleDateFormat",
"df",
"=",
"new",
"SimpleDateFormat",
"(",
"format",
")",
";",
"return",
"df",
".",
"format",
"(",
"cal",
".",
"toGregorianCalendar",
"(",
")",
".",
"getTime",
"(",
")",
")",
";",
"}"
] | Formatiert den XML-Kalender im angegebenen Format.
@param cal der Kalender.
@param format das zu verwendende Format. Fuer Beispiele siehe
{@link SepaUtil#DATE_FORMAT}
{@link SepaUtil#DATETIME_FORMAT}
Wenn keines angegeben ist, wird per Default {@link SepaUtil#DATE_FORMAT} verwendet.
@return die String das formatierte Datum. | [
"Formatiert",
"den",
"XML",
"-",
"Kalender",
"im",
"angegebenen",
"Format",
"."
] | 5e24f7e429d6b555e1d993196b4cf1adda6433cf | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/GV/SepaUtil.java#L57-L66 |
143,217 | adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/GV/SepaUtil.java | SepaUtil.toDate | public static Date toDate(XMLGregorianCalendar cal) {
if (cal == null)
return null;
return cal.toGregorianCalendar().getTime();
} | java | public static Date toDate(XMLGregorianCalendar cal) {
if (cal == null)
return null;
return cal.toGregorianCalendar().getTime();
} | [
"public",
"static",
"Date",
"toDate",
"(",
"XMLGregorianCalendar",
"cal",
")",
"{",
"if",
"(",
"cal",
"==",
"null",
")",
"return",
"null",
";",
"return",
"cal",
".",
"toGregorianCalendar",
"(",
")",
".",
"getTime",
"(",
")",
";",
"}"
] | Liefert ein Date-Objekt fuer den Kalender.
@param cal der Kalender.
@return das Date-Objekt. | [
"Liefert",
"ein",
"Date",
"-",
"Objekt",
"fuer",
"den",
"Kalender",
"."
] | 5e24f7e429d6b555e1d993196b4cf1adda6433cf | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/GV/SepaUtil.java#L74-L79 |
143,218 | adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/GV/SepaUtil.java | SepaUtil.maxIndex | public static Integer maxIndex(HashMap<String, String> properties) {
Integer max = null;
for (String key : properties.keySet()) {
Matcher m = INDEX_PATTERN.matcher(key);
if (m.matches()) {
int index = Integer.parseInt(m.group(1));
if (max == null || index > max) {
max = index;
}
}
}
return max;
} | java | public static Integer maxIndex(HashMap<String, String> properties) {
Integer max = null;
for (String key : properties.keySet()) {
Matcher m = INDEX_PATTERN.matcher(key);
if (m.matches()) {
int index = Integer.parseInt(m.group(1));
if (max == null || index > max) {
max = index;
}
}
}
return max;
} | [
"public",
"static",
"Integer",
"maxIndex",
"(",
"HashMap",
"<",
"String",
",",
"String",
">",
"properties",
")",
"{",
"Integer",
"max",
"=",
"null",
";",
"for",
"(",
"String",
"key",
":",
"properties",
".",
"keySet",
"(",
")",
")",
"{",
"Matcher",
"m",
"=",
"INDEX_PATTERN",
".",
"matcher",
"(",
"key",
")",
";",
"if",
"(",
"m",
".",
"matches",
"(",
")",
")",
"{",
"int",
"index",
"=",
"Integer",
".",
"parseInt",
"(",
"m",
".",
"group",
"(",
"1",
")",
")",
";",
"if",
"(",
"max",
"==",
"null",
"||",
"index",
">",
"max",
")",
"{",
"max",
"=",
"index",
";",
"}",
"}",
"}",
"return",
"max",
";",
"}"
] | Ermittelt den maximalen Index aller indizierten Properties. Nicht indizierte Properties
werden ignoriert.
@param properties die Properties, mit denen gearbeitet werden soll
@return Maximaler Index, oder {@code null}, wenn keine indizierten Properties gefunden wurden | [
"Ermittelt",
"den",
"maximalen",
"Index",
"aller",
"indizierten",
"Properties",
".",
"Nicht",
"indizierte",
"Properties",
"werden",
"ignoriert",
"."
] | 5e24f7e429d6b555e1d993196b4cf1adda6433cf | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/GV/SepaUtil.java#L99-L111 |
143,219 | adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/GV/SepaUtil.java | SepaUtil.insertIndex | public static String insertIndex(String key, Integer index) {
if (index == null)
return key;
int pos = key.indexOf('.');
if (pos >= 0) {
return key.substring(0, pos) + '[' + index + ']' + key.substring(pos);
} else {
return key + '[' + index + ']';
}
} | java | public static String insertIndex(String key, Integer index) {
if (index == null)
return key;
int pos = key.indexOf('.');
if (pos >= 0) {
return key.substring(0, pos) + '[' + index + ']' + key.substring(pos);
} else {
return key + '[' + index + ']';
}
} | [
"public",
"static",
"String",
"insertIndex",
"(",
"String",
"key",
",",
"Integer",
"index",
")",
"{",
"if",
"(",
"index",
"==",
"null",
")",
"return",
"key",
";",
"int",
"pos",
"=",
"key",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"pos",
">=",
"0",
")",
"{",
"return",
"key",
".",
"substring",
"(",
"0",
",",
"pos",
")",
"+",
"'",
"'",
"+",
"index",
"+",
"'",
"'",
"+",
"key",
".",
"substring",
"(",
"pos",
")",
";",
"}",
"else",
"{",
"return",
"key",
"+",
"'",
"'",
"+",
"index",
"+",
"'",
"'",
";",
"}",
"}"
] | Fuegt einen Index in den Property-Key ein. Wurde kein Index angegeben, wird der Key
unveraendert zurueckgeliefert.
@param key Key, der mit einem Index ergaenzt werden soll
@param index Index oder {@code null}, wenn kein Index gesetzt werden soll
@return Key mit Index | [
"Fuegt",
"einen",
"Index",
"in",
"den",
"Property",
"-",
"Key",
"ein",
".",
"Wurde",
"kein",
"Index",
"angegeben",
"wird",
"der",
"Key",
"unveraendert",
"zurueckgeliefert",
"."
] | 5e24f7e429d6b555e1d993196b4cf1adda6433cf | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/GV/SepaUtil.java#L153-L163 |
143,220 | adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/GV/SepaUtil.java | SepaUtil.sumBtgValueObject | public static Value sumBtgValueObject(HashMap<String, String> properties) {
Integer maxIndex = maxIndex(properties);
BigDecimal btg = sumBtgValue(properties, maxIndex);
String curr = properties.get(insertIndex("btg.curr", maxIndex == null ? null : 0));
return new Value(btg, curr);
} | java | public static Value sumBtgValueObject(HashMap<String, String> properties) {
Integer maxIndex = maxIndex(properties);
BigDecimal btg = sumBtgValue(properties, maxIndex);
String curr = properties.get(insertIndex("btg.curr", maxIndex == null ? null : 0));
return new Value(btg, curr);
} | [
"public",
"static",
"Value",
"sumBtgValueObject",
"(",
"HashMap",
"<",
"String",
",",
"String",
">",
"properties",
")",
"{",
"Integer",
"maxIndex",
"=",
"maxIndex",
"(",
"properties",
")",
";",
"BigDecimal",
"btg",
"=",
"sumBtgValue",
"(",
"properties",
",",
"maxIndex",
")",
";",
"String",
"curr",
"=",
"properties",
".",
"get",
"(",
"insertIndex",
"(",
"\"btg.curr\"",
",",
"maxIndex",
"==",
"null",
"?",
"null",
":",
"0",
")",
")",
";",
"return",
"new",
"Value",
"(",
"btg",
",",
"curr",
")",
";",
"}"
] | Liefert ein Value-Objekt mit den Summen des Auftrages.
@param properties Auftrags-Properties.
@return das Value-Objekt mit der Summe. | [
"Liefert",
"ein",
"Value",
"-",
"Objekt",
"mit",
"den",
"Summen",
"des",
"Auftrages",
"."
] | 5e24f7e429d6b555e1d993196b4cf1adda6433cf | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/GV/SepaUtil.java#L171-L176 |
143,221 | adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/GV/SepaUtil.java | SepaUtil.getProperty | public static String getProperty(HashMap<String, String> props, String name, String defaultValue) {
String value = props.get(name);
return value != null && value.length() > 0 ? value : defaultValue;
} | java | public static String getProperty(HashMap<String, String> props, String name, String defaultValue) {
String value = props.get(name);
return value != null && value.length() > 0 ? value : defaultValue;
} | [
"public",
"static",
"String",
"getProperty",
"(",
"HashMap",
"<",
"String",
",",
"String",
">",
"props",
",",
"String",
"name",
",",
"String",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"props",
".",
"get",
"(",
"name",
")",
";",
"return",
"value",
"!=",
"null",
"&&",
"value",
".",
"length",
"(",
")",
">",
"0",
"?",
"value",
":",
"defaultValue",
";",
"}"
] | Liefert den Wert des Properties oder den Default-Wert.
Der Default-Wert wird nicht nur bei NULL verwendet sondern auch bei Leerstring.
@param props die Properties.
@param name der Name des Properties.
@param defaultValue der Default-Wert.
@return der Wert. | [
"Liefert",
"den",
"Wert",
"des",
"Properties",
"oder",
"den",
"Default",
"-",
"Wert",
".",
"Der",
"Default",
"-",
"Wert",
"wird",
"nicht",
"nur",
"bei",
"NULL",
"verwendet",
"sondern",
"auch",
"bei",
"Leerstring",
"."
] | 5e24f7e429d6b555e1d993196b4cf1adda6433cf | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/GV/SepaUtil.java#L187-L190 |
143,222 | Chorus-bdd/Chorus | interpreter/chorus-output/src/main/java/org/chorusbdd/chorus/output/AbstractChorusOutputWriter.java | AbstractChorusOutputWriter.getPrintWriter | protected PrintWriter getPrintWriter() {
if ( printWriter == null || printStream != ChorusOut.out) {
printWriter = new PrintWriter(ChorusOut.out);
printStream = ChorusOut.out;
}
return printWriter;
} | java | protected PrintWriter getPrintWriter() {
if ( printWriter == null || printStream != ChorusOut.out) {
printWriter = new PrintWriter(ChorusOut.out);
printStream = ChorusOut.out;
}
return printWriter;
} | [
"protected",
"PrintWriter",
"getPrintWriter",
"(",
")",
"{",
"if",
"(",
"printWriter",
"==",
"null",
"||",
"printStream",
"!=",
"ChorusOut",
".",
"out",
")",
"{",
"printWriter",
"=",
"new",
"PrintWriter",
"(",
"ChorusOut",
".",
"out",
")",
";",
"printStream",
"=",
"ChorusOut",
".",
"out",
";",
"}",
"return",
"printWriter",
";",
"}"
] | This is an extension point to change Chorus output
The user can provider their own OutputWriter which extends the default and
overrides getPrintWriter() to return a writer configured for a different output stream
n.b. this method will be called frequently so it is expected that the PrintWriter returned
will generally be cached and reused by the implementation, but in some circumstances it is
useful to be able to change the PrintWriter during the testing process so the details are
left to the implementation
@return a PrintWriter to use for all logging | [
"This",
"is",
"an",
"extension",
"point",
"to",
"change",
"Chorus",
"output"
] | 1eea7ca858876bce821bb49b43fd5b6ba1737997 | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-output/src/main/java/org/chorusbdd/chorus/output/AbstractChorusOutputWriter.java#L256-L262 |
143,223 | Chorus-bdd/Chorus | interpreter/chorus-stepinvoker/src/main/java/org/chorusbdd/chorus/stepinvoker/PolledInvoker.java | PolledInvoker.invoke | public Object invoke(final String stepTokenId, final List<String> args) {
final AtomicReference resultRef = new AtomicReference();
PolledAssertion p = new PolledAssertion() {
protected void validate() throws Exception {
Object r = wrappedInvoker.invoke(stepTokenId, args);
resultRef.set(r);
}
protected int getPollPeriodMillis() {
return (int)pollFrequency;
}
};
retryAttempts = doTest(p, timeUnit, length);
Object result = resultRef.get();
return result;
} | java | public Object invoke(final String stepTokenId, final List<String> args) {
final AtomicReference resultRef = new AtomicReference();
PolledAssertion p = new PolledAssertion() {
protected void validate() throws Exception {
Object r = wrappedInvoker.invoke(stepTokenId, args);
resultRef.set(r);
}
protected int getPollPeriodMillis() {
return (int)pollFrequency;
}
};
retryAttempts = doTest(p, timeUnit, length);
Object result = resultRef.get();
return result;
} | [
"public",
"Object",
"invoke",
"(",
"final",
"String",
"stepTokenId",
",",
"final",
"List",
"<",
"String",
">",
"args",
")",
"{",
"final",
"AtomicReference",
"resultRef",
"=",
"new",
"AtomicReference",
"(",
")",
";",
"PolledAssertion",
"p",
"=",
"new",
"PolledAssertion",
"(",
")",
"{",
"protected",
"void",
"validate",
"(",
")",
"throws",
"Exception",
"{",
"Object",
"r",
"=",
"wrappedInvoker",
".",
"invoke",
"(",
"stepTokenId",
",",
"args",
")",
";",
"resultRef",
".",
"set",
"(",
"r",
")",
";",
"}",
"protected",
"int",
"getPollPeriodMillis",
"(",
")",
"{",
"return",
"(",
"int",
")",
"pollFrequency",
";",
"}",
"}",
";",
"retryAttempts",
"=",
"doTest",
"(",
"p",
",",
"timeUnit",
",",
"length",
")",
";",
"Object",
"result",
"=",
"resultRef",
".",
"get",
"(",
")",
";",
"return",
"result",
";",
"}"
] | Invoke the method
@param stepTokenId
@param args | [
"Invoke",
"the",
"method"
] | 1eea7ca858876bce821bb49b43fd5b6ba1737997 | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-stepinvoker/src/main/java/org/chorusbdd/chorus/stepinvoker/PolledInvoker.java#L64-L82 |
143,224 | Chorus-bdd/Chorus | interpreter/chorus-processes/src/main/java/org/chorusbdd/chorus/processes/manager/patternmatching/TailLogPatternMatcher.java | TailLogPatternMatcher.waitForPattern | private String waitForPattern(long timeout, TailLogBufferedReader bufferedReader, Pattern pattern, boolean searchWithinLines, long timeoutInSeconds) throws IOException {
StringBuilder sb = new StringBuilder();
String result;
label:
while(true) {
while ( bufferedReader.ready() ) {
int c = bufferedReader.read();
if ( c != -1 ) {
if (c == '\n' || c == '\r') {
if (sb.length() > 0) {
Matcher m = pattern.matcher(sb);
boolean match = searchWithinLines ? m.find() : m.matches();
if (match) {
result = sb.toString();
break label;
} else {
sb.setLength(0);
}
}
} else {
sb.append((char) c);
}
}
}
//nothing more to read, does the current output match the pattern?
if ( sb.length() > 0 && searchWithinLines) {
Matcher m = pattern.matcher(sb);
if ( m.find() ) {
result = m.group(0);
break label;
}
}
try {
Thread.sleep(10); //avoid a busy loop since we are using nonblocking ready() / read()
} catch (InterruptedException e) {}
checkTimeout(timeout, timeoutInSeconds);
if ( process.isStopped() && ! bufferedReader.ready()) {
ChorusAssert.fail(
process.isExitWithFailureCode() ?
"Process stopped with error code " + process.getExitCode() + " while waiting for match" :
"Process stopped while waiting for match"
);
}
}
return result;
} | java | private String waitForPattern(long timeout, TailLogBufferedReader bufferedReader, Pattern pattern, boolean searchWithinLines, long timeoutInSeconds) throws IOException {
StringBuilder sb = new StringBuilder();
String result;
label:
while(true) {
while ( bufferedReader.ready() ) {
int c = bufferedReader.read();
if ( c != -1 ) {
if (c == '\n' || c == '\r') {
if (sb.length() > 0) {
Matcher m = pattern.matcher(sb);
boolean match = searchWithinLines ? m.find() : m.matches();
if (match) {
result = sb.toString();
break label;
} else {
sb.setLength(0);
}
}
} else {
sb.append((char) c);
}
}
}
//nothing more to read, does the current output match the pattern?
if ( sb.length() > 0 && searchWithinLines) {
Matcher m = pattern.matcher(sb);
if ( m.find() ) {
result = m.group(0);
break label;
}
}
try {
Thread.sleep(10); //avoid a busy loop since we are using nonblocking ready() / read()
} catch (InterruptedException e) {}
checkTimeout(timeout, timeoutInSeconds);
if ( process.isStopped() && ! bufferedReader.ready()) {
ChorusAssert.fail(
process.isExitWithFailureCode() ?
"Process stopped with error code " + process.getExitCode() + " while waiting for match" :
"Process stopped while waiting for match"
);
}
}
return result;
} | [
"private",
"String",
"waitForPattern",
"(",
"long",
"timeout",
",",
"TailLogBufferedReader",
"bufferedReader",
",",
"Pattern",
"pattern",
",",
"boolean",
"searchWithinLines",
",",
"long",
"timeoutInSeconds",
")",
"throws",
"IOException",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"String",
"result",
";",
"label",
":",
"while",
"(",
"true",
")",
"{",
"while",
"(",
"bufferedReader",
".",
"ready",
"(",
")",
")",
"{",
"int",
"c",
"=",
"bufferedReader",
".",
"read",
"(",
")",
";",
"if",
"(",
"c",
"!=",
"-",
"1",
")",
"{",
"if",
"(",
"c",
"==",
"'",
"'",
"||",
"c",
"==",
"'",
"'",
")",
"{",
"if",
"(",
"sb",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"Matcher",
"m",
"=",
"pattern",
".",
"matcher",
"(",
"sb",
")",
";",
"boolean",
"match",
"=",
"searchWithinLines",
"?",
"m",
".",
"find",
"(",
")",
":",
"m",
".",
"matches",
"(",
")",
";",
"if",
"(",
"match",
")",
"{",
"result",
"=",
"sb",
".",
"toString",
"(",
")",
";",
"break",
"label",
";",
"}",
"else",
"{",
"sb",
".",
"setLength",
"(",
"0",
")",
";",
"}",
"}",
"}",
"else",
"{",
"sb",
".",
"append",
"(",
"(",
"char",
")",
"c",
")",
";",
"}",
"}",
"}",
"//nothing more to read, does the current output match the pattern?",
"if",
"(",
"sb",
".",
"length",
"(",
")",
">",
"0",
"&&",
"searchWithinLines",
")",
"{",
"Matcher",
"m",
"=",
"pattern",
".",
"matcher",
"(",
"sb",
")",
";",
"if",
"(",
"m",
".",
"find",
"(",
")",
")",
"{",
"result",
"=",
"m",
".",
"group",
"(",
"0",
")",
";",
"break",
"label",
";",
"}",
"}",
"try",
"{",
"Thread",
".",
"sleep",
"(",
"10",
")",
";",
"//avoid a busy loop since we are using nonblocking ready() / read()",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"}",
"checkTimeout",
"(",
"timeout",
",",
"timeoutInSeconds",
")",
";",
"if",
"(",
"process",
".",
"isStopped",
"(",
")",
"&&",
"!",
"bufferedReader",
".",
"ready",
"(",
")",
")",
"{",
"ChorusAssert",
".",
"fail",
"(",
"process",
".",
"isExitWithFailureCode",
"(",
")",
"?",
"\"Process stopped with error code \"",
"+",
"process",
".",
"getExitCode",
"(",
")",
"+",
"\" while waiting for match\"",
":",
"\"Process stopped while waiting for match\"",
")",
";",
"}",
"}",
"return",
"result",
";",
"}"
] | read ahead without blocking and attempt to match the pattern | [
"read",
"ahead",
"without",
"blocking",
"and",
"attempt",
"to",
"match",
"the",
"pattern"
] | 1eea7ca858876bce821bb49b43fd5b6ba1737997 | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-processes/src/main/java/org/chorusbdd/chorus/processes/manager/patternmatching/TailLogPatternMatcher.java#L79-L128 |
143,225 | adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/manager/BankInfo.java | BankInfo.parse | static BankInfo parse(String text) {
BankInfo info = new BankInfo();
if (text == null || text.length() == 0)
return info;
String[] cols = text.split("\\|");
info.setName(getValue(cols, 0));
info.setLocation(getValue(cols, 1));
info.setBic(getValue(cols, 2));
info.setChecksumMethod(getValue(cols, 3));
info.setRdhAddress(getValue(cols, 4));
info.setPinTanAddress(getValue(cols, 5));
info.setRdhVersion(HBCIVersion.byId(getValue(cols, 6)));
info.setPinTanVersion(HBCIVersion.byId(getValue(cols, 7)));
return info;
} | java | static BankInfo parse(String text) {
BankInfo info = new BankInfo();
if (text == null || text.length() == 0)
return info;
String[] cols = text.split("\\|");
info.setName(getValue(cols, 0));
info.setLocation(getValue(cols, 1));
info.setBic(getValue(cols, 2));
info.setChecksumMethod(getValue(cols, 3));
info.setRdhAddress(getValue(cols, 4));
info.setPinTanAddress(getValue(cols, 5));
info.setRdhVersion(HBCIVersion.byId(getValue(cols, 6)));
info.setPinTanVersion(HBCIVersion.byId(getValue(cols, 7)));
return info;
} | [
"static",
"BankInfo",
"parse",
"(",
"String",
"text",
")",
"{",
"BankInfo",
"info",
"=",
"new",
"BankInfo",
"(",
")",
";",
"if",
"(",
"text",
"==",
"null",
"||",
"text",
".",
"length",
"(",
")",
"==",
"0",
")",
"return",
"info",
";",
"String",
"[",
"]",
"cols",
"=",
"text",
".",
"split",
"(",
"\"\\\\|\"",
")",
";",
"info",
".",
"setName",
"(",
"getValue",
"(",
"cols",
",",
"0",
")",
")",
";",
"info",
".",
"setLocation",
"(",
"getValue",
"(",
"cols",
",",
"1",
")",
")",
";",
"info",
".",
"setBic",
"(",
"getValue",
"(",
"cols",
",",
"2",
")",
")",
";",
"info",
".",
"setChecksumMethod",
"(",
"getValue",
"(",
"cols",
",",
"3",
")",
")",
";",
"info",
".",
"setRdhAddress",
"(",
"getValue",
"(",
"cols",
",",
"4",
")",
")",
";",
"info",
".",
"setPinTanAddress",
"(",
"getValue",
"(",
"cols",
",",
"5",
")",
")",
";",
"info",
".",
"setRdhVersion",
"(",
"HBCIVersion",
".",
"byId",
"(",
"getValue",
"(",
"cols",
",",
"6",
")",
")",
")",
";",
"info",
".",
"setPinTanVersion",
"(",
"HBCIVersion",
".",
"byId",
"(",
"getValue",
"(",
"cols",
",",
"7",
")",
")",
")",
";",
"return",
"info",
";",
"}"
] | Parst die BankInfo-Daten aus einer Zeile der blz.properties.
@param text der Text (Value) aus der blz.properties.
@return das BankInfo-Objekt. Niemals NULL sondern hoechstens ein leeres Objekt. | [
"Parst",
"die",
"BankInfo",
"-",
"Daten",
"aus",
"einer",
"Zeile",
"der",
"blz",
".",
"properties",
"."
] | 5e24f7e429d6b555e1d993196b4cf1adda6433cf | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/manager/BankInfo.java#L30-L46 |
143,226 | adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/manager/BankInfo.java | BankInfo.getValue | private static String getValue(String[] cols, int idx) {
if (cols == null || idx >= cols.length)
return null;
return cols[idx];
} | java | private static String getValue(String[] cols, int idx) {
if (cols == null || idx >= cols.length)
return null;
return cols[idx];
} | [
"private",
"static",
"String",
"getValue",
"(",
"String",
"[",
"]",
"cols",
",",
"int",
"idx",
")",
"{",
"if",
"(",
"cols",
"==",
"null",
"||",
"idx",
">=",
"cols",
".",
"length",
")",
"return",
"null",
";",
"return",
"cols",
"[",
"idx",
"]",
";",
"}"
] | Liefert den Wert aus der angegebenen Spalte.
@param cols die Werte.
@param idx die Spalte - beginnend bei 0.
@return der Wert der Spalte oder NULL, wenn er nicht existiert.
Die Funktion wirft keine {@link ArrayIndexOutOfBoundsException} | [
"Liefert",
"den",
"Wert",
"aus",
"der",
"angegebenen",
"Spalte",
"."
] | 5e24f7e429d6b555e1d993196b4cf1adda6433cf | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/manager/BankInfo.java#L56-L60 |
143,227 | Chorus-bdd/Chorus | interpreter/chorus-util/src/main/java/org/chorusbdd/chorus/util/properties/PropertyOperations.java | PropertyOperations.splitKeyAndGroup | public GroupedPropertyLoader splitKeyAndGroup(final String keyDelimiter) {
return group(new BiFunction<String, String, Tuple3<String, String, String>>() {
public Tuple3<String, String, String> apply(String key, String value) {
String[] keyTokens = key.split(keyDelimiter, 2);
if ( keyTokens.length == 1) {
keyTokens = new String[] {"", keyTokens[0]};
}
return Tuple3.tuple3(keyTokens[0], keyTokens[1], value);
}
});
} | java | public GroupedPropertyLoader splitKeyAndGroup(final String keyDelimiter) {
return group(new BiFunction<String, String, Tuple3<String, String, String>>() {
public Tuple3<String, String, String> apply(String key, String value) {
String[] keyTokens = key.split(keyDelimiter, 2);
if ( keyTokens.length == 1) {
keyTokens = new String[] {"", keyTokens[0]};
}
return Tuple3.tuple3(keyTokens[0], keyTokens[1], value);
}
});
} | [
"public",
"GroupedPropertyLoader",
"splitKeyAndGroup",
"(",
"final",
"String",
"keyDelimiter",
")",
"{",
"return",
"group",
"(",
"new",
"BiFunction",
"<",
"String",
",",
"String",
",",
"Tuple3",
"<",
"String",
",",
"String",
",",
"String",
">",
">",
"(",
")",
"{",
"public",
"Tuple3",
"<",
"String",
",",
"String",
",",
"String",
">",
"apply",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"String",
"[",
"]",
"keyTokens",
"=",
"key",
".",
"split",
"(",
"keyDelimiter",
",",
"2",
")",
";",
"if",
"(",
"keyTokens",
".",
"length",
"==",
"1",
")",
"{",
"keyTokens",
"=",
"new",
"String",
"[",
"]",
"{",
"\"\"",
",",
"keyTokens",
"[",
"0",
"]",
"}",
";",
"}",
"return",
"Tuple3",
".",
"tuple3",
"(",
"keyTokens",
"[",
"0",
"]",
",",
"keyTokens",
"[",
"1",
"]",
",",
"value",
")",
";",
"}",
"}",
")",
";",
"}"
] | Split the key into 2 and use the first token to group
<pre>
For keys in the form:
Properties()
group.key1=value1
group.key2=value2
group2.key2=value2
group2.key3=value3
create a GroupedPropertyLoader to load one Properties map for each of the groups, stripping the group name from property keys
e.g.
group1 = Properties()
key1=value1
key2=value2
group2 = Properties()
key2 = value2
key3 = value3
Where the delimiter does not exist in the source key, the group "" will be used.
</pre>
@param keyDelimiter | [
"Split",
"the",
"key",
"into",
"2",
"and",
"use",
"the",
"first",
"token",
"to",
"group"
] | 1eea7ca858876bce821bb49b43fd5b6ba1737997 | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-util/src/main/java/org/chorusbdd/chorus/util/properties/PropertyOperations.java#L165-L175 |
143,228 | Chorus-bdd/Chorus | interpreter/chorus/src/main/java/org/chorusbdd/chorus/ant/ChorusTask.java | ChorusTask.execute | @Override
public void execute() throws BuildException {
Java javaTask = (Java) getProject().createTask("java");
javaTask.setTaskName(getTaskName());
javaTask.setClassname("org.chorusbdd.chorus.Main");
javaTask.setClasspath(classpath);
//if log4j config is set then pass this on to new process
String value = System.getProperty("log4j.configuration");
if (value != null) {
Environment.Variable sysp = new Environment.Variable();
sysp.setKey("log4j.configuration");
sysp.setValue(value);
javaTask.addSysproperty(sysp);
}
//provide the verbose flag
if (verbose) {
javaTask.createArg().setValue("-verbose");
}
//set the feature file args
javaTask.createArg().setValue("-f");
for (File featureFile : featureFiles) {
System.out.println("Found feature " + featureFile);
javaTask.createArg().setFile(featureFile);
}
System.out.println("Classpath " + classpath);
//set the base packges args
javaTask.createArg().setValue("-h");
for (String basePackage : handlerBasePackages.split(",")) {
javaTask.createArg().setValue(basePackage.trim());
}
javaTask.setFork(true);
int exitStatus = javaTask.executeJava();
if (exitStatus != 0) {
String failMessage = "Chorus feature failed, see test results for details.";
if (failOnTestFailure) {
throw new BuildException(failMessage);
} else {
log(failMessage, Project.MSG_ERR);
}
} else {
log("Chorus features all passed", Project.MSG_INFO);
}
} | java | @Override
public void execute() throws BuildException {
Java javaTask = (Java) getProject().createTask("java");
javaTask.setTaskName(getTaskName());
javaTask.setClassname("org.chorusbdd.chorus.Main");
javaTask.setClasspath(classpath);
//if log4j config is set then pass this on to new process
String value = System.getProperty("log4j.configuration");
if (value != null) {
Environment.Variable sysp = new Environment.Variable();
sysp.setKey("log4j.configuration");
sysp.setValue(value);
javaTask.addSysproperty(sysp);
}
//provide the verbose flag
if (verbose) {
javaTask.createArg().setValue("-verbose");
}
//set the feature file args
javaTask.createArg().setValue("-f");
for (File featureFile : featureFiles) {
System.out.println("Found feature " + featureFile);
javaTask.createArg().setFile(featureFile);
}
System.out.println("Classpath " + classpath);
//set the base packges args
javaTask.createArg().setValue("-h");
for (String basePackage : handlerBasePackages.split(",")) {
javaTask.createArg().setValue(basePackage.trim());
}
javaTask.setFork(true);
int exitStatus = javaTask.executeJava();
if (exitStatus != 0) {
String failMessage = "Chorus feature failed, see test results for details.";
if (failOnTestFailure) {
throw new BuildException(failMessage);
} else {
log(failMessage, Project.MSG_ERR);
}
} else {
log("Chorus features all passed", Project.MSG_INFO);
}
} | [
"@",
"Override",
"public",
"void",
"execute",
"(",
")",
"throws",
"BuildException",
"{",
"Java",
"javaTask",
"=",
"(",
"Java",
")",
"getProject",
"(",
")",
".",
"createTask",
"(",
"\"java\"",
")",
";",
"javaTask",
".",
"setTaskName",
"(",
"getTaskName",
"(",
")",
")",
";",
"javaTask",
".",
"setClassname",
"(",
"\"org.chorusbdd.chorus.Main\"",
")",
";",
"javaTask",
".",
"setClasspath",
"(",
"classpath",
")",
";",
"//if log4j config is set then pass this on to new process",
"String",
"value",
"=",
"System",
".",
"getProperty",
"(",
"\"log4j.configuration\"",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"Environment",
".",
"Variable",
"sysp",
"=",
"new",
"Environment",
".",
"Variable",
"(",
")",
";",
"sysp",
".",
"setKey",
"(",
"\"log4j.configuration\"",
")",
";",
"sysp",
".",
"setValue",
"(",
"value",
")",
";",
"javaTask",
".",
"addSysproperty",
"(",
"sysp",
")",
";",
"}",
"//provide the verbose flag",
"if",
"(",
"verbose",
")",
"{",
"javaTask",
".",
"createArg",
"(",
")",
".",
"setValue",
"(",
"\"-verbose\"",
")",
";",
"}",
"//set the feature file args",
"javaTask",
".",
"createArg",
"(",
")",
".",
"setValue",
"(",
"\"-f\"",
")",
";",
"for",
"(",
"File",
"featureFile",
":",
"featureFiles",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Found feature \"",
"+",
"featureFile",
")",
";",
"javaTask",
".",
"createArg",
"(",
")",
".",
"setFile",
"(",
"featureFile",
")",
";",
"}",
"System",
".",
"out",
".",
"println",
"(",
"\"Classpath \"",
"+",
"classpath",
")",
";",
"//set the base packges args",
"javaTask",
".",
"createArg",
"(",
")",
".",
"setValue",
"(",
"\"-h\"",
")",
";",
"for",
"(",
"String",
"basePackage",
":",
"handlerBasePackages",
".",
"split",
"(",
"\",\"",
")",
")",
"{",
"javaTask",
".",
"createArg",
"(",
")",
".",
"setValue",
"(",
"basePackage",
".",
"trim",
"(",
")",
")",
";",
"}",
"javaTask",
".",
"setFork",
"(",
"true",
")",
";",
"int",
"exitStatus",
"=",
"javaTask",
".",
"executeJava",
"(",
")",
";",
"if",
"(",
"exitStatus",
"!=",
"0",
")",
"{",
"String",
"failMessage",
"=",
"\"Chorus feature failed, see test results for details.\"",
";",
"if",
"(",
"failOnTestFailure",
")",
"{",
"throw",
"new",
"BuildException",
"(",
"failMessage",
")",
";",
"}",
"else",
"{",
"log",
"(",
"failMessage",
",",
"Project",
".",
"MSG_ERR",
")",
";",
"}",
"}",
"else",
"{",
"log",
"(",
"\"Chorus features all passed\"",
",",
"Project",
".",
"MSG_INFO",
")",
";",
"}",
"}"
] | Launches Chorus and runs the Interpreter over the speficied feature files
@throws org.apache.tools.ant.BuildException | [
"Launches",
"Chorus",
"and",
"runs",
"the",
"Interpreter",
"over",
"the",
"speficied",
"feature",
"files"
] | 1eea7ca858876bce821bb49b43fd5b6ba1737997 | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus/src/main/java/org/chorusbdd/chorus/ant/ChorusTask.java#L64-L112 |
143,229 | Chorus-bdd/Chorus | interpreter/chorus/src/main/java/org/chorusbdd/chorus/ant/ChorusTask.java | ChorusTask.addConfiguredFileset | public void addConfiguredFileset(FileSet fs) {
File dir = fs.getDir();
DirectoryScanner ds = fs.getDirectoryScanner();
String[] fileNames = ds.getIncludedFiles();
for (String fileName : fileNames) {
featureFiles.add(new File(dir, fileName));
}
} | java | public void addConfiguredFileset(FileSet fs) {
File dir = fs.getDir();
DirectoryScanner ds = fs.getDirectoryScanner();
String[] fileNames = ds.getIncludedFiles();
for (String fileName : fileNames) {
featureFiles.add(new File(dir, fileName));
}
} | [
"public",
"void",
"addConfiguredFileset",
"(",
"FileSet",
"fs",
")",
"{",
"File",
"dir",
"=",
"fs",
".",
"getDir",
"(",
")",
";",
"DirectoryScanner",
"ds",
"=",
"fs",
".",
"getDirectoryScanner",
"(",
")",
";",
"String",
"[",
"]",
"fileNames",
"=",
"ds",
".",
"getIncludedFiles",
"(",
")",
";",
"for",
"(",
"String",
"fileName",
":",
"fileNames",
")",
"{",
"featureFiles",
".",
"add",
"(",
"new",
"File",
"(",
"dir",
",",
"fileName",
")",
")",
";",
"}",
"}"
] | Used to set the list of feature files that will be processed | [
"Used",
"to",
"set",
"the",
"list",
"of",
"feature",
"files",
"that",
"will",
"be",
"processed"
] | 1eea7ca858876bce821bb49b43fd5b6ba1737997 | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus/src/main/java/org/chorusbdd/chorus/ant/ChorusTask.java#L117-L124 |
143,230 | adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/GV/generators/AbstractSEPAGenerator.java | AbstractSEPAGenerator.marshal | protected void marshal(JAXBElement e, OutputStream os, boolean validate) throws Exception {
JAXBContext jaxbContext = JAXBContext.newInstance(e.getDeclaredType());
Marshaller marshaller = jaxbContext.createMarshaller();
// Wir verwenden hier hart UTF-8. Siehe http://www.onlinebanking-forum.de/forum/topic.php?p=107420#real107420
marshaller.setProperty(Marshaller.JAXB_ENCODING, ENCODING);
// Siehe https://groups.google.com/d/msg/hbci4java/RYHCai_TzHM/72Bx51B9bXUJ
if (System.getProperty("sepa.pain.formatted", "false").equalsIgnoreCase("true"))
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
SepaVersion version = this.getSepaVersion();
if (version != null) {
String schemaLocation = version.getSchemaLocation();
if (schemaLocation != null) {
LOG.fine("appending schemaLocation " + schemaLocation);
marshaller.setProperty(Marshaller.JAXB_SCHEMA_LOCATION, schemaLocation);
}
String file = version.getFile();
if (file != null) {
if (validate) {
Source source = null;
InputStream is = this.getClass().getClassLoader().getResourceAsStream(file);
if (is != null) {
source = new StreamSource(is);
} else {
// Fallback auf File-Objekt
File f = new File(file);
if (f.isFile() && f.canRead())
source = new StreamSource(f);
}
if (source == null)
throw new HBCI_Exception("schema validation activated against " + file + " - but schema file " +
"could not be found");
LOG.fine("activating schema validation against " + file);
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = schemaFactory.newSchema(source);
marshaller.setSchema(schema);
}
}
}
marshaller.marshal(e, os);
} | java | protected void marshal(JAXBElement e, OutputStream os, boolean validate) throws Exception {
JAXBContext jaxbContext = JAXBContext.newInstance(e.getDeclaredType());
Marshaller marshaller = jaxbContext.createMarshaller();
// Wir verwenden hier hart UTF-8. Siehe http://www.onlinebanking-forum.de/forum/topic.php?p=107420#real107420
marshaller.setProperty(Marshaller.JAXB_ENCODING, ENCODING);
// Siehe https://groups.google.com/d/msg/hbci4java/RYHCai_TzHM/72Bx51B9bXUJ
if (System.getProperty("sepa.pain.formatted", "false").equalsIgnoreCase("true"))
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
SepaVersion version = this.getSepaVersion();
if (version != null) {
String schemaLocation = version.getSchemaLocation();
if (schemaLocation != null) {
LOG.fine("appending schemaLocation " + schemaLocation);
marshaller.setProperty(Marshaller.JAXB_SCHEMA_LOCATION, schemaLocation);
}
String file = version.getFile();
if (file != null) {
if (validate) {
Source source = null;
InputStream is = this.getClass().getClassLoader().getResourceAsStream(file);
if (is != null) {
source = new StreamSource(is);
} else {
// Fallback auf File-Objekt
File f = new File(file);
if (f.isFile() && f.canRead())
source = new StreamSource(f);
}
if (source == null)
throw new HBCI_Exception("schema validation activated against " + file + " - but schema file " +
"could not be found");
LOG.fine("activating schema validation against " + file);
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = schemaFactory.newSchema(source);
marshaller.setSchema(schema);
}
}
}
marshaller.marshal(e, os);
} | [
"protected",
"void",
"marshal",
"(",
"JAXBElement",
"e",
",",
"OutputStream",
"os",
",",
"boolean",
"validate",
")",
"throws",
"Exception",
"{",
"JAXBContext",
"jaxbContext",
"=",
"JAXBContext",
".",
"newInstance",
"(",
"e",
".",
"getDeclaredType",
"(",
")",
")",
";",
"Marshaller",
"marshaller",
"=",
"jaxbContext",
".",
"createMarshaller",
"(",
")",
";",
"// Wir verwenden hier hart UTF-8. Siehe http://www.onlinebanking-forum.de/forum/topic.php?p=107420#real107420",
"marshaller",
".",
"setProperty",
"(",
"Marshaller",
".",
"JAXB_ENCODING",
",",
"ENCODING",
")",
";",
"// Siehe https://groups.google.com/d/msg/hbci4java/RYHCai_TzHM/72Bx51B9bXUJ",
"if",
"(",
"System",
".",
"getProperty",
"(",
"\"sepa.pain.formatted\"",
",",
"\"false\"",
")",
".",
"equalsIgnoreCase",
"(",
"\"true\"",
")",
")",
"marshaller",
".",
"setProperty",
"(",
"Marshaller",
".",
"JAXB_FORMATTED_OUTPUT",
",",
"Boolean",
".",
"TRUE",
")",
";",
"SepaVersion",
"version",
"=",
"this",
".",
"getSepaVersion",
"(",
")",
";",
"if",
"(",
"version",
"!=",
"null",
")",
"{",
"String",
"schemaLocation",
"=",
"version",
".",
"getSchemaLocation",
"(",
")",
";",
"if",
"(",
"schemaLocation",
"!=",
"null",
")",
"{",
"LOG",
".",
"fine",
"(",
"\"appending schemaLocation \"",
"+",
"schemaLocation",
")",
";",
"marshaller",
".",
"setProperty",
"(",
"Marshaller",
".",
"JAXB_SCHEMA_LOCATION",
",",
"schemaLocation",
")",
";",
"}",
"String",
"file",
"=",
"version",
".",
"getFile",
"(",
")",
";",
"if",
"(",
"file",
"!=",
"null",
")",
"{",
"if",
"(",
"validate",
")",
"{",
"Source",
"source",
"=",
"null",
";",
"InputStream",
"is",
"=",
"this",
".",
"getClass",
"(",
")",
".",
"getClassLoader",
"(",
")",
".",
"getResourceAsStream",
"(",
"file",
")",
";",
"if",
"(",
"is",
"!=",
"null",
")",
"{",
"source",
"=",
"new",
"StreamSource",
"(",
"is",
")",
";",
"}",
"else",
"{",
"// Fallback auf File-Objekt",
"File",
"f",
"=",
"new",
"File",
"(",
"file",
")",
";",
"if",
"(",
"f",
".",
"isFile",
"(",
")",
"&&",
"f",
".",
"canRead",
"(",
")",
")",
"source",
"=",
"new",
"StreamSource",
"(",
"f",
")",
";",
"}",
"if",
"(",
"source",
"==",
"null",
")",
"throw",
"new",
"HBCI_Exception",
"(",
"\"schema validation activated against \"",
"+",
"file",
"+",
"\" - but schema file \"",
"+",
"\"could not be found\"",
")",
";",
"LOG",
".",
"fine",
"(",
"\"activating schema validation against \"",
"+",
"file",
")",
";",
"SchemaFactory",
"schemaFactory",
"=",
"SchemaFactory",
".",
"newInstance",
"(",
"XMLConstants",
".",
"W3C_XML_SCHEMA_NS_URI",
")",
";",
"Schema",
"schema",
"=",
"schemaFactory",
".",
"newSchema",
"(",
"source",
")",
";",
"marshaller",
".",
"setSchema",
"(",
"schema",
")",
";",
"}",
"}",
"}",
"marshaller",
".",
"marshal",
"(",
"e",
",",
"os",
")",
";",
"}"
] | Schreibt die Bean mittels JAXB in den Strean.
@param e das zu schreibende JAXBElement mit der Bean.
@param os der OutputStream, in den das XML geschrieben wird.
@param validate true, wenn das erzeugte XML gegen das PAIN-Schema validiert werden soll.
@throws Exception | [
"Schreibt",
"die",
"Bean",
"mittels",
"JAXB",
"in",
"den",
"Strean",
"."
] | 5e24f7e429d6b555e1d993196b4cf1adda6433cf | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/GV/generators/AbstractSEPAGenerator.java#L40-L87 |
143,231 | adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/manager/QRCode.java | QRCode.tryParse | public static QRCode tryParse(String hhd, String msg) {
try {
return new QRCode(hhd, msg);
} catch (Exception e) {
return null;
}
} | java | public static QRCode tryParse(String hhd, String msg) {
try {
return new QRCode(hhd, msg);
} catch (Exception e) {
return null;
}
} | [
"public",
"static",
"QRCode",
"tryParse",
"(",
"String",
"hhd",
",",
"String",
"msg",
")",
"{",
"try",
"{",
"return",
"new",
"QRCode",
"(",
"hhd",
",",
"msg",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"return",
"null",
";",
"}",
"}"
] | Versucht die Daten als QR-Code zu parsen.
@param hhd der HHDuc.
@param msg die Nachricht.
@return der QR-Code oder NULL. | [
"Versucht",
"die",
"Daten",
"als",
"QR",
"-",
"Code",
"zu",
"parsen",
"."
] | 5e24f7e429d6b555e1d993196b4cf1adda6433cf | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/manager/QRCode.java#L139-L145 |
143,232 | adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/manager/QRCode.java | QRCode.decode | private String decode(byte[] bytes) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < bytes.length; ++i) {
sb.append(Integer.toString(bytes[i], 10));
}
return sb.toString();
} | java | private String decode(byte[] bytes) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < bytes.length; ++i) {
sb.append(Integer.toString(bytes[i], 10));
}
return sb.toString();
} | [
"private",
"String",
"decode",
"(",
"byte",
"[",
"]",
"bytes",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"bytes",
".",
"length",
";",
"++",
"i",
")",
"{",
"sb",
".",
"append",
"(",
"Integer",
".",
"toString",
"(",
"bytes",
"[",
"i",
"]",
",",
"10",
")",
")",
";",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] | Decodiert die Bytes als String.
@param bytes die Bytes.
@return der String. | [
"Decodiert",
"die",
"Bytes",
"als",
"String",
"."
] | 5e24f7e429d6b555e1d993196b4cf1adda6433cf | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/manager/QRCode.java#L153-L159 |
143,233 | IBM-Cloud/gp-java-client | src/main/java/com/ibm/g11n/pipeline/client/MTServiceBindingData.java | MTServiceBindingData.getServiceCredentials | public Map<String, Object> getServiceCredentials() {
if (serviceCredentials == null) {
return null;
}
return Collections.unmodifiableMap(serviceCredentials);
} | java | public Map<String, Object> getServiceCredentials() {
if (serviceCredentials == null) {
return null;
}
return Collections.unmodifiableMap(serviceCredentials);
} | [
"public",
"Map",
"<",
"String",
",",
"Object",
">",
"getServiceCredentials",
"(",
")",
"{",
"if",
"(",
"serviceCredentials",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"Collections",
".",
"unmodifiableMap",
"(",
"serviceCredentials",
")",
";",
"}"
] | Returns the credentials used for accessing the machine translation service.
@return The credentials used for accessing the machine translation service. | [
"Returns",
"the",
"credentials",
"used",
"for",
"accessing",
"the",
"machine",
"translation",
"service",
"."
] | b015a081d7a7313bc48c448087fbc07bce860427 | https://github.com/IBM-Cloud/gp-java-client/blob/b015a081d7a7313bc48c448087fbc07bce860427/src/main/java/com/ibm/g11n/pipeline/client/MTServiceBindingData.java#L76-L81 |
143,234 | Chorus-bdd/Chorus | interpreter/chorus-handlerconfig/src/main/java/org/chorusbdd/chorus/handlerconfig/HandlerConfigLoader.java | HandlerConfigLoader.loadPropertiesForSubGroup | public Properties loadPropertiesForSubGroup(ConfigurationManager configurationManager, String handlerPrefix, String groupName) {
PropertyOperations handlerProps = properties(loadProperties(configurationManager, handlerPrefix));
PropertyOperations defaultProps = handlerProps.filterByAndRemoveKeyPrefix(ChorusConstants.DEFAULT_PROPERTIES_GROUP + ".");
PropertyOperations configProps = handlerProps.filterByAndRemoveKeyPrefix(groupName + ".");
PropertyOperations merged = defaultProps.merge(configProps);
return merged.loadProperties();
} | java | public Properties loadPropertiesForSubGroup(ConfigurationManager configurationManager, String handlerPrefix, String groupName) {
PropertyOperations handlerProps = properties(loadProperties(configurationManager, handlerPrefix));
PropertyOperations defaultProps = handlerProps.filterByAndRemoveKeyPrefix(ChorusConstants.DEFAULT_PROPERTIES_GROUP + ".");
PropertyOperations configProps = handlerProps.filterByAndRemoveKeyPrefix(groupName + ".");
PropertyOperations merged = defaultProps.merge(configProps);
return merged.loadProperties();
} | [
"public",
"Properties",
"loadPropertiesForSubGroup",
"(",
"ConfigurationManager",
"configurationManager",
",",
"String",
"handlerPrefix",
",",
"String",
"groupName",
")",
"{",
"PropertyOperations",
"handlerProps",
"=",
"properties",
"(",
"loadProperties",
"(",
"configurationManager",
",",
"handlerPrefix",
")",
")",
";",
"PropertyOperations",
"defaultProps",
"=",
"handlerProps",
".",
"filterByAndRemoveKeyPrefix",
"(",
"ChorusConstants",
".",
"DEFAULT_PROPERTIES_GROUP",
"+",
"\".\"",
")",
";",
"PropertyOperations",
"configProps",
"=",
"handlerProps",
".",
"filterByAndRemoveKeyPrefix",
"(",
"groupName",
"+",
"\".\"",
")",
";",
"PropertyOperations",
"merged",
"=",
"defaultProps",
".",
"merge",
"(",
"configProps",
")",
";",
"return",
"merged",
".",
"loadProperties",
"(",
")",
";",
"}"
] | Get properties for a specific config, for a handler which maintains properties grouped by configNames
Defaults may also be provided in a special default configName, defaults provide base values which may be overridden
by those set at configName level.
myHandler.config1.property1=val
myHandler.config1.property2=val
myHandler.config2.property1=val
myHandler.config2.property2=val
myHandler.default.property1=val | [
"Get",
"properties",
"for",
"a",
"specific",
"config",
"for",
"a",
"handler",
"which",
"maintains",
"properties",
"grouped",
"by",
"configNames"
] | 1eea7ca858876bce821bb49b43fd5b6ba1737997 | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-handlerconfig/src/main/java/org/chorusbdd/chorus/handlerconfig/HandlerConfigLoader.java#L65-L73 |
143,235 | Chorus-bdd/Chorus | interpreter/chorus-parser/src/main/java/org/chorusbdd/chorus/parser/StepMacro.java | StepMacro.replaceVariablesWithPatterns | private String replaceVariablesWithPatterns(String pattern) {
int group = 0;
Matcher findVariablesMatcher = variablePattern.matcher(pattern);
while(findVariablesMatcher.find()) {
String variable = findVariablesMatcher.group(0);
pattern = pattern.replaceFirst(variable, "(.+)");
variableToGroupNumber.put(variable, ++group);
}
return pattern;
} | java | private String replaceVariablesWithPatterns(String pattern) {
int group = 0;
Matcher findVariablesMatcher = variablePattern.matcher(pattern);
while(findVariablesMatcher.find()) {
String variable = findVariablesMatcher.group(0);
pattern = pattern.replaceFirst(variable, "(.+)");
variableToGroupNumber.put(variable, ++group);
}
return pattern;
} | [
"private",
"String",
"replaceVariablesWithPatterns",
"(",
"String",
"pattern",
")",
"{",
"int",
"group",
"=",
"0",
";",
"Matcher",
"findVariablesMatcher",
"=",
"variablePattern",
".",
"matcher",
"(",
"pattern",
")",
";",
"while",
"(",
"findVariablesMatcher",
".",
"find",
"(",
")",
")",
"{",
"String",
"variable",
"=",
"findVariablesMatcher",
".",
"group",
"(",
"0",
")",
";",
"pattern",
"=",
"pattern",
".",
"replaceFirst",
"(",
"variable",
",",
"\"(.+)\"",
")",
";",
"variableToGroupNumber",
".",
"put",
"(",
"variable",
",",
"++",
"group",
")",
";",
"}",
"return",
"pattern",
";",
"}"
] | find and replace any variables in the form | [
"find",
"and",
"replace",
"any",
"variables",
"in",
"the",
"form"
] | 1eea7ca858876bce821bb49b43fd5b6ba1737997 | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-parser/src/main/java/org/chorusbdd/chorus/parser/StepMacro.java#L107-L116 |
143,236 | Chorus-bdd/Chorus | interpreter/chorus-parser/src/main/java/org/chorusbdd/chorus/parser/StepMacro.java | StepMacro.processStep | public boolean processStep(StepToken scenarioStep, List<StepMacro> macros, boolean alreadymatched) {
boolean stepMacroMatched = doProcessStep(scenarioStep, macros, 0, alreadymatched);
return stepMacroMatched;
} | java | public boolean processStep(StepToken scenarioStep, List<StepMacro> macros, boolean alreadymatched) {
boolean stepMacroMatched = doProcessStep(scenarioStep, macros, 0, alreadymatched);
return stepMacroMatched;
} | [
"public",
"boolean",
"processStep",
"(",
"StepToken",
"scenarioStep",
",",
"List",
"<",
"StepMacro",
">",
"macros",
",",
"boolean",
"alreadymatched",
")",
"{",
"boolean",
"stepMacroMatched",
"=",
"doProcessStep",
"(",
"scenarioStep",
",",
"macros",
",",
"0",
",",
"alreadymatched",
")",
";",
"return",
"stepMacroMatched",
";",
"}"
] | Process a scenario step, adding child steps if it matches this StepMacro
@param scenarioStep the step to match to this StepMacro's pattern
@param macros the dictionary of macros against which to recursively match child steps | [
"Process",
"a",
"scenario",
"step",
"adding",
"child",
"steps",
"if",
"it",
"matches",
"this",
"StepMacro"
] | 1eea7ca858876bce821bb49b43fd5b6ba1737997 | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-parser/src/main/java/org/chorusbdd/chorus/parser/StepMacro.java#L128-L131 |
143,237 | Chorus-bdd/Chorus | interpreter/chorus-parser/src/main/java/org/chorusbdd/chorus/parser/StepMacro.java | StepMacro.replaceVariablesInMacroStep | private String replaceVariablesInMacroStep(Matcher macroMatcher, String action) {
for (Map.Entry<String, Integer> e : variableToGroupNumber.entrySet()) {
action = action.replace(e.getKey(), "<$" + e.getValue() + ">");
}
return action;
} | java | private String replaceVariablesInMacroStep(Matcher macroMatcher, String action) {
for (Map.Entry<String, Integer> e : variableToGroupNumber.entrySet()) {
action = action.replace(e.getKey(), "<$" + e.getValue() + ">");
}
return action;
} | [
"private",
"String",
"replaceVariablesInMacroStep",
"(",
"Matcher",
"macroMatcher",
",",
"String",
"action",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"Integer",
">",
"e",
":",
"variableToGroupNumber",
".",
"entrySet",
"(",
")",
")",
"{",
"action",
"=",
"action",
".",
"replace",
"(",
"e",
".",
"getKey",
"(",
")",
",",
"\"<$\"",
"+",
"e",
".",
"getValue",
"(",
")",
"+",
"\">\"",
")",
";",
"}",
"return",
"action",
";",
"}"
] | replace the variables using regular expresson group syntax | [
"replace",
"the",
"variables",
"using",
"regular",
"expresson",
"group",
"syntax"
] | 1eea7ca858876bce821bb49b43fd5b6ba1737997 | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-parser/src/main/java/org/chorusbdd/chorus/parser/StepMacro.java#L176-L181 |
143,238 | Chorus-bdd/Chorus | interpreter/chorus-parser/src/main/java/org/chorusbdd/chorus/parser/StepMacro.java | StepMacro.replaceGroupsInMacroStep | private String replaceGroupsInMacroStep(Matcher macroMatcher, String action) {
Matcher groupMatcher = groupPattern.matcher(action);
while(groupMatcher.find()) {
String match = groupMatcher.group();
String groupString = match.substring(2, match.length() - 1);
int groupId = Integer.parseInt(groupString);
if ( groupId > macroMatcher.groupCount() ) {
throw new ChorusException("Capture group with index " + groupId + " in StepMacro step '" + action +
"' did not have a matching capture group in the pattern '" + pattern.toString() + "'");
}
String replacement = macroMatcher.group(groupId);
replacement = RegexpUtils.escapeRegexReplacement(replacement);
log.trace("Replacing group " + match + " with " + replacement + " in action " + action);
action = action.replaceFirst("<\\$" + groupId + ">", replacement);
}
return action;
} | java | private String replaceGroupsInMacroStep(Matcher macroMatcher, String action) {
Matcher groupMatcher = groupPattern.matcher(action);
while(groupMatcher.find()) {
String match = groupMatcher.group();
String groupString = match.substring(2, match.length() - 1);
int groupId = Integer.parseInt(groupString);
if ( groupId > macroMatcher.groupCount() ) {
throw new ChorusException("Capture group with index " + groupId + " in StepMacro step '" + action +
"' did not have a matching capture group in the pattern '" + pattern.toString() + "'");
}
String replacement = macroMatcher.group(groupId);
replacement = RegexpUtils.escapeRegexReplacement(replacement);
log.trace("Replacing group " + match + " with " + replacement + " in action " + action);
action = action.replaceFirst("<\\$" + groupId + ">", replacement);
}
return action;
} | [
"private",
"String",
"replaceGroupsInMacroStep",
"(",
"Matcher",
"macroMatcher",
",",
"String",
"action",
")",
"{",
"Matcher",
"groupMatcher",
"=",
"groupPattern",
".",
"matcher",
"(",
"action",
")",
";",
"while",
"(",
"groupMatcher",
".",
"find",
"(",
")",
")",
"{",
"String",
"match",
"=",
"groupMatcher",
".",
"group",
"(",
")",
";",
"String",
"groupString",
"=",
"match",
".",
"substring",
"(",
"2",
",",
"match",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"int",
"groupId",
"=",
"Integer",
".",
"parseInt",
"(",
"groupString",
")",
";",
"if",
"(",
"groupId",
">",
"macroMatcher",
".",
"groupCount",
"(",
")",
")",
"{",
"throw",
"new",
"ChorusException",
"(",
"\"Capture group with index \"",
"+",
"groupId",
"+",
"\" in StepMacro step '\"",
"+",
"action",
"+",
"\"' did not have a matching capture group in the pattern '\"",
"+",
"pattern",
".",
"toString",
"(",
")",
"+",
"\"'\"",
")",
";",
"}",
"String",
"replacement",
"=",
"macroMatcher",
".",
"group",
"(",
"groupId",
")",
";",
"replacement",
"=",
"RegexpUtils",
".",
"escapeRegexReplacement",
"(",
"replacement",
")",
";",
"log",
".",
"trace",
"(",
"\"Replacing group \"",
"+",
"match",
"+",
"\" with \"",
"+",
"replacement",
"+",
"\" in action \"",
"+",
"action",
")",
";",
"action",
"=",
"action",
".",
"replaceFirst",
"(",
"\"<\\\\$\"",
"+",
"groupId",
"+",
"\">\"",
",",
"replacement",
")",
";",
"}",
"return",
"action",
";",
"}"
] | capturing group from the macroMatcher | [
"capturing",
"group",
"from",
"the",
"macroMatcher"
] | 1eea7ca858876bce821bb49b43fd5b6ba1737997 | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-parser/src/main/java/org/chorusbdd/chorus/parser/StepMacro.java#L185-L201 |
143,239 | Chorus-bdd/Chorus | interpreter/chorus-parser/src/main/java/org/chorusbdd/chorus/parser/StepMacro.java | StepMacro.calculateStepMacroEndState | public static StepEndState calculateStepMacroEndState(List<StepToken> executedSteps) {
StepEndState stepMacroEndState = StepEndState.PASSED;
for ( StepToken s : executedSteps) {
if ( s.getEndState() != StepEndState.PASSED) {
stepMacroEndState = s.getEndState();
break;
}
}
return stepMacroEndState;
} | java | public static StepEndState calculateStepMacroEndState(List<StepToken> executedSteps) {
StepEndState stepMacroEndState = StepEndState.PASSED;
for ( StepToken s : executedSteps) {
if ( s.getEndState() != StepEndState.PASSED) {
stepMacroEndState = s.getEndState();
break;
}
}
return stepMacroEndState;
} | [
"public",
"static",
"StepEndState",
"calculateStepMacroEndState",
"(",
"List",
"<",
"StepToken",
">",
"executedSteps",
")",
"{",
"StepEndState",
"stepMacroEndState",
"=",
"StepEndState",
".",
"PASSED",
";",
"for",
"(",
"StepToken",
"s",
":",
"executedSteps",
")",
"{",
"if",
"(",
"s",
".",
"getEndState",
"(",
")",
"!=",
"StepEndState",
".",
"PASSED",
")",
"{",
"stepMacroEndState",
"=",
"s",
".",
"getEndState",
"(",
")",
";",
"break",
";",
"}",
"}",
"return",
"stepMacroEndState",
";",
"}"
] | The end state of a step macro step is derived from the child steps
If all child steps are PASSED then the step macro will be PASSED,
otherwise the step macro end state is taken from the first child step which was not PASSED | [
"The",
"end",
"state",
"of",
"a",
"step",
"macro",
"step",
"is",
"derived",
"from",
"the",
"child",
"steps",
"If",
"all",
"child",
"steps",
"are",
"PASSED",
"then",
"the",
"step",
"macro",
"will",
"be",
"PASSED",
"otherwise",
"the",
"step",
"macro",
"end",
"state",
"is",
"taken",
"from",
"the",
"first",
"child",
"step",
"which",
"was",
"not",
"PASSED"
] | 1eea7ca858876bce821bb49b43fd5b6ba1737997 | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-parser/src/main/java/org/chorusbdd/chorus/parser/StepMacro.java#L212-L221 |
143,240 | Chorus-bdd/Chorus | interpreter/chorus-config/src/main/java/org/chorusbdd/chorus/config/CommandLineParser.java | CommandLineParser.isBooleanSwitchProperty | private boolean isBooleanSwitchProperty(ExecutionProperty property) {
return property.hasDefaults() && property.getDefaults().length == 1 && property.getDefaults()[0].equals("false");
} | java | private boolean isBooleanSwitchProperty(ExecutionProperty property) {
return property.hasDefaults() && property.getDefaults().length == 1 && property.getDefaults()[0].equals("false");
} | [
"private",
"boolean",
"isBooleanSwitchProperty",
"(",
"ExecutionProperty",
"property",
")",
"{",
"return",
"property",
".",
"hasDefaults",
"(",
")",
"&&",
"property",
".",
"getDefaults",
"(",
")",
".",
"length",
"==",
"1",
"&&",
"property",
".",
"getDefaults",
"(",
")",
"[",
"0",
"]",
".",
"equals",
"(",
"\"false\"",
")",
";",
"}"
] | This is a property with a boolean value which defaults to false
The user can 'turn this option on' by passing a command line switch without a value (e.g. -d ) in which case we need to
set the value to true
@param property
@return true if this is a boolean switch property | [
"This",
"is",
"a",
"property",
"with",
"a",
"boolean",
"value",
"which",
"defaults",
"to",
"false"
] | 1eea7ca858876bce821bb49b43fd5b6ba1737997 | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-config/src/main/java/org/chorusbdd/chorus/config/CommandLineParser.java#L115-L117 |
143,241 | adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/manager/AccountCRCAlgs.java | AccountCRCAlgs.alg_24 | public static boolean alg_24(int[] blz, int[] number) {
int[] weights = {1, 2, 3, 1, 2, 3, 1, 2, 3};
int crc = 0;
int idx = 0;
switch (number[0]) {
case 3:
case 4:
case 5:
case 6:
number[0] = 0;
break;
case 9:
number[0] = number[1] = number[2] = 0;
break;
default:
break;
}
for (int i = 0; i < 9; i++) {
if (number[i] > 0) {
idx = i;
break;
}
}
for (int i = idx, j = 0; i < 9; i++, j++) {
crc += ((weights[j] * number[i]) + weights[j]) % 11;
}
return ((crc % 10) == number[9]);
} | java | public static boolean alg_24(int[] blz, int[] number) {
int[] weights = {1, 2, 3, 1, 2, 3, 1, 2, 3};
int crc = 0;
int idx = 0;
switch (number[0]) {
case 3:
case 4:
case 5:
case 6:
number[0] = 0;
break;
case 9:
number[0] = number[1] = number[2] = 0;
break;
default:
break;
}
for (int i = 0; i < 9; i++) {
if (number[i] > 0) {
idx = i;
break;
}
}
for (int i = idx, j = 0; i < 9; i++, j++) {
crc += ((weights[j] * number[i]) + weights[j]) % 11;
}
return ((crc % 10) == number[9]);
} | [
"public",
"static",
"boolean",
"alg_24",
"(",
"int",
"[",
"]",
"blz",
",",
"int",
"[",
"]",
"number",
")",
"{",
"int",
"[",
"]",
"weights",
"=",
"{",
"1",
",",
"2",
",",
"3",
",",
"1",
",",
"2",
",",
"3",
",",
"1",
",",
"2",
",",
"3",
"}",
";",
"int",
"crc",
"=",
"0",
";",
"int",
"idx",
"=",
"0",
";",
"switch",
"(",
"number",
"[",
"0",
"]",
")",
"{",
"case",
"3",
":",
"case",
"4",
":",
"case",
"5",
":",
"case",
"6",
":",
"number",
"[",
"0",
"]",
"=",
"0",
";",
"break",
";",
"case",
"9",
":",
"number",
"[",
"0",
"]",
"=",
"number",
"[",
"1",
"]",
"=",
"number",
"[",
"2",
"]",
"=",
"0",
";",
"break",
";",
"default",
":",
"break",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"9",
";",
"i",
"++",
")",
"{",
"if",
"(",
"number",
"[",
"i",
"]",
">",
"0",
")",
"{",
"idx",
"=",
"i",
";",
"break",
";",
"}",
"}",
"for",
"(",
"int",
"i",
"=",
"idx",
",",
"j",
"=",
"0",
";",
"i",
"<",
"9",
";",
"i",
"++",
",",
"j",
"++",
")",
"{",
"crc",
"+=",
"(",
"(",
"weights",
"[",
"j",
"]",
"*",
"number",
"[",
"i",
"]",
")",
"+",
"weights",
"[",
"j",
"]",
")",
"%",
"11",
";",
"}",
"return",
"(",
"(",
"crc",
"%",
"10",
")",
"==",
"number",
"[",
"9",
"]",
")",
";",
"}"
] | code by Gerd Balzuweit | [
"code",
"by",
"Gerd",
"Balzuweit"
] | 5e24f7e429d6b555e1d993196b4cf1adda6433cf | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/manager/AccountCRCAlgs.java#L217-L250 |
143,242 | adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/rewrite/RWrongStatusSegOrder.java | RWrongStatusSegOrder.createSegmentListFromMessage | private List<HashMap<String, String>> createSegmentListFromMessage(String msg) {
List<HashMap<String, String>> segmentList = new ArrayList<HashMap<String, String>>();
boolean quoteNext = false;
int startPosi = 0;
for (int i = 0; i < msg.length(); i++) {
char ch = msg.charAt(i);
if (!quoteNext && ch == '@') {
// skip binary values
int idx = msg.indexOf("@", i + 1);
String len_st = msg.substring(i + 1, idx);
i += Integer.parseInt(len_st) + 1 + len_st.length();
} else if (!quoteNext && ch == '\'') {
// segment-ende gefunden
HashMap<String, String> segmentInfo = new HashMap<>();
segmentInfo.put("code", msg.substring(startPosi, msg.indexOf(":", startPosi)));
segmentInfo.put("start", Integer.toString(startPosi));
segmentInfo.put("length", Integer.toString(i - startPosi + 1));
segmentList.add(segmentInfo);
startPosi = i + 1;
}
quoteNext = !quoteNext && ch == '?';
}
return segmentList;
} | java | private List<HashMap<String, String>> createSegmentListFromMessage(String msg) {
List<HashMap<String, String>> segmentList = new ArrayList<HashMap<String, String>>();
boolean quoteNext = false;
int startPosi = 0;
for (int i = 0; i < msg.length(); i++) {
char ch = msg.charAt(i);
if (!quoteNext && ch == '@') {
// skip binary values
int idx = msg.indexOf("@", i + 1);
String len_st = msg.substring(i + 1, idx);
i += Integer.parseInt(len_st) + 1 + len_st.length();
} else if (!quoteNext && ch == '\'') {
// segment-ende gefunden
HashMap<String, String> segmentInfo = new HashMap<>();
segmentInfo.put("code", msg.substring(startPosi, msg.indexOf(":", startPosi)));
segmentInfo.put("start", Integer.toString(startPosi));
segmentInfo.put("length", Integer.toString(i - startPosi + 1));
segmentList.add(segmentInfo);
startPosi = i + 1;
}
quoteNext = !quoteNext && ch == '?';
}
return segmentList;
} | [
"private",
"List",
"<",
"HashMap",
"<",
"String",
",",
"String",
">",
">",
"createSegmentListFromMessage",
"(",
"String",
"msg",
")",
"{",
"List",
"<",
"HashMap",
"<",
"String",
",",
"String",
">",
">",
"segmentList",
"=",
"new",
"ArrayList",
"<",
"HashMap",
"<",
"String",
",",
"String",
">",
">",
"(",
")",
";",
"boolean",
"quoteNext",
"=",
"false",
";",
"int",
"startPosi",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"msg",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"char",
"ch",
"=",
"msg",
".",
"charAt",
"(",
"i",
")",
";",
"if",
"(",
"!",
"quoteNext",
"&&",
"ch",
"==",
"'",
"'",
")",
"{",
"// skip binary values",
"int",
"idx",
"=",
"msg",
".",
"indexOf",
"(",
"\"@\"",
",",
"i",
"+",
"1",
")",
";",
"String",
"len_st",
"=",
"msg",
".",
"substring",
"(",
"i",
"+",
"1",
",",
"idx",
")",
";",
"i",
"+=",
"Integer",
".",
"parseInt",
"(",
"len_st",
")",
"+",
"1",
"+",
"len_st",
".",
"length",
"(",
")",
";",
"}",
"else",
"if",
"(",
"!",
"quoteNext",
"&&",
"ch",
"==",
"'",
"'",
")",
"{",
"// segment-ende gefunden",
"HashMap",
"<",
"String",
",",
"String",
">",
"segmentInfo",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"segmentInfo",
".",
"put",
"(",
"\"code\"",
",",
"msg",
".",
"substring",
"(",
"startPosi",
",",
"msg",
".",
"indexOf",
"(",
"\":\"",
",",
"startPosi",
")",
")",
")",
";",
"segmentInfo",
".",
"put",
"(",
"\"start\"",
",",
"Integer",
".",
"toString",
"(",
"startPosi",
")",
")",
";",
"segmentInfo",
".",
"put",
"(",
"\"length\"",
",",
"Integer",
".",
"toString",
"(",
"i",
"-",
"startPosi",
"+",
"1",
")",
")",
";",
"segmentList",
".",
"add",
"(",
"segmentInfo",
")",
";",
"startPosi",
"=",
"i",
"+",
"1",
";",
"}",
"quoteNext",
"=",
"!",
"quoteNext",
"&&",
"ch",
"==",
"'",
"'",
";",
"}",
"return",
"segmentList",
";",
"}"
] | Liste mit segmentInfo-Properties aus der Nachricht erzeugen | [
"Liste",
"mit",
"segmentInfo",
"-",
"Properties",
"aus",
"der",
"Nachricht",
"erzeugen"
] | 5e24f7e429d6b555e1d993196b4cf1adda6433cf | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/rewrite/RWrongStatusSegOrder.java#L36-L64 |
143,243 | IBM-Cloud/gp-java-client | src/main/java/com/ibm/g11n/pipeline/client/impl/ServiceClientImpl.java | ServiceClientImpl.createGson | private static Gson createGson(String className) {
GsonBuilder builder = new GsonBuilder();
// ISO8601 date format support
builder.setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX");
builder.registerTypeAdapter(TranslationStatus.class,
new EnumWithFallbackAdapter<TranslationStatus>(TranslationStatus.UNKNOWN));
builder.registerTypeAdapter(TranslationRequestStatus.class,
new EnumWithFallbackAdapter<TranslationRequestStatus>(TranslationRequestStatus.UNKNOWN));
builder.registerTypeAdapter(
new TypeToken<EnumMap<TranslationStatus, Integer>>() {}.getType(),
new EnumMapInstanceCreator<TranslationStatus, Integer>(TranslationStatus.class));
builder.registerTypeAdapterFactory(new NullMapValueTypeAdapterFactory());
return builder.create();
} | java | private static Gson createGson(String className) {
GsonBuilder builder = new GsonBuilder();
// ISO8601 date format support
builder.setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX");
builder.registerTypeAdapter(TranslationStatus.class,
new EnumWithFallbackAdapter<TranslationStatus>(TranslationStatus.UNKNOWN));
builder.registerTypeAdapter(TranslationRequestStatus.class,
new EnumWithFallbackAdapter<TranslationRequestStatus>(TranslationRequestStatus.UNKNOWN));
builder.registerTypeAdapter(
new TypeToken<EnumMap<TranslationStatus, Integer>>() {}.getType(),
new EnumMapInstanceCreator<TranslationStatus, Integer>(TranslationStatus.class));
builder.registerTypeAdapterFactory(new NullMapValueTypeAdapterFactory());
return builder.create();
} | [
"private",
"static",
"Gson",
"createGson",
"(",
"String",
"className",
")",
"{",
"GsonBuilder",
"builder",
"=",
"new",
"GsonBuilder",
"(",
")",
";",
"// ISO8601 date format support",
"builder",
".",
"setDateFormat",
"(",
"\"yyyy-MM-dd'T'HH:mm:ss.SSSX\"",
")",
";",
"builder",
".",
"registerTypeAdapter",
"(",
"TranslationStatus",
".",
"class",
",",
"new",
"EnumWithFallbackAdapter",
"<",
"TranslationStatus",
">",
"(",
"TranslationStatus",
".",
"UNKNOWN",
")",
")",
";",
"builder",
".",
"registerTypeAdapter",
"(",
"TranslationRequestStatus",
".",
"class",
",",
"new",
"EnumWithFallbackAdapter",
"<",
"TranslationRequestStatus",
">",
"(",
"TranslationRequestStatus",
".",
"UNKNOWN",
")",
")",
";",
"builder",
".",
"registerTypeAdapter",
"(",
"new",
"TypeToken",
"<",
"EnumMap",
"<",
"TranslationStatus",
",",
"Integer",
">",
">",
"(",
")",
"{",
"}",
".",
"getType",
"(",
")",
",",
"new",
"EnumMapInstanceCreator",
"<",
"TranslationStatus",
",",
"Integer",
">",
"(",
"TranslationStatus",
".",
"class",
")",
")",
";",
"builder",
".",
"registerTypeAdapterFactory",
"(",
"new",
"NullMapValueTypeAdapterFactory",
"(",
")",
")",
";",
"return",
"builder",
".",
"create",
"(",
")",
";",
"}"
] | Creates a new Gson object
@param className A class name used for serialization/deserialization.
<p>Note: This implementation does not use this argument
for now. If we need different kinds of type adapters
depending on class, the implementation might be updated
to set up appropriate set of type adapters.
@return A Gson object | [
"Creates",
"a",
"new",
"Gson",
"object"
] | b015a081d7a7313bc48c448087fbc07bce860427 | https://github.com/IBM-Cloud/gp-java-client/blob/b015a081d7a7313bc48c448087fbc07bce860427/src/main/java/com/ibm/g11n/pipeline/client/impl/ServiceClientImpl.java#L1791-L1810 |
143,244 | Chorus-bdd/Chorus | interpreter/chorus-processes/src/main/java/org/chorusbdd/chorus/processes/manager/ProcessManagerProcess.java | ProcessManagerProcess.writeToStdIn | public void writeToStdIn(String text, boolean newLine) {
if ( outputStream == null) {
outputStream = new BufferedOutputStream(process.getOutputStream());
outputWriter = new BufferedWriter(new OutputStreamWriter(outputStream));
}
try {
outputWriter.write(text);
if ( newLine ) {
outputWriter.newLine();
}
outputWriter.flush();
outputStream.flush();
} catch (IOException e) {
getLog().debug("Error when writing to process in for " + this, e);
ChorusAssert.fail("IOException when writing line to process");
}
} | java | public void writeToStdIn(String text, boolean newLine) {
if ( outputStream == null) {
outputStream = new BufferedOutputStream(process.getOutputStream());
outputWriter = new BufferedWriter(new OutputStreamWriter(outputStream));
}
try {
outputWriter.write(text);
if ( newLine ) {
outputWriter.newLine();
}
outputWriter.flush();
outputStream.flush();
} catch (IOException e) {
getLog().debug("Error when writing to process in for " + this, e);
ChorusAssert.fail("IOException when writing line to process");
}
} | [
"public",
"void",
"writeToStdIn",
"(",
"String",
"text",
",",
"boolean",
"newLine",
")",
"{",
"if",
"(",
"outputStream",
"==",
"null",
")",
"{",
"outputStream",
"=",
"new",
"BufferedOutputStream",
"(",
"process",
".",
"getOutputStream",
"(",
")",
")",
";",
"outputWriter",
"=",
"new",
"BufferedWriter",
"(",
"new",
"OutputStreamWriter",
"(",
"outputStream",
")",
")",
";",
"}",
"try",
"{",
"outputWriter",
".",
"write",
"(",
"text",
")",
";",
"if",
"(",
"newLine",
")",
"{",
"outputWriter",
".",
"newLine",
"(",
")",
";",
"}",
"outputWriter",
".",
"flush",
"(",
")",
";",
"outputStream",
".",
"flush",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"getLog",
"(",
")",
".",
"debug",
"(",
"\"Error when writing to process in for \"",
"+",
"this",
",",
"e",
")",
";",
"ChorusAssert",
".",
"fail",
"(",
"\"IOException when writing line to process\"",
")",
";",
"}",
"}"
] | Write the text to the std in of the process
@param newLine append a new line | [
"Write",
"the",
"text",
"to",
"the",
"std",
"in",
"of",
"the",
"process"
] | 1eea7ca858876bce821bb49b43fd5b6ba1737997 | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-processes/src/main/java/org/chorusbdd/chorus/processes/manager/ProcessManagerProcess.java#L171-L188 |
143,245 | Chorus-bdd/Chorus | extensions/chorus-selenium/src/main/java/org/chorusbdd/chorus/selenium/SeleniumLoggingSuppression.java | SeleniumLoggingSuppression.suppressLog4jLogging | private void suppressLog4jLogging() {
if ( ! log4jLoggingSuppressed.getAndSet(true) ) {
Logger logger = Logger.getLogger("org.apache.http");
logger.setLevel(Level.ERROR);
logger.addAppender(new ConsoleAppender());
}
} | java | private void suppressLog4jLogging() {
if ( ! log4jLoggingSuppressed.getAndSet(true) ) {
Logger logger = Logger.getLogger("org.apache.http");
logger.setLevel(Level.ERROR);
logger.addAppender(new ConsoleAppender());
}
} | [
"private",
"void",
"suppressLog4jLogging",
"(",
")",
"{",
"if",
"(",
"!",
"log4jLoggingSuppressed",
".",
"getAndSet",
"(",
"true",
")",
")",
"{",
"Logger",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
"\"org.apache.http\"",
")",
";",
"logger",
".",
"setLevel",
"(",
"Level",
".",
"ERROR",
")",
";",
"logger",
".",
"addAppender",
"(",
"new",
"ConsoleAppender",
"(",
")",
")",
";",
"}",
"}"
] | We don't want this in the Chorus interpreter output by default | [
"We",
"don",
"t",
"want",
"this",
"in",
"the",
"Chorus",
"interpreter",
"output",
"by",
"default"
] | 1eea7ca858876bce821bb49b43fd5b6ba1737997 | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/extensions/chorus-selenium/src/main/java/org/chorusbdd/chorus/selenium/SeleniumLoggingSuppression.java#L52-L58 |
143,246 | Chorus-bdd/Chorus | extensions/chorus-selenium/src/main/java/org/chorusbdd/chorus/selenium/SeleniumLoggingSuppression.java | SeleniumLoggingSuppression.suppressSeleniumJavaUtilLogging | private void suppressSeleniumJavaUtilLogging() {
if ( ! seleniumLoggingSuppressed.getAndSet(true) ) {
try {
// Log4j logging is annoyingly difficult to turn off, it usually requires a config file but we can also do it with an InputStream
Properties properties = new Properties();
properties.setProperty("org.openqa.selenium.remote.ProtocolHandshake.level", "OFF");
properties.setProperty("org.openqa.selenium.remote.ProtocolHandshake.useParentHandlers", "false");
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
properties.store(byteArrayOutputStream, "seleniumLoggingProperties");
byte[] bytes = byteArrayOutputStream.toByteArray();
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes);
LogManager.getLogManager().readConfiguration(byteArrayInputStream);
} catch (IOException e) {
e.printStackTrace();
}
}
} | java | private void suppressSeleniumJavaUtilLogging() {
if ( ! seleniumLoggingSuppressed.getAndSet(true) ) {
try {
// Log4j logging is annoyingly difficult to turn off, it usually requires a config file but we can also do it with an InputStream
Properties properties = new Properties();
properties.setProperty("org.openqa.selenium.remote.ProtocolHandshake.level", "OFF");
properties.setProperty("org.openqa.selenium.remote.ProtocolHandshake.useParentHandlers", "false");
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
properties.store(byteArrayOutputStream, "seleniumLoggingProperties");
byte[] bytes = byteArrayOutputStream.toByteArray();
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes);
LogManager.getLogManager().readConfiguration(byteArrayInputStream);
} catch (IOException e) {
e.printStackTrace();
}
}
} | [
"private",
"void",
"suppressSeleniumJavaUtilLogging",
"(",
")",
"{",
"if",
"(",
"!",
"seleniumLoggingSuppressed",
".",
"getAndSet",
"(",
"true",
")",
")",
"{",
"try",
"{",
"// Log4j logging is annoyingly difficult to turn off, it usually requires a config file but we can also do it with an InputStream",
"Properties",
"properties",
"=",
"new",
"Properties",
"(",
")",
";",
"properties",
".",
"setProperty",
"(",
"\"org.openqa.selenium.remote.ProtocolHandshake.level\"",
",",
"\"OFF\"",
")",
";",
"properties",
".",
"setProperty",
"(",
"\"org.openqa.selenium.remote.ProtocolHandshake.useParentHandlers\"",
",",
"\"false\"",
")",
";",
"ByteArrayOutputStream",
"byteArrayOutputStream",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"properties",
".",
"store",
"(",
"byteArrayOutputStream",
",",
"\"seleniumLoggingProperties\"",
")",
";",
"byte",
"[",
"]",
"bytes",
"=",
"byteArrayOutputStream",
".",
"toByteArray",
"(",
")",
";",
"ByteArrayInputStream",
"byteArrayInputStream",
"=",
"new",
"ByteArrayInputStream",
"(",
"bytes",
")",
";",
"LogManager",
".",
"getLogManager",
"(",
")",
".",
"readConfiguration",
"(",
"byteArrayInputStream",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"}"
] | We don't want that in the Chorus interpreter output by default | [
"We",
"don",
"t",
"want",
"that",
"in",
"the",
"Chorus",
"interpreter",
"output",
"by",
"default"
] | 1eea7ca858876bce821bb49b43fd5b6ba1737997 | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/extensions/chorus-selenium/src/main/java/org/chorusbdd/chorus/selenium/SeleniumLoggingSuppression.java#L62-L80 |
143,247 | Chorus-bdd/Chorus | services/chorus-webagent/src/main/java/org/chorusbdd/chorus/tools/webagent/WebAgentFeatureCache.java | WebAgentFeatureCache.setSuiteIdsUsingZeroBasedIndex | public void setSuiteIdsUsingZeroBasedIndex() {
synchronized (cachedSuites) {
List<WebAgentTestSuite> s = new ArrayList<>(cachedSuites.values());
cachedSuites.clear();
for ( int index=0; index < s.size(); index++) {
WebAgentTestSuite suite = s.get(index);
cachedSuites.put(suite.getTestSuiteName() + "-" + index, suite);
}
}
} | java | public void setSuiteIdsUsingZeroBasedIndex() {
synchronized (cachedSuites) {
List<WebAgentTestSuite> s = new ArrayList<>(cachedSuites.values());
cachedSuites.clear();
for ( int index=0; index < s.size(); index++) {
WebAgentTestSuite suite = s.get(index);
cachedSuites.put(suite.getTestSuiteName() + "-" + index, suite);
}
}
} | [
"public",
"void",
"setSuiteIdsUsingZeroBasedIndex",
"(",
")",
"{",
"synchronized",
"(",
"cachedSuites",
")",
"{",
"List",
"<",
"WebAgentTestSuite",
">",
"s",
"=",
"new",
"ArrayList",
"<>",
"(",
"cachedSuites",
".",
"values",
"(",
")",
")",
";",
"cachedSuites",
".",
"clear",
"(",
")",
";",
"for",
"(",
"int",
"index",
"=",
"0",
";",
"index",
"<",
"s",
".",
"size",
"(",
")",
";",
"index",
"++",
")",
"{",
"WebAgentTestSuite",
"suite",
"=",
"s",
".",
"get",
"(",
"index",
")",
";",
"cachedSuites",
".",
"put",
"(",
"suite",
".",
"getTestSuiteName",
"(",
")",
"+",
"\"-\"",
"+",
"index",
",",
"suite",
")",
";",
"}",
"}",
"}"
] | A testing hook to set the cached suites to have predictable keys | [
"A",
"testing",
"hook",
"to",
"set",
"the",
"cached",
"suites",
"to",
"have",
"predictable",
"keys"
] | 1eea7ca858876bce821bb49b43fd5b6ba1737997 | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/services/chorus-webagent/src/main/java/org/chorusbdd/chorus/tools/webagent/WebAgentFeatureCache.java#L188-L197 |
143,248 | adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/GV/AbstractHBCIJob.java | AbstractHBCIJob.setSegVersion | public void setSegVersion(int version) {
if (version < 1) {
log.warn("tried to change segment version for task " + this.jobName + " explicit, but no version given");
return;
}
// Wenn sich die Versionsnummer nicht geaendert hat, muessen wir die
// Huehner ja nicht verrueckt machen ;)
if (version == this.segVersion)
return;
log.info("changing segment version for task " + this.jobName + " explicit from " + this.segVersion + " to " + version);
// Der alte Name
String oldName = this.name;
// Neuer Name und neue Versionsnummer
this.segVersion = version;
this.name = this.jobName + version;
// Bereits gesetzte llParams fixen
String[] names = this.llParams.keySet().toArray(new String[0]);
for (String s : names) {
if (!s.startsWith(oldName))
continue; // nicht betroffen
// Alten Schluessel entfernen und neuen einfuegen
String value = this.llParams.get(s);
String newName = s.replaceFirst(oldName, this.name);
this.llParams.remove(s);
this.llParams.put(newName, value);
}
// Destination-Namen in den LowLevel-Parameter auf den neuen Namen umbiegen
constraints.forEach((frontendName, values) -> {
for (String[] value : values) {
// value[0] ist das Target
if (!value[0].startsWith(oldName))
continue;
// Hier ersetzen wir z.Bsp. "TAN2Step5.process" gegen "TAN2Step3.process"
value[0] = value[0].replaceFirst(oldName, this.name);
}
});
} | java | public void setSegVersion(int version) {
if (version < 1) {
log.warn("tried to change segment version for task " + this.jobName + " explicit, but no version given");
return;
}
// Wenn sich die Versionsnummer nicht geaendert hat, muessen wir die
// Huehner ja nicht verrueckt machen ;)
if (version == this.segVersion)
return;
log.info("changing segment version for task " + this.jobName + " explicit from " + this.segVersion + " to " + version);
// Der alte Name
String oldName = this.name;
// Neuer Name und neue Versionsnummer
this.segVersion = version;
this.name = this.jobName + version;
// Bereits gesetzte llParams fixen
String[] names = this.llParams.keySet().toArray(new String[0]);
for (String s : names) {
if (!s.startsWith(oldName))
continue; // nicht betroffen
// Alten Schluessel entfernen und neuen einfuegen
String value = this.llParams.get(s);
String newName = s.replaceFirst(oldName, this.name);
this.llParams.remove(s);
this.llParams.put(newName, value);
}
// Destination-Namen in den LowLevel-Parameter auf den neuen Namen umbiegen
constraints.forEach((frontendName, values) -> {
for (String[] value : values) {
// value[0] ist das Target
if (!value[0].startsWith(oldName))
continue;
// Hier ersetzen wir z.Bsp. "TAN2Step5.process" gegen "TAN2Step3.process"
value[0] = value[0].replaceFirst(oldName, this.name);
}
});
} | [
"public",
"void",
"setSegVersion",
"(",
"int",
"version",
")",
"{",
"if",
"(",
"version",
"<",
"1",
")",
"{",
"log",
".",
"warn",
"(",
"\"tried to change segment version for task \"",
"+",
"this",
".",
"jobName",
"+",
"\" explicit, but no version given\"",
")",
";",
"return",
";",
"}",
"// Wenn sich die Versionsnummer nicht geaendert hat, muessen wir die",
"// Huehner ja nicht verrueckt machen ;)",
"if",
"(",
"version",
"==",
"this",
".",
"segVersion",
")",
"return",
";",
"log",
".",
"info",
"(",
"\"changing segment version for task \"",
"+",
"this",
".",
"jobName",
"+",
"\" explicit from \"",
"+",
"this",
".",
"segVersion",
"+",
"\" to \"",
"+",
"version",
")",
";",
"// Der alte Name",
"String",
"oldName",
"=",
"this",
".",
"name",
";",
"// Neuer Name und neue Versionsnummer",
"this",
".",
"segVersion",
"=",
"version",
";",
"this",
".",
"name",
"=",
"this",
".",
"jobName",
"+",
"version",
";",
"// Bereits gesetzte llParams fixen",
"String",
"[",
"]",
"names",
"=",
"this",
".",
"llParams",
".",
"keySet",
"(",
")",
".",
"toArray",
"(",
"new",
"String",
"[",
"0",
"]",
")",
";",
"for",
"(",
"String",
"s",
":",
"names",
")",
"{",
"if",
"(",
"!",
"s",
".",
"startsWith",
"(",
"oldName",
")",
")",
"continue",
";",
"// nicht betroffen",
"// Alten Schluessel entfernen und neuen einfuegen",
"String",
"value",
"=",
"this",
".",
"llParams",
".",
"get",
"(",
"s",
")",
";",
"String",
"newName",
"=",
"s",
".",
"replaceFirst",
"(",
"oldName",
",",
"this",
".",
"name",
")",
";",
"this",
".",
"llParams",
".",
"remove",
"(",
"s",
")",
";",
"this",
".",
"llParams",
".",
"put",
"(",
"newName",
",",
"value",
")",
";",
"}",
"// Destination-Namen in den LowLevel-Parameter auf den neuen Namen umbiegen",
"constraints",
".",
"forEach",
"(",
"(",
"frontendName",
",",
"values",
")",
"->",
"{",
"for",
"(",
"String",
"[",
"]",
"value",
":",
"values",
")",
"{",
"// value[0] ist das Target",
"if",
"(",
"!",
"value",
"[",
"0",
"]",
".",
"startsWith",
"(",
"oldName",
")",
")",
"continue",
";",
"// Hier ersetzen wir z.Bsp. \"TAN2Step5.process\" gegen \"TAN2Step3.process\"",
"value",
"[",
"0",
"]",
"=",
"value",
"[",
"0",
"]",
".",
"replaceFirst",
"(",
"oldName",
",",
"this",
".",
"name",
")",
";",
"}",
"}",
")",
";",
"}"
] | Legt die Versionsnummer des Segments manuell fest.
Ist u.a. noetig, um HKTAN-Segmente in genau der Version zu senden, in der
auch die HITANS empfangen wurden. Andernfalls koennte es passieren, dass
wir ein HKTAN mit einem TAN-Verfahren senden, welches in dieser HKTAN-Version
gar nicht von der Bank unterstuetzt wird. Das ist ein Dirty-Hack, ich weiss ;)
Falls das noch IRGENDWO anders verwendet wird, muss man hoellisch aufpassen,
dass alle Stellen, wo "this.name" bzw. "this.segVersion" direkt oder indirekt
verwendet wurde, ebenfalls beruecksichtigt werden.
@param version die neue Versionsnummer. | [
"Legt",
"die",
"Versionsnummer",
"des",
"Segments",
"manuell",
"fest",
".",
"Ist",
"u",
".",
"a",
".",
"noetig",
"um",
"HKTAN",
"-",
"Segmente",
"in",
"genau",
"der",
"Version",
"zu",
"senden",
"in",
"der",
"auch",
"die",
"HITANS",
"empfangen",
"wurden",
".",
"Andernfalls",
"koennte",
"es",
"passieren",
"dass",
"wir",
"ein",
"HKTAN",
"mit",
"einem",
"TAN",
"-",
"Verfahren",
"senden",
"welches",
"in",
"dieser",
"HKTAN",
"-",
"Version",
"gar",
"nicht",
"von",
"der",
"Bank",
"unterstuetzt",
"wird",
".",
"Das",
"ist",
"ein",
"Dirty",
"-",
"Hack",
"ich",
"weiss",
";",
")",
"Falls",
"das",
"noch",
"IRGENDWO",
"anders",
"verwendet",
"wird",
"muss",
"man",
"hoellisch",
"aufpassen",
"dass",
"alle",
"Stellen",
"wo",
"this",
".",
"name",
"bzw",
".",
"this",
".",
"segVersion",
"direkt",
"oder",
"indirekt",
"verwendet",
"wurde",
"ebenfalls",
"beruecksichtigt",
"werden",
"."
] | 5e24f7e429d6b555e1d993196b4cf1adda6433cf | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/GV/AbstractHBCIJob.java#L607-L651 |
143,249 | adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/GV/AbstractHBCIJob.java | AbstractHBCIJob.getOrderAccount | public Konto getOrderAccount() {
// Checken, ob wir das Konto unter "My.[number/iban]" haben
String prefix = this.getName() + ".My.";
String number = this.getLowlevelParam(prefix + "number");
String iban = this.getLowlevelParam(prefix + "iban");
if ((number == null || number.length() == 0) && (iban == null || iban.length() == 0)) {
// OK, vielleicht unter "KTV.[number/iban]"?
prefix = this.getName() + ".KTV.";
number = this.getLowlevelParam(prefix + "number");
iban = this.getLowlevelParam(prefix + "iban");
if ((number == null || number.length() == 0) && (iban == null || iban.length() == 0))
return null; // definitiv kein Konto vorhanden
}
Konto k = new Konto();
k.number = number;
k.iban = iban;
k.bic = this.getLowlevelParam(prefix + "bic");
k.subnumber = this.getLowlevelParam(prefix + "subnumber");
k.blz = this.getLowlevelParam(prefix + "KIK.blz");
k.country = this.getLowlevelParam(prefix + "KIK.country");
return k;
} | java | public Konto getOrderAccount() {
// Checken, ob wir das Konto unter "My.[number/iban]" haben
String prefix = this.getName() + ".My.";
String number = this.getLowlevelParam(prefix + "number");
String iban = this.getLowlevelParam(prefix + "iban");
if ((number == null || number.length() == 0) && (iban == null || iban.length() == 0)) {
// OK, vielleicht unter "KTV.[number/iban]"?
prefix = this.getName() + ".KTV.";
number = this.getLowlevelParam(prefix + "number");
iban = this.getLowlevelParam(prefix + "iban");
if ((number == null || number.length() == 0) && (iban == null || iban.length() == 0))
return null; // definitiv kein Konto vorhanden
}
Konto k = new Konto();
k.number = number;
k.iban = iban;
k.bic = this.getLowlevelParam(prefix + "bic");
k.subnumber = this.getLowlevelParam(prefix + "subnumber");
k.blz = this.getLowlevelParam(prefix + "KIK.blz");
k.country = this.getLowlevelParam(prefix + "KIK.country");
return k;
} | [
"public",
"Konto",
"getOrderAccount",
"(",
")",
"{",
"// Checken, ob wir das Konto unter \"My.[number/iban]\" haben",
"String",
"prefix",
"=",
"this",
".",
"getName",
"(",
")",
"+",
"\".My.\"",
";",
"String",
"number",
"=",
"this",
".",
"getLowlevelParam",
"(",
"prefix",
"+",
"\"number\"",
")",
";",
"String",
"iban",
"=",
"this",
".",
"getLowlevelParam",
"(",
"prefix",
"+",
"\"iban\"",
")",
";",
"if",
"(",
"(",
"number",
"==",
"null",
"||",
"number",
".",
"length",
"(",
")",
"==",
"0",
")",
"&&",
"(",
"iban",
"==",
"null",
"||",
"iban",
".",
"length",
"(",
")",
"==",
"0",
")",
")",
"{",
"// OK, vielleicht unter \"KTV.[number/iban]\"?",
"prefix",
"=",
"this",
".",
"getName",
"(",
")",
"+",
"\".KTV.\"",
";",
"number",
"=",
"this",
".",
"getLowlevelParam",
"(",
"prefix",
"+",
"\"number\"",
")",
";",
"iban",
"=",
"this",
".",
"getLowlevelParam",
"(",
"prefix",
"+",
"\"iban\"",
")",
";",
"if",
"(",
"(",
"number",
"==",
"null",
"||",
"number",
".",
"length",
"(",
")",
"==",
"0",
")",
"&&",
"(",
"iban",
"==",
"null",
"||",
"iban",
".",
"length",
"(",
")",
"==",
"0",
")",
")",
"return",
"null",
";",
"// definitiv kein Konto vorhanden",
"}",
"Konto",
"k",
"=",
"new",
"Konto",
"(",
")",
";",
"k",
".",
"number",
"=",
"number",
";",
"k",
".",
"iban",
"=",
"iban",
";",
"k",
".",
"bic",
"=",
"this",
".",
"getLowlevelParam",
"(",
"prefix",
"+",
"\"bic\"",
")",
";",
"k",
".",
"subnumber",
"=",
"this",
".",
"getLowlevelParam",
"(",
"prefix",
"+",
"\"subnumber\"",
")",
";",
"k",
".",
"blz",
"=",
"this",
".",
"getLowlevelParam",
"(",
"prefix",
"+",
"\"KIK.blz\"",
")",
";",
"k",
".",
"country",
"=",
"this",
".",
"getLowlevelParam",
"(",
"prefix",
"+",
"\"KIK.country\"",
")",
";",
"return",
"k",
";",
"}"
] | Liefert das Auftraggeber-Konto, wie es ab HKTAN5 erforderlich ist.
@return das Auftraggeber-Konto oder NULL, wenn keines angegeben ist. | [
"Liefert",
"das",
"Auftraggeber",
"-",
"Konto",
"wie",
"es",
"ab",
"HKTAN5",
"erforderlich",
"ist",
"."
] | 5e24f7e429d6b555e1d993196b4cf1adda6433cf | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/GV/AbstractHBCIJob.java#L951-L973 |
143,250 | adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/GV/parsers/AbstractSepaParser.java | AbstractSepaParser.put | void put(HashMap<String, String> props, Names name, String value) {
// BUGZILLA 1610 - "java.util.Properties" ist von Hashtable abgeleitet und unterstuetzt keine NULL-Werte
if (value == null)
return;
props.put(name.getValue(), value);
} | java | void put(HashMap<String, String> props, Names name, String value) {
// BUGZILLA 1610 - "java.util.Properties" ist von Hashtable abgeleitet und unterstuetzt keine NULL-Werte
if (value == null)
return;
props.put(name.getValue(), value);
} | [
"void",
"put",
"(",
"HashMap",
"<",
"String",
",",
"String",
">",
"props",
",",
"Names",
"name",
",",
"String",
"value",
")",
"{",
"// BUGZILLA 1610 - \"java.util.Properties\" ist von Hashtable abgeleitet und unterstuetzt keine NULL-Werte",
"if",
"(",
"value",
"==",
"null",
")",
"return",
";",
"props",
".",
"put",
"(",
"name",
".",
"getValue",
"(",
")",
",",
"value",
")",
";",
"}"
] | Speichert den Wert in den Properties.
@param props die Properties.
@param name das Property.
@param value der Wert. | [
"Speichert",
"den",
"Wert",
"in",
"den",
"Properties",
"."
] | 5e24f7e429d6b555e1d993196b4cf1adda6433cf | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/GV/parsers/AbstractSepaParser.java#L18-L24 |
143,251 | IBM-Cloud/gp-java-client | src/main/java/com/ibm/g11n/pipeline/client/DocumentTranslationRequestDataChangeSet.java | DocumentTranslationRequestDataChangeSet.setTargetLanguagesMap | public DocumentTranslationRequestDataChangeSet setTargetLanguagesMap(
Map<String, Map<String, Set<String>>> targetLanguagesMap) {
// TODO - check empty map?
if (targetLanguagesMap == null) {
throw new NullPointerException("The input map is null.");
}
this.targetLanguagesMap = targetLanguagesMap;
return this;
} | java | public DocumentTranslationRequestDataChangeSet setTargetLanguagesMap(
Map<String, Map<String, Set<String>>> targetLanguagesMap) {
// TODO - check empty map?
if (targetLanguagesMap == null) {
throw new NullPointerException("The input map is null.");
}
this.targetLanguagesMap = targetLanguagesMap;
return this;
} | [
"public",
"DocumentTranslationRequestDataChangeSet",
"setTargetLanguagesMap",
"(",
"Map",
"<",
"String",
",",
"Map",
"<",
"String",
",",
"Set",
"<",
"String",
">",
">",
">",
"targetLanguagesMap",
")",
"{",
"// TODO - check empty map?",
"if",
"(",
"targetLanguagesMap",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"The input map is null.\"",
")",
";",
"}",
"this",
".",
"targetLanguagesMap",
"=",
"targetLanguagesMap",
";",
"return",
"this",
";",
"}"
] | Sets a map containing target languages indexed by document ids. This method adopts
the input map without creating a safe copy.
@param targetLanguagesMap A map containing target languages indexed by
document ids.
@return This object.
@throws NullPointerException When the input <code>targetLanguagesMap</code> is null. | [
"Sets",
"a",
"map",
"containing",
"target",
"languages",
"indexed",
"by",
"document",
"ids",
".",
"This",
"method",
"adopts",
"the",
"input",
"map",
"without",
"creating",
"a",
"safe",
"copy",
"."
] | b015a081d7a7313bc48c448087fbc07bce860427 | https://github.com/IBM-Cloud/gp-java-client/blob/b015a081d7a7313bc48c448087fbc07bce860427/src/main/java/com/ibm/g11n/pipeline/client/DocumentTranslationRequestDataChangeSet.java#L57-L65 |
143,252 | Chorus-bdd/Chorus | interpreter/chorus-results/src/main/java/org/chorusbdd/chorus/results/FeatureToken.java | FeatureToken.getEndState | public EndState getEndState() {
EndState result = EndState.PASSED;
for ( ScenarioToken s : scenarios) {
if ( s.getEndState() == EndState.FAILED) {
result = EndState.FAILED;
break;
}
}
if ( result != EndState.FAILED) {
for ( ScenarioToken s : scenarios) {
if ( s.getEndState() == EndState.PENDING) {
result = EndState.PENDING;
}
}
}
return result;
} | java | public EndState getEndState() {
EndState result = EndState.PASSED;
for ( ScenarioToken s : scenarios) {
if ( s.getEndState() == EndState.FAILED) {
result = EndState.FAILED;
break;
}
}
if ( result != EndState.FAILED) {
for ( ScenarioToken s : scenarios) {
if ( s.getEndState() == EndState.PENDING) {
result = EndState.PENDING;
}
}
}
return result;
} | [
"public",
"EndState",
"getEndState",
"(",
")",
"{",
"EndState",
"result",
"=",
"EndState",
".",
"PASSED",
";",
"for",
"(",
"ScenarioToken",
"s",
":",
"scenarios",
")",
"{",
"if",
"(",
"s",
".",
"getEndState",
"(",
")",
"==",
"EndState",
".",
"FAILED",
")",
"{",
"result",
"=",
"EndState",
".",
"FAILED",
";",
"break",
";",
"}",
"}",
"if",
"(",
"result",
"!=",
"EndState",
".",
"FAILED",
")",
"{",
"for",
"(",
"ScenarioToken",
"s",
":",
"scenarios",
")",
"{",
"if",
"(",
"s",
".",
"getEndState",
"(",
")",
"==",
"EndState",
".",
"PENDING",
")",
"{",
"result",
"=",
"EndState",
".",
"PENDING",
";",
"}",
"}",
"}",
"return",
"result",
";",
"}"
] | fail if any scenarios failed, otherwise pending if any pending, or passed | [
"fail",
"if",
"any",
"scenarios",
"failed",
"otherwise",
"pending",
"if",
"any",
"pending",
"or",
"passed"
] | 1eea7ca858876bce821bb49b43fd5b6ba1737997 | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-results/src/main/java/org/chorusbdd/chorus/results/FeatureToken.java#L179-L196 |
143,253 | adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/protocol/DE.java | DE.propagateValue | @Override
public boolean propagateValue(String destPath, String valueString, boolean tryToCreate, boolean allowOverwrite) {
boolean ret = false;
// wenn dieses de gemeint ist
if (destPath.equals(getPath())) {
if (this.value != null) { // es gibt schon einen Wert
if (!allowOverwrite) { // überschreiben ist nicht erlaubt
throw new OverwriteException(getPath(), value.toString(), valueString);
}
}
setValue(valueString);
ret = true;
}
return ret;
} | java | @Override
public boolean propagateValue(String destPath, String valueString, boolean tryToCreate, boolean allowOverwrite) {
boolean ret = false;
// wenn dieses de gemeint ist
if (destPath.equals(getPath())) {
if (this.value != null) { // es gibt schon einen Wert
if (!allowOverwrite) { // überschreiben ist nicht erlaubt
throw new OverwriteException(getPath(), value.toString(), valueString);
}
}
setValue(valueString);
ret = true;
}
return ret;
} | [
"@",
"Override",
"public",
"boolean",
"propagateValue",
"(",
"String",
"destPath",
",",
"String",
"valueString",
",",
"boolean",
"tryToCreate",
",",
"boolean",
"allowOverwrite",
")",
"{",
"boolean",
"ret",
"=",
"false",
";",
"// wenn dieses de gemeint ist",
"if",
"(",
"destPath",
".",
"equals",
"(",
"getPath",
"(",
")",
")",
")",
"{",
"if",
"(",
"this",
".",
"value",
"!=",
"null",
")",
"{",
"// es gibt schon einen Wert",
"if",
"(",
"!",
"allowOverwrite",
")",
"{",
"// überschreiben ist nicht erlaubt",
"throw",
"new",
"OverwriteException",
"(",
"getPath",
"(",
")",
",",
"value",
".",
"toString",
"(",
")",
",",
"valueString",
")",
";",
"}",
"}",
"setValue",
"(",
"valueString",
")",
";",
"ret",
"=",
"true",
";",
"}",
"return",
"ret",
";",
"}"
] | setzen des wertes des de | [
"setzen",
"des",
"wertes",
"des",
"de"
] | 5e24f7e429d6b555e1d993196b4cf1adda6433cf | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/protocol/DE.java#L67-L84 |
143,254 | adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/protocol/DE.java | DE.parseValue | private void parseValue(StringBuffer res, HashMap<String, String> predefs, char preDelim,
HashMap<String, String> valids) {
int len = res.length();
if (preDelim != (char) 0 && res.charAt(0) != preDelim) {
if (len == 0) {
throw new ParseErrorException(HBCIUtils.getLocMsg("EXCMSG_ENDOFSTRG", getPath()));
}
// log.("error string: "+res.toString(),log._ERR);
// log.("current: "+getPath()+":"+type+"("+minsize+","+maxsize+")="+value,log._ERR);
// log.("predelimiter mismatch (required:"+getPreDelim()+" found:"+temp.charAt(0)+")",log._ERR);
throw new PredelimErrorException(getPath(), Character.toString(preDelim),
Character.toString(res.charAt(0)));
}
this.value = SyntaxDEFactory.createSyntaxDE(getType(), getPath(), res, minsize, maxsize);
String valueString = value.toString(0);
String predefined = predefs.get(getPath());
if (predefined != null) {
if (!valueString.equals(predefined)) {
throw new ParseErrorException(HBCIUtils.getLocMsg("EXCMSG_PREDEFERR",
new Object[]{getPath(), predefined, value}));
}
}
boolean atLeastOne = false;
boolean ok = false;
if (valids != null) {
String header = getPath() + ".value";
for (String key : valids.keySet()) {
if (key.startsWith(header) &&
key.indexOf(".", header.length()) == -1) {
atLeastOne = true;
String validValue = valids.get(key);
if (valueString.equals(validValue)) {
ok = true;
break;
}
}
}
}
if (atLeastOne && !ok) {
throw new NoValidValueException(getPath(), valueString);
}
} | java | private void parseValue(StringBuffer res, HashMap<String, String> predefs, char preDelim,
HashMap<String, String> valids) {
int len = res.length();
if (preDelim != (char) 0 && res.charAt(0) != preDelim) {
if (len == 0) {
throw new ParseErrorException(HBCIUtils.getLocMsg("EXCMSG_ENDOFSTRG", getPath()));
}
// log.("error string: "+res.toString(),log._ERR);
// log.("current: "+getPath()+":"+type+"("+minsize+","+maxsize+")="+value,log._ERR);
// log.("predelimiter mismatch (required:"+getPreDelim()+" found:"+temp.charAt(0)+")",log._ERR);
throw new PredelimErrorException(getPath(), Character.toString(preDelim),
Character.toString(res.charAt(0)));
}
this.value = SyntaxDEFactory.createSyntaxDE(getType(), getPath(), res, minsize, maxsize);
String valueString = value.toString(0);
String predefined = predefs.get(getPath());
if (predefined != null) {
if (!valueString.equals(predefined)) {
throw new ParseErrorException(HBCIUtils.getLocMsg("EXCMSG_PREDEFERR",
new Object[]{getPath(), predefined, value}));
}
}
boolean atLeastOne = false;
boolean ok = false;
if (valids != null) {
String header = getPath() + ".value";
for (String key : valids.keySet()) {
if (key.startsWith(header) &&
key.indexOf(".", header.length()) == -1) {
atLeastOne = true;
String validValue = valids.get(key);
if (valueString.equals(validValue)) {
ok = true;
break;
}
}
}
}
if (atLeastOne && !ok) {
throw new NoValidValueException(getPath(), valueString);
}
} | [
"private",
"void",
"parseValue",
"(",
"StringBuffer",
"res",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"predefs",
",",
"char",
"preDelim",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"valids",
")",
"{",
"int",
"len",
"=",
"res",
".",
"length",
"(",
")",
";",
"if",
"(",
"preDelim",
"!=",
"(",
"char",
")",
"0",
"&&",
"res",
".",
"charAt",
"(",
"0",
")",
"!=",
"preDelim",
")",
"{",
"if",
"(",
"len",
"==",
"0",
")",
"{",
"throw",
"new",
"ParseErrorException",
"(",
"HBCIUtils",
".",
"getLocMsg",
"(",
"\"EXCMSG_ENDOFSTRG\"",
",",
"getPath",
"(",
")",
")",
")",
";",
"}",
"// log.(\"error string: \"+res.toString(),log._ERR);",
"// log.(\"current: \"+getPath()+\":\"+type+\"(\"+minsize+\",\"+maxsize+\")=\"+value,log._ERR);",
"// log.(\"predelimiter mismatch (required:\"+getPreDelim()+\" found:\"+temp.charAt(0)+\")\",log._ERR);",
"throw",
"new",
"PredelimErrorException",
"(",
"getPath",
"(",
")",
",",
"Character",
".",
"toString",
"(",
"preDelim",
")",
",",
"Character",
".",
"toString",
"(",
"res",
".",
"charAt",
"(",
"0",
")",
")",
")",
";",
"}",
"this",
".",
"value",
"=",
"SyntaxDEFactory",
".",
"createSyntaxDE",
"(",
"getType",
"(",
")",
",",
"getPath",
"(",
")",
",",
"res",
",",
"minsize",
",",
"maxsize",
")",
";",
"String",
"valueString",
"=",
"value",
".",
"toString",
"(",
"0",
")",
";",
"String",
"predefined",
"=",
"predefs",
".",
"get",
"(",
"getPath",
"(",
")",
")",
";",
"if",
"(",
"predefined",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"valueString",
".",
"equals",
"(",
"predefined",
")",
")",
"{",
"throw",
"new",
"ParseErrorException",
"(",
"HBCIUtils",
".",
"getLocMsg",
"(",
"\"EXCMSG_PREDEFERR\"",
",",
"new",
"Object",
"[",
"]",
"{",
"getPath",
"(",
")",
",",
"predefined",
",",
"value",
"}",
")",
")",
";",
"}",
"}",
"boolean",
"atLeastOne",
"=",
"false",
";",
"boolean",
"ok",
"=",
"false",
";",
"if",
"(",
"valids",
"!=",
"null",
")",
"{",
"String",
"header",
"=",
"getPath",
"(",
")",
"+",
"\".value\"",
";",
"for",
"(",
"String",
"key",
":",
"valids",
".",
"keySet",
"(",
")",
")",
"{",
"if",
"(",
"key",
".",
"startsWith",
"(",
"header",
")",
"&&",
"key",
".",
"indexOf",
"(",
"\".\"",
",",
"header",
".",
"length",
"(",
")",
")",
"==",
"-",
"1",
")",
"{",
"atLeastOne",
"=",
"true",
";",
"String",
"validValue",
"=",
"valids",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"valueString",
".",
"equals",
"(",
"validValue",
")",
")",
"{",
"ok",
"=",
"true",
";",
"break",
";",
"}",
"}",
"}",
"}",
"if",
"(",
"atLeastOne",
"&&",
"!",
"ok",
")",
"{",
"throw",
"new",
"NoValidValueException",
"(",
"getPath",
"(",
")",
",",
"valueString",
")",
";",
"}",
"}"
] | anlegen eines de beim parsen funktioniert analog zum
anlegen eines de bei der message-synthese | [
"anlegen",
"eines",
"de",
"beim",
"parsen",
"funktioniert",
"analog",
"zum",
"anlegen",
"eines",
"de",
"bei",
"der",
"message",
"-",
"synthese"
] | 5e24f7e429d6b555e1d993196b4cf1adda6433cf | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/protocol/DE.java#L191-L239 |
143,255 | imsweb/seerapi-client-java | src/main/java/com/imsweb/seerapi/client/SeerApi.java | SeerApi.getMapper | static ObjectMapper getMapper() {
ObjectMapper mapper = new ObjectMapper();
// do not write null values
mapper.setSerializationInclusion(Include.NON_NULL);
mapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.NONE);
mapper.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY);
// set Date objects to output in readable customized format
mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
mapper.setDateFormat(dateFormat);
return mapper;
} | java | static ObjectMapper getMapper() {
ObjectMapper mapper = new ObjectMapper();
// do not write null values
mapper.setSerializationInclusion(Include.NON_NULL);
mapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.NONE);
mapper.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY);
// set Date objects to output in readable customized format
mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
mapper.setDateFormat(dateFormat);
return mapper;
} | [
"static",
"ObjectMapper",
"getMapper",
"(",
")",
"{",
"ObjectMapper",
"mapper",
"=",
"new",
"ObjectMapper",
"(",
")",
";",
"// do not write null values",
"mapper",
".",
"setSerializationInclusion",
"(",
"Include",
".",
"NON_NULL",
")",
";",
"mapper",
".",
"setVisibility",
"(",
"PropertyAccessor",
".",
"ALL",
",",
"JsonAutoDetect",
".",
"Visibility",
".",
"NONE",
")",
";",
"mapper",
".",
"setVisibility",
"(",
"PropertyAccessor",
".",
"FIELD",
",",
"JsonAutoDetect",
".",
"Visibility",
".",
"ANY",
")",
";",
"// set Date objects to output in readable customized format",
"mapper",
".",
"configure",
"(",
"SerializationFeature",
".",
"WRITE_DATES_AS_TIMESTAMPS",
",",
"false",
")",
";",
"DateFormat",
"dateFormat",
"=",
"new",
"SimpleDateFormat",
"(",
"\"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'\"",
")",
";",
"mapper",
".",
"setDateFormat",
"(",
"dateFormat",
")",
";",
"return",
"mapper",
";",
"}"
] | Return the internal ObjectMapper
@return an Objectmapper | [
"Return",
"the",
"internal",
"ObjectMapper"
] | 04f509961c3a5ece7b232ecb8d8cb8f89d810a85 | https://github.com/imsweb/seerapi-client-java/blob/04f509961c3a5ece7b232ecb8d8cb8f89d810a85/src/main/java/com/imsweb/seerapi/client/SeerApi.java#L96-L111 |
143,256 | IBM-Cloud/gp-java-client | src/main/java/com/ibm/g11n/pipeline/client/TranslationRequestData.java | TranslationRequestData.getTargetLanguagesByBundle | public Map<String, Set<String>> getTargetLanguagesByBundle() {
if (targetLanguagesByBundle == null) {
assert false;
return Collections.emptyMap();
}
return Collections.unmodifiableMap(targetLanguagesByBundle);
} | java | public Map<String, Set<String>> getTargetLanguagesByBundle() {
if (targetLanguagesByBundle == null) {
assert false;
return Collections.emptyMap();
}
return Collections.unmodifiableMap(targetLanguagesByBundle);
} | [
"public",
"Map",
"<",
"String",
",",
"Set",
"<",
"String",
">",
">",
"getTargetLanguagesByBundle",
"(",
")",
"{",
"if",
"(",
"targetLanguagesByBundle",
"==",
"null",
")",
"{",
"assert",
"false",
";",
"return",
"Collections",
".",
"emptyMap",
"(",
")",
";",
"}",
"return",
"Collections",
".",
"unmodifiableMap",
"(",
"targetLanguagesByBundle",
")",
";",
"}"
] | Returns the map containing target languages indexed by bundle IDs.
This method always returns non-null map.
@return The map containing target languages indexed by bundle IDs. | [
"Returns",
"the",
"map",
"containing",
"target",
"languages",
"indexed",
"by",
"bundle",
"IDs",
".",
"This",
"method",
"always",
"returns",
"non",
"-",
"null",
"map",
"."
] | b015a081d7a7313bc48c448087fbc07bce860427 | https://github.com/IBM-Cloud/gp-java-client/blob/b015a081d7a7313bc48c448087fbc07bce860427/src/main/java/com/ibm/g11n/pipeline/client/TranslationRequestData.java#L88-L94 |
143,257 | adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/protocol/Message.java | Message.setMsgSizeValue | private void setMsgSizeValue(int value, boolean allowOverwrite) {
String absPath = getPath() + ".MsgHead.msgsize";
SyntaxElement msgsizeElem = getElement(absPath);
if (msgsizeElem == null)
throw new NoSuchPathException(absPath);
int size = ((DE) msgsizeElem).getMinSize();
char[] zeros = new char[size];
Arrays.fill(zeros, '0');
DecimalFormat df = new DecimalFormat(String.valueOf(zeros));
if (!propagateValue(absPath, df.format(value), DONT_TRY_TO_CREATE, allowOverwrite))
throw new NoSuchPathException(absPath);
} | java | private void setMsgSizeValue(int value, boolean allowOverwrite) {
String absPath = getPath() + ".MsgHead.msgsize";
SyntaxElement msgsizeElem = getElement(absPath);
if (msgsizeElem == null)
throw new NoSuchPathException(absPath);
int size = ((DE) msgsizeElem).getMinSize();
char[] zeros = new char[size];
Arrays.fill(zeros, '0');
DecimalFormat df = new DecimalFormat(String.valueOf(zeros));
if (!propagateValue(absPath, df.format(value), DONT_TRY_TO_CREATE, allowOverwrite))
throw new NoSuchPathException(absPath);
} | [
"private",
"void",
"setMsgSizeValue",
"(",
"int",
"value",
",",
"boolean",
"allowOverwrite",
")",
"{",
"String",
"absPath",
"=",
"getPath",
"(",
")",
"+",
"\".MsgHead.msgsize\"",
";",
"SyntaxElement",
"msgsizeElem",
"=",
"getElement",
"(",
"absPath",
")",
";",
"if",
"(",
"msgsizeElem",
"==",
"null",
")",
"throw",
"new",
"NoSuchPathException",
"(",
"absPath",
")",
";",
"int",
"size",
"=",
"(",
"(",
"DE",
")",
"msgsizeElem",
")",
".",
"getMinSize",
"(",
")",
";",
"char",
"[",
"]",
"zeros",
"=",
"new",
"char",
"[",
"size",
"]",
";",
"Arrays",
".",
"fill",
"(",
"zeros",
",",
"'",
"'",
")",
";",
"DecimalFormat",
"df",
"=",
"new",
"DecimalFormat",
"(",
"String",
".",
"valueOf",
"(",
"zeros",
")",
")",
";",
"if",
"(",
"!",
"propagateValue",
"(",
"absPath",
",",
"df",
".",
"format",
"(",
"value",
")",
",",
"DONT_TRY_TO_CREATE",
",",
"allowOverwrite",
")",
")",
"throw",
"new",
"NoSuchPathException",
"(",
"absPath",
")",
";",
"}"
] | setzen des feldes "nachrichtengroesse" im nachrichtenkopf einer nachricht | [
"setzen",
"des",
"feldes",
"nachrichtengroesse",
"im",
"nachrichtenkopf",
"einer",
"nachricht"
] | 5e24f7e429d6b555e1d993196b4cf1adda6433cf | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/protocol/Message.java#L96-L109 |
143,258 | Chorus-bdd/Chorus | interpreter/chorus-pathscanner/src/main/java/org/chorusbdd/chorus/pathscanner/ClasspathScanner.java | ClasspathScanner.getClasspathFileNames | static String[] getClasspathFileNames() throws IOException {
//for performance we most likely only want to do this once for each interpreter session,
//classpath should not change dynamically
ChorusLog log = ChorusLogFactory.getLog(ClasspathScanner.class);
log.debug("Getting file names " + Thread.currentThread().getName());
long start = System.currentTimeMillis();
if (classpathNames == null) {
classpathNames = findClassNames();
log.debug("Getting file names took " + (System.currentTimeMillis() - start) + " millis");
}
return classpathNames;
} | java | static String[] getClasspathFileNames() throws IOException {
//for performance we most likely only want to do this once for each interpreter session,
//classpath should not change dynamically
ChorusLog log = ChorusLogFactory.getLog(ClasspathScanner.class);
log.debug("Getting file names " + Thread.currentThread().getName());
long start = System.currentTimeMillis();
if (classpathNames == null) {
classpathNames = findClassNames();
log.debug("Getting file names took " + (System.currentTimeMillis() - start) + " millis");
}
return classpathNames;
} | [
"static",
"String",
"[",
"]",
"getClasspathFileNames",
"(",
")",
"throws",
"IOException",
"{",
"//for performance we most likely only want to do this once for each interpreter session,",
"//classpath should not change dynamically",
"ChorusLog",
"log",
"=",
"ChorusLogFactory",
".",
"getLog",
"(",
"ClasspathScanner",
".",
"class",
")",
";",
"log",
".",
"debug",
"(",
"\"Getting file names \"",
"+",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"long",
"start",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"if",
"(",
"classpathNames",
"==",
"null",
")",
"{",
"classpathNames",
"=",
"findClassNames",
"(",
")",
";",
"log",
".",
"debug",
"(",
"\"Getting file names took \"",
"+",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
"-",
"start",
")",
"+",
"\" millis\"",
")",
";",
"}",
"return",
"classpathNames",
";",
"}"
] | Returns the fully qualified class names of
all the classes in the classpath. Checks
directories and zip files. The FilenameFilter
will be applied only to files that are in the
zip files and the directories. In other words,
the filter will not be used to sort directories. | [
"Returns",
"the",
"fully",
"qualified",
"class",
"names",
"of",
"all",
"the",
"classes",
"in",
"the",
"classpath",
".",
"Checks",
"directories",
"and",
"zip",
"files",
".",
"The",
"FilenameFilter",
"will",
"be",
"applied",
"only",
"to",
"files",
"that",
"are",
"in",
"the",
"zip",
"files",
"and",
"the",
"directories",
".",
"In",
"other",
"words",
"the",
"filter",
"will",
"not",
"be",
"used",
"to",
"sort",
"directories",
"."
] | 1eea7ca858876bce821bb49b43fd5b6ba1737997 | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-pathscanner/src/main/java/org/chorusbdd/chorus/pathscanner/ClasspathScanner.java#L144-L155 |
143,259 | IBM-Cloud/gp-java-client | src/main/java/com/ibm/g11n/pipeline/iam/TokenLifeCycleManager.java | TokenLifeCycleManager.getInstance | static TokenLifeCycleManager getInstance(final String iamEndpoint,
final String apiKey) {
if (iamEndpoint == null || iamEndpoint.isEmpty()) {
throw new IllegalArgumentException(
"Cannot initialize with null or empty IAM endpoint.");
}
if (apiKey == null || apiKey.isEmpty()) {
throw new IllegalArgumentException(
"Cannot initialize with null or empty IAM apiKey.");
}
return getInstanceUnchecked(iamEndpoint, apiKey);
} | java | static TokenLifeCycleManager getInstance(final String iamEndpoint,
final String apiKey) {
if (iamEndpoint == null || iamEndpoint.isEmpty()) {
throw new IllegalArgumentException(
"Cannot initialize with null or empty IAM endpoint.");
}
if (apiKey == null || apiKey.isEmpty()) {
throw new IllegalArgumentException(
"Cannot initialize with null or empty IAM apiKey.");
}
return getInstanceUnchecked(iamEndpoint, apiKey);
} | [
"static",
"TokenLifeCycleManager",
"getInstance",
"(",
"final",
"String",
"iamEndpoint",
",",
"final",
"String",
"apiKey",
")",
"{",
"if",
"(",
"iamEndpoint",
"==",
"null",
"||",
"iamEndpoint",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Cannot initialize with null or empty IAM endpoint.\"",
")",
";",
"}",
"if",
"(",
"apiKey",
"==",
"null",
"||",
"apiKey",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Cannot initialize with null or empty IAM apiKey.\"",
")",
";",
"}",
"return",
"getInstanceUnchecked",
"(",
"iamEndpoint",
",",
"apiKey",
")",
";",
"}"
] | Get an instance of TokenLifeCylceManager. Single instance is maintained
for each unique pair of iamEndpoint and apiKey. The method is thread
safe.
@param iamEndpoint
IAM endpoint.
@param apiKey
IAM API Key.
@return Instance of TokenLifeCylceManager | [
"Get",
"an",
"instance",
"of",
"TokenLifeCylceManager",
".",
"Single",
"instance",
"is",
"maintained",
"for",
"each",
"unique",
"pair",
"of",
"iamEndpoint",
"and",
"apiKey",
".",
"The",
"method",
"is",
"thread",
"safe",
"."
] | b015a081d7a7313bc48c448087fbc07bce860427 | https://github.com/IBM-Cloud/gp-java-client/blob/b015a081d7a7313bc48c448087fbc07bce860427/src/main/java/com/ibm/g11n/pipeline/iam/TokenLifeCycleManager.java#L184-L195 |
143,260 | IBM-Cloud/gp-java-client | src/main/java/com/ibm/g11n/pipeline/iam/TokenLifeCycleManager.java | TokenLifeCycleManager.getInstance | static TokenLifeCycleManager getInstance(final String jsonCredentials) {
final JsonObject credentials = new JsonParser().parse(jsonCredentials)
.getAsJsonObject();
if(credentials.get("apikey")==null || credentials.get("apikey").isJsonNull()||credentials.get("apikey").getAsString().isEmpty()) {
throw new IllegalArgumentException(
"IAM API Key value is either not available, or null or is empty in credentials JSON.");
}
if(credentials.get("iam_endpoint")==null || credentials.get("iam_endpoint").isJsonNull()||credentials.get("iam_endpoint").getAsString().isEmpty()) {
throw new IllegalArgumentException(
"IAM endpoint Key value is either not available, or null or is empty in credentials JSON.");
}
final String apiKey = credentials.get("apikey").getAsString();
final String iamEndpoint = credentials.get("iam_endpoint").getAsString();
return getInstanceUnchecked(iamEndpoint, apiKey);
} | java | static TokenLifeCycleManager getInstance(final String jsonCredentials) {
final JsonObject credentials = new JsonParser().parse(jsonCredentials)
.getAsJsonObject();
if(credentials.get("apikey")==null || credentials.get("apikey").isJsonNull()||credentials.get("apikey").getAsString().isEmpty()) {
throw new IllegalArgumentException(
"IAM API Key value is either not available, or null or is empty in credentials JSON.");
}
if(credentials.get("iam_endpoint")==null || credentials.get("iam_endpoint").isJsonNull()||credentials.get("iam_endpoint").getAsString().isEmpty()) {
throw new IllegalArgumentException(
"IAM endpoint Key value is either not available, or null or is empty in credentials JSON.");
}
final String apiKey = credentials.get("apikey").getAsString();
final String iamEndpoint = credentials.get("iam_endpoint").getAsString();
return getInstanceUnchecked(iamEndpoint, apiKey);
} | [
"static",
"TokenLifeCycleManager",
"getInstance",
"(",
"final",
"String",
"jsonCredentials",
")",
"{",
"final",
"JsonObject",
"credentials",
"=",
"new",
"JsonParser",
"(",
")",
".",
"parse",
"(",
"jsonCredentials",
")",
".",
"getAsJsonObject",
"(",
")",
";",
"if",
"(",
"credentials",
".",
"get",
"(",
"\"apikey\"",
")",
"==",
"null",
"||",
"credentials",
".",
"get",
"(",
"\"apikey\"",
")",
".",
"isJsonNull",
"(",
")",
"||",
"credentials",
".",
"get",
"(",
"\"apikey\"",
")",
".",
"getAsString",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"IAM API Key value is either not available, or null or is empty in credentials JSON.\"",
")",
";",
"}",
"if",
"(",
"credentials",
".",
"get",
"(",
"\"iam_endpoint\"",
")",
"==",
"null",
"||",
"credentials",
".",
"get",
"(",
"\"iam_endpoint\"",
")",
".",
"isJsonNull",
"(",
")",
"||",
"credentials",
".",
"get",
"(",
"\"iam_endpoint\"",
")",
".",
"getAsString",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"IAM endpoint Key value is either not available, or null or is empty in credentials JSON.\"",
")",
";",
"}",
"final",
"String",
"apiKey",
"=",
"credentials",
".",
"get",
"(",
"\"apikey\"",
")",
".",
"getAsString",
"(",
")",
";",
"final",
"String",
"iamEndpoint",
"=",
"credentials",
".",
"get",
"(",
"\"iam_endpoint\"",
")",
".",
"getAsString",
"(",
")",
";",
"return",
"getInstanceUnchecked",
"(",
"iamEndpoint",
",",
"apiKey",
")",
";",
"}"
] | Get an instance of TokenLifeCylceManager. Single instance is maintained
for each unique pair of iamEndpoint and apiKey. The method and the returned instance is thread
safe.
@param jsonCredentials
Credentials in JSON format. The credentials should at minimum
have these <key>:<value> pairs in the credentials json:
{
"apikey":"<IAM_API_KEY>",
"iam_endpoint":"<IAM_ENDPOINT>"
}
@return Instance of TokenLifeCylceManager. | [
"Get",
"an",
"instance",
"of",
"TokenLifeCylceManager",
".",
"Single",
"instance",
"is",
"maintained",
"for",
"each",
"unique",
"pair",
"of",
"iamEndpoint",
"and",
"apiKey",
".",
"The",
"method",
"and",
"the",
"returned",
"instance",
"is",
"thread",
"safe",
"."
] | b015a081d7a7313bc48c448087fbc07bce860427 | https://github.com/IBM-Cloud/gp-java-client/blob/b015a081d7a7313bc48c448087fbc07bce860427/src/main/java/com/ibm/g11n/pipeline/iam/TokenLifeCycleManager.java#L222-L237 |
143,261 | adorsys/hbci4java-adorsys | src/main/java/org/kapott/cryptalgs/ISO9796p2.java | ISO9796p2.adjustJ | private static BigInteger adjustJ(BigInteger J, BigInteger modulus) {
byte[] ba = J.toByteArray();
int last = ba[ba.length - 1];
if ((last & 0x0F) == 0x0C) {
return J;
}
BigInteger twelve = new BigInteger("12");
byte[] modulus2 = modulus.subtract(twelve).toByteArray();
int last2 = modulus2[modulus2.length - 1];
if ((last & 0x0F) == (last2 & 0x0F)) {
return modulus.subtract(J);
}
return null;
} | java | private static BigInteger adjustJ(BigInteger J, BigInteger modulus) {
byte[] ba = J.toByteArray();
int last = ba[ba.length - 1];
if ((last & 0x0F) == 0x0C) {
return J;
}
BigInteger twelve = new BigInteger("12");
byte[] modulus2 = modulus.subtract(twelve).toByteArray();
int last2 = modulus2[modulus2.length - 1];
if ((last & 0x0F) == (last2 & 0x0F)) {
return modulus.subtract(J);
}
return null;
} | [
"private",
"static",
"BigInteger",
"adjustJ",
"(",
"BigInteger",
"J",
",",
"BigInteger",
"modulus",
")",
"{",
"byte",
"[",
"]",
"ba",
"=",
"J",
".",
"toByteArray",
"(",
")",
";",
"int",
"last",
"=",
"ba",
"[",
"ba",
".",
"length",
"-",
"1",
"]",
";",
"if",
"(",
"(",
"last",
"&",
"0x0F",
")",
"==",
"0x0C",
")",
"{",
"return",
"J",
";",
"}",
"BigInteger",
"twelve",
"=",
"new",
"BigInteger",
"(",
"\"12\"",
")",
";",
"byte",
"[",
"]",
"modulus2",
"=",
"modulus",
".",
"subtract",
"(",
"twelve",
")",
".",
"toByteArray",
"(",
")",
";",
"int",
"last2",
"=",
"modulus2",
"[",
"modulus2",
".",
"length",
"-",
"1",
"]",
";",
"if",
"(",
"(",
"last",
"&",
"0x0F",
")",
"==",
"(",
"last2",
"&",
"0x0F",
")",
")",
"{",
"return",
"modulus",
".",
"subtract",
"(",
"J",
")",
";",
"}",
"return",
"null",
";",
"}"
] | entweder x oder n-x zurueckgeben | [
"entweder",
"x",
"oder",
"n",
"-",
"x",
"zurueckgeben"
] | 5e24f7e429d6b555e1d993196b4cf1adda6433cf | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/cryptalgs/ISO9796p2.java#L57-L74 |
143,262 | Chorus-bdd/Chorus | interpreter/chorus-util/src/main/java/org/chorusbdd/chorus/util/handler/HandlerPatterns.java | HandlerPatterns.getNames | public static List<String> getNames(String nameList) {
String[] names = nameList.split(",");
List<String> results = new LinkedList<>();
for ( String p : names) {
String configName = p.trim();
if ( configName.length() > 0) {
results.add(configName);
}
}
return results;
} | java | public static List<String> getNames(String nameList) {
String[] names = nameList.split(",");
List<String> results = new LinkedList<>();
for ( String p : names) {
String configName = p.trim();
if ( configName.length() > 0) {
results.add(configName);
}
}
return results;
} | [
"public",
"static",
"List",
"<",
"String",
">",
"getNames",
"(",
"String",
"nameList",
")",
"{",
"String",
"[",
"]",
"names",
"=",
"nameList",
".",
"split",
"(",
"\",\"",
")",
";",
"List",
"<",
"String",
">",
"results",
"=",
"new",
"LinkedList",
"<>",
"(",
")",
";",
"for",
"(",
"String",
"p",
":",
"names",
")",
"{",
"String",
"configName",
"=",
"p",
".",
"trim",
"(",
")",
";",
"if",
"(",
"configName",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"results",
".",
"add",
"(",
"configName",
")",
";",
"}",
"}",
"return",
"results",
";",
"}"
] | Get a List of process names from a comma separated list
@param nameList a list of process names conforming to the processNameListPattern | [
"Get",
"a",
"List",
"of",
"process",
"names",
"from",
"a",
"comma",
"separated",
"list"
] | 1eea7ca858876bce821bb49b43fd5b6ba1737997 | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-util/src/main/java/org/chorusbdd/chorus/util/handler/HandlerPatterns.java#L82-L92 |
143,263 | adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/manager/ChallengeInfo.java | ChallengeInfo.applyParams | public void applyParams(AbstractHBCIJob task, AbstractHBCIJob hktan, HBCITwoStepMechanism hbciTwoStepMechanism) {
String code = task.getHBCICode(); // Code des Geschaeftsvorfalls
// Job-Parameter holen
Job job = this.getData(code);
// Den Geschaeftsvorfall kennen wir nicht. Dann brauchen wir
// auch keine Challenge-Parameter setzen
if (job == null) {
log.info("have no challenge data for " + code + ", will not apply challenge params");
return;
}
HHDVersion version = HHDVersion.find(hbciTwoStepMechanism);
log.debug("using hhd version " + version);
// Parameter fuer die passende HHD-Version holen
HhdVersion hhd = job.getVersion(version.getChallengeVersion());
// Wir haben keine Parameter fuer diese HHD-Version
if (hhd == null) {
log.info("have no challenge data for " + code + " in " + version + ", will not apply challenge params");
return;
}
// Schritt 1: Challenge-Klasse uebernehmen
String klass = hhd.getKlass();
log.debug("using challenge klass " + klass);
hktan.setParam("challengeklass", klass);
// Schritt 2: Challenge-Parameter uebernehmen
List<Param> params = hhd.getParams();
for (int i = 0; i < params.size(); ++i) {
int num = i + 1; // Die Job-Parameter beginnen bei 1
Param param = params.get(i);
// Checken, ob der Parameter angewendet werden soll.
if (!param.isComplied(hbciTwoStepMechanism)) {
log.debug("skipping challenge parameter " + num + " (" + param.path + "), condition " + param.conditionName + "=" + param.conditionValue + " not complied");
continue;
}
// Parameter uebernehmen. Aber nur wenn er auch einen Wert hat.
// Seit HHD 1.4 duerfen Parameter mittendrin optional sein, sie
// werden dann freigelassen
String value = param.getValue(task);
if (value == null || value.length() == 0) {
log.debug("challenge parameter " + num + " (" + param.path + ") is empty");
continue;
}
log.debug("adding challenge parameter " + num + " " + param.path + "=" + value);
hktan.setParam("ChallengeKlassParam" + num, value);
}
} | java | public void applyParams(AbstractHBCIJob task, AbstractHBCIJob hktan, HBCITwoStepMechanism hbciTwoStepMechanism) {
String code = task.getHBCICode(); // Code des Geschaeftsvorfalls
// Job-Parameter holen
Job job = this.getData(code);
// Den Geschaeftsvorfall kennen wir nicht. Dann brauchen wir
// auch keine Challenge-Parameter setzen
if (job == null) {
log.info("have no challenge data for " + code + ", will not apply challenge params");
return;
}
HHDVersion version = HHDVersion.find(hbciTwoStepMechanism);
log.debug("using hhd version " + version);
// Parameter fuer die passende HHD-Version holen
HhdVersion hhd = job.getVersion(version.getChallengeVersion());
// Wir haben keine Parameter fuer diese HHD-Version
if (hhd == null) {
log.info("have no challenge data for " + code + " in " + version + ", will not apply challenge params");
return;
}
// Schritt 1: Challenge-Klasse uebernehmen
String klass = hhd.getKlass();
log.debug("using challenge klass " + klass);
hktan.setParam("challengeklass", klass);
// Schritt 2: Challenge-Parameter uebernehmen
List<Param> params = hhd.getParams();
for (int i = 0; i < params.size(); ++i) {
int num = i + 1; // Die Job-Parameter beginnen bei 1
Param param = params.get(i);
// Checken, ob der Parameter angewendet werden soll.
if (!param.isComplied(hbciTwoStepMechanism)) {
log.debug("skipping challenge parameter " + num + " (" + param.path + "), condition " + param.conditionName + "=" + param.conditionValue + " not complied");
continue;
}
// Parameter uebernehmen. Aber nur wenn er auch einen Wert hat.
// Seit HHD 1.4 duerfen Parameter mittendrin optional sein, sie
// werden dann freigelassen
String value = param.getValue(task);
if (value == null || value.length() == 0) {
log.debug("challenge parameter " + num + " (" + param.path + ") is empty");
continue;
}
log.debug("adding challenge parameter " + num + " " + param.path + "=" + value);
hktan.setParam("ChallengeKlassParam" + num, value);
}
} | [
"public",
"void",
"applyParams",
"(",
"AbstractHBCIJob",
"task",
",",
"AbstractHBCIJob",
"hktan",
",",
"HBCITwoStepMechanism",
"hbciTwoStepMechanism",
")",
"{",
"String",
"code",
"=",
"task",
".",
"getHBCICode",
"(",
")",
";",
"// Code des Geschaeftsvorfalls",
"// Job-Parameter holen",
"Job",
"job",
"=",
"this",
".",
"getData",
"(",
"code",
")",
";",
"// Den Geschaeftsvorfall kennen wir nicht. Dann brauchen wir",
"// auch keine Challenge-Parameter setzen",
"if",
"(",
"job",
"==",
"null",
")",
"{",
"log",
".",
"info",
"(",
"\"have no challenge data for \"",
"+",
"code",
"+",
"\", will not apply challenge params\"",
")",
";",
"return",
";",
"}",
"HHDVersion",
"version",
"=",
"HHDVersion",
".",
"find",
"(",
"hbciTwoStepMechanism",
")",
";",
"log",
".",
"debug",
"(",
"\"using hhd version \"",
"+",
"version",
")",
";",
"// Parameter fuer die passende HHD-Version holen",
"HhdVersion",
"hhd",
"=",
"job",
".",
"getVersion",
"(",
"version",
".",
"getChallengeVersion",
"(",
")",
")",
";",
"// Wir haben keine Parameter fuer diese HHD-Version",
"if",
"(",
"hhd",
"==",
"null",
")",
"{",
"log",
".",
"info",
"(",
"\"have no challenge data for \"",
"+",
"code",
"+",
"\" in \"",
"+",
"version",
"+",
"\", will not apply challenge params\"",
")",
";",
"return",
";",
"}",
"// Schritt 1: Challenge-Klasse uebernehmen",
"String",
"klass",
"=",
"hhd",
".",
"getKlass",
"(",
")",
";",
"log",
".",
"debug",
"(",
"\"using challenge klass \"",
"+",
"klass",
")",
";",
"hktan",
".",
"setParam",
"(",
"\"challengeklass\"",
",",
"klass",
")",
";",
"// Schritt 2: Challenge-Parameter uebernehmen",
"List",
"<",
"Param",
">",
"params",
"=",
"hhd",
".",
"getParams",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"params",
".",
"size",
"(",
")",
";",
"++",
"i",
")",
"{",
"int",
"num",
"=",
"i",
"+",
"1",
";",
"// Die Job-Parameter beginnen bei 1",
"Param",
"param",
"=",
"params",
".",
"get",
"(",
"i",
")",
";",
"// Checken, ob der Parameter angewendet werden soll.",
"if",
"(",
"!",
"param",
".",
"isComplied",
"(",
"hbciTwoStepMechanism",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"skipping challenge parameter \"",
"+",
"num",
"+",
"\" (\"",
"+",
"param",
".",
"path",
"+",
"\"), condition \"",
"+",
"param",
".",
"conditionName",
"+",
"\"=\"",
"+",
"param",
".",
"conditionValue",
"+",
"\" not complied\"",
")",
";",
"continue",
";",
"}",
"// Parameter uebernehmen. Aber nur wenn er auch einen Wert hat.",
"// Seit HHD 1.4 duerfen Parameter mittendrin optional sein, sie",
"// werden dann freigelassen",
"String",
"value",
"=",
"param",
".",
"getValue",
"(",
"task",
")",
";",
"if",
"(",
"value",
"==",
"null",
"||",
"value",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"log",
".",
"debug",
"(",
"\"challenge parameter \"",
"+",
"num",
"+",
"\" (\"",
"+",
"param",
".",
"path",
"+",
"\") is empty\"",
")",
";",
"continue",
";",
"}",
"log",
".",
"debug",
"(",
"\"adding challenge parameter \"",
"+",
"num",
"+",
"\" \"",
"+",
"param",
".",
"path",
"+",
"\"=\"",
"+",
"value",
")",
";",
"hktan",
".",
"setParam",
"(",
"\"ChallengeKlassParam\"",
"+",
"num",
",",
"value",
")",
";",
"}",
"}"
] | Uebernimmt die Challenge-Parameter in den HKTAN-Geschaeftsvorfall.
@param task der Job, zu dem die Challenge-Parameter ermittelt werden sollen.
@param hktan der HKTAN-Geschaeftsvorfall, in dem die Parameter gesetzt werden sollen.
@param hbciTwoStepMechanism die BPD-Informationen zum TAN-Verfahren. | [
"Uebernimmt",
"die",
"Challenge",
"-",
"Parameter",
"in",
"den",
"HKTAN",
"-",
"Geschaeftsvorfall",
"."
] | 5e24f7e429d6b555e1d993196b4cf1adda6433cf | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/manager/ChallengeInfo.java#L131-L185 |
143,264 | Chorus-bdd/Chorus | extensions/chorus-websockets/src/main/java/org/chorusbdd/chorus/websockets/ChorusWebSocketServer.java | ChorusWebSocketServer.findClientIdForWebSocket | private Optional<String> findClientIdForWebSocket(WebSocket conn) {
return clientIdToSocket.entrySet().stream()
.filter(e -> e.getValue() == conn)
.map(Map.Entry::getKey)
.findFirst();
} | java | private Optional<String> findClientIdForWebSocket(WebSocket conn) {
return clientIdToSocket.entrySet().stream()
.filter(e -> e.getValue() == conn)
.map(Map.Entry::getKey)
.findFirst();
} | [
"private",
"Optional",
"<",
"String",
">",
"findClientIdForWebSocket",
"(",
"WebSocket",
"conn",
")",
"{",
"return",
"clientIdToSocket",
".",
"entrySet",
"(",
")",
".",
"stream",
"(",
")",
".",
"filter",
"(",
"e",
"->",
"e",
".",
"getValue",
"(",
")",
"==",
"conn",
")",
".",
"map",
"(",
"Map",
".",
"Entry",
"::",
"getKey",
")",
".",
"findFirst",
"(",
")",
";",
"}"
] | Unless a client has sent a CONNECT message we will not have a client Id associated with the socket | [
"Unless",
"a",
"client",
"has",
"sent",
"a",
"CONNECT",
"message",
"we",
"will",
"not",
"have",
"a",
"client",
"Id",
"associated",
"with",
"the",
"socket"
] | 1eea7ca858876bce821bb49b43fd5b6ba1737997 | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/extensions/chorus-websockets/src/main/java/org/chorusbdd/chorus/websockets/ChorusWebSocketServer.java#L87-L92 |
143,265 | Chorus-bdd/Chorus | interpreter/chorus-config/src/main/java/org/chorusbdd/chorus/config/ConfigReader.java | ConfigReader.mergeProperties | private void mergeProperties(Map<ExecutionConfigSource, Map<ExecutionProperty, List<String>>> sourceToPropertiesMap) {
for ( ExecutionConfigSource s : propertySources) {
Map<ExecutionProperty, List<String>> properties = sourceToPropertiesMap.get(s);
for ( ExecutionProperty p : properties.keySet()) {
List<String> valuesFromSource = properties.get(p);
if ( valuesFromSource != null && !valuesFromSource.isEmpty()) {
List<String> vals = getOrCreatePropertyValues(p);
mergeValues(valuesFromSource, p, vals);
}
}
}
} | java | private void mergeProperties(Map<ExecutionConfigSource, Map<ExecutionProperty, List<String>>> sourceToPropertiesMap) {
for ( ExecutionConfigSource s : propertySources) {
Map<ExecutionProperty, List<String>> properties = sourceToPropertiesMap.get(s);
for ( ExecutionProperty p : properties.keySet()) {
List<String> valuesFromSource = properties.get(p);
if ( valuesFromSource != null && !valuesFromSource.isEmpty()) {
List<String> vals = getOrCreatePropertyValues(p);
mergeValues(valuesFromSource, p, vals);
}
}
}
} | [
"private",
"void",
"mergeProperties",
"(",
"Map",
"<",
"ExecutionConfigSource",
",",
"Map",
"<",
"ExecutionProperty",
",",
"List",
"<",
"String",
">",
">",
">",
"sourceToPropertiesMap",
")",
"{",
"for",
"(",
"ExecutionConfigSource",
"s",
":",
"propertySources",
")",
"{",
"Map",
"<",
"ExecutionProperty",
",",
"List",
"<",
"String",
">",
">",
"properties",
"=",
"sourceToPropertiesMap",
".",
"get",
"(",
"s",
")",
";",
"for",
"(",
"ExecutionProperty",
"p",
":",
"properties",
".",
"keySet",
"(",
")",
")",
"{",
"List",
"<",
"String",
">",
"valuesFromSource",
"=",
"properties",
".",
"get",
"(",
"p",
")",
";",
"if",
"(",
"valuesFromSource",
"!=",
"null",
"&&",
"!",
"valuesFromSource",
".",
"isEmpty",
"(",
")",
")",
"{",
"List",
"<",
"String",
">",
"vals",
"=",
"getOrCreatePropertyValues",
"(",
"p",
")",
";",
"mergeValues",
"(",
"valuesFromSource",
",",
"p",
",",
"vals",
")",
";",
"}",
"}",
"}",
"}"
] | deermine the final set of properties according to PropertySourceMode for each property | [
"deermine",
"the",
"final",
"set",
"of",
"properties",
"according",
"to",
"PropertySourceMode",
"for",
"each",
"property"
] | 1eea7ca858876bce821bb49b43fd5b6ba1737997 | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-config/src/main/java/org/chorusbdd/chorus/config/ConfigReader.java#L104-L115 |
143,266 | Chorus-bdd/Chorus | interpreter/chorus-config/src/main/java/org/chorusbdd/chorus/config/ConfigReader.java | ConfigReader.isTrue | public boolean isTrue(ExecutionProperty property) {
return isSet(property) && propertyMap.get(property).size() == 1
&& "true".equalsIgnoreCase(propertyMap.get(property).get(0));
} | java | public boolean isTrue(ExecutionProperty property) {
return isSet(property) && propertyMap.get(property).size() == 1
&& "true".equalsIgnoreCase(propertyMap.get(property).get(0));
} | [
"public",
"boolean",
"isTrue",
"(",
"ExecutionProperty",
"property",
")",
"{",
"return",
"isSet",
"(",
"property",
")",
"&&",
"propertyMap",
".",
"get",
"(",
"property",
")",
".",
"size",
"(",
")",
"==",
"1",
"&&",
"\"true\"",
".",
"equalsIgnoreCase",
"(",
"propertyMap",
".",
"get",
"(",
"property",
")",
".",
"get",
"(",
"0",
")",
")",
";",
"}"
] | for boolean properties, is the property set true | [
"for",
"boolean",
"properties",
"is",
"the",
"property",
"set",
"true"
] | 1eea7ca858876bce821bb49b43fd5b6ba1737997 | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-config/src/main/java/org/chorusbdd/chorus/config/ConfigReader.java#L163-L166 |
143,267 | Chorus-bdd/Chorus | interpreter/chorus-handlers/src/main/java/org/chorusbdd/chorus/handlers/choruscontext/ChorusContextHandler.java | ChorusContextHandler.initializeContextVariables | @Initialize(scope = Scope.SCENARIO)
public void initializeContextVariables() {
Properties p = new HandlerConfigLoader().loadProperties(configurationManager, "context");
for ( Map.Entry e : p.entrySet()) {
ChorusContext.getContext().put(e.getKey().toString(), e.getValue().toString());
}
} | java | @Initialize(scope = Scope.SCENARIO)
public void initializeContextVariables() {
Properties p = new HandlerConfigLoader().loadProperties(configurationManager, "context");
for ( Map.Entry e : p.entrySet()) {
ChorusContext.getContext().put(e.getKey().toString(), e.getValue().toString());
}
} | [
"@",
"Initialize",
"(",
"scope",
"=",
"Scope",
".",
"SCENARIO",
")",
"public",
"void",
"initializeContextVariables",
"(",
")",
"{",
"Properties",
"p",
"=",
"new",
"HandlerConfigLoader",
"(",
")",
".",
"loadProperties",
"(",
"configurationManager",
",",
"\"context\"",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"e",
":",
"p",
".",
"entrySet",
"(",
")",
")",
"{",
"ChorusContext",
".",
"getContext",
"(",
")",
".",
"put",
"(",
"e",
".",
"getKey",
"(",
")",
".",
"toString",
"(",
")",
",",
"e",
".",
"getValue",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"}",
"}"
] | Load any context properties defined in handler configuration files | [
"Load",
"any",
"context",
"properties",
"defined",
"in",
"handler",
"configuration",
"files"
] | 1eea7ca858876bce821bb49b43fd5b6ba1737997 | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-handlers/src/main/java/org/chorusbdd/chorus/handlers/choruscontext/ChorusContextHandler.java#L54-L60 |
143,268 | adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/manager/HBCIInstitute.java | HBCIInstitute.updateBPD | void updateBPD(HashMap<String, String> result) {
log.debug("extracting BPD from results");
HashMap<String, String> newBPD = new HashMap<>();
result.keySet().forEach(key -> {
if (key.startsWith("BPD.")) {
newBPD.put(key.substring(("BPD.").length()), result.get(key));
}
});
if (newBPD.size() != 0) {
newBPD.put(BPD_KEY_HBCIVERSION, passport.getHBCIVersion());
newBPD.put(BPD_KEY_LASTUPDATE, String.valueOf(System.currentTimeMillis()));
passport.setBPD(newBPD);
log.info("installed new BPD with version " + passport.getBPDVersion());
passport.getCallback().status(HBCICallback.STATUS_INST_BPD_INIT_DONE, passport.getBPD());
}
} | java | void updateBPD(HashMap<String, String> result) {
log.debug("extracting BPD from results");
HashMap<String, String> newBPD = new HashMap<>();
result.keySet().forEach(key -> {
if (key.startsWith("BPD.")) {
newBPD.put(key.substring(("BPD.").length()), result.get(key));
}
});
if (newBPD.size() != 0) {
newBPD.put(BPD_KEY_HBCIVERSION, passport.getHBCIVersion());
newBPD.put(BPD_KEY_LASTUPDATE, String.valueOf(System.currentTimeMillis()));
passport.setBPD(newBPD);
log.info("installed new BPD with version " + passport.getBPDVersion());
passport.getCallback().status(HBCICallback.STATUS_INST_BPD_INIT_DONE, passport.getBPD());
}
} | [
"void",
"updateBPD",
"(",
"HashMap",
"<",
"String",
",",
"String",
">",
"result",
")",
"{",
"log",
".",
"debug",
"(",
"\"extracting BPD from results\"",
")",
";",
"HashMap",
"<",
"String",
",",
"String",
">",
"newBPD",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"result",
".",
"keySet",
"(",
")",
".",
"forEach",
"(",
"key",
"->",
"{",
"if",
"(",
"key",
".",
"startsWith",
"(",
"\"BPD.\"",
")",
")",
"{",
"newBPD",
".",
"put",
"(",
"key",
".",
"substring",
"(",
"(",
"\"BPD.\"",
")",
".",
"length",
"(",
")",
")",
",",
"result",
".",
"get",
"(",
"key",
")",
")",
";",
"}",
"}",
")",
";",
"if",
"(",
"newBPD",
".",
"size",
"(",
")",
"!=",
"0",
")",
"{",
"newBPD",
".",
"put",
"(",
"BPD_KEY_HBCIVERSION",
",",
"passport",
".",
"getHBCIVersion",
"(",
")",
")",
";",
"newBPD",
".",
"put",
"(",
"BPD_KEY_LASTUPDATE",
",",
"String",
".",
"valueOf",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
")",
")",
";",
"passport",
".",
"setBPD",
"(",
"newBPD",
")",
";",
"log",
".",
"info",
"(",
"\"installed new BPD with version \"",
"+",
"passport",
".",
"getBPDVersion",
"(",
")",
")",
";",
"passport",
".",
"getCallback",
"(",
")",
".",
"status",
"(",
"HBCICallback",
".",
"STATUS_INST_BPD_INIT_DONE",
",",
"passport",
".",
"getBPD",
"(",
")",
")",
";",
"}",
"}"
] | gets the BPD out of the result and store it in the
passport field | [
"gets",
"the",
"BPD",
"out",
"of",
"the",
"result",
"and",
"store",
"it",
"in",
"the",
"passport",
"field"
] | 5e24f7e429d6b555e1d993196b4cf1adda6433cf | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/manager/HBCIInstitute.java#L68-L85 |
143,269 | adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/manager/HBCIInstitute.java | HBCIInstitute.extractKeys | void extractKeys(HashMap<String, String> result) {
boolean foundChanges = false;
try {
log.debug("extracting public institute keys from results");
for (int i = 0; i < 3; i++) {
String head = HBCIUtils.withCounter("SendPubKey", i);
String keyType = result.get(head + ".KeyName.keytype");
if (keyType == null)
continue;
String keyCountry = result.get(head + ".KeyName.KIK.country");
String keyBLZ = result.get(head + ".KeyName.KIK.blz");
String keyUserId = result.get(head + ".KeyName.userid");
String keyNum = result.get(head + ".KeyName.keynum");
String keyVersion = result.get(head + ".KeyName.keyversion");
log.info("found key " +
keyCountry + "_" + keyBLZ + "_" + keyUserId + "_" + keyType + "_" +
keyNum + "_" + keyVersion);
byte[] keyExponent = result.get(head + ".PubKey.exponent").getBytes(CommPinTan.ENCODING);
byte[] keyModulus = result.get(head + ".PubKey.modulus").getBytes(CommPinTan.ENCODING);
KeyFactory fac = KeyFactory.getInstance("RSA");
KeySpec spec = new RSAPublicKeySpec(new BigInteger(+1, keyModulus),
new BigInteger(+1, keyExponent));
Key key = fac.generatePublic(spec);
if (keyType.equals("S")) {
passport.setInstSigKey(new HBCIKey(keyCountry, keyBLZ, keyUserId, keyNum, keyVersion, key));
foundChanges = true;
} else if (keyType.equals("V")) {
passport.setInstEncKey(new HBCIKey(keyCountry, keyBLZ, keyUserId, keyNum, keyVersion, key));
foundChanges = true;
}
}
} catch (Exception e) {
String msg = HBCIUtils.getLocMsg("EXCMSG_EXTR_IKEYS_ERR");
throw new HBCI_Exception(msg, e);
}
if (foundChanges) {
passport.getCallback().status(HBCICallback.STATUS_INST_GET_KEYS_DONE, null);
}
} | java | void extractKeys(HashMap<String, String> result) {
boolean foundChanges = false;
try {
log.debug("extracting public institute keys from results");
for (int i = 0; i < 3; i++) {
String head = HBCIUtils.withCounter("SendPubKey", i);
String keyType = result.get(head + ".KeyName.keytype");
if (keyType == null)
continue;
String keyCountry = result.get(head + ".KeyName.KIK.country");
String keyBLZ = result.get(head + ".KeyName.KIK.blz");
String keyUserId = result.get(head + ".KeyName.userid");
String keyNum = result.get(head + ".KeyName.keynum");
String keyVersion = result.get(head + ".KeyName.keyversion");
log.info("found key " +
keyCountry + "_" + keyBLZ + "_" + keyUserId + "_" + keyType + "_" +
keyNum + "_" + keyVersion);
byte[] keyExponent = result.get(head + ".PubKey.exponent").getBytes(CommPinTan.ENCODING);
byte[] keyModulus = result.get(head + ".PubKey.modulus").getBytes(CommPinTan.ENCODING);
KeyFactory fac = KeyFactory.getInstance("RSA");
KeySpec spec = new RSAPublicKeySpec(new BigInteger(+1, keyModulus),
new BigInteger(+1, keyExponent));
Key key = fac.generatePublic(spec);
if (keyType.equals("S")) {
passport.setInstSigKey(new HBCIKey(keyCountry, keyBLZ, keyUserId, keyNum, keyVersion, key));
foundChanges = true;
} else if (keyType.equals("V")) {
passport.setInstEncKey(new HBCIKey(keyCountry, keyBLZ, keyUserId, keyNum, keyVersion, key));
foundChanges = true;
}
}
} catch (Exception e) {
String msg = HBCIUtils.getLocMsg("EXCMSG_EXTR_IKEYS_ERR");
throw new HBCI_Exception(msg, e);
}
if (foundChanges) {
passport.getCallback().status(HBCICallback.STATUS_INST_GET_KEYS_DONE, null);
}
} | [
"void",
"extractKeys",
"(",
"HashMap",
"<",
"String",
",",
"String",
">",
"result",
")",
"{",
"boolean",
"foundChanges",
"=",
"false",
";",
"try",
"{",
"log",
".",
"debug",
"(",
"\"extracting public institute keys from results\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"3",
";",
"i",
"++",
")",
"{",
"String",
"head",
"=",
"HBCIUtils",
".",
"withCounter",
"(",
"\"SendPubKey\"",
",",
"i",
")",
";",
"String",
"keyType",
"=",
"result",
".",
"get",
"(",
"head",
"+",
"\".KeyName.keytype\"",
")",
";",
"if",
"(",
"keyType",
"==",
"null",
")",
"continue",
";",
"String",
"keyCountry",
"=",
"result",
".",
"get",
"(",
"head",
"+",
"\".KeyName.KIK.country\"",
")",
";",
"String",
"keyBLZ",
"=",
"result",
".",
"get",
"(",
"head",
"+",
"\".KeyName.KIK.blz\"",
")",
";",
"String",
"keyUserId",
"=",
"result",
".",
"get",
"(",
"head",
"+",
"\".KeyName.userid\"",
")",
";",
"String",
"keyNum",
"=",
"result",
".",
"get",
"(",
"head",
"+",
"\".KeyName.keynum\"",
")",
";",
"String",
"keyVersion",
"=",
"result",
".",
"get",
"(",
"head",
"+",
"\".KeyName.keyversion\"",
")",
";",
"log",
".",
"info",
"(",
"\"found key \"",
"+",
"keyCountry",
"+",
"\"_\"",
"+",
"keyBLZ",
"+",
"\"_\"",
"+",
"keyUserId",
"+",
"\"_\"",
"+",
"keyType",
"+",
"\"_\"",
"+",
"keyNum",
"+",
"\"_\"",
"+",
"keyVersion",
")",
";",
"byte",
"[",
"]",
"keyExponent",
"=",
"result",
".",
"get",
"(",
"head",
"+",
"\".PubKey.exponent\"",
")",
".",
"getBytes",
"(",
"CommPinTan",
".",
"ENCODING",
")",
";",
"byte",
"[",
"]",
"keyModulus",
"=",
"result",
".",
"get",
"(",
"head",
"+",
"\".PubKey.modulus\"",
")",
".",
"getBytes",
"(",
"CommPinTan",
".",
"ENCODING",
")",
";",
"KeyFactory",
"fac",
"=",
"KeyFactory",
".",
"getInstance",
"(",
"\"RSA\"",
")",
";",
"KeySpec",
"spec",
"=",
"new",
"RSAPublicKeySpec",
"(",
"new",
"BigInteger",
"(",
"+",
"1",
",",
"keyModulus",
")",
",",
"new",
"BigInteger",
"(",
"+",
"1",
",",
"keyExponent",
")",
")",
";",
"Key",
"key",
"=",
"fac",
".",
"generatePublic",
"(",
"spec",
")",
";",
"if",
"(",
"keyType",
".",
"equals",
"(",
"\"S\"",
")",
")",
"{",
"passport",
".",
"setInstSigKey",
"(",
"new",
"HBCIKey",
"(",
"keyCountry",
",",
"keyBLZ",
",",
"keyUserId",
",",
"keyNum",
",",
"keyVersion",
",",
"key",
")",
")",
";",
"foundChanges",
"=",
"true",
";",
"}",
"else",
"if",
"(",
"keyType",
".",
"equals",
"(",
"\"V\"",
")",
")",
"{",
"passport",
".",
"setInstEncKey",
"(",
"new",
"HBCIKey",
"(",
"keyCountry",
",",
"keyBLZ",
",",
"keyUserId",
",",
"keyNum",
",",
"keyVersion",
",",
"key",
")",
")",
";",
"foundChanges",
"=",
"true",
";",
"}",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"String",
"msg",
"=",
"HBCIUtils",
".",
"getLocMsg",
"(",
"\"EXCMSG_EXTR_IKEYS_ERR\"",
")",
";",
"throw",
"new",
"HBCI_Exception",
"(",
"msg",
",",
"e",
")",
";",
"}",
"if",
"(",
"foundChanges",
")",
"{",
"passport",
".",
"getCallback",
"(",
")",
".",
"status",
"(",
"HBCICallback",
".",
"STATUS_INST_GET_KEYS_DONE",
",",
"null",
")",
";",
"}",
"}"
] | gets the server public keys from the result and store them in the passport | [
"gets",
"the",
"server",
"public",
"keys",
"from",
"the",
"result",
"and",
"store",
"them",
"in",
"the",
"passport"
] | 5e24f7e429d6b555e1d993196b4cf1adda6433cf | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/manager/HBCIInstitute.java#L90-L136 |
143,270 | adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/manager/HBCIInstitute.java | HBCIInstitute.isBPDExpired | private boolean isBPDExpired() {
Map<String, String> bpd = passport.getBPD();
log.info("[BPD] max age: " + maxAge + " days");
long maxMillis = -1L;
try {
int days = Integer.parseInt(maxAge);
if (days == 0) {
log.info("[BPD] auto-expiry disabled");
return false;
}
if (days > 0)
maxMillis = days * 24 * 60 * 60 * 1000L;
} catch (NumberFormatException e) {
log.error(e.getMessage(), e);
return false;
}
long lastUpdate = 0L;
if (bpd != null) {
String lastUpdateProperty = bpd.get(BPD_KEY_LASTUPDATE);
try {
lastUpdate = lastUpdateProperty != null ? Long.parseLong(lastUpdateProperty) : lastUpdate;
} catch (NumberFormatException e) {
log.error(e.getMessage(), e);
return false;
}
log.info("[BPD] last update: " + (lastUpdate == 0 ? "never" : new Date(lastUpdate)));
}
long now = System.currentTimeMillis();
if (maxMillis < 0 || (now - lastUpdate) > maxMillis) {
log.info("[BPD] expired, will be updated now");
return true;
}
return false;
} | java | private boolean isBPDExpired() {
Map<String, String> bpd = passport.getBPD();
log.info("[BPD] max age: " + maxAge + " days");
long maxMillis = -1L;
try {
int days = Integer.parseInt(maxAge);
if (days == 0) {
log.info("[BPD] auto-expiry disabled");
return false;
}
if (days > 0)
maxMillis = days * 24 * 60 * 60 * 1000L;
} catch (NumberFormatException e) {
log.error(e.getMessage(), e);
return false;
}
long lastUpdate = 0L;
if (bpd != null) {
String lastUpdateProperty = bpd.get(BPD_KEY_LASTUPDATE);
try {
lastUpdate = lastUpdateProperty != null ? Long.parseLong(lastUpdateProperty) : lastUpdate;
} catch (NumberFormatException e) {
log.error(e.getMessage(), e);
return false;
}
log.info("[BPD] last update: " + (lastUpdate == 0 ? "never" : new Date(lastUpdate)));
}
long now = System.currentTimeMillis();
if (maxMillis < 0 || (now - lastUpdate) > maxMillis) {
log.info("[BPD] expired, will be updated now");
return true;
}
return false;
} | [
"private",
"boolean",
"isBPDExpired",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"bpd",
"=",
"passport",
".",
"getBPD",
"(",
")",
";",
"log",
".",
"info",
"(",
"\"[BPD] max age: \"",
"+",
"maxAge",
"+",
"\" days\"",
")",
";",
"long",
"maxMillis",
"=",
"-",
"1L",
";",
"try",
"{",
"int",
"days",
"=",
"Integer",
".",
"parseInt",
"(",
"maxAge",
")",
";",
"if",
"(",
"days",
"==",
"0",
")",
"{",
"log",
".",
"info",
"(",
"\"[BPD] auto-expiry disabled\"",
")",
";",
"return",
"false",
";",
"}",
"if",
"(",
"days",
">",
"0",
")",
"maxMillis",
"=",
"days",
"*",
"24",
"*",
"60",
"*",
"60",
"*",
"1000L",
";",
"}",
"catch",
"(",
"NumberFormatException",
"e",
")",
"{",
"log",
".",
"error",
"(",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"return",
"false",
";",
"}",
"long",
"lastUpdate",
"=",
"0L",
";",
"if",
"(",
"bpd",
"!=",
"null",
")",
"{",
"String",
"lastUpdateProperty",
"=",
"bpd",
".",
"get",
"(",
"BPD_KEY_LASTUPDATE",
")",
";",
"try",
"{",
"lastUpdate",
"=",
"lastUpdateProperty",
"!=",
"null",
"?",
"Long",
".",
"parseLong",
"(",
"lastUpdateProperty",
")",
":",
"lastUpdate",
";",
"}",
"catch",
"(",
"NumberFormatException",
"e",
")",
"{",
"log",
".",
"error",
"(",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"return",
"false",
";",
"}",
"log",
".",
"info",
"(",
"\"[BPD] last update: \"",
"+",
"(",
"lastUpdate",
"==",
"0",
"?",
"\"never\"",
":",
"new",
"Date",
"(",
"lastUpdate",
")",
")",
")",
";",
"}",
"long",
"now",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"if",
"(",
"maxMillis",
"<",
"0",
"||",
"(",
"now",
"-",
"lastUpdate",
")",
">",
"maxMillis",
")",
"{",
"log",
".",
"info",
"(",
"\"[BPD] expired, will be updated now\"",
")",
";",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | Prueft, ob die BPD abgelaufen sind und neu geladen werden muessen.
@return true, wenn die BPD abgelaufen sind. | [
"Prueft",
"ob",
"die",
"BPD",
"abgelaufen",
"sind",
"und",
"neu",
"geladen",
"werden",
"muessen",
"."
] | 5e24f7e429d6b555e1d993196b4cf1adda6433cf | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/manager/HBCIInstitute.java#L143-L181 |
143,271 | adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/manager/HBCIInstitute.java | HBCIInstitute.fetchBPDAnonymous | void fetchBPDAnonymous() {
// BPD abholen, wenn nicht vorhanden oder HBCI-Version geaendert
Map<String, String> bpd = passport.getBPD();
String hbciVersionOfBPD = (bpd != null) ? bpd.get(BPD_KEY_HBCIVERSION) : null;
final String version = passport.getBPDVersion();
if (version.equals("0") || isBPDExpired() || hbciVersionOfBPD == null || !hbciVersionOfBPD.equals(passport.getHBCIVersion())) {
try {
// Wenn wir die BPD per anonymem Dialog neu abrufen, muessen wir sicherstellen,
// dass die BPD-Version im Passport auf "0" zurueckgesetzt ist. Denn wenn die
// Bank den anonymen Abruf nicht unterstuetzt, wuerde dieser Abruf hier fehlschlagen,
// der erneute Versuch mit authentifiziertem Dialog wuerde jedoch nicht zum
// Neuabruf der BPD fuehren, da dort (in HBCIUser#fetchUPD bzw. HBCIDialog#doDialogInit)
// weiterhin die (u.U. ja noch aktuelle) BPD-Version an die Bank geschickt wird
// und diese daraufhin keine neuen BPD schickt. Das wuerde in einer endlosen
// Schleife enden, in der wir hier immer wieder versuchen wuerden, neu abzurufen
// (weil expired). Siehe https://www.willuhn.de/bugzilla/show_bug.cgi?id=1567
// Also muessen wir die BPD-Version auf 0 setzen. Fuer den Fall, dass wir in dem
// "if" hier aus einem der anderen beiden o.g. Gruende (BPD-Expiry oder neue HBCI-Version)
// gelandet sind.
if (!version.equals("0")) {
log.info("resetting BPD version from " + version + " to 0");
passport.getBPD().put("BPA.version", "0");
}
passport.getCallback().status(HBCICallback.STATUS_INST_BPD_INIT, null);
log.info("fetching BPD");
HBCIMsgStatus msgStatus = anonymousDialogInit();
updateBPD(msgStatus.getData());
if (!msgStatus.isDialogClosed()) {
anonymousDialogEnd(msgStatus.getData());
}
if (!msgStatus.isOK()) {
log.error("fetching BPD failed");
throw new ProcessException(HBCIUtils.getLocMsg("ERR_INST_BPDFAILED"), msgStatus);
}
} catch (HBCI_Exception e) {
if (e.isFatal())
throw e;
} catch (Exception e) {
// Viele Kreditinstitute unterstützen den anonymen Login nicht. Dass sollte nicht als Fehler den
// Anwender beunruhigen
log.info("FAILED! - maybe this institute does not support anonymous logins");
log.info("we will nevertheless go on");
}
}
// ueberpruefen, ob angeforderte sicherheitsmethode auch
// tatsaechlich unterstuetzt wird
log.debug("checking if requested hbci parameters are supported");
if (passport.getBPD() != null) {
if (!Arrays.asList(passport.getSuppVersions()).contains(passport.getHBCIVersion())) {
String msg = HBCIUtils.getLocMsg("EXCMSG_VERSIONNOTSUPP");
throw new InvalidUserDataException(msg);
}
} else {
log.warn("can not check if requested parameters are supported");
}
} | java | void fetchBPDAnonymous() {
// BPD abholen, wenn nicht vorhanden oder HBCI-Version geaendert
Map<String, String> bpd = passport.getBPD();
String hbciVersionOfBPD = (bpd != null) ? bpd.get(BPD_KEY_HBCIVERSION) : null;
final String version = passport.getBPDVersion();
if (version.equals("0") || isBPDExpired() || hbciVersionOfBPD == null || !hbciVersionOfBPD.equals(passport.getHBCIVersion())) {
try {
// Wenn wir die BPD per anonymem Dialog neu abrufen, muessen wir sicherstellen,
// dass die BPD-Version im Passport auf "0" zurueckgesetzt ist. Denn wenn die
// Bank den anonymen Abruf nicht unterstuetzt, wuerde dieser Abruf hier fehlschlagen,
// der erneute Versuch mit authentifiziertem Dialog wuerde jedoch nicht zum
// Neuabruf der BPD fuehren, da dort (in HBCIUser#fetchUPD bzw. HBCIDialog#doDialogInit)
// weiterhin die (u.U. ja noch aktuelle) BPD-Version an die Bank geschickt wird
// und diese daraufhin keine neuen BPD schickt. Das wuerde in einer endlosen
// Schleife enden, in der wir hier immer wieder versuchen wuerden, neu abzurufen
// (weil expired). Siehe https://www.willuhn.de/bugzilla/show_bug.cgi?id=1567
// Also muessen wir die BPD-Version auf 0 setzen. Fuer den Fall, dass wir in dem
// "if" hier aus einem der anderen beiden o.g. Gruende (BPD-Expiry oder neue HBCI-Version)
// gelandet sind.
if (!version.equals("0")) {
log.info("resetting BPD version from " + version + " to 0");
passport.getBPD().put("BPA.version", "0");
}
passport.getCallback().status(HBCICallback.STATUS_INST_BPD_INIT, null);
log.info("fetching BPD");
HBCIMsgStatus msgStatus = anonymousDialogInit();
updateBPD(msgStatus.getData());
if (!msgStatus.isDialogClosed()) {
anonymousDialogEnd(msgStatus.getData());
}
if (!msgStatus.isOK()) {
log.error("fetching BPD failed");
throw new ProcessException(HBCIUtils.getLocMsg("ERR_INST_BPDFAILED"), msgStatus);
}
} catch (HBCI_Exception e) {
if (e.isFatal())
throw e;
} catch (Exception e) {
// Viele Kreditinstitute unterstützen den anonymen Login nicht. Dass sollte nicht als Fehler den
// Anwender beunruhigen
log.info("FAILED! - maybe this institute does not support anonymous logins");
log.info("we will nevertheless go on");
}
}
// ueberpruefen, ob angeforderte sicherheitsmethode auch
// tatsaechlich unterstuetzt wird
log.debug("checking if requested hbci parameters are supported");
if (passport.getBPD() != null) {
if (!Arrays.asList(passport.getSuppVersions()).contains(passport.getHBCIVersion())) {
String msg = HBCIUtils.getLocMsg("EXCMSG_VERSIONNOTSUPP");
throw new InvalidUserDataException(msg);
}
} else {
log.warn("can not check if requested parameters are supported");
}
} | [
"void",
"fetchBPDAnonymous",
"(",
")",
"{",
"// BPD abholen, wenn nicht vorhanden oder HBCI-Version geaendert",
"Map",
"<",
"String",
",",
"String",
">",
"bpd",
"=",
"passport",
".",
"getBPD",
"(",
")",
";",
"String",
"hbciVersionOfBPD",
"=",
"(",
"bpd",
"!=",
"null",
")",
"?",
"bpd",
".",
"get",
"(",
"BPD_KEY_HBCIVERSION",
")",
":",
"null",
";",
"final",
"String",
"version",
"=",
"passport",
".",
"getBPDVersion",
"(",
")",
";",
"if",
"(",
"version",
".",
"equals",
"(",
"\"0\"",
")",
"||",
"isBPDExpired",
"(",
")",
"||",
"hbciVersionOfBPD",
"==",
"null",
"||",
"!",
"hbciVersionOfBPD",
".",
"equals",
"(",
"passport",
".",
"getHBCIVersion",
"(",
")",
")",
")",
"{",
"try",
"{",
"// Wenn wir die BPD per anonymem Dialog neu abrufen, muessen wir sicherstellen,",
"// dass die BPD-Version im Passport auf \"0\" zurueckgesetzt ist. Denn wenn die",
"// Bank den anonymen Abruf nicht unterstuetzt, wuerde dieser Abruf hier fehlschlagen,",
"// der erneute Versuch mit authentifiziertem Dialog wuerde jedoch nicht zum",
"// Neuabruf der BPD fuehren, da dort (in HBCIUser#fetchUPD bzw. HBCIDialog#doDialogInit)",
"// weiterhin die (u.U. ja noch aktuelle) BPD-Version an die Bank geschickt wird",
"// und diese daraufhin keine neuen BPD schickt. Das wuerde in einer endlosen",
"// Schleife enden, in der wir hier immer wieder versuchen wuerden, neu abzurufen",
"// (weil expired). Siehe https://www.willuhn.de/bugzilla/show_bug.cgi?id=1567",
"// Also muessen wir die BPD-Version auf 0 setzen. Fuer den Fall, dass wir in dem",
"// \"if\" hier aus einem der anderen beiden o.g. Gruende (BPD-Expiry oder neue HBCI-Version)",
"// gelandet sind.",
"if",
"(",
"!",
"version",
".",
"equals",
"(",
"\"0\"",
")",
")",
"{",
"log",
".",
"info",
"(",
"\"resetting BPD version from \"",
"+",
"version",
"+",
"\" to 0\"",
")",
";",
"passport",
".",
"getBPD",
"(",
")",
".",
"put",
"(",
"\"BPA.version\"",
",",
"\"0\"",
")",
";",
"}",
"passport",
".",
"getCallback",
"(",
")",
".",
"status",
"(",
"HBCICallback",
".",
"STATUS_INST_BPD_INIT",
",",
"null",
")",
";",
"log",
".",
"info",
"(",
"\"fetching BPD\"",
")",
";",
"HBCIMsgStatus",
"msgStatus",
"=",
"anonymousDialogInit",
"(",
")",
";",
"updateBPD",
"(",
"msgStatus",
".",
"getData",
"(",
")",
")",
";",
"if",
"(",
"!",
"msgStatus",
".",
"isDialogClosed",
"(",
")",
")",
"{",
"anonymousDialogEnd",
"(",
"msgStatus",
".",
"getData",
"(",
")",
")",
";",
"}",
"if",
"(",
"!",
"msgStatus",
".",
"isOK",
"(",
")",
")",
"{",
"log",
".",
"error",
"(",
"\"fetching BPD failed\"",
")",
";",
"throw",
"new",
"ProcessException",
"(",
"HBCIUtils",
".",
"getLocMsg",
"(",
"\"ERR_INST_BPDFAILED\"",
")",
",",
"msgStatus",
")",
";",
"}",
"}",
"catch",
"(",
"HBCI_Exception",
"e",
")",
"{",
"if",
"(",
"e",
".",
"isFatal",
"(",
")",
")",
"throw",
"e",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// Viele Kreditinstitute unterstützen den anonymen Login nicht. Dass sollte nicht als Fehler den",
"// Anwender beunruhigen",
"log",
".",
"info",
"(",
"\"FAILED! - maybe this institute does not support anonymous logins\"",
")",
";",
"log",
".",
"info",
"(",
"\"we will nevertheless go on\"",
")",
";",
"}",
"}",
"// ueberpruefen, ob angeforderte sicherheitsmethode auch",
"// tatsaechlich unterstuetzt wird",
"log",
".",
"debug",
"(",
"\"checking if requested hbci parameters are supported\"",
")",
";",
"if",
"(",
"passport",
".",
"getBPD",
"(",
")",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"Arrays",
".",
"asList",
"(",
"passport",
".",
"getSuppVersions",
"(",
")",
")",
".",
"contains",
"(",
"passport",
".",
"getHBCIVersion",
"(",
")",
")",
")",
"{",
"String",
"msg",
"=",
"HBCIUtils",
".",
"getLocMsg",
"(",
"\"EXCMSG_VERSIONNOTSUPP\"",
")",
";",
"throw",
"new",
"InvalidUserDataException",
"(",
"msg",
")",
";",
"}",
"}",
"else",
"{",
"log",
".",
"warn",
"(",
"\"can not check if requested parameters are supported\"",
")",
";",
"}",
"}"
] | Aktualisiert die BPD bei Bedarf. | [
"Aktualisiert",
"die",
"BPD",
"bei",
"Bedarf",
"."
] | 5e24f7e429d6b555e1d993196b4cf1adda6433cf | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/manager/HBCIInstitute.java#L186-L248 |
143,272 | Chorus-bdd/Chorus | interpreter/chorus-parser/src/main/java/org/chorusbdd/chorus/parser/FeatureFileParser.java | FeatureFileParser.getFeaturesWithConfigurations | private List<FeatureToken> getFeaturesWithConfigurations(List<String> configurationNames, FeatureToken parsedFeature) {
List<FeatureToken> results = new ArrayList<>();
if (parsedFeature != null) {
if (configurationNames == null) {
results.add(parsedFeature);
} else {
createFeaturesWithConfigurations(configurationNames, parsedFeature, results);
}
}
return results;
} | java | private List<FeatureToken> getFeaturesWithConfigurations(List<String> configurationNames, FeatureToken parsedFeature) {
List<FeatureToken> results = new ArrayList<>();
if (parsedFeature != null) {
if (configurationNames == null) {
results.add(parsedFeature);
} else {
createFeaturesWithConfigurations(configurationNames, parsedFeature, results);
}
}
return results;
} | [
"private",
"List",
"<",
"FeatureToken",
">",
"getFeaturesWithConfigurations",
"(",
"List",
"<",
"String",
">",
"configurationNames",
",",
"FeatureToken",
"parsedFeature",
")",
"{",
"List",
"<",
"FeatureToken",
">",
"results",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"if",
"(",
"parsedFeature",
"!=",
"null",
")",
"{",
"if",
"(",
"configurationNames",
"==",
"null",
")",
"{",
"results",
".",
"add",
"(",
"parsedFeature",
")",
";",
"}",
"else",
"{",
"createFeaturesWithConfigurations",
"(",
"configurationNames",
",",
"parsedFeature",
",",
"results",
")",
";",
"}",
"}",
"return",
"results",
";",
"}"
] | If parsedFeature has no configurations then we can return a single item list containg the parsedFeature
If configurations are present we need to return a list with one feature per supported configuration
@param configurationNames
@param parsedFeature
@return | [
"If",
"parsedFeature",
"has",
"no",
"configurations",
"then",
"we",
"can",
"return",
"a",
"single",
"item",
"list",
"containg",
"the",
"parsedFeature",
"If",
"configurations",
"are",
"present",
"we",
"need",
"to",
"return",
"a",
"list",
"with",
"one",
"feature",
"per",
"supported",
"configuration"
] | 1eea7ca858876bce821bb49b43fd5b6ba1737997 | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-parser/src/main/java/org/chorusbdd/chorus/parser/FeatureFileParser.java#L308-L318 |
143,273 | Chorus-bdd/Chorus | interpreter/chorus-parser/src/main/java/org/chorusbdd/chorus/parser/FeatureFileParser.java | FeatureFileParser.extractTagsAndResetLastTagsLineField | private List<String> extractTagsAndResetLastTagsLineField() {
String tags = lastTagsLine;
List<String> result = extractTags(tags);
resetLastTagsLine();
return result;
} | java | private List<String> extractTagsAndResetLastTagsLineField() {
String tags = lastTagsLine;
List<String> result = extractTags(tags);
resetLastTagsLine();
return result;
} | [
"private",
"List",
"<",
"String",
">",
"extractTagsAndResetLastTagsLineField",
"(",
")",
"{",
"String",
"tags",
"=",
"lastTagsLine",
";",
"List",
"<",
"String",
">",
"result",
"=",
"extractTags",
"(",
"tags",
")",
";",
"resetLastTagsLine",
"(",
")",
";",
"return",
"result",
";",
"}"
] | Extracts the tags from the lastTagsLine field before setting it to null.
@return the tags or null if lastTagsLine is null. | [
"Extracts",
"the",
"tags",
"from",
"the",
"lastTagsLine",
"field",
"before",
"setting",
"it",
"to",
"null",
"."
] | 1eea7ca858876bce821bb49b43fd5b6ba1737997 | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-parser/src/main/java/org/chorusbdd/chorus/parser/FeatureFileParser.java#L445-L450 |
143,274 | IBM-Cloud/gp-java-client | src/main/java/com/ibm/g11n/pipeline/client/TranslationRequestDataChangeSet.java | TranslationRequestDataChangeSet.setTargetLanguagesByBundle | public TranslationRequestDataChangeSet setTargetLanguagesByBundle(
Map<String, Set<String>> targetLanguagesByBundle) {
// TODO - check empty map?
if (targetLanguagesByBundle == null) {
throw new NullPointerException("The input map is null.");
}
this.targetLanguagesByBundle = targetLanguagesByBundle;
return this;
} | java | public TranslationRequestDataChangeSet setTargetLanguagesByBundle(
Map<String, Set<String>> targetLanguagesByBundle) {
// TODO - check empty map?
if (targetLanguagesByBundle == null) {
throw new NullPointerException("The input map is null.");
}
this.targetLanguagesByBundle = targetLanguagesByBundle;
return this;
} | [
"public",
"TranslationRequestDataChangeSet",
"setTargetLanguagesByBundle",
"(",
"Map",
"<",
"String",
",",
"Set",
"<",
"String",
">",
">",
"targetLanguagesByBundle",
")",
"{",
"// TODO - check empty map?",
"if",
"(",
"targetLanguagesByBundle",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"The input map is null.\"",
")",
";",
"}",
"this",
".",
"targetLanguagesByBundle",
"=",
"targetLanguagesByBundle",
";",
"return",
"this",
";",
"}"
] | Sets a map containing target languages indexed by bundle IDs. This method adopts
the input map without creating a safe copy.
@param targetLanguagesByBundle A map containing target languages indexed by
bundle IDs.
@return This object.
@throws NullPointerException When the input <code>targetLanguagesByBundle</code> is null. | [
"Sets",
"a",
"map",
"containing",
"target",
"languages",
"indexed",
"by",
"bundle",
"IDs",
".",
"This",
"method",
"adopts",
"the",
"input",
"map",
"without",
"creating",
"a",
"safe",
"copy",
"."
] | b015a081d7a7313bc48c448087fbc07bce860427 | https://github.com/IBM-Cloud/gp-java-client/blob/b015a081d7a7313bc48c448087fbc07bce860427/src/main/java/com/ibm/g11n/pipeline/client/TranslationRequestDataChangeSet.java#L57-L65 |
143,275 | Chorus-bdd/Chorus | interpreter/chorus-pathscanner/src/main/java/org/chorusbdd/chorus/pathscanner/FilePathScanner.java | FilePathScanner.addFeaturesRecursively | private void addFeaturesRecursively(File directory, List<File> targetList, FileFilter fileFilter) {
File[] files = directory.listFiles();
//sort the files here, since otherwise we get differences in execution order between 'nix, case sensitive
//and win, case insensitive, toys 'r us
Arrays.sort(files, new Comparator<File>() {
public int compare(File o1, File o2) {
return o1.getName().compareTo(o2.getName());
}
});
for (File f : files) {
if (f.isDirectory()) {
addFeaturesRecursively(f, targetList, fileFilter);
} else if (fileFilter.accept(f)) {
targetList.add(f);
}
}
} | java | private void addFeaturesRecursively(File directory, List<File> targetList, FileFilter fileFilter) {
File[] files = directory.listFiles();
//sort the files here, since otherwise we get differences in execution order between 'nix, case sensitive
//and win, case insensitive, toys 'r us
Arrays.sort(files, new Comparator<File>() {
public int compare(File o1, File o2) {
return o1.getName().compareTo(o2.getName());
}
});
for (File f : files) {
if (f.isDirectory()) {
addFeaturesRecursively(f, targetList, fileFilter);
} else if (fileFilter.accept(f)) {
targetList.add(f);
}
}
} | [
"private",
"void",
"addFeaturesRecursively",
"(",
"File",
"directory",
",",
"List",
"<",
"File",
">",
"targetList",
",",
"FileFilter",
"fileFilter",
")",
"{",
"File",
"[",
"]",
"files",
"=",
"directory",
".",
"listFiles",
"(",
")",
";",
"//sort the files here, since otherwise we get differences in execution order between 'nix, case sensitive",
"//and win, case insensitive, toys 'r us",
"Arrays",
".",
"sort",
"(",
"files",
",",
"new",
"Comparator",
"<",
"File",
">",
"(",
")",
"{",
"public",
"int",
"compare",
"(",
"File",
"o1",
",",
"File",
"o2",
")",
"{",
"return",
"o1",
".",
"getName",
"(",
")",
".",
"compareTo",
"(",
"o2",
".",
"getName",
"(",
")",
")",
";",
"}",
"}",
")",
";",
"for",
"(",
"File",
"f",
":",
"files",
")",
"{",
"if",
"(",
"f",
".",
"isDirectory",
"(",
")",
")",
"{",
"addFeaturesRecursively",
"(",
"f",
",",
"targetList",
",",
"fileFilter",
")",
";",
"}",
"else",
"if",
"(",
"fileFilter",
".",
"accept",
"(",
"f",
")",
")",
"{",
"targetList",
".",
"add",
"(",
"f",
")",
";",
"}",
"}",
"}"
] | Recursively scans subdirectories, adding all feature files to the targetList. | [
"Recursively",
"scans",
"subdirectories",
"adding",
"all",
"feature",
"files",
"to",
"the",
"targetList",
"."
] | 1eea7ca858876bce821bb49b43fd5b6ba1737997 | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-pathscanner/src/main/java/org/chorusbdd/chorus/pathscanner/FilePathScanner.java#L69-L87 |
143,276 | Chorus-bdd/Chorus | interpreter/chorus-util/src/main/java/org/chorusbdd/chorus/util/PolledAssertion.java | PolledAssertion.await | public int await(TimeUnit unit, long length) {
int pollPeriodMillis = getPollPeriodMillis();
long startTime = System.currentTimeMillis();
long expireTime = startTime + unit.toMillis(length);
int iteration = 0;
boolean success = false;
while(true) {
iteration++;
try {
validate();
//no assertion errors? condition passes, we can continue
success = true;
break;
} catch (Throwable r) {
if ( r instanceof FailImmediatelyException) {
throw (FailImmediatelyException)r;
} else if ( r.getCause() instanceof FailImmediatelyException) {
throw (FailImmediatelyException)r.getCause();
}
//ignore failures up until the last check
}
sleepUntil(startTime + (pollPeriodMillis * iteration));
if ( System.currentTimeMillis() >= expireTime) {
break;
}
}
if ( ! success ) {
try {
validate(); //this time allow any assertion errors to propagate
} catch (Throwable e) {
propagateAsError(e);
}
}
return iteration;
} | java | public int await(TimeUnit unit, long length) {
int pollPeriodMillis = getPollPeriodMillis();
long startTime = System.currentTimeMillis();
long expireTime = startTime + unit.toMillis(length);
int iteration = 0;
boolean success = false;
while(true) {
iteration++;
try {
validate();
//no assertion errors? condition passes, we can continue
success = true;
break;
} catch (Throwable r) {
if ( r instanceof FailImmediatelyException) {
throw (FailImmediatelyException)r;
} else if ( r.getCause() instanceof FailImmediatelyException) {
throw (FailImmediatelyException)r.getCause();
}
//ignore failures up until the last check
}
sleepUntil(startTime + (pollPeriodMillis * iteration));
if ( System.currentTimeMillis() >= expireTime) {
break;
}
}
if ( ! success ) {
try {
validate(); //this time allow any assertion errors to propagate
} catch (Throwable e) {
propagateAsError(e);
}
}
return iteration;
} | [
"public",
"int",
"await",
"(",
"TimeUnit",
"unit",
",",
"long",
"length",
")",
"{",
"int",
"pollPeriodMillis",
"=",
"getPollPeriodMillis",
"(",
")",
";",
"long",
"startTime",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"long",
"expireTime",
"=",
"startTime",
"+",
"unit",
".",
"toMillis",
"(",
"length",
")",
";",
"int",
"iteration",
"=",
"0",
";",
"boolean",
"success",
"=",
"false",
";",
"while",
"(",
"true",
")",
"{",
"iteration",
"++",
";",
"try",
"{",
"validate",
"(",
")",
";",
"//no assertion errors? condition passes, we can continue",
"success",
"=",
"true",
";",
"break",
";",
"}",
"catch",
"(",
"Throwable",
"r",
")",
"{",
"if",
"(",
"r",
"instanceof",
"FailImmediatelyException",
")",
"{",
"throw",
"(",
"FailImmediatelyException",
")",
"r",
";",
"}",
"else",
"if",
"(",
"r",
".",
"getCause",
"(",
")",
"instanceof",
"FailImmediatelyException",
")",
"{",
"throw",
"(",
"FailImmediatelyException",
")",
"r",
".",
"getCause",
"(",
")",
";",
"}",
"//ignore failures up until the last check",
"}",
"sleepUntil",
"(",
"startTime",
"+",
"(",
"pollPeriodMillis",
"*",
"iteration",
")",
")",
";",
"if",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
">=",
"expireTime",
")",
"{",
"break",
";",
"}",
"}",
"if",
"(",
"!",
"success",
")",
"{",
"try",
"{",
"validate",
"(",
")",
";",
"//this time allow any assertion errors to propagate",
"}",
"catch",
"(",
"Throwable",
"e",
")",
"{",
"propagateAsError",
"(",
"e",
")",
";",
"}",
"}",
"return",
"iteration",
";",
"}"
] | Wait for the assertions to pass for the specified time limit
Validation will be attempted and errors handled silently until the timeout period expires after which assertion
errors will be propagated and will cause test failure
@return number of times validation was retried if it failed the first time | [
"Wait",
"for",
"the",
"assertions",
"to",
"pass",
"for",
"the",
"specified",
"time",
"limit"
] | 1eea7ca858876bce821bb49b43fd5b6ba1737997 | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-util/src/main/java/org/chorusbdd/chorus/util/PolledAssertion.java#L114-L154 |
143,277 | Chorus-bdd/Chorus | interpreter/chorus-util/src/main/java/org/chorusbdd/chorus/util/PolledAssertion.java | PolledAssertion.check | public int check(TimeUnit timeUnit, long count) {
int pollPeriodMillis = getPollPeriodMillis();
long startTime = System.currentTimeMillis();
long expireTime = startTime + timeUnit.toMillis(count);
int iteration = 0;
while(true) {
iteration++;
try {
validate();
} catch (Throwable t) {
propagateAsError(t);
}
sleepUntil(startTime + (pollPeriodMillis * iteration));
if ( System.currentTimeMillis() >= expireTime) {
break;
}
}
return iteration;
} | java | public int check(TimeUnit timeUnit, long count) {
int pollPeriodMillis = getPollPeriodMillis();
long startTime = System.currentTimeMillis();
long expireTime = startTime + timeUnit.toMillis(count);
int iteration = 0;
while(true) {
iteration++;
try {
validate();
} catch (Throwable t) {
propagateAsError(t);
}
sleepUntil(startTime + (pollPeriodMillis * iteration));
if ( System.currentTimeMillis() >= expireTime) {
break;
}
}
return iteration;
} | [
"public",
"int",
"check",
"(",
"TimeUnit",
"timeUnit",
",",
"long",
"count",
")",
"{",
"int",
"pollPeriodMillis",
"=",
"getPollPeriodMillis",
"(",
")",
";",
"long",
"startTime",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"long",
"expireTime",
"=",
"startTime",
"+",
"timeUnit",
".",
"toMillis",
"(",
"count",
")",
";",
"int",
"iteration",
"=",
"0",
";",
"while",
"(",
"true",
")",
"{",
"iteration",
"++",
";",
"try",
"{",
"validate",
"(",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"propagateAsError",
"(",
"t",
")",
";",
"}",
"sleepUntil",
"(",
"startTime",
"+",
"(",
"pollPeriodMillis",
"*",
"iteration",
")",
")",
";",
"if",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
">=",
"expireTime",
")",
"{",
"break",
";",
"}",
"}",
"return",
"iteration",
";",
"}"
] | check that the assertions pass for the whole duration of the period specified
@return number of times validation was retried if it failed the first time | [
"check",
"that",
"the",
"assertions",
"pass",
"for",
"the",
"whole",
"duration",
"of",
"the",
"period",
"specified"
] | 1eea7ca858876bce821bb49b43fd5b6ba1737997 | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-util/src/main/java/org/chorusbdd/chorus/util/PolledAssertion.java#L173-L195 |
143,278 | Chorus-bdd/Chorus | interpreter/chorus-util/src/main/java/org/chorusbdd/chorus/util/PolledAssertion.java | PolledAssertion.propagateAsError | private void propagateAsError(Throwable t) {
if ( t instanceof InvocationTargetException) {
t = t.getCause();
}
if ( Error.class.isAssignableFrom(t.getClass())) {
throw (Error)t;
}
throw new PolledAssertionError(t);
} | java | private void propagateAsError(Throwable t) {
if ( t instanceof InvocationTargetException) {
t = t.getCause();
}
if ( Error.class.isAssignableFrom(t.getClass())) {
throw (Error)t;
}
throw new PolledAssertionError(t);
} | [
"private",
"void",
"propagateAsError",
"(",
"Throwable",
"t",
")",
"{",
"if",
"(",
"t",
"instanceof",
"InvocationTargetException",
")",
"{",
"t",
"=",
"t",
".",
"getCause",
"(",
")",
";",
"}",
"if",
"(",
"Error",
".",
"class",
".",
"isAssignableFrom",
"(",
"t",
".",
"getClass",
"(",
")",
")",
")",
"{",
"throw",
"(",
"Error",
")",
"t",
";",
"}",
"throw",
"new",
"PolledAssertionError",
"(",
"t",
")",
";",
"}"
] | Otherwise wrap with a PolledAssertionError and throw | [
"Otherwise",
"wrap",
"with",
"a",
"PolledAssertionError",
"and",
"throw"
] | 1eea7ca858876bce821bb49b43fd5b6ba1737997 | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-util/src/main/java/org/chorusbdd/chorus/util/PolledAssertion.java#L211-L219 |
143,279 | avast/syringe | src/main/java/com/avast/syringe/config/internal/ConfigClassAnalyzer.java | ConfigClassAnalyzer.stripDeep | public static Object stripDeep(Object decorated) {
Object stripped = stripShallow(decorated);
if (stripped == decorated) {
return stripped;
} else {
return stripDeep(stripped);
}
} | java | public static Object stripDeep(Object decorated) {
Object stripped = stripShallow(decorated);
if (stripped == decorated) {
return stripped;
} else {
return stripDeep(stripped);
}
} | [
"public",
"static",
"Object",
"stripDeep",
"(",
"Object",
"decorated",
")",
"{",
"Object",
"stripped",
"=",
"stripShallow",
"(",
"decorated",
")",
";",
"if",
"(",
"stripped",
"==",
"decorated",
")",
"{",
"return",
"stripped",
";",
"}",
"else",
"{",
"return",
"stripDeep",
"(",
"stripped",
")",
";",
"}",
"}"
] | Strips all decorations from the decorated object.
@param decorated the decorated object
@return the stripped object | [
"Strips",
"all",
"decorations",
"from",
"the",
"decorated",
"object",
"."
] | 762da5e50776f2bc028e0cf17eac9bd09b5b6aab | https://github.com/avast/syringe/blob/762da5e50776f2bc028e0cf17eac9bd09b5b6aab/src/main/java/com/avast/syringe/config/internal/ConfigClassAnalyzer.java#L89-L96 |
143,280 | Labs64/swid-generator | src/main/java/com/labs64/utils/swid/support/JAXBUtils.java | JAXBUtils.writeObject | public static <T> void writeObject(final T entity, final Object destination, final String comment) {
try {
JAXBContext jaxbContext;
if (entity instanceof JAXBElement) {
jaxbContext = JAXBContext.newInstance(((JAXBElement) entity).getValue().getClass());
} else {
jaxbContext = JAXBContext.newInstance(entity.getClass());
}
Marshaller marshaller = jaxbContext.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
if (StringUtils.isNotBlank(comment)) {
marshaller.setProperty("com.sun.xml.bind.xmlHeaders", comment);
}
if (destination instanceof java.io.OutputStream) {
marshaller.marshal(entity, (OutputStream) destination);
} else if (destination instanceof java.io.File) {
marshaller.marshal(entity, (java.io.File) destination);
} else if (destination instanceof java.io.Writer) {
marshaller.marshal(entity, (java.io.Writer) destination);
} else {
throw new IllegalArgumentException("Unsupported destination.");
}
} catch (final JAXBException e) {
throw new SwidException("Cannot write object.", e);
}
} | java | public static <T> void writeObject(final T entity, final Object destination, final String comment) {
try {
JAXBContext jaxbContext;
if (entity instanceof JAXBElement) {
jaxbContext = JAXBContext.newInstance(((JAXBElement) entity).getValue().getClass());
} else {
jaxbContext = JAXBContext.newInstance(entity.getClass());
}
Marshaller marshaller = jaxbContext.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
if (StringUtils.isNotBlank(comment)) {
marshaller.setProperty("com.sun.xml.bind.xmlHeaders", comment);
}
if (destination instanceof java.io.OutputStream) {
marshaller.marshal(entity, (OutputStream) destination);
} else if (destination instanceof java.io.File) {
marshaller.marshal(entity, (java.io.File) destination);
} else if (destination instanceof java.io.Writer) {
marshaller.marshal(entity, (java.io.Writer) destination);
} else {
throw new IllegalArgumentException("Unsupported destination.");
}
} catch (final JAXBException e) {
throw new SwidException("Cannot write object.", e);
}
} | [
"public",
"static",
"<",
"T",
">",
"void",
"writeObject",
"(",
"final",
"T",
"entity",
",",
"final",
"Object",
"destination",
",",
"final",
"String",
"comment",
")",
"{",
"try",
"{",
"JAXBContext",
"jaxbContext",
";",
"if",
"(",
"entity",
"instanceof",
"JAXBElement",
")",
"{",
"jaxbContext",
"=",
"JAXBContext",
".",
"newInstance",
"(",
"(",
"(",
"JAXBElement",
")",
"entity",
")",
".",
"getValue",
"(",
")",
".",
"getClass",
"(",
")",
")",
";",
"}",
"else",
"{",
"jaxbContext",
"=",
"JAXBContext",
".",
"newInstance",
"(",
"entity",
".",
"getClass",
"(",
")",
")",
";",
"}",
"Marshaller",
"marshaller",
"=",
"jaxbContext",
".",
"createMarshaller",
"(",
")",
";",
"marshaller",
".",
"setProperty",
"(",
"Marshaller",
".",
"JAXB_FORMATTED_OUTPUT",
",",
"true",
")",
";",
"if",
"(",
"StringUtils",
".",
"isNotBlank",
"(",
"comment",
")",
")",
"{",
"marshaller",
".",
"setProperty",
"(",
"\"com.sun.xml.bind.xmlHeaders\"",
",",
"comment",
")",
";",
"}",
"if",
"(",
"destination",
"instanceof",
"java",
".",
"io",
".",
"OutputStream",
")",
"{",
"marshaller",
".",
"marshal",
"(",
"entity",
",",
"(",
"OutputStream",
")",
"destination",
")",
";",
"}",
"else",
"if",
"(",
"destination",
"instanceof",
"java",
".",
"io",
".",
"File",
")",
"{",
"marshaller",
".",
"marshal",
"(",
"entity",
",",
"(",
"java",
".",
"io",
".",
"File",
")",
"destination",
")",
";",
"}",
"else",
"if",
"(",
"destination",
"instanceof",
"java",
".",
"io",
".",
"Writer",
")",
"{",
"marshaller",
".",
"marshal",
"(",
"entity",
",",
"(",
"java",
".",
"io",
".",
"Writer",
")",
"destination",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Unsupported destination.\"",
")",
";",
"}",
"}",
"catch",
"(",
"final",
"JAXBException",
"e",
")",
"{",
"throw",
"new",
"SwidException",
"(",
"\"Cannot write object.\"",
",",
"e",
")",
";",
"}",
"}"
] | Write XML entity to the given destination.
@param entity
XML entity
@param destination
destination to write to. Supported destinations: {@link java.io.OutputStream}, {@link java.io.File},
{@link java.io.Writer}
@param comment
optional comment which will be added at the begining of the generated XML
@throws IllegalArgumentException
@throws SwidException
@param <T>
JAXB entity | [
"Write",
"XML",
"entity",
"to",
"the",
"given",
"destination",
"."
] | cf78d2469469a09701bce7c5f966ac6de2b7c613 | https://github.com/Labs64/swid-generator/blob/cf78d2469469a09701bce7c5f966ac6de2b7c613/src/main/java/com/labs64/utils/swid/support/JAXBUtils.java#L76-L104 |
143,281 | Labs64/swid-generator | src/main/java/com/labs64/utils/swid/support/JAXBUtils.java | JAXBUtils.writeObjectToString | public static <T> String writeObjectToString(final T entity) {
ByteArrayOutputStream destination = new ByteArrayOutputStream();
writeObject(entity, destination, null);
return destination.toString();
} | java | public static <T> String writeObjectToString(final T entity) {
ByteArrayOutputStream destination = new ByteArrayOutputStream();
writeObject(entity, destination, null);
return destination.toString();
} | [
"public",
"static",
"<",
"T",
">",
"String",
"writeObjectToString",
"(",
"final",
"T",
"entity",
")",
"{",
"ByteArrayOutputStream",
"destination",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"writeObject",
"(",
"entity",
",",
"destination",
",",
"null",
")",
";",
"return",
"destination",
".",
"toString",
"(",
")",
";",
"}"
] | Write XML entity to the string.
@param entity
XML entity
@throws IllegalArgumentException
@throws SwidException
@param <T>
JAXB entity | [
"Write",
"XML",
"entity",
"to",
"the",
"string",
"."
] | cf78d2469469a09701bce7c5f966ac6de2b7c613 | https://github.com/Labs64/swid-generator/blob/cf78d2469469a09701bce7c5f966ac6de2b7c613/src/main/java/com/labs64/utils/swid/support/JAXBUtils.java#L116-L120 |
143,282 | Labs64/swid-generator | src/main/java/com/labs64/utils/swid/support/SwidUtils.java | SwidUtils.generateRegId | public static String generateRegId(final String domainCreationDate, final String reverseDomainName) {
return generateRegId(domainCreationDate, reverseDomainName, null);
} | java | public static String generateRegId(final String domainCreationDate, final String reverseDomainName) {
return generateRegId(domainCreationDate, reverseDomainName, null);
} | [
"public",
"static",
"String",
"generateRegId",
"(",
"final",
"String",
"domainCreationDate",
",",
"final",
"String",
"reverseDomainName",
")",
"{",
"return",
"generateRegId",
"(",
"domainCreationDate",
",",
"reverseDomainName",
",",
"null",
")",
";",
"}"
] | Generate RegId.
@param domainCreationDate
the date at which the entity creating the regid first owned the domain that is also used in the regid
in year-month format; e.g. 2010-04
@param reverseDomainName
the domain of the entity, in reverse order; e.g. com.labs64
@return generated RegId | [
"Generate",
"RegId",
"."
] | cf78d2469469a09701bce7c5f966ac6de2b7c613 | https://github.com/Labs64/swid-generator/blob/cf78d2469469a09701bce7c5f966ac6de2b7c613/src/main/java/com/labs64/utils/swid/support/SwidUtils.java#L59-L61 |
143,283 | Labs64/swid-generator | src/main/java/com/labs64/utils/swid/support/SwidUtils.java | SwidUtils.generateRegId | public static String generateRegId(final String domainCreationDate, final String reverseDomainName,
final String suffix) {
if (StringUtils.isBlank(domainCreationDate)) {
throw new SwidException("domainCreationDate isn't defined");
}
if (StringUtils.isBlank(reverseDomainName)) {
throw new SwidException("reverseDomainName isn't defined");
}
StringBuilder res = new StringBuilder()
.append("regid")
.append(DELIMITER)
.append(domainCreationDate)
.append(DELIMITER)
.append(reverseDomainName);
if (StringUtils.isNotBlank(suffix)) {
res.append(",").append(suffix);
}
return res.toString();
} | java | public static String generateRegId(final String domainCreationDate, final String reverseDomainName,
final String suffix) {
if (StringUtils.isBlank(domainCreationDate)) {
throw new SwidException("domainCreationDate isn't defined");
}
if (StringUtils.isBlank(reverseDomainName)) {
throw new SwidException("reverseDomainName isn't defined");
}
StringBuilder res = new StringBuilder()
.append("regid")
.append(DELIMITER)
.append(domainCreationDate)
.append(DELIMITER)
.append(reverseDomainName);
if (StringUtils.isNotBlank(suffix)) {
res.append(",").append(suffix);
}
return res.toString();
} | [
"public",
"static",
"String",
"generateRegId",
"(",
"final",
"String",
"domainCreationDate",
",",
"final",
"String",
"reverseDomainName",
",",
"final",
"String",
"suffix",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"domainCreationDate",
")",
")",
"{",
"throw",
"new",
"SwidException",
"(",
"\"domainCreationDate isn't defined\"",
")",
";",
"}",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"reverseDomainName",
")",
")",
"{",
"throw",
"new",
"SwidException",
"(",
"\"reverseDomainName isn't defined\"",
")",
";",
"}",
"StringBuilder",
"res",
"=",
"new",
"StringBuilder",
"(",
")",
".",
"append",
"(",
"\"regid\"",
")",
".",
"append",
"(",
"DELIMITER",
")",
".",
"append",
"(",
"domainCreationDate",
")",
".",
"append",
"(",
"DELIMITER",
")",
".",
"append",
"(",
"reverseDomainName",
")",
";",
"if",
"(",
"StringUtils",
".",
"isNotBlank",
"(",
"suffix",
")",
")",
"{",
"res",
".",
"append",
"(",
"\",\"",
")",
".",
"append",
"(",
"suffix",
")",
";",
"}",
"return",
"res",
".",
"toString",
"(",
")",
";",
"}"
] | Generate RegId with additional suffix.
@param domainCreationDate
the date at which the entity creating the regid first owned the domain that is also used in the regid
in year-month format; e.g. 2010-04
@param reverseDomainName
the domain of the entity, in reverse order; e.g. com.labs64
@param suffix
additional sub-entities that are added as a suffix to the RegId
@return generated RegId | [
"Generate",
"RegId",
"with",
"additional",
"suffix",
"."
] | cf78d2469469a09701bce7c5f966ac6de2b7c613 | https://github.com/Labs64/swid-generator/blob/cf78d2469469a09701bce7c5f966ac6de2b7c613/src/main/java/com/labs64/utils/swid/support/SwidUtils.java#L75-L95 |
143,284 | Labs64/swid-generator | src/main/java/com/labs64/utils/swid/processor/DefaultSwidProcessor.java | DefaultSwidProcessor.setGenerator | public void setGenerator(final IdGenerator generator) {
if (generator != null) {
this.idGenerator = generator;
swidTag.setId(idGenerator.nextId());
}
} | java | public void setGenerator(final IdGenerator generator) {
if (generator != null) {
this.idGenerator = generator;
swidTag.setId(idGenerator.nextId());
}
} | [
"public",
"void",
"setGenerator",
"(",
"final",
"IdGenerator",
"generator",
")",
"{",
"if",
"(",
"generator",
"!=",
"null",
")",
"{",
"this",
".",
"idGenerator",
"=",
"generator",
";",
"swidTag",
".",
"setId",
"(",
"idGenerator",
".",
"nextId",
"(",
")",
")",
";",
"}",
"}"
] | Set element identifier generator.
@param generator
element identifier generator | [
"Set",
"element",
"identifier",
"generator",
"."
] | cf78d2469469a09701bce7c5f966ac6de2b7c613 | https://github.com/Labs64/swid-generator/blob/cf78d2469469a09701bce7c5f966ac6de2b7c613/src/main/java/com/labs64/utils/swid/processor/DefaultSwidProcessor.java#L53-L58 |
143,285 | Labs64/swid-generator | src/main/java/com/labs64/utils/swid/processor/DefaultSwidProcessor.java | DefaultSwidProcessor.validate | public void validate() {
if (swidTag.getEntitlementRequiredIndicator() == null) {
throw new SwidException("'entitlement_required_indicator' is not set");
}
if (swidTag.getProductTitle() == null) {
throw new SwidException("'product_title' is not set");
}
if (swidTag.getProductVersion() == null) {
throw new SwidException("'product_version' is not set");
}
if (swidTag.getSoftwareCreator() == null) {
throw new SwidException("'software_creator' is not set");
}
if (swidTag.getSoftwareLicensor() == null) {
throw new SwidException("'software_licensor' is not set");
}
if (swidTag.getSoftwareId() == null) {
throw new SwidException("'software_id' is not set");
}
if (swidTag.getTagCreator() == null) {
throw new SwidException("'tag_creator' is not set");
}
} | java | public void validate() {
if (swidTag.getEntitlementRequiredIndicator() == null) {
throw new SwidException("'entitlement_required_indicator' is not set");
}
if (swidTag.getProductTitle() == null) {
throw new SwidException("'product_title' is not set");
}
if (swidTag.getProductVersion() == null) {
throw new SwidException("'product_version' is not set");
}
if (swidTag.getSoftwareCreator() == null) {
throw new SwidException("'software_creator' is not set");
}
if (swidTag.getSoftwareLicensor() == null) {
throw new SwidException("'software_licensor' is not set");
}
if (swidTag.getSoftwareId() == null) {
throw new SwidException("'software_id' is not set");
}
if (swidTag.getTagCreator() == null) {
throw new SwidException("'tag_creator' is not set");
}
} | [
"public",
"void",
"validate",
"(",
")",
"{",
"if",
"(",
"swidTag",
".",
"getEntitlementRequiredIndicator",
"(",
")",
"==",
"null",
")",
"{",
"throw",
"new",
"SwidException",
"(",
"\"'entitlement_required_indicator' is not set\"",
")",
";",
"}",
"if",
"(",
"swidTag",
".",
"getProductTitle",
"(",
")",
"==",
"null",
")",
"{",
"throw",
"new",
"SwidException",
"(",
"\"'product_title' is not set\"",
")",
";",
"}",
"if",
"(",
"swidTag",
".",
"getProductVersion",
"(",
")",
"==",
"null",
")",
"{",
"throw",
"new",
"SwidException",
"(",
"\"'product_version' is not set\"",
")",
";",
"}",
"if",
"(",
"swidTag",
".",
"getSoftwareCreator",
"(",
")",
"==",
"null",
")",
"{",
"throw",
"new",
"SwidException",
"(",
"\"'software_creator' is not set\"",
")",
";",
"}",
"if",
"(",
"swidTag",
".",
"getSoftwareLicensor",
"(",
")",
"==",
"null",
")",
"{",
"throw",
"new",
"SwidException",
"(",
"\"'software_licensor' is not set\"",
")",
";",
"}",
"if",
"(",
"swidTag",
".",
"getSoftwareId",
"(",
")",
"==",
"null",
")",
"{",
"throw",
"new",
"SwidException",
"(",
"\"'software_id' is not set\"",
")",
";",
"}",
"if",
"(",
"swidTag",
".",
"getTagCreator",
"(",
")",
"==",
"null",
")",
"{",
"throw",
"new",
"SwidException",
"(",
"\"'tag_creator' is not set\"",
")",
";",
"}",
"}"
] | Validate whether processor configuration is valid.
@throws com.labs64.utils.swid.exception.SwidException
in case of invalid processor configuration | [
"Validate",
"whether",
"processor",
"configuration",
"is",
"valid",
"."
] | cf78d2469469a09701bce7c5f966ac6de2b7c613 | https://github.com/Labs64/swid-generator/blob/cf78d2469469a09701bce7c5f966ac6de2b7c613/src/main/java/com/labs64/utils/swid/processor/DefaultSwidProcessor.java#L221-L243 |
143,286 | Labs64/swid-generator | src/main/java/com/labs64/utils/swid/io/SwidWriter.java | SwidWriter.write | public void write(final SoftwareIdentificationTagComplexType swidTag, final java.io.OutputStream output) {
JAXBUtils.writeObject(objectFactory.createSoftwareIdentificationTag(swidTag), output, getComment());
} | java | public void write(final SoftwareIdentificationTagComplexType swidTag, final java.io.OutputStream output) {
JAXBUtils.writeObject(objectFactory.createSoftwareIdentificationTag(swidTag), output, getComment());
} | [
"public",
"void",
"write",
"(",
"final",
"SoftwareIdentificationTagComplexType",
"swidTag",
",",
"final",
"java",
".",
"io",
".",
"OutputStream",
"output",
")",
"{",
"JAXBUtils",
".",
"writeObject",
"(",
"objectFactory",
".",
"createSoftwareIdentificationTag",
"(",
"swidTag",
")",
",",
"output",
",",
"getComment",
"(",
")",
")",
";",
"}"
] | Write the object into an output stream.
@param swidTag
The SWID Tag object to be written.
@param output
SWID Tag will be added to this stream.
@throws com.labs64.utils.swid.exception.SwidException
If any unexpected problem occurs during the writing.
@throws IllegalArgumentException
If any of the method parameters are null | [
"Write",
"the",
"object",
"into",
"an",
"output",
"stream",
"."
] | cf78d2469469a09701bce7c5f966ac6de2b7c613 | https://github.com/Labs64/swid-generator/blob/cf78d2469469a09701bce7c5f966ac6de2b7c613/src/main/java/com/labs64/utils/swid/io/SwidWriter.java#L44-L46 |
143,287 | Labs64/swid-generator | src/main/java/com/labs64/utils/swid/io/SwidWriter.java | SwidWriter.write | public void write(final SoftwareIdentificationTagComplexType swidTag, final File file) {
JAXBUtils.writeObject(objectFactory.createSoftwareIdentificationTag(swidTag), file, getComment());
} | java | public void write(final SoftwareIdentificationTagComplexType swidTag, final File file) {
JAXBUtils.writeObject(objectFactory.createSoftwareIdentificationTag(swidTag), file, getComment());
} | [
"public",
"void",
"write",
"(",
"final",
"SoftwareIdentificationTagComplexType",
"swidTag",
",",
"final",
"File",
"file",
")",
"{",
"JAXBUtils",
".",
"writeObject",
"(",
"objectFactory",
".",
"createSoftwareIdentificationTag",
"(",
"swidTag",
")",
",",
"file",
",",
"getComment",
"(",
")",
")",
";",
"}"
] | Write the object into a file.
@param swidTag
The root of content tree to be written.
@param file
File to be written. If this file already exists, it will be overwritten.
@throws com.labs64.utils.swid.exception.SwidException
If any unexpected problem occurs during the writing.
@throws IllegalArgumentException
If any of the method parameters are null | [
"Write",
"the",
"object",
"into",
"a",
"file",
"."
] | cf78d2469469a09701bce7c5f966ac6de2b7c613 | https://github.com/Labs64/swid-generator/blob/cf78d2469469a09701bce7c5f966ac6de2b7c613/src/main/java/com/labs64/utils/swid/io/SwidWriter.java#L61-L63 |
143,288 | Labs64/swid-generator | src/main/java/com/labs64/utils/swid/io/SwidWriter.java | SwidWriter.write | public void write(final SoftwareIdentificationTagComplexType swidTag, final java.io.Writer writer) {
JAXBUtils.writeObject(objectFactory.createSoftwareIdentificationTag(swidTag), writer, getComment());
} | java | public void write(final SoftwareIdentificationTagComplexType swidTag, final java.io.Writer writer) {
JAXBUtils.writeObject(objectFactory.createSoftwareIdentificationTag(swidTag), writer, getComment());
} | [
"public",
"void",
"write",
"(",
"final",
"SoftwareIdentificationTagComplexType",
"swidTag",
",",
"final",
"java",
".",
"io",
".",
"Writer",
"writer",
")",
"{",
"JAXBUtils",
".",
"writeObject",
"(",
"objectFactory",
".",
"createSoftwareIdentificationTag",
"(",
"swidTag",
")",
",",
"writer",
",",
"getComment",
"(",
")",
")",
";",
"}"
] | Write the object into a Writer.
@param swidTag
The root of content tree to be written.
@param writer
SWID Tag will be sent to this writer.
@throws com.labs64.utils.swid.exception.SwidException
If any unexpected problem occurs during the writing.
@throws IllegalArgumentException
If any of the method parameters are null | [
"Write",
"the",
"object",
"into",
"a",
"Writer",
"."
] | cf78d2469469a09701bce7c5f966ac6de2b7c613 | https://github.com/Labs64/swid-generator/blob/cf78d2469469a09701bce7c5f966ac6de2b7c613/src/main/java/com/labs64/utils/swid/io/SwidWriter.java#L78-L80 |
143,289 | aerogear/aerogear-unifiedpush-java-client | src/main/java/org/jboss/aerogear/unifiedpush/utils/HttpRequestUtil.java | HttpRequestUtil.post | public static URLConnection post(String url, String encodedCredentials, String jsonPayloadObject, Charset charset,
ProxyConfig proxy, TrustStoreConfig customTrustStore, ConnectionSettings connectionSettings) throws Exception {
if (url == null || encodedCredentials == null || jsonPayloadObject == null) {
throw new IllegalArgumentException("arguments cannot be null");
}
byte[] bytes = jsonPayloadObject.getBytes(charset);
URLConnection conn = getConnection(url, proxy);
if (customTrustStore != null && customTrustStore.getTrustStorePath() != null && conn instanceof HttpsURLConnection) {
KeyStore trustStore = TrustStoreManagerService
.getInstance()
.getTrustStoreManager()
.loadTrustStore(customTrustStore.getTrustStorePath(), customTrustStore.getTrustStoreType(),
customTrustStore.getTrustStorePassword());
TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
tmf.init(trustStore);
SSLContext ctx = SSLContext.getInstance("TLS");
ctx.init(null, tmf.getTrustManagers(), null);
SSLSocketFactory sslSocketFactory = ctx.getSocketFactory();
((HttpsURLConnection) conn).setSSLSocketFactory(sslSocketFactory);
}
conn.setDoOutput(true);
conn.setUseCaches(false);
((HttpURLConnection) conn).setFixedLengthStreamingMode(bytes.length);
conn.setRequestProperty("Authorization", "Basic " + encodedCredentials);
conn.setRequestProperty("Content-Type", "application/json");
conn.setRequestProperty("Accept", "application/json, text/plain");
if(connectionSettings.getReadTimeout() != null) {
conn.setReadTimeout(connectionSettings.getReadTimeout());
}
if(connectionSettings.getConnectTimeout() != null) {
conn.setConnectTimeout(connectionSettings.getConnectTimeout());
}
// custom header, for UPS
conn.setRequestProperty("aerogear-sender", "AeroGear Java Sender");
((HttpURLConnection) conn).setRequestMethod("POST");
OutputStream out = null;
try {
out = conn.getOutputStream();
out.write(bytes);
} finally {
// in case something blows up, while writing
// the payload, we wanna close the stream:
if (out != null) {
out.close();
}
}
return conn;
} | java | public static URLConnection post(String url, String encodedCredentials, String jsonPayloadObject, Charset charset,
ProxyConfig proxy, TrustStoreConfig customTrustStore, ConnectionSettings connectionSettings) throws Exception {
if (url == null || encodedCredentials == null || jsonPayloadObject == null) {
throw new IllegalArgumentException("arguments cannot be null");
}
byte[] bytes = jsonPayloadObject.getBytes(charset);
URLConnection conn = getConnection(url, proxy);
if (customTrustStore != null && customTrustStore.getTrustStorePath() != null && conn instanceof HttpsURLConnection) {
KeyStore trustStore = TrustStoreManagerService
.getInstance()
.getTrustStoreManager()
.loadTrustStore(customTrustStore.getTrustStorePath(), customTrustStore.getTrustStoreType(),
customTrustStore.getTrustStorePassword());
TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
tmf.init(trustStore);
SSLContext ctx = SSLContext.getInstance("TLS");
ctx.init(null, tmf.getTrustManagers(), null);
SSLSocketFactory sslSocketFactory = ctx.getSocketFactory();
((HttpsURLConnection) conn).setSSLSocketFactory(sslSocketFactory);
}
conn.setDoOutput(true);
conn.setUseCaches(false);
((HttpURLConnection) conn).setFixedLengthStreamingMode(bytes.length);
conn.setRequestProperty("Authorization", "Basic " + encodedCredentials);
conn.setRequestProperty("Content-Type", "application/json");
conn.setRequestProperty("Accept", "application/json, text/plain");
if(connectionSettings.getReadTimeout() != null) {
conn.setReadTimeout(connectionSettings.getReadTimeout());
}
if(connectionSettings.getConnectTimeout() != null) {
conn.setConnectTimeout(connectionSettings.getConnectTimeout());
}
// custom header, for UPS
conn.setRequestProperty("aerogear-sender", "AeroGear Java Sender");
((HttpURLConnection) conn).setRequestMethod("POST");
OutputStream out = null;
try {
out = conn.getOutputStream();
out.write(bytes);
} finally {
// in case something blows up, while writing
// the payload, we wanna close the stream:
if (out != null) {
out.close();
}
}
return conn;
} | [
"public",
"static",
"URLConnection",
"post",
"(",
"String",
"url",
",",
"String",
"encodedCredentials",
",",
"String",
"jsonPayloadObject",
",",
"Charset",
"charset",
",",
"ProxyConfig",
"proxy",
",",
"TrustStoreConfig",
"customTrustStore",
",",
"ConnectionSettings",
"connectionSettings",
")",
"throws",
"Exception",
"{",
"if",
"(",
"url",
"==",
"null",
"||",
"encodedCredentials",
"==",
"null",
"||",
"jsonPayloadObject",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"arguments cannot be null\"",
")",
";",
"}",
"byte",
"[",
"]",
"bytes",
"=",
"jsonPayloadObject",
".",
"getBytes",
"(",
"charset",
")",
";",
"URLConnection",
"conn",
"=",
"getConnection",
"(",
"url",
",",
"proxy",
")",
";",
"if",
"(",
"customTrustStore",
"!=",
"null",
"&&",
"customTrustStore",
".",
"getTrustStorePath",
"(",
")",
"!=",
"null",
"&&",
"conn",
"instanceof",
"HttpsURLConnection",
")",
"{",
"KeyStore",
"trustStore",
"=",
"TrustStoreManagerService",
".",
"getInstance",
"(",
")",
".",
"getTrustStoreManager",
"(",
")",
".",
"loadTrustStore",
"(",
"customTrustStore",
".",
"getTrustStorePath",
"(",
")",
",",
"customTrustStore",
".",
"getTrustStoreType",
"(",
")",
",",
"customTrustStore",
".",
"getTrustStorePassword",
"(",
")",
")",
";",
"TrustManagerFactory",
"tmf",
"=",
"TrustManagerFactory",
".",
"getInstance",
"(",
"TrustManagerFactory",
".",
"getDefaultAlgorithm",
"(",
")",
")",
";",
"tmf",
".",
"init",
"(",
"trustStore",
")",
";",
"SSLContext",
"ctx",
"=",
"SSLContext",
".",
"getInstance",
"(",
"\"TLS\"",
")",
";",
"ctx",
".",
"init",
"(",
"null",
",",
"tmf",
".",
"getTrustManagers",
"(",
")",
",",
"null",
")",
";",
"SSLSocketFactory",
"sslSocketFactory",
"=",
"ctx",
".",
"getSocketFactory",
"(",
")",
";",
"(",
"(",
"HttpsURLConnection",
")",
"conn",
")",
".",
"setSSLSocketFactory",
"(",
"sslSocketFactory",
")",
";",
"}",
"conn",
".",
"setDoOutput",
"(",
"true",
")",
";",
"conn",
".",
"setUseCaches",
"(",
"false",
")",
";",
"(",
"(",
"HttpURLConnection",
")",
"conn",
")",
".",
"setFixedLengthStreamingMode",
"(",
"bytes",
".",
"length",
")",
";",
"conn",
".",
"setRequestProperty",
"(",
"\"Authorization\"",
",",
"\"Basic \"",
"+",
"encodedCredentials",
")",
";",
"conn",
".",
"setRequestProperty",
"(",
"\"Content-Type\"",
",",
"\"application/json\"",
")",
";",
"conn",
".",
"setRequestProperty",
"(",
"\"Accept\"",
",",
"\"application/json, text/plain\"",
")",
";",
"if",
"(",
"connectionSettings",
".",
"getReadTimeout",
"(",
")",
"!=",
"null",
")",
"{",
"conn",
".",
"setReadTimeout",
"(",
"connectionSettings",
".",
"getReadTimeout",
"(",
")",
")",
";",
"}",
"if",
"(",
"connectionSettings",
".",
"getConnectTimeout",
"(",
")",
"!=",
"null",
")",
"{",
"conn",
".",
"setConnectTimeout",
"(",
"connectionSettings",
".",
"getConnectTimeout",
"(",
")",
")",
";",
"}",
"// custom header, for UPS",
"conn",
".",
"setRequestProperty",
"(",
"\"aerogear-sender\"",
",",
"\"AeroGear Java Sender\"",
")",
";",
"(",
"(",
"HttpURLConnection",
")",
"conn",
")",
".",
"setRequestMethod",
"(",
"\"POST\"",
")",
";",
"OutputStream",
"out",
"=",
"null",
";",
"try",
"{",
"out",
"=",
"conn",
".",
"getOutputStream",
"(",
")",
";",
"out",
".",
"write",
"(",
"bytes",
")",
";",
"}",
"finally",
"{",
"// in case something blows up, while writing",
"// the payload, we wanna close the stream:",
"if",
"(",
"out",
"!=",
"null",
")",
"{",
"out",
".",
"close",
"(",
")",
";",
"}",
"}",
"return",
"conn",
";",
"}"
] | Returns URLConnection that 'posts' the given JSON to the given UnifiedPush Server URL.
@param url
@param encodedCredentials
@param jsonPayloadObject
@param charset
@param proxy
@param customTrustStore
@param connectionSettings
@return {@link URLConnection}
@throws Exception | [
"Returns",
"URLConnection",
"that",
"posts",
"the",
"given",
"JSON",
"to",
"the",
"given",
"UnifiedPush",
"Server",
"URL",
"."
] | 50705dc1b9e301a99fa73a9c5fd14e76c2a28c80 | https://github.com/aerogear/aerogear-unifiedpush-java-client/blob/50705dc1b9e301a99fa73a9c5fd14e76c2a28c80/src/main/java/org/jboss/aerogear/unifiedpush/utils/HttpRequestUtil.java#L99-L151 |
143,290 | aerogear/aerogear-unifiedpush-java-client | src/main/java/org/jboss/aerogear/unifiedpush/DefaultPushSender.java | DefaultPushSender.submitPayload | private void submitPayload(String url, HttpRequestUtil.ConnectionSettings connectionSettings, String jsonPayloadObject, String pushApplicationId, String masterSecret,
MessageResponseCallback callback, List<String> redirectUrls) {
if (redirectUrls.contains(url)) {
throw new PushSenderException("The site contains an infinite redirect loop! Duplicate url: " +
url);
} else {
redirectUrls.add(url);
}
HttpURLConnection httpURLConnection = null;
try {
final String credentials = pushApplicationId + ':' + masterSecret;
final String encoded = Base64.encodeBytes(credentials.getBytes(UTF_8));
// POST the payload to the UnifiedPush Server
httpURLConnection = (HttpURLConnection) HttpRequestUtil.post(url, encoded, jsonPayloadObject, UTF_8, proxy,
customTrustStore, connectionSettings);
final int statusCode = httpURLConnection.getResponseCode();
logger.log(Level.INFO, String.format("HTTP Response code from UnifiedPush Server: %s", statusCode));
// if we got a redirect, let's extract the 'Location' header from the response
// and submit the payload again
if (isRedirect(statusCode)) {
String redirectURL = httpURLConnection.getHeaderField("Location");
logger.log(Level.INFO, String.format("Performing redirect to '%s'", redirectURL));
// execute the 'redirect'
submitPayload(redirectURL, pushConfiguration.getConnectionSettings(), jsonPayloadObject, pushApplicationId, masterSecret, callback, redirectUrls);
} else if (statusCode >= 400) {
// treating any 400/500 error codes an an exception to a sending attempt:
logger.log(Level.SEVERE, "The Unified Push Server returned status code: " + statusCode);
throw new PushSenderHttpException(statusCode);
} else {
if (callback != null) {
callback.onComplete();
}
}
} catch (PushSenderHttpException pshe) {
throw pshe;
} catch (Exception e) {
logger.log(Level.INFO, "Error happening while trying to send the push delivery request", e);
throw new PushSenderException(e.getMessage(), e);
}
finally {
// tear down
if (httpURLConnection != null) {
httpURLConnection.disconnect();
}
}
} | java | private void submitPayload(String url, HttpRequestUtil.ConnectionSettings connectionSettings, String jsonPayloadObject, String pushApplicationId, String masterSecret,
MessageResponseCallback callback, List<String> redirectUrls) {
if (redirectUrls.contains(url)) {
throw new PushSenderException("The site contains an infinite redirect loop! Duplicate url: " +
url);
} else {
redirectUrls.add(url);
}
HttpURLConnection httpURLConnection = null;
try {
final String credentials = pushApplicationId + ':' + masterSecret;
final String encoded = Base64.encodeBytes(credentials.getBytes(UTF_8));
// POST the payload to the UnifiedPush Server
httpURLConnection = (HttpURLConnection) HttpRequestUtil.post(url, encoded, jsonPayloadObject, UTF_8, proxy,
customTrustStore, connectionSettings);
final int statusCode = httpURLConnection.getResponseCode();
logger.log(Level.INFO, String.format("HTTP Response code from UnifiedPush Server: %s", statusCode));
// if we got a redirect, let's extract the 'Location' header from the response
// and submit the payload again
if (isRedirect(statusCode)) {
String redirectURL = httpURLConnection.getHeaderField("Location");
logger.log(Level.INFO, String.format("Performing redirect to '%s'", redirectURL));
// execute the 'redirect'
submitPayload(redirectURL, pushConfiguration.getConnectionSettings(), jsonPayloadObject, pushApplicationId, masterSecret, callback, redirectUrls);
} else if (statusCode >= 400) {
// treating any 400/500 error codes an an exception to a sending attempt:
logger.log(Level.SEVERE, "The Unified Push Server returned status code: " + statusCode);
throw new PushSenderHttpException(statusCode);
} else {
if (callback != null) {
callback.onComplete();
}
}
} catch (PushSenderHttpException pshe) {
throw pshe;
} catch (Exception e) {
logger.log(Level.INFO, "Error happening while trying to send the push delivery request", e);
throw new PushSenderException(e.getMessage(), e);
}
finally {
// tear down
if (httpURLConnection != null) {
httpURLConnection.disconnect();
}
}
} | [
"private",
"void",
"submitPayload",
"(",
"String",
"url",
",",
"HttpRequestUtil",
".",
"ConnectionSettings",
"connectionSettings",
",",
"String",
"jsonPayloadObject",
",",
"String",
"pushApplicationId",
",",
"String",
"masterSecret",
",",
"MessageResponseCallback",
"callback",
",",
"List",
"<",
"String",
">",
"redirectUrls",
")",
"{",
"if",
"(",
"redirectUrls",
".",
"contains",
"(",
"url",
")",
")",
"{",
"throw",
"new",
"PushSenderException",
"(",
"\"The site contains an infinite redirect loop! Duplicate url: \"",
"+",
"url",
")",
";",
"}",
"else",
"{",
"redirectUrls",
".",
"add",
"(",
"url",
")",
";",
"}",
"HttpURLConnection",
"httpURLConnection",
"=",
"null",
";",
"try",
"{",
"final",
"String",
"credentials",
"=",
"pushApplicationId",
"+",
"'",
"'",
"+",
"masterSecret",
";",
"final",
"String",
"encoded",
"=",
"Base64",
".",
"encodeBytes",
"(",
"credentials",
".",
"getBytes",
"(",
"UTF_8",
")",
")",
";",
"// POST the payload to the UnifiedPush Server",
"httpURLConnection",
"=",
"(",
"HttpURLConnection",
")",
"HttpRequestUtil",
".",
"post",
"(",
"url",
",",
"encoded",
",",
"jsonPayloadObject",
",",
"UTF_8",
",",
"proxy",
",",
"customTrustStore",
",",
"connectionSettings",
")",
";",
"final",
"int",
"statusCode",
"=",
"httpURLConnection",
".",
"getResponseCode",
"(",
")",
";",
"logger",
".",
"log",
"(",
"Level",
".",
"INFO",
",",
"String",
".",
"format",
"(",
"\"HTTP Response code from UnifiedPush Server: %s\"",
",",
"statusCode",
")",
")",
";",
"// if we got a redirect, let's extract the 'Location' header from the response",
"// and submit the payload again",
"if",
"(",
"isRedirect",
"(",
"statusCode",
")",
")",
"{",
"String",
"redirectURL",
"=",
"httpURLConnection",
".",
"getHeaderField",
"(",
"\"Location\"",
")",
";",
"logger",
".",
"log",
"(",
"Level",
".",
"INFO",
",",
"String",
".",
"format",
"(",
"\"Performing redirect to '%s'\"",
",",
"redirectURL",
")",
")",
";",
"// execute the 'redirect'",
"submitPayload",
"(",
"redirectURL",
",",
"pushConfiguration",
".",
"getConnectionSettings",
"(",
")",
",",
"jsonPayloadObject",
",",
"pushApplicationId",
",",
"masterSecret",
",",
"callback",
",",
"redirectUrls",
")",
";",
"}",
"else",
"if",
"(",
"statusCode",
">=",
"400",
")",
"{",
"// treating any 400/500 error codes an an exception to a sending attempt:",
"logger",
".",
"log",
"(",
"Level",
".",
"SEVERE",
",",
"\"The Unified Push Server returned status code: \"",
"+",
"statusCode",
")",
";",
"throw",
"new",
"PushSenderHttpException",
"(",
"statusCode",
")",
";",
"}",
"else",
"{",
"if",
"(",
"callback",
"!=",
"null",
")",
"{",
"callback",
".",
"onComplete",
"(",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"PushSenderHttpException",
"pshe",
")",
"{",
"throw",
"pshe",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"logger",
".",
"log",
"(",
"Level",
".",
"INFO",
",",
"\"Error happening while trying to send the push delivery request\"",
",",
"e",
")",
";",
"throw",
"new",
"PushSenderException",
"(",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"finally",
"{",
"// tear down",
"if",
"(",
"httpURLConnection",
"!=",
"null",
")",
"{",
"httpURLConnection",
".",
"disconnect",
"(",
")",
";",
"}",
"}",
"}"
] | The actual method that does the real send and connection handling
@param url the URL to use for the HTTP POST request.
@param connectionSettings additional settings to use for the underlying {@link java.net.URLConnection}.
@param jsonPayloadObject the JSON payload of the POST request
@param pushApplicationId the registered applications identifier.
@param masterSecret the master secret for the push server.
@param callback the {@link org.jboss.aerogear.unifiedpush.message.MessageResponseCallback} that will be called once the POST request completes.
@param redirectUrls a list containing the previous redirectUrls, used to detect an infinite loop
@throws org.jboss.aerogear.unifiedpush.exception.PushSenderHttpException when delivering push message to Unified Push Server fails.
@throws org.jboss.aerogear.unifiedpush.exception.PushSenderException when generic error during sending occurs, such as an infinite redirect loop. | [
"The",
"actual",
"method",
"that",
"does",
"the",
"real",
"send",
"and",
"connection",
"handling"
] | 50705dc1b9e301a99fa73a9c5fd14e76c2a28c80 | https://github.com/aerogear/aerogear-unifiedpush-java-client/blob/50705dc1b9e301a99fa73a9c5fd14e76c2a28c80/src/main/java/org/jboss/aerogear/unifiedpush/DefaultPushSender.java#L281-L332 |
143,291 | gekoh/yaGen | lib/yagen-api/src/main/java/com/github/gekoh/yagen/api/AuditInfo.java | AuditInfo.prePersist | public void prePersist() {
this.createdAt = getCurrentTime();
if (this.createdBy == null || this.createdBy.trim().length()<1) {
this.createdBy = getUserName();
}
} | java | public void prePersist() {
this.createdAt = getCurrentTime();
if (this.createdBy == null || this.createdBy.trim().length()<1) {
this.createdBy = getUserName();
}
} | [
"public",
"void",
"prePersist",
"(",
")",
"{",
"this",
".",
"createdAt",
"=",
"getCurrentTime",
"(",
")",
";",
"if",
"(",
"this",
".",
"createdBy",
"==",
"null",
"||",
"this",
".",
"createdBy",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
"<",
"1",
")",
"{",
"this",
".",
"createdBy",
"=",
"getUserName",
"(",
")",
";",
"}",
"}"
] | Called by JPA container before sql insert. | [
"Called",
"by",
"JPA",
"container",
"before",
"sql",
"insert",
"."
] | 144cabeb294ce9d3d9e6f78403085d146579cc8e | https://github.com/gekoh/yaGen/blob/144cabeb294ce9d3d9e6f78403085d146579cc8e/lib/yagen-api/src/main/java/com/github/gekoh/yagen/api/AuditInfo.java#L77-L83 |
143,292 | gekoh/yaGen | lib/yagen-api/src/main/java/com/github/gekoh/yagen/util/FieldInfo.java | FieldInfo.concatOverrides | private static String concatOverrides(String annotation, Collection<String> attributeOverrides) {
if (attributeOverrides == null || attributeOverrides.size() < 1) {
return annotation;
}
if (annotation == null) {
annotation = "";
}
else {
Matcher overrideMatcher;
while ((overrideMatcher = PATTERN_ATTR_OVERRIDE.matcher(annotation)).find()) {
if (!(attributeOverrides instanceof ArrayList)) {
attributeOverrides = new ArrayList<String>(attributeOverrides);
}
((ArrayList) attributeOverrides).add(0, overrideMatcher.group(1));
annotation = annotation.substring(0, overrideMatcher.start()) + annotation.substring(overrideMatcher.end());
}
}
Matcher overridesMatcher = PATTERN_ATTR_OVERRIDES.matcher(annotation);
if (!overridesMatcher.find()) {
annotation = (annotation.length() < 1 ? "" : annotation + "\n ") + "@" + AttributeOverrides.class.getName() + "({})";
}
for (String addOverride : attributeOverrides) {
overridesMatcher = PATTERN_ATTR_OVERRIDES.matcher(annotation);
if (!overridesMatcher.find()) {
throw new IllegalStateException();
}
if (StringUtils.isNotEmpty(overridesMatcher.group(2))) {
addOverride = ", " + addOverride;
}
annotation = annotation.substring(0, overridesMatcher.start(3)) + addOverride +
annotation.substring(overridesMatcher.start(3));
}
return annotation;
} | java | private static String concatOverrides(String annotation, Collection<String> attributeOverrides) {
if (attributeOverrides == null || attributeOverrides.size() < 1) {
return annotation;
}
if (annotation == null) {
annotation = "";
}
else {
Matcher overrideMatcher;
while ((overrideMatcher = PATTERN_ATTR_OVERRIDE.matcher(annotation)).find()) {
if (!(attributeOverrides instanceof ArrayList)) {
attributeOverrides = new ArrayList<String>(attributeOverrides);
}
((ArrayList) attributeOverrides).add(0, overrideMatcher.group(1));
annotation = annotation.substring(0, overrideMatcher.start()) + annotation.substring(overrideMatcher.end());
}
}
Matcher overridesMatcher = PATTERN_ATTR_OVERRIDES.matcher(annotation);
if (!overridesMatcher.find()) {
annotation = (annotation.length() < 1 ? "" : annotation + "\n ") + "@" + AttributeOverrides.class.getName() + "({})";
}
for (String addOverride : attributeOverrides) {
overridesMatcher = PATTERN_ATTR_OVERRIDES.matcher(annotation);
if (!overridesMatcher.find()) {
throw new IllegalStateException();
}
if (StringUtils.isNotEmpty(overridesMatcher.group(2))) {
addOverride = ", " + addOverride;
}
annotation = annotation.substring(0, overridesMatcher.start(3)) + addOverride +
annotation.substring(overridesMatcher.start(3));
}
return annotation;
} | [
"private",
"static",
"String",
"concatOverrides",
"(",
"String",
"annotation",
",",
"Collection",
"<",
"String",
">",
"attributeOverrides",
")",
"{",
"if",
"(",
"attributeOverrides",
"==",
"null",
"||",
"attributeOverrides",
".",
"size",
"(",
")",
"<",
"1",
")",
"{",
"return",
"annotation",
";",
"}",
"if",
"(",
"annotation",
"==",
"null",
")",
"{",
"annotation",
"=",
"\"\"",
";",
"}",
"else",
"{",
"Matcher",
"overrideMatcher",
";",
"while",
"(",
"(",
"overrideMatcher",
"=",
"PATTERN_ATTR_OVERRIDE",
".",
"matcher",
"(",
"annotation",
")",
")",
".",
"find",
"(",
")",
")",
"{",
"if",
"(",
"!",
"(",
"attributeOverrides",
"instanceof",
"ArrayList",
")",
")",
"{",
"attributeOverrides",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
"attributeOverrides",
")",
";",
"}",
"(",
"(",
"ArrayList",
")",
"attributeOverrides",
")",
".",
"add",
"(",
"0",
",",
"overrideMatcher",
".",
"group",
"(",
"1",
")",
")",
";",
"annotation",
"=",
"annotation",
".",
"substring",
"(",
"0",
",",
"overrideMatcher",
".",
"start",
"(",
")",
")",
"+",
"annotation",
".",
"substring",
"(",
"overrideMatcher",
".",
"end",
"(",
")",
")",
";",
"}",
"}",
"Matcher",
"overridesMatcher",
"=",
"PATTERN_ATTR_OVERRIDES",
".",
"matcher",
"(",
"annotation",
")",
";",
"if",
"(",
"!",
"overridesMatcher",
".",
"find",
"(",
")",
")",
"{",
"annotation",
"=",
"(",
"annotation",
".",
"length",
"(",
")",
"<",
"1",
"?",
"\"\"",
":",
"annotation",
"+",
"\"\\n \"",
")",
"+",
"\"@\"",
"+",
"AttributeOverrides",
".",
"class",
".",
"getName",
"(",
")",
"+",
"\"({})\"",
";",
"}",
"for",
"(",
"String",
"addOverride",
":",
"attributeOverrides",
")",
"{",
"overridesMatcher",
"=",
"PATTERN_ATTR_OVERRIDES",
".",
"matcher",
"(",
"annotation",
")",
";",
"if",
"(",
"!",
"overridesMatcher",
".",
"find",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
")",
";",
"}",
"if",
"(",
"StringUtils",
".",
"isNotEmpty",
"(",
"overridesMatcher",
".",
"group",
"(",
"2",
")",
")",
")",
"{",
"addOverride",
"=",
"\", \"",
"+",
"addOverride",
";",
"}",
"annotation",
"=",
"annotation",
".",
"substring",
"(",
"0",
",",
"overridesMatcher",
".",
"start",
"(",
"3",
")",
")",
"+",
"addOverride",
"+",
"annotation",
".",
"substring",
"(",
"overridesMatcher",
".",
"start",
"(",
"3",
")",
")",
";",
"}",
"return",
"annotation",
";",
"}"
] | merges given collection of javax.persistence.AttributeOverride elements into an optionally existing
javax.persistence.AttributeOverrides annotation with optionally pre-existing javax.persistence.AttributeOverride elements.
@param annotation existing javax.persistence.AttributeOverrides annotation, if any, otherwise it will be created
@param attributeOverrides collection of javax.persistence.AttributeOverride annotation to be appended
@return merged AttributeOverrides annotation | [
"merges",
"given",
"collection",
"of",
"javax",
".",
"persistence",
".",
"AttributeOverride",
"elements",
"into",
"an",
"optionally",
"existing",
"javax",
".",
"persistence",
".",
"AttributeOverrides",
"annotation",
"with",
"optionally",
"pre",
"-",
"existing",
"javax",
".",
"persistence",
".",
"AttributeOverride",
"elements",
"."
] | 144cabeb294ce9d3d9e6f78403085d146579cc8e | https://github.com/gekoh/yaGen/blob/144cabeb294ce9d3d9e6f78403085d146579cc8e/lib/yagen-api/src/main/java/com/github/gekoh/yagen/util/FieldInfo.java#L349-L386 |
143,293 | gekoh/yaGen | lib/yagen-api/src/main/java/com/github/gekoh/yagen/hibernate/PatchGlue.java | PatchGlue.schemaExportPerform | public static void schemaExportPerform (String[] sqlCommands, List exporters, SchemaExport schemaExport) {
if (schemaExportPerform == null) {
try {
schemaExportPerform = SchemaExport.class.getMethod("performApi", String[].class, List.class, String.class);
} catch (NoSuchMethodException e) {
LOG.error("cannot find api method inserted by patch", e);
}
}
String[] wrapArr = new String[1];
for (String sqlCommand : sqlCommands) {
for (String singleSql : splitSQL(sqlCommand)) {
SqlStatement ddlStmt = prepareDDL(singleSql);
wrapArr[0] = ddlStmt.getSql();
boolean emptyStatement = isEmptyStatement(singleSql);
try {
List passedExporters = new ArrayList();
passedExporters.add(null);
for (Object exporter : exporters) {
passedExporters.set(0, exporter);
boolean databaseExporter = exporter.getClass().getSimpleName().equals("DatabaseExporter");
if (!databaseExporter || !emptyStatement) {
schemaExportPerform.invoke(schemaExport, new Object[]{wrapArr, passedExporters, databaseExporter ? null : ddlStmt.getDelimiter()});
}
}
} catch (InvocationTargetException e) {
if (e.getCause() instanceof SQLException && !emptyStatement) {
LOG.warn("failed executing sql: {}", singleSql);
LOG.warn("failure: {}", e.getCause().getMessage());
}
} catch (Exception e) {
LOG.error("cannot call patched api method in SchemaExport", e);
}
}
}
} | java | public static void schemaExportPerform (String[] sqlCommands, List exporters, SchemaExport schemaExport) {
if (schemaExportPerform == null) {
try {
schemaExportPerform = SchemaExport.class.getMethod("performApi", String[].class, List.class, String.class);
} catch (NoSuchMethodException e) {
LOG.error("cannot find api method inserted by patch", e);
}
}
String[] wrapArr = new String[1];
for (String sqlCommand : sqlCommands) {
for (String singleSql : splitSQL(sqlCommand)) {
SqlStatement ddlStmt = prepareDDL(singleSql);
wrapArr[0] = ddlStmt.getSql();
boolean emptyStatement = isEmptyStatement(singleSql);
try {
List passedExporters = new ArrayList();
passedExporters.add(null);
for (Object exporter : exporters) {
passedExporters.set(0, exporter);
boolean databaseExporter = exporter.getClass().getSimpleName().equals("DatabaseExporter");
if (!databaseExporter || !emptyStatement) {
schemaExportPerform.invoke(schemaExport, new Object[]{wrapArr, passedExporters, databaseExporter ? null : ddlStmt.getDelimiter()});
}
}
} catch (InvocationTargetException e) {
if (e.getCause() instanceof SQLException && !emptyStatement) {
LOG.warn("failed executing sql: {}", singleSql);
LOG.warn("failure: {}", e.getCause().getMessage());
}
} catch (Exception e) {
LOG.error("cannot call patched api method in SchemaExport", e);
}
}
}
} | [
"public",
"static",
"void",
"schemaExportPerform",
"(",
"String",
"[",
"]",
"sqlCommands",
",",
"List",
"exporters",
",",
"SchemaExport",
"schemaExport",
")",
"{",
"if",
"(",
"schemaExportPerform",
"==",
"null",
")",
"{",
"try",
"{",
"schemaExportPerform",
"=",
"SchemaExport",
".",
"class",
".",
"getMethod",
"(",
"\"performApi\"",
",",
"String",
"[",
"]",
".",
"class",
",",
"List",
".",
"class",
",",
"String",
".",
"class",
")",
";",
"}",
"catch",
"(",
"NoSuchMethodException",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"\"cannot find api method inserted by patch\"",
",",
"e",
")",
";",
"}",
"}",
"String",
"[",
"]",
"wrapArr",
"=",
"new",
"String",
"[",
"1",
"]",
";",
"for",
"(",
"String",
"sqlCommand",
":",
"sqlCommands",
")",
"{",
"for",
"(",
"String",
"singleSql",
":",
"splitSQL",
"(",
"sqlCommand",
")",
")",
"{",
"SqlStatement",
"ddlStmt",
"=",
"prepareDDL",
"(",
"singleSql",
")",
";",
"wrapArr",
"[",
"0",
"]",
"=",
"ddlStmt",
".",
"getSql",
"(",
")",
";",
"boolean",
"emptyStatement",
"=",
"isEmptyStatement",
"(",
"singleSql",
")",
";",
"try",
"{",
"List",
"passedExporters",
"=",
"new",
"ArrayList",
"(",
")",
";",
"passedExporters",
".",
"add",
"(",
"null",
")",
";",
"for",
"(",
"Object",
"exporter",
":",
"exporters",
")",
"{",
"passedExporters",
".",
"set",
"(",
"0",
",",
"exporter",
")",
";",
"boolean",
"databaseExporter",
"=",
"exporter",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
".",
"equals",
"(",
"\"DatabaseExporter\"",
")",
";",
"if",
"(",
"!",
"databaseExporter",
"||",
"!",
"emptyStatement",
")",
"{",
"schemaExportPerform",
".",
"invoke",
"(",
"schemaExport",
",",
"new",
"Object",
"[",
"]",
"{",
"wrapArr",
",",
"passedExporters",
",",
"databaseExporter",
"?",
"null",
":",
"ddlStmt",
".",
"getDelimiter",
"(",
")",
"}",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"InvocationTargetException",
"e",
")",
"{",
"if",
"(",
"e",
".",
"getCause",
"(",
")",
"instanceof",
"SQLException",
"&&",
"!",
"emptyStatement",
")",
"{",
"LOG",
".",
"warn",
"(",
"\"failed executing sql: {}\"",
",",
"singleSql",
")",
";",
"LOG",
".",
"warn",
"(",
"\"failure: {}\"",
",",
"e",
".",
"getCause",
"(",
")",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"\"cannot call patched api method in SchemaExport\"",
",",
"e",
")",
";",
"}",
"}",
"}",
"}"
] | Hibernate 4.3.5 | [
"Hibernate",
"4",
".",
"3",
".",
"5"
] | 144cabeb294ce9d3d9e6f78403085d146579cc8e | https://github.com/gekoh/yaGen/blob/144cabeb294ce9d3d9e6f78403085d146579cc8e/lib/yagen-api/src/main/java/com/github/gekoh/yagen/hibernate/PatchGlue.java#L268-L302 |
143,294 | centic9/commons-test | src/main/java/org/dstadler/commons/email/SafeCloseSmtpServer.java | SafeCloseSmtpServer.run | @Override
public void run() {
stopped = false;
try {
try {
serverSocket = new ServerSocket(port);
serverSocket.setSoTimeout(TIMEOUT); // Block for maximum of 1.5 seconds
} finally {
// Notify when server socket has been created
startupBarrier.countDown();
}
// Server: loop until stopped
while (!isStopped()) {
// get a semaphore so we can ensure below that no thread is still doing stuff when we want to close the server
if (!semaphore.tryAcquire()) {
throw new IllegalStateException("Could not get semaphore, number of possible threads is too low.");
}
try {
// Start server socket and listen for client connections
final Socket socket;
try {
socket = serverSocket.accept();
} catch (@SuppressWarnings("unused") Exception e) {
continue; // Non-blocking socket timeout occurred: try accept() again
}
// Get the input and output streams
BufferedReader input = new BufferedReader(new InputStreamReader(socket.getInputStream(), "UTF-8")); // NOSONAR - test class works only locally anyway
PrintWriter out = new PrintWriter(socket.getOutputStream()); // NOSONAR - test class works only locally anyway
synchronized (this) {
/*
* We synchronize over the handle method and the list update because the client call completes inside
* the handle method and we have to prevent the client from reading the list until we've updated it.
* For higher concurrency, we could just change handle to return void and update the list inside the
* method
* to limit the duration that we hold the lock.
*/
List<SmtpMessage> messages = handleTransaction(out, input);
receivedMail.addAll(messages);
}
socket.close();
} finally {
semaphore.release();
}
}
} catch (Exception e) {
// TODO: Should throw an appropriate exception here
log.log(Level.SEVERE, "Caught exception: ", e);
} finally {
if (serverSocket != null) {
try {
serverSocket.close();
} catch (IOException e) {
log.log(Level.SEVERE, "Caught exception: ", e);
}
}
}
} | java | @Override
public void run() {
stopped = false;
try {
try {
serverSocket = new ServerSocket(port);
serverSocket.setSoTimeout(TIMEOUT); // Block for maximum of 1.5 seconds
} finally {
// Notify when server socket has been created
startupBarrier.countDown();
}
// Server: loop until stopped
while (!isStopped()) {
// get a semaphore so we can ensure below that no thread is still doing stuff when we want to close the server
if (!semaphore.tryAcquire()) {
throw new IllegalStateException("Could not get semaphore, number of possible threads is too low.");
}
try {
// Start server socket and listen for client connections
final Socket socket;
try {
socket = serverSocket.accept();
} catch (@SuppressWarnings("unused") Exception e) {
continue; // Non-blocking socket timeout occurred: try accept() again
}
// Get the input and output streams
BufferedReader input = new BufferedReader(new InputStreamReader(socket.getInputStream(), "UTF-8")); // NOSONAR - test class works only locally anyway
PrintWriter out = new PrintWriter(socket.getOutputStream()); // NOSONAR - test class works only locally anyway
synchronized (this) {
/*
* We synchronize over the handle method and the list update because the client call completes inside
* the handle method and we have to prevent the client from reading the list until we've updated it.
* For higher concurrency, we could just change handle to return void and update the list inside the
* method
* to limit the duration that we hold the lock.
*/
List<SmtpMessage> messages = handleTransaction(out, input);
receivedMail.addAll(messages);
}
socket.close();
} finally {
semaphore.release();
}
}
} catch (Exception e) {
// TODO: Should throw an appropriate exception here
log.log(Level.SEVERE, "Caught exception: ", e);
} finally {
if (serverSocket != null) {
try {
serverSocket.close();
} catch (IOException e) {
log.log(Level.SEVERE, "Caught exception: ", e);
}
}
}
} | [
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"stopped",
"=",
"false",
";",
"try",
"{",
"try",
"{",
"serverSocket",
"=",
"new",
"ServerSocket",
"(",
"port",
")",
";",
"serverSocket",
".",
"setSoTimeout",
"(",
"TIMEOUT",
")",
";",
"// Block for maximum of 1.5 seconds",
"}",
"finally",
"{",
"// Notify when server socket has been created",
"startupBarrier",
".",
"countDown",
"(",
")",
";",
"}",
"// Server: loop until stopped",
"while",
"(",
"!",
"isStopped",
"(",
")",
")",
"{",
"// get a semaphore so we can ensure below that no thread is still doing stuff when we want to close the server",
"if",
"(",
"!",
"semaphore",
".",
"tryAcquire",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Could not get semaphore, number of possible threads is too low.\"",
")",
";",
"}",
"try",
"{",
"// Start server socket and listen for client connections",
"final",
"Socket",
"socket",
";",
"try",
"{",
"socket",
"=",
"serverSocket",
".",
"accept",
"(",
")",
";",
"}",
"catch",
"(",
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"Exception",
"e",
")",
"{",
"continue",
";",
"// Non-blocking socket timeout occurred: try accept() again",
"}",
"// Get the input and output streams",
"BufferedReader",
"input",
"=",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"socket",
".",
"getInputStream",
"(",
")",
",",
"\"UTF-8\"",
")",
")",
";",
"// NOSONAR - test class works only locally anyway",
"PrintWriter",
"out",
"=",
"new",
"PrintWriter",
"(",
"socket",
".",
"getOutputStream",
"(",
")",
")",
";",
"// NOSONAR - test class works only locally anyway",
"synchronized",
"(",
"this",
")",
"{",
"/*\n\t\t\t\t\t\t * We synchronize over the handle method and the list update because the client call completes inside\n\t\t\t\t\t\t * the handle method and we have to prevent the client from reading the list until we've updated it.\n\t\t\t\t\t\t * For higher concurrency, we could just change handle to return void and update the list inside the\n\t\t\t\t\t\t * method\n\t\t\t\t\t\t * to limit the duration that we hold the lock.\n\t\t\t\t\t\t */",
"List",
"<",
"SmtpMessage",
">",
"messages",
"=",
"handleTransaction",
"(",
"out",
",",
"input",
")",
";",
"receivedMail",
".",
"addAll",
"(",
"messages",
")",
";",
"}",
"socket",
".",
"close",
"(",
")",
";",
"}",
"finally",
"{",
"semaphore",
".",
"release",
"(",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// TODO: Should throw an appropriate exception here",
"log",
".",
"log",
"(",
"Level",
".",
"SEVERE",
",",
"\"Caught exception: \"",
",",
"e",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"serverSocket",
"!=",
"null",
")",
"{",
"try",
"{",
"serverSocket",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"log",
".",
"log",
"(",
"Level",
".",
"SEVERE",
",",
"\"Caught exception: \"",
",",
"e",
")",
";",
"}",
"}",
"}",
"}"
] | Main loop of the SMTP server. | [
"Main",
"loop",
"of",
"the",
"SMTP",
"server",
"."
] | 562047c198133ecb116f2472e9aeb15e866579f5 | https://github.com/centic9/commons-test/blob/562047c198133ecb116f2472e9aeb15e866579f5/src/main/java/org/dstadler/commons/email/SafeCloseSmtpServer.java#L104-L164 |
143,295 | centic9/commons-test | src/main/java/org/dstadler/commons/email/SafeCloseSmtpServer.java | SafeCloseSmtpServer.stop | public synchronized void stop() {
// Mark us closed
stopped = true;
try {
// Kick the server accept loop
serverSocket.close();
// acquire all semaphores so that we wait for all connections to finish before we report back as closed
semaphore.acquireUninterruptibly(MAXIMUM_CONCURRENT_READERS);
} catch (IOException e) {
log.log(Level.SEVERE, "Caught exception: ", e);
}
} | java | public synchronized void stop() {
// Mark us closed
stopped = true;
try {
// Kick the server accept loop
serverSocket.close();
// acquire all semaphores so that we wait for all connections to finish before we report back as closed
semaphore.acquireUninterruptibly(MAXIMUM_CONCURRENT_READERS);
} catch (IOException e) {
log.log(Level.SEVERE, "Caught exception: ", e);
}
} | [
"public",
"synchronized",
"void",
"stop",
"(",
")",
"{",
"// Mark us closed",
"stopped",
"=",
"true",
";",
"try",
"{",
"// Kick the server accept loop",
"serverSocket",
".",
"close",
"(",
")",
";",
"// acquire all semaphores so that we wait for all connections to finish before we report back as closed",
"semaphore",
".",
"acquireUninterruptibly",
"(",
"MAXIMUM_CONCURRENT_READERS",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"log",
".",
"log",
"(",
"Level",
".",
"SEVERE",
",",
"\"Caught exception: \"",
",",
"e",
")",
";",
"}",
"}"
] | Stops the server. Server is shutdown after processing of the current request is complete. | [
"Stops",
"the",
"server",
".",
"Server",
"is",
"shutdown",
"after",
"processing",
"of",
"the",
"current",
"request",
"is",
"complete",
"."
] | 562047c198133ecb116f2472e9aeb15e866579f5 | https://github.com/centic9/commons-test/blob/562047c198133ecb116f2472e9aeb15e866579f5/src/main/java/org/dstadler/commons/email/SafeCloseSmtpServer.java#L179-L191 |
143,296 | centic9/commons-test | src/main/java/org/dstadler/commons/email/SafeCloseSmtpServer.java | SafeCloseSmtpServer.handleTransaction | private List<SmtpMessage> handleTransaction(PrintWriter out, BufferedReader input) throws IOException {
// Initialize the state machine
SmtpState smtpState = SmtpState.CONNECT;
SmtpRequest smtpRequest = new SmtpRequest(SmtpActionType.CONNECT, "", smtpState);
// Execute the connection request
SmtpResponse smtpResponse = smtpRequest.execute();
// Send initial response
sendResponse(out, smtpResponse);
smtpState = smtpResponse.getNextState();
List<SmtpMessage> msgList = new ArrayList<>();
SmtpMessage msg = new SmtpMessage();
while (smtpState != SmtpState.CONNECT) {
String line = input.readLine();
if (line == null) {
break;
}
// Create request from client input and current state
SmtpRequest request = SmtpRequest.createRequest(line, smtpState);
// Execute request and create response object
SmtpResponse response = request.execute();
// Move to next internal state
smtpState = response.getNextState();
// Send response to client
sendResponse(out, response);
// Store input in message
String params = request.getParams();
msg.store(response, params);
// If message reception is complete save it
if (smtpState == SmtpState.QUIT) {
msgList.add(msg);
msg = new SmtpMessage();
}
}
return msgList;
} | java | private List<SmtpMessage> handleTransaction(PrintWriter out, BufferedReader input) throws IOException {
// Initialize the state machine
SmtpState smtpState = SmtpState.CONNECT;
SmtpRequest smtpRequest = new SmtpRequest(SmtpActionType.CONNECT, "", smtpState);
// Execute the connection request
SmtpResponse smtpResponse = smtpRequest.execute();
// Send initial response
sendResponse(out, smtpResponse);
smtpState = smtpResponse.getNextState();
List<SmtpMessage> msgList = new ArrayList<>();
SmtpMessage msg = new SmtpMessage();
while (smtpState != SmtpState.CONNECT) {
String line = input.readLine();
if (line == null) {
break;
}
// Create request from client input and current state
SmtpRequest request = SmtpRequest.createRequest(line, smtpState);
// Execute request and create response object
SmtpResponse response = request.execute();
// Move to next internal state
smtpState = response.getNextState();
// Send response to client
sendResponse(out, response);
// Store input in message
String params = request.getParams();
msg.store(response, params);
// If message reception is complete save it
if (smtpState == SmtpState.QUIT) {
msgList.add(msg);
msg = new SmtpMessage();
}
}
return msgList;
} | [
"private",
"List",
"<",
"SmtpMessage",
">",
"handleTransaction",
"(",
"PrintWriter",
"out",
",",
"BufferedReader",
"input",
")",
"throws",
"IOException",
"{",
"// Initialize the state machine",
"SmtpState",
"smtpState",
"=",
"SmtpState",
".",
"CONNECT",
";",
"SmtpRequest",
"smtpRequest",
"=",
"new",
"SmtpRequest",
"(",
"SmtpActionType",
".",
"CONNECT",
",",
"\"\"",
",",
"smtpState",
")",
";",
"// Execute the connection request",
"SmtpResponse",
"smtpResponse",
"=",
"smtpRequest",
".",
"execute",
"(",
")",
";",
"// Send initial response",
"sendResponse",
"(",
"out",
",",
"smtpResponse",
")",
";",
"smtpState",
"=",
"smtpResponse",
".",
"getNextState",
"(",
")",
";",
"List",
"<",
"SmtpMessage",
">",
"msgList",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"SmtpMessage",
"msg",
"=",
"new",
"SmtpMessage",
"(",
")",
";",
"while",
"(",
"smtpState",
"!=",
"SmtpState",
".",
"CONNECT",
")",
"{",
"String",
"line",
"=",
"input",
".",
"readLine",
"(",
")",
";",
"if",
"(",
"line",
"==",
"null",
")",
"{",
"break",
";",
"}",
"// Create request from client input and current state",
"SmtpRequest",
"request",
"=",
"SmtpRequest",
".",
"createRequest",
"(",
"line",
",",
"smtpState",
")",
";",
"// Execute request and create response object",
"SmtpResponse",
"response",
"=",
"request",
".",
"execute",
"(",
")",
";",
"// Move to next internal state",
"smtpState",
"=",
"response",
".",
"getNextState",
"(",
")",
";",
"// Send response to client",
"sendResponse",
"(",
"out",
",",
"response",
")",
";",
"// Store input in message",
"String",
"params",
"=",
"request",
".",
"getParams",
"(",
")",
";",
"msg",
".",
"store",
"(",
"response",
",",
"params",
")",
";",
"// If message reception is complete save it",
"if",
"(",
"smtpState",
"==",
"SmtpState",
".",
"QUIT",
")",
"{",
"msgList",
".",
"add",
"(",
"msg",
")",
";",
"msg",
"=",
"new",
"SmtpMessage",
"(",
")",
";",
"}",
"}",
"return",
"msgList",
";",
"}"
] | Handle an SMTP transaction, i.e. all activity between initial connect and QUIT command.
@param out output stream
@param input input stream
@return List of SmtpMessage | [
"Handle",
"an",
"SMTP",
"transaction",
"i",
".",
"e",
".",
"all",
"activity",
"between",
"initial",
"connect",
"and",
"QUIT",
"command",
"."
] | 562047c198133ecb116f2472e9aeb15e866579f5 | https://github.com/centic9/commons-test/blob/562047c198133ecb116f2472e9aeb15e866579f5/src/main/java/org/dstadler/commons/email/SafeCloseSmtpServer.java#L200-L243 |
143,297 | centic9/commons-test | src/main/java/org/dstadler/commons/email/SafeCloseSmtpServer.java | SafeCloseSmtpServer.sendResponse | private static void sendResponse(PrintWriter out, SmtpResponse smtpResponse) {
if (smtpResponse.getCode() > 0) {
int code = smtpResponse.getCode();
String message = smtpResponse.getMessage();
out.print(code + " " + message + "\r\n");
out.flush();
}
} | java | private static void sendResponse(PrintWriter out, SmtpResponse smtpResponse) {
if (smtpResponse.getCode() > 0) {
int code = smtpResponse.getCode();
String message = smtpResponse.getMessage();
out.print(code + " " + message + "\r\n");
out.flush();
}
} | [
"private",
"static",
"void",
"sendResponse",
"(",
"PrintWriter",
"out",
",",
"SmtpResponse",
"smtpResponse",
")",
"{",
"if",
"(",
"smtpResponse",
".",
"getCode",
"(",
")",
">",
"0",
")",
"{",
"int",
"code",
"=",
"smtpResponse",
".",
"getCode",
"(",
")",
";",
"String",
"message",
"=",
"smtpResponse",
".",
"getMessage",
"(",
")",
";",
"out",
".",
"print",
"(",
"code",
"+",
"\" \"",
"+",
"message",
"+",
"\"\\r\\n\"",
")",
";",
"out",
".",
"flush",
"(",
")",
";",
"}",
"}"
] | Send response to client.
@param out socket output stream
@param smtpResponse response object | [
"Send",
"response",
"to",
"client",
"."
] | 562047c198133ecb116f2472e9aeb15e866579f5 | https://github.com/centic9/commons-test/blob/562047c198133ecb116f2472e9aeb15e866579f5/src/main/java/org/dstadler/commons/email/SafeCloseSmtpServer.java#L251-L258 |
143,298 | centic9/commons-test | src/main/java/org/dstadler/commons/email/SafeCloseSmtpServer.java | SafeCloseSmtpServer.start | public static SafeCloseSmtpServer start(int port) {
SafeCloseSmtpServer server = new SafeCloseSmtpServer(port);
Thread t = new Thread(server, "Mock SMTP Server Thread");
t.start();
// Block until the server socket is created
try {
server.startupBarrier.await();
} catch (InterruptedException e) {
log.log(Level.WARNING, "Interrupted", e);
}
return server;
} | java | public static SafeCloseSmtpServer start(int port) {
SafeCloseSmtpServer server = new SafeCloseSmtpServer(port);
Thread t = new Thread(server, "Mock SMTP Server Thread");
t.start();
// Block until the server socket is created
try {
server.startupBarrier.await();
} catch (InterruptedException e) {
log.log(Level.WARNING, "Interrupted", e);
}
return server;
} | [
"public",
"static",
"SafeCloseSmtpServer",
"start",
"(",
"int",
"port",
")",
"{",
"SafeCloseSmtpServer",
"server",
"=",
"new",
"SafeCloseSmtpServer",
"(",
"port",
")",
";",
"Thread",
"t",
"=",
"new",
"Thread",
"(",
"server",
",",
"\"Mock SMTP Server Thread\"",
")",
";",
"t",
".",
"start",
"(",
")",
";",
"// Block until the server socket is created",
"try",
"{",
"server",
".",
"startupBarrier",
".",
"await",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"log",
".",
"log",
"(",
"Level",
".",
"WARNING",
",",
"\"Interrupted\"",
",",
"e",
")",
";",
"}",
"return",
"server",
";",
"}"
] | Creates an instance of SimpleSmtpServer and starts it.
@param port port number the server should listen to
@return a reference to the SMTP server | [
"Creates",
"an",
"instance",
"of",
"SimpleSmtpServer",
"and",
"starts",
"it",
"."
] | 562047c198133ecb116f2472e9aeb15e866579f5 | https://github.com/centic9/commons-test/blob/562047c198133ecb116f2472e9aeb15e866579f5/src/main/java/org/dstadler/commons/email/SafeCloseSmtpServer.java#L284-L297 |
143,299 | galan/commons | src/main/java/de/galan/commons/net/Ports.java | Ports.findFree | public static Integer findFree(int lowIncluse, int highInclusive) {
int low = Math.max(1, Math.min(lowIncluse, highInclusive));
int high = Math.min(65535, Math.max(lowIncluse, highInclusive));
Integer result = null;
int split = RandomUtils.nextInt(low, high + 1);
for (int port = split; port <= high; port++) {
if (isFree(port)) {
result = port;
break;
}
}
if (result == null) {
for (int port = low; port < split; port++) {
if (isFree(port)) {
result = port;
break;
}
}
}
return result;
} | java | public static Integer findFree(int lowIncluse, int highInclusive) {
int low = Math.max(1, Math.min(lowIncluse, highInclusive));
int high = Math.min(65535, Math.max(lowIncluse, highInclusive));
Integer result = null;
int split = RandomUtils.nextInt(low, high + 1);
for (int port = split; port <= high; port++) {
if (isFree(port)) {
result = port;
break;
}
}
if (result == null) {
for (int port = low; port < split; port++) {
if (isFree(port)) {
result = port;
break;
}
}
}
return result;
} | [
"public",
"static",
"Integer",
"findFree",
"(",
"int",
"lowIncluse",
",",
"int",
"highInclusive",
")",
"{",
"int",
"low",
"=",
"Math",
".",
"max",
"(",
"1",
",",
"Math",
".",
"min",
"(",
"lowIncluse",
",",
"highInclusive",
")",
")",
";",
"int",
"high",
"=",
"Math",
".",
"min",
"(",
"65535",
",",
"Math",
".",
"max",
"(",
"lowIncluse",
",",
"highInclusive",
")",
")",
";",
"Integer",
"result",
"=",
"null",
";",
"int",
"split",
"=",
"RandomUtils",
".",
"nextInt",
"(",
"low",
",",
"high",
"+",
"1",
")",
";",
"for",
"(",
"int",
"port",
"=",
"split",
";",
"port",
"<=",
"high",
";",
"port",
"++",
")",
"{",
"if",
"(",
"isFree",
"(",
"port",
")",
")",
"{",
"result",
"=",
"port",
";",
"break",
";",
"}",
"}",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"for",
"(",
"int",
"port",
"=",
"low",
";",
"port",
"<",
"split",
";",
"port",
"++",
")",
"{",
"if",
"(",
"isFree",
"(",
"port",
")",
")",
"{",
"result",
"=",
"port",
";",
"break",
";",
"}",
"}",
"}",
"return",
"result",
";",
"}"
] | Returns a free port in the defined range, returns null if none is available. | [
"Returns",
"a",
"free",
"port",
"in",
"the",
"defined",
"range",
"returns",
"null",
"if",
"none",
"is",
"available",
"."
] | 45d2f36c69958d3f847e5fed66603ea629471822 | https://github.com/galan/commons/blob/45d2f36c69958d3f847e5fed66603ea629471822/src/main/java/de/galan/commons/net/Ports.java#L27-L47 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.