auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static void spawnMob(final IEssentials ess, final Server server, final CommandSource sender, final User target, final Location sloc, List<String> parts, List<String> data) throws Exception { Mob mob; Entity spawnedMob = null; Entity spawnedMount; for (int i = 0; i < parts.size(); i++) { if (i == 0) { mob = Mob.fromName(parts.get(i)); spawnedMob = mob.spawn(sloc.getWorld(), server, sloc); defaultMobData(mob.getType(), spawnedMob); if (data.get(i) != null) { changeMobData(sender, mob.getType(), spawnedMob, data.get(i).toLowerCase(Locale.ENGLISH), target); } } int next = (i + 1); if (next < parts.size()) { Mob mMob = Mob.fromName(parts.get(next)); spawnedMount = mMob.spawn(sloc.getWorld(), server, sloc); defaultMobData(mMob.getType(), spawnedMount); if (data.get(next) != null) { changeMobData(sender, mMob.getType(), spawnedMount, data.get(next).toLowerCase(Locale.ENGLISH), target); } if (spawnedMob != null) { spawnedMob.setPassenger(spawnedMount); } spawnedMob = spawnedMount; } } }

Target:
private static void spawnMob(final IEssentials ess, final Server server, final CommandSource sender, final User target, final Location sloc, List<String> parts, List<String> data) throws Exception { Mob mob; Entity spawnedMob = null; Entity spawnedMount; for (int i = 0; i < parts.size(); i++) { if (i == 0) { mob = Mob.fromName(parts.get(i)); spawnedMob = mob.spawn(sloc.getWorld(), server, sloc); defaultMobData(mob.getType(), spawnedMob); if (data.get(i) != null) { changeMobData(sender, mob.getType(), spawnedMob, data.get(i).toLowerCase(Locale.ENGLISH), target); } } int next = (i + 1); if (next < parts.size()) { Mob mMob = Mob.fromName(parts.get(next)); spawnedMount = mMob.spawn(sloc.getWorld(), server, sloc); defaultMobData(mMob.getType(), spawnedMount); if (data.get(next) != null) { changeMobData(sender, mMob.getType(), spawnedMount, data.get(next).toLowerCase(Locale.ENGLISH), target); } spawnedMob.setPassenger(spawnedMount); spawnedMob = spawnedMount; } } }
Source:
public void testQuery1() throws IOException, ClassNotFoundException { check("SELECT dc:title, dc:dublincore FROM Document " + "WHERE dc:created > TIMESTAMP '2007-02-03 0:0'"); }

Target:
public void testQuery1() throws Exception { check("SELECT dc:title, dc:dublincore FROM Document " + "WHERE dc:created > TIMESTAMP '2007-02-03 0:0'"); }
Source:
public void testSubarticleDoi() throws IOException { ImmutableMap<String, ? extends Map<String, ?>> itemTable = new ImmutableMap.Builder<String, Map<String, ?>>() .put("10.1371/journal.pone.0207232.r001", ImmutableMap.of( "doi", "10.1371/journal.pone.0207232.r001", "itemType", "reviewLetter", "files", ImmutableMap.of("letter", ImmutableMap.of( "crepoKey", "info:doi/10.1371/journal.pone.0207232.r001.xml", "crepoUuid", UUID.randomUUID().toString() )) )).build(); PeerReviewService serviceWithMockedContent = getServiceWithMockedContent(); String html = serviceWithMockedContent.asHtml(itemTable); System.out.println(html); Document d = Jsoup.parse(html); assertThat(d.select(".review-history .review__doi").get(0).text(), containsString("<LINK_0>")); }

Target:
public void testSubarticleDoi() throws IOException { ImmutableMap<String, ? extends Map<String, ?>> itemTable = new ImmutableMap.Builder<String, Map<String, ?>>() .put("10.1371/journal.pone.0207232.r001", ImmutableMap.of( "doi", "10.1371/journal.pone.0207232.r001", "itemType", "reviewLetter", "files", ImmutableMap.of("letter", ImmutableMap.of( "crepoKey", "info:doi/10.1371/journal.pone.0207232.r001.xml", "crepoUuid", UUID.randomUUID().toString() )) )).build(); PeerReviewService serviceWithMockedContent = getServiceWithMockedContent(); String html = serviceWithMockedContent.asHtml(itemTable); Document d = Jsoup.parse(html); assertThat(d.select(".review-history .review__doi").get(0).text(), containsString("<LINK_0>")); }
Source:
public Optional<TextStyle.Base> getById(String id) { if (id.equals("NONE")) { return Optional.of((TextStyle.Base) TextStyles.NONE); } return Optional.ofNullable(textStyleMappings.get(Namespaces.namespacedId(id))); }

Target:
public Optional<TextStyle.Base> getById(String id) { if (id.equals("NONE")) { return Optional.of((TextStyle.Base) TextStyles.NONE); } return Optional.ofNullable(textStyleMappings.get(Preconditions.checkNotNull(id))); }
Source:
public void write(int i) throws IOException { byte[] b = ByteBuffer.allocate(4).putInt(i).array(); write(b); }

Target:
public void write(int i) throws IOException { singleByte[0] = (byte)(i & 0xff); write(singleByte); }
Source:
default List<@NonNull ITmfCallsite> getCallsites() { ITmfCallsite callsite = getCallsite(); if (callsite == null) { return null; } return Collections.singletonList(callsite); }

Target:
default @Nullable List<@NonNull ITmfCallsite> getCallsites() { ITmfCallsite callsite = getCallsite(); if (callsite == null) { return null; } return Collections.singletonList(callsite); }
Source:
public void write(final Channel channel, NettyResponseFuture<?> future) { Object msg; if (body instanceof RandomAccessBody && !ChannelManager.isSslHandlerConfigured(channel.pipeline()) && !config.isDisableZeroCopy()) { msg = new BodyFileRegion((RandomAccessBody) body); channel.write(msg, channel.newProgressivePromise()) .addListener(new WriteProgressListener(future, false, getContentLength()) { @Override public void operationComplete(ChannelProgressiveFuture cf) { closeSilently(body); super.operationComplete(cf); } }); } else { msg = new BodyChunkedInput(body); BodyGenerator bg = future.getTargetRequest().getBodyGenerator(); if (bg instanceof FeedableBodyGenerator && !(bg instanceof ReactiveStreamsBodyGenerator)) { final ChunkedWriteHandler chunkedWriteHandler = channel.pipeline().get(ChunkedWriteHandler.class); FeedableBodyGenerator.class.cast(bg).setListener(new FeedListener() { @Override public void onContentAdded() { chunkedWriteHandler.resumeTransfer(); } @Override public void onError(Throwable t) { } }); } channel.write(msg, channel.newProgressivePromise()) .addListener(new WriteProgressListener(future, false, getContentLength()) { @Override public void operationComplete(ChannelProgressiveFuture cf) { closeSilently(body); super.operationComplete(cf); } @Override protected boolean abortOnThrowable(Channel channel, Throwable cause) { if (cause instanceof IOException && StackTraceInspector.recoverOnChunkedUploadFailed(cause)) return false; return super.abortOnThrowable(channel, cause); } }); } channel.writeAndFlush(LastHttpContent.EMPTY_LAST_CONTENT, channel.voidPromise()); }

Target:
public void write(final Channel channel, NettyResponseFuture<?> future) { Object msg; if (body instanceof RandomAccessBody && !ChannelManager.isSslHandlerConfigured(channel.pipeline()) && !config.isDisableZeroCopy()) { msg = new BodyFileRegion((RandomAccessBody) body); } else { msg = new BodyChunkedInput(body); BodyGenerator bg = future.getTargetRequest().getBodyGenerator(); if (bg instanceof FeedableBodyGenerator && !(bg instanceof ReactiveStreamsBodyGenerator)) { final ChunkedWriteHandler chunkedWriteHandler = channel.pipeline().get(ChunkedWriteHandler.class); FeedableBodyGenerator.class.cast(bg).setListener(new FeedListener() { @Override public void onContentAdded() { chunkedWriteHandler.resumeTransfer(); } @Override public void onError(Throwable t) { } }); } } channel.write(msg, channel.newProgressivePromise()) .addListener(new WriteProgressListener(future, false, getContentLength()) { @Override public void operationComplete(ChannelProgressiveFuture cf) { closeSilently(body); super.operationComplete(cf); } @Override protected boolean abortOnThrowable(Channel channel, Throwable cause) { return cause instanceof ChannelOutputShutdownException || super.abortOnThrowable(channel, cause); } }); channel.writeAndFlush(LastHttpContent.EMPTY_LAST_CONTENT, channel.voidPromise()); }
Source:
public ResourceManagerThrottlingInfo(HttpHeaders headers) { commonRateLimits = new HashMap<>(); for (String header : COMMON_RATE_LIMIT_HEADERS) { String value = headers.getValue(header); if (value != null && !value.isEmpty()) { commonRateLimits.put(header, value); } } resourceRateLimit = headers.getValue(RESOURCE_RATE_LIMIT_HEADERS); Matcher matcher = Pattern.compile("\\w+\\.\\w+/([^;]+);(\\d+)").matcher(resourceRateLimit); while (matcher.find()) { commonRateLimits.put( String.format("%s-%s", RESOURCE_RATE_LIMIT_HEADERS, matcher.group(1)), matcher.group(2)); } }

Target:
public ResourceManagerThrottlingInfo(HttpHeaders headers) { commonRateLimits = new HashMap<>(); for (String header : COMMON_RATE_LIMIT_HEADERS) { String value = headers.getValue(header); if (value != null && !value.isEmpty()) { commonRateLimits.put(header, value); } } resourceRateLimit = headers.getValue(RESOURCE_RATE_LIMIT_HEADER); Matcher matcher = RESOURCE_RATE_LIMIT_HEADER_PATTERN.matcher(resourceRateLimit); while (matcher.find()) { commonRateLimits.put( String.format("%s-%s", RESOURCE_RATE_LIMIT_HEADER, matcher.group(1)), matcher.group(2)); } }
Source:
public static int innerMain(String[] args) { BaseOptions base = new BaseOptions(); JCommander jc = new JCommander(base); jc.setProgramName("ehcache-ops"); jc.addCommand(new ListCacheManagers(base)); jc.addCommand(new CreateCacheManager(base)); jc.addCommand(new UpdateCacheManager(base)); jc.addCommand(new DestroyCacheManager(base)); jc.setParameterDescriptionComparator(REQUIRED_FIRST); for (JCommander jcc : jc.getCommands().values()) { jcc.setParameterDescriptionComparator(REQUIRED_FIRST); } try { jc.parse(args); if (base.isHelp()) { jc.usage(); return 1; } else { int result = 0; for (Object o : jc.getCommands().get(jc.getParsedCommand()).getObjects()) { result |= ((Command) o).execute(); }; return result; } } catch (ParameterException e) { System.out.println(e.getMessage()); jc.usage(); return 1; } }

Target:
public static int innerMain(String[] args) { BaseOptions base = new BaseOptions(); JCommander jc = new JCommander(base); jc.setProgramName("ehcache-ops"); jc.addCommand(new ListCacheManagers(base)); jc.addCommand(new CreateCacheManager(base)); jc.addCommand(new UpdateCacheManager(base)); jc.addCommand(new DestroyCacheManager(base)); jc.setParameterDescriptionComparator(REQUIRED_FIRST); for (JCommander jcc : jc.getCommands().values()) { jcc.setParameterDescriptionComparator(REQUIRED_FIRST); } try { jc.parse(args); if (base.isHelp()) { return usage(jc, new StringBuilder()); } else { int result = 0; for (Object o : jc.getCommands().get(jc.getParsedCommand()).getObjects()) { result |= ((Command) o).execute(); }; return result; } } catch (ParameterException e) { return usage(jc, new StringBuilder(e.getMessage()).append("\n")); } }
Source:
void testSerialiseQuestionlessForm() throws IOException { Survey form1 = new Survey(); form1.setKey(KeyFactory.createKey("Survey", 17L)); form1.setName("This is a form"); form1.setVersion(11.0); QuestionGroup qg = new QuestionGroup(); qg.setKey(KeyFactory.createKey("Survey", 18L)); qg.setSurveyId(17L); qg.setName("This is a group"); qg.setOrder(1); TreeMap<Integer, QuestionGroup> gl = new TreeMap<>(); gl.put(1, qg); form1.setQuestionGroupMap(gl); XmlForm form = new XmlForm(form1, "Name of containing survey"); assertNotEquals(null, form); assertNotEquals(null, form.getQuestionGroup()); List<XmlQuestionGroup> ga = form.getQuestionGroup(); assertEquals(1, ga.size()); assertEquals("This is a group", ga.get(0).getHeading()); assertEquals(1, ga.get(0).getOrder()); assertFalse(ga.get(0).getRepeatable()); String xml = PublishedForm.generate(form); SurveyDto dto = PublishedForm.parse(xml, true).toDto(); assertNotEquals(null, dto); assertEquals(17L, dto.getKeyId()); assertEquals("This is a form", dto.getName()); assertEquals("11.0", dto.getVersion()); assertEquals("This is a form", dto.getName()); }

Target:
void testSerialiseQuestionlessForm() throws IOException { Survey form1 = new Survey(); form1.setKey(KeyFactory.createKey("Survey", 17L)); form1.setName("This is a form"); form1.setVersion(11.0); QuestionGroup qg = new QuestionGroup(); qg.setKey(KeyFactory.createKey("Survey", 18L)); qg.setSurveyId(17L); qg.setName("This is a group"); qg.setOrder(1); TreeMap<Integer, QuestionGroup> gl = new TreeMap<>(); gl.put(1, qg); form1.setQuestionGroupMap(gl); XmlForm form = new XmlForm(form1, "Name of containing survey"); assertNotEquals(null, form); assertNotEquals(null, form.getQuestionGroup()); List<XmlQuestionGroup> ga = form.getQuestionGroup(); assertEquals(1, ga.size()); assertEquals("This is a group", ga.get(0).getHeading()); assertEquals(1, ga.get(0).getOrder()); assertFalse(ga.get(0).getRepeatable()); String xml = PublishedForm.generate(form); assertEquals(xml, expectedQuestionlessXml); SurveyDto dto = PublishedForm.parse(xml, true).toDto(); assertNotEquals(null, dto); assertEquals(17L, dto.getKeyId()); assertEquals("This is a form", dto.getName()); assertEquals("11.0", dto.getVersion()); assertEquals("This is a form", dto.getName()); }
Source:
public synchronized Collection<ITmfTrace> getActiveTraceSet() { final ITmfTrace trace = fCurrentTrace; if (trace == null) { return Collections.EMPTY_SET; } return getTraceSet(trace); }

Target:
public synchronized Collection<ITmfTrace> getActiveTraceSet() { final ITmfTrace trace = fCurrentTrace; return getTraceSet(trace); }
Source:
public void reopenS3FileByReopener_on_retry_always_throw_exception() throws Exception { { S3Object s3Object = mock(S3Object.class); doReturn(s3Object).when(client).getObject(any(GetObjectRequest.class)); doThrow(new AmazonClientException("This exception is thrown when retrying.")).when(s3Object).getObjectContent(); S3InputStreamReopener opener = new S3InputStreamReopener( client, new GetObjectRequest("my_bucket", "in/aa/a"), "value".length(), retryExecutor() .withInitialRetryWait(0) .withRetryLimit(2)); try (InputStream in = opener.reopen(0, new AmazonClientException("This exception can be ignored"))) { fail("Should throw exception."); } } }

Target:
public void reopenS3FileByReopener_on_retry_always_throw_exception() throws Exception { doThrow(new AmazonClientException("This exception is thrown when retrying.")).when(client).getObject(any(GetObjectRequest.class)); S3InputStreamReopener opener = new S3InputStreamReopener( client, new GetObjectRequest("my_bucket", "in/aa/a"), "value".length(), retryExecutor() .withInitialRetryWait(0) .withRetryLimit(2)); try (InputStream in = opener.reopen(0, new AmazonClientException("This exception can be ignored"))) { fail("Should throw exception."); } }
Source:
public void newTemplateCreation() { new TemplateEditPage().open("InfoboxBuilderNewTemplateCreation").getTemplateClassification() .changeTemplateType(TemplateTypes.TEMPLATE_TYPE_INFOBOX).clickAddButton(); Assertion.assertTrue(new InfoboxBuilderPage().isInfoboxBuilderPresent()); }

Target:
public void newTemplateCreation() { new TemplateEditPage().open("InfoboxBuilderNewTemplateCreation") .getTemplateClassification() .changeTemplateType(TemplateTypes.INFOBOX) .clickAddButton(); Assertion.assertTrue(new InfoboxBuilderPage().isInfoboxBuilderPresent()); }
Source:
StoreFindToken() { this(Type.Uninitialized, null, null, null, null); }

Target:
StoreFindToken() { this(Type.Uninitialized, null, null, null, null, true); }
Source:
private boolean insertObjectReference(ApiContext context, Reference<?> referee, AnnotatedElement referenceClass, String referenceClassName) { if (referenceClassName == null || referenceClassName.startsWith("java.")) { return false; } if (referenceClassName.startsWith("javax.")) { return false; } if (!context.isApplicationType(referenceClassName)) { return false; } if (referenceClass != null && referenceClass instanceof ExtensibleType) { ExtensibleType referenceClassType = (ExtensibleType) referenceClass; final AnnotationModel schemaAnnotation = AnnotationInfo.valueOf(referenceClassType) .getAnnotation(Schema.class); if (schemaAnnotation != null) { String schemaName = schemaAnnotation.getValue("name", String.class); if (schemaName == null || schemaName.isEmpty()) { schemaName = ModelUtils.getSimpleName(referenceClassName); } referee.setRef(schemaName); org.eclipse.microprofile.openapi.models.media.Schema schema = context.getApi().getComponents().getSchemas().get(schemaName); if (schema == null) { if (context.isAllowedType(referenceClassType)) { visitSchema(schemaAnnotation, referenceClass, context); } else if(referenceClassType instanceof ClassModel) { apiWalker.processAnnotation((ClassModel)referenceClassType, this); } } return true; } } return false; }

Target:
private boolean insertObjectReference(ApiContext context, Reference<?> referee, AnnotatedElement referenceClass, String referenceClassName) { if (referenceClassName == null || referenceClassName.startsWith("java.")) { return false; } if (referenceClassName.startsWith("javax.")) { return false; } if (!context.isApplicationType(referenceClassName)) { return false; } if (referenceClass != null && referenceClass instanceof ExtensibleType) { ExtensibleType referenceClassType = (ExtensibleType) referenceClass; final AnnotationModel schemaAnnotation = AnnotationInfo.valueOf(referenceClassType) .getAnnotation(Schema.class); if (schemaAnnotation != null) { String schemaName = schemaAnnotation.getValue("name", String.class); if (schemaName == null || schemaName.isEmpty()) { schemaName = ModelUtils.getSimpleName(referenceClassName); } referee.setRef(schemaName); org.eclipse.microprofile.openapi.models.media.Schema schema = context.getApi().getComponents().getSchemas().get(schemaName); if (schema == null) { if (context.isAllowedType(referenceClassType)) { visitSchema(schemaAnnotation, referenceClass, context); } else if(referenceClassType instanceof ClassModel) { apiWalker.processAnnotation((ClassModel)referenceClassType, this); } else { LOGGER.log(FINE, "Unrecognised schema {0} class found.", new Object[]{referenceClassName}); } } return true; } } return false; }
Source:
private List<String> getDirectoriesOfSelectedRepositoryNodes( ISelection selection) { List<String> result = new ArrayList<>(); if (selection instanceof StructuredSelection) { Object[] elements = ((StructuredSelection) selection).toArray(); for (Object element : elements) { if (element instanceof RepositoryNode) { result.add(((RepositoryNode) element).getRepository() .getDirectory().toString()); } } } return result; }

Target:
private List<File> getDirectoriesOfSelectedRepositoryNodes( ISelection selection) { List<File> result = new ArrayList<>(); if (selection instanceof StructuredSelection) { Object[] elements = ((StructuredSelection) selection).toArray(); for (Object element : elements) { if (element instanceof RepositoryNode) { result.add(((RepositoryNode) element).getRepository() .getDirectory()); } } } return result; }
Source:
public OrcidOAuth2AP(String clientId, String clientSecret, String userEndpoint) { String s = null; if(userEndpoint != null){ s = userEndpoint.startsWith("https://pub") ? "/authenticate" : "/read-limited"; } scope = Arrays.asList(s); this.clientId = clientId; this.clientSecret = clientSecret; this.baseUserEndpoint = userEndpoint; }

Target:
public OrcidOAuth2AP(String clientId, String clientSecret, String userEndpoint) { if(userEndpoint != null && userEndpoint.startsWith("https://pub")) { this.scope = Arrays.asList("/authenticate"); } else { this.scope = Arrays.asList("/read-limited"); } this.clientId = clientId; this.clientSecret = clientSecret; this.baseUserEndpoint = userEndpoint; }
Source:
private void showJavaVersionOutdatedWarning(JavaVersion runtimeVersion, JavaVersion requiredVersion) { String message = String.format(JavaVersion.OUTDATED_JAVA_VERSION_MESSAGE, requiredVersion.toString(), runtimeVersion.toString()); DialogMessage.showInformationDialog("Update your Java version", message); }

Target:
private void showJavaVersionOutdatedWarning(JavaVersion runtimeVersion, JavaVersion requiredVersion) { String message = String.format(WARNING_MSG_OUTDATED_JAVA_VERSION, requiredVersion.toString(), runtimeVersion.toString()); DialogMessage.showInformationDialog("Update your Java version", message); }
Source:
public Response doImport(Action action) { validateParameters(action, "storageDomain.id|name"); ImportRepoImageParameters importParameters = new ImportRepoImageParameters(); importParameters.setSourceRepoImageId(id); importParameters.setSourceStorageDomainId(getStorageDomainId()); importParameters.setStoragePoolId(getDataCenterId(getStorageDomainId(action))); importParameters.setStorageDomainId(getStorageDomainId(action)); if (action.isSetImportAsTemplate()) { if (action.isImportAsTemplate()) { validateParameters(action, "cluster.id|name"); importParameters.setClusterId(getClusterId(action)); if (action.isSetTemplate() && action.getTemplate().isSetName()) { importParameters.setTemplateName(action.getTemplate().getName()); } } importParameters.setImportAsTemplate(action.isImportAsTemplate()); } if (action.isSetDisk() && action.getDisk().isSetAlias()) { importParameters.setDiskAlias(action.getDisk().getAlias()); } return doAction(VdcActionType.ImportRepoImage, importParameters, action); }

Target:
public Response doImport(Action action) { validateParameters(action, "storageDomain.id|name"); ImportRepoImageParameters importParameters = new ImportRepoImageParameters(); importParameters.setSourceRepoImageId(id); importParameters.setSourceStorageDomainId(getStorageDomainId()); importParameters.setStoragePoolId(getDataCenterId(getStorageDomainId(action))); importParameters.setStorageDomainId(getStorageDomainId(action)); if (action.isSetImportAsTemplate()) { if (action.isImportAsTemplate()) { validateParameters(action, "cluster.id|name"); importParameters.setClusterId(getClusterId(action)); if (action.isSetTemplate() && action.getTemplate().isSetName()) { importParameters.setTemplateName(action.getTemplate().getName()); } } importParameters.setImportAsTemplate(action.isImportAsTemplate()); } if (action.isSetDisk()) { if (action.getDisk().isSetAlias()) { importParameters.setDiskAlias(action.getDisk().getAlias()); } if (action.getDisk().isSetName()) { importParameters.setDiskAlias(action.getDisk().getName()); } } return doAction(VdcActionType.ImportRepoImage, importParameters, action); }
Source:
public static ImmutableMap<String, String> getNormalizedObjectNames(final ImmutableList<Path> pipedFiles) { final ImmutableMap.Builder<String, String> map = ImmutableMap.builder(); for (final Path file : pipedFiles) { map.put(normalizeObjectName(file.toString()), file.toString()); } return map.build(); }

Target:
public static ImmutableMap<String, String> getNormalizedObjectNames(final ImmutableList<Path> pipedFiles) { final ImmutableList.Builder<String> fileNames = ImmutableList.builder(); for (final Path file : pipedFiles) { fileNames.add(file.toString()); } return normalizedObjectNames(fileNames.build()); }
Source:
public static String decrypt(String data, String key) { if (key == null || key.isEmpty() || data == null) { return data; } try { byte[] keyBytes = Base64.decode(key, Base64.DEFAULT); byte[] dataBytes = Base64.decode(data, Base64.DEFAULT); byte[] decryptedData = decrypt(dataBytes, 0, dataBytes.length, keyBytes); return new String(decryptedData, 0, decryptedData.length, UTF8); } catch (Exception ex) { Log.w("Encryptor:decrypt", "error during decryption", ex); } return null; }

Target:
public static String decrypt(String data, String key) { if (TextUtils.isEmpty(key) || data == null) { return data; } try { byte[] keyBytes = Base64.decode(key, Base64.DEFAULT); byte[] dataBytes = Base64.decode(data, Base64.DEFAULT); byte[] decryptedData = decrypt(dataBytes, 0, dataBytes.length, keyBytes); return new String(decryptedData, 0, decryptedData.length, UTF8); } catch (Exception ex) { Log.w("Encryptor:decrypt", "error during decryption", ex); } return null; }
Source:
public void convertModelToXML() throws Exception { BpmnModel bpmnModel = readXMLFile(); BpmnModel parsedModel = exportAndReadXMLFile(bpmnModel); validateModel(parsedModel); deployProcess(parsedModel); }

Target:
public void convertModelToXML() throws Exception { BpmnModel bpmnModel = readXMLFile(); BpmnModel parsedModel = exportAndReadXMLFile(bpmnModel); validateModel(parsedModel); }
Source:
public boolean hasIV(){ if(ivSize != null){ return true; } return false; }

Target:
public boolean hasIV(){ return ivSize != null; }
Source:
public void copyTo(TemplateOptions to) { super.copyTo(to); if (to instanceof EC2TemplateOptions) { EC2TemplateOptions eTo = EC2TemplateOptions.class.cast(to); if (getGroups().size() > 0) eTo.securityGroups(getGroups()); if (getKeyPair() != null) eTo.keyPair(getKeyPair()); if (getBlockDeviceMappings().size() > 0) eTo.blockDeviceMappings(getBlockDeviceMappings()); if (!shouldAutomaticallyCreateKeyPair()) eTo.noKeyPair(); if (getUserData() != null) eTo.userData(getUserData()); if (getMaxCount() != 0) eTo.maxCount(getMaxCount()); if (getClientToken() != null) eTo.clientToken(getClientToken()); } }

Target:
public void copyTo(TemplateOptions to) { super.copyTo(to); if (to instanceof EC2TemplateOptions) { EC2TemplateOptions eTo = EC2TemplateOptions.class.cast(to); if (getGroups().size() > 0) eTo.securityGroups(getGroups()); if (getKeyPair() != null) eTo.keyPair(getKeyPair()); if (getBlockDeviceMappings().size() > 0) eTo.blockDeviceMappings(getBlockDeviceMappings()); if (!shouldAutomaticallyCreateKeyPair()) eTo.noKeyPair(); if (getUserData() != null) eTo.userData(getUserData()); if (getMaxCount() > 0) eTo.maxCount(getMaxCount()); if (getClientToken() != null) eTo.clientToken(getClientToken()); } }
Source:
public Type getType(int field) { return type; }

Target:
public Type getType(int field) { throw new UnsupportedOperationException(); }
Source:
private static String createPropertiesText() { final StringBuilder result = new StringBuilder(100); result.append("\n<ul>"); for (List<Node> property : CHECK_PROPERTIES) { final String propertyName = getNodeText(property.get(0)); result.append("\n<li>\nProperty {@code "); result.append(propertyName); result.append("} - "); final String temp = getNodeText(property.get(1)); result.append(temp); CHECK_PROPERTY_DOC.put(propertyName, temp); String typeText = "java.lang.String[]"; final String propertyType = property.get(2).getTextContent(); final boolean isSpecialAllTokensType = propertyType.contains("all tokens"); final boolean isPropertyTokenType = isSpecialAllTokensType || propertyType.contains("subset of tokens") || propertyType.contains("subset of javadoc tokens"); if (!isPropertyTokenType) { final String typeName = getCorrectNodeBasedOnPropertyType(property).getTextContent().trim(); typeText = FULLY_QUALIFIED_CLASS_NAMES.get(typeName).getTypeName(); } if (isSpecialAllTokensType) { typeText = "allTokenTypes"; } result.append(" Type is {@code ").append(typeText).append("}."); if (!isSpecialAllTokensType) { final String validationType = getValidationType(isPropertyTokenType, propertyName); if (validationType != null) { result.append(validationType); } } result.append(getDefaultValueOfType(propertyName, isSpecialAllTokensType)); result.append(emptyStringArrayDefaultValue(property.get(3))); if (result.charAt(result.length() - 1) != '.') { result.append('.'); } result.append("\n</li>"); } result.append("\n</ul>"); return result.toString(); }

Target:
private static String createPropertiesText() { final StringBuilder result = new StringBuilder(100); result.append("\n<ul>"); for (List<Node> property : CHECK_PROPERTIES) { final String propertyName = getNodeText(property.get(0)); result.append("\n<li>\nProperty {@code "); result.append(propertyName); result.append("} - "); final String temp = getNodeText(property.get(1)); result.append(temp); CHECK_PROPERTY_DOC.put(propertyName, temp); String typeText = "java.lang.String[]"; final String propertyType = property.get(2).getTextContent(); final boolean isSpecialAllTokensType = propertyType.contains("set of any supported"); final boolean isPropertyTokenType = isSpecialAllTokensType || propertyType.contains("subset of tokens") || propertyType.contains("subset of javadoc tokens"); if (!isPropertyTokenType) { final String typeName = getCorrectNodeBasedOnPropertyType(property).getTextContent().trim(); typeText = FULLY_QUALIFIED_CLASS_NAMES.get(typeName).getTypeName(); } if (isSpecialAllTokensType) { typeText = "anyTokenTypesSet"; } result.append(" Type is {@code ").append(typeText).append("}."); if (!isSpecialAllTokensType) { final String validationType = getValidationType(isPropertyTokenType, propertyName); if (validationType != null) { result.append(validationType); } } result.append(getDefaultValueOfType(propertyName, isSpecialAllTokensType)); result.append(emptyStringArrayDefaultValue(property.get(3))); if (result.charAt(result.length() - 1) != '.') { result.append('.'); } result.append("\n</li>"); } result.append("\n</ul>"); return result.toString(); }
Source:
private static void validateRegion(String region) { if (region != null && region.isEmpty()) { throw new IllegalArgumentException("region cannot be empty"); } }

Target:
private void validateRegion(String region) { if (region != null && region.isEmpty()) { throw new IllegalArgumentException("region cannot be empty"); } }
Source:
private void initRevPool(boolean reverse) { if (queue != null) throw new IllegalStateException(); if (revPool != null) revPool.close(); if (reverse) revPool = new ReverseWalk(getRepository()); else revPool = new RevWalk(getRepository()); SEEN = revPool.newFlag("SEEN"); reader = revPool.getObjectReader(); treeWalk = new TreeWalk(getRepository(), reader); treeWalk.setRecursive(true); }

Target:
private void initRevPool(boolean reverse) { if (queue != null) throw new IllegalStateException(); if (revPool != null) revPool.close(); if (reverse) revPool = new ReverseWalk(getRepository()); else revPool = new RevWalk(getRepository()); SEEN = revPool.newFlag("SEEN"); reader = revPool.getObjectReader(); treeWalk = new TreeWalk(reader); treeWalk.setRecursive(true); }
Source:
public QueryResult<AnnotationSet> getAnnotationSet(String id, @Nullable String studyStr, String annotationSetName, String sessionId) throws CatalogException { if (annotationSetName.isEmpty()) { MyResourceId resource = commonGetAllAnnotationSets(id, studyStr, sessionId); return cohortDBAdaptor.getAnnotationSet(resource, null, StudyAclEntry.StudyPermissions.VIEW_COHORT_ANNOTATIONS.toString()); } else { MyResourceId resource = commonGetAnnotationSet(id, studyStr, annotationSetName, sessionId); return cohortDBAdaptor.getAnnotationSet(resource, annotationSetName, StudyAclEntry.StudyPermissions.VIEW_COHORT_ANNOTATIONS.toString()); } }

Target:
public QueryResult<AnnotationSet> getAnnotationSet(String id, @Nullable String studyStr, String annotationSetName, String sessionId) throws CatalogException { if (StringUtils.isEmpty(annotationSetName)) { MyResourceId resource = commonGetAllAnnotationSets(id, studyStr, sessionId); return cohortDBAdaptor.getAnnotationSet(resource, null, StudyAclEntry.StudyPermissions.VIEW_COHORT_ANNOTATIONS.toString()); } else { MyResourceId resource = commonGetAnnotationSet(id, studyStr, annotationSetName, sessionId); return cohortDBAdaptor.getAnnotationSet(resource, annotationSetName, StudyAclEntry.StudyPermissions.VIEW_COHORT_ANNOTATIONS.toString()); } }
Source:
public void onNext(final ActiveContext activeContext) { final String evaluatorId = activeContext.getEvaluatorId(); if (!idMap.containsKey(evaluatorId)) { LOG.warning("Failed to find a requestor for " + evaluatorId + ". Ignore " + activeContext.toString()); return; } final String requestorId = idMap.get(evaluatorId); if (requestorId.equals(DataLoader.class.getName())) { if (!groupCommDriver.isConfigured(activeContext)) { final Configuration finalContextConf = getContextConfiguration(); final Configuration finalServiceConf; if (dataLoadingService.isComputeContext(activeContext)) { LOG.log(Level.INFO, "Submitting GroupCommContext for ControllerTask to underlying context"); ctrlTaskContextId = getContextId(finalContextConf); finalServiceConf = getServiceConfiguration(); } else { LOG.log(Level.INFO, "Submitting GroupCommContext for ComputeTask to underlying context"); final Configuration dataParseConf = DataParseService.getServiceConfiguration(userJobInfo.getDataParser()); finalServiceConf = Configurations.merge(getServiceConfiguration(), dataParseConf); } activeContext.submitContextAndService(finalContextConf, finalServiceConf); } else { submitTask(activeContext, 0); } } else if (requestorId.equals(ElasticMemory.class.getName())) { emResouceCallbackManager.onCompleted(activeContext); } }

Target:
public void onNext(final ActiveContext activeContext) { final String evaluatorId = activeContext.getEvaluatorId(); final String requestorId = evalToRequestorMap.get(evaluatorId); if (requestorId == null) { LOG.warning("Failed to find a requestor for " + evaluatorId + ". Ignore " + activeContext); activeContext.close(); return; } if (requestorId.equals(DataLoader.class.getName())) { if (!groupCommDriver.isConfigured(activeContext)) { final Configuration finalContextConf = getContextConfiguration(); final Configuration finalServiceConf; if (dataLoadingService.isComputeContext(activeContext)) { LOG.log(Level.INFO, "Submitting GroupCommContext for ControllerTask to underlying context"); ctrlTaskContextId = getContextId(finalContextConf); finalServiceConf = getServiceConfiguration(); } else { LOG.log(Level.INFO, "Submitting GroupCommContext for ComputeTask to underlying context"); final Configuration dataParseConf = DataParseService.getServiceConfiguration(userJobInfo.getDataParser()); finalServiceConf = Configurations.merge(getServiceConfiguration(), dataParseConf); } activeContext.submitContextAndService(finalContextConf, finalServiceConf); } else { submitTask(activeContext, 0); } } else if (requestorId.equals(ElasticMemory.class.getName())) { emResourceRequestManager.onCompleted(activeContext); } else { LOG.warning("Unknown evaluator. Ignore " + activeContext); activeContext.close(); } }
Source:
public void authenticate(final AuthenticationFlowContext context) { final HttpRequest httpRequest = context.getHttpRequest(); final HttpHeaders httpHeaders = httpRequest.getHttpHeaders(); final String[] usernameAndPassword = getUsernameAndPassword(httpHeaders); context.attempted(); if (usernameAndPassword != null) { final RealmModel realm = context.getRealm(); final String username = usernameAndPassword[0]; final UserModel user = context.getSession().users().getUserByUsername(username, realm); if (user != null) { final String password = usernameAndPassword[1]; final boolean valid = context.getSession().userCredentialManager().isValid(realm, user, UserCredentialModel.password(password)); if (valid) { if (user.isEnabled()) { context.getClientSession().setAuthenticatedUser(user); context.success(); } else { userDisabledFailure(context, realm, user); } } else { authFailure(context, realm, user); } } else { handleNullUser(context, realm, username); } } }

Target:
public void authenticate(final AuthenticationFlowContext context) { final HttpRequest httpRequest = context.getHttpRequest(); final HttpHeaders httpHeaders = httpRequest.getHttpHeaders(); final String[] usernameAndPassword = getUsernameAndPassword(httpHeaders); context.attempted(); if (usernameAndPassword != null) { final RealmModel realm = context.getRealm(); final String username = usernameAndPassword[0]; final UserModel user = context.getSession().users().getUserByUsername(username, realm); if (user != null) { final String password = usernameAndPassword[1]; final boolean valid = context.getSession().userCredentialManager().isValid(realm, user, UserCredentialModel.password(password)); if (valid) { if (user.isEnabled()) { userSuccessAction(context, user); } else { userDisabledAction(context, realm, user); } } else { notValidCredentialsAction(context, realm, user); } } else { nullUserAction(context, realm, username); } } }
Source:
public Block readBlock(BlockEncodingSerde blockEncodingSerde, SliceInput sliceInput) { int positionCount = sliceInput.readInt(); byte[] values = new byte[positionCount]; if (!sliceInput.readBoolean()) { sliceInput.readBytes(wrappedBuffer(values)); return new ByteArrayBlock(0, positionCount, null, values); } boolean[] valueIsNull = new boolean[positionCount]; int nullPositions = decodeNullBits(sliceInput, valueIsNull); int nonNullPositions = positionCount - nullPositions; sliceInput.readBytes(wrappedBuffer(values), nonNullPositions * SIZE_OF_BYTE); int writePosition = values.length - 1; int readPosition = nonNullPositions - 1; while (readPosition >= 0) { values[writePosition] = values[readPosition]; readPosition -= valueIsNull[writePosition] ? 0 : 1; writePosition--; } return new ByteArrayBlock(0, positionCount, valueIsNull, values); }

Target:
public Block readBlock(BlockEncodingSerde blockEncodingSerde, SliceInput sliceInput) { int positionCount = sliceInput.readInt(); byte[] values = new byte[positionCount]; if (!sliceInput.readBoolean()) { sliceInput.readBytes(values); return new ByteArrayBlock(0, positionCount, null, values); } boolean[] valueIsNull = new boolean[positionCount]; int nullPositions = decodeNullBits(sliceInput, valueIsNull); int nonNullPositions = positionCount - nullPositions; sliceInput.readBytes(values, 0, nonNullPositions * SIZE_OF_BYTE); int writePosition = values.length - 1; int readPosition = nonNullPositions - 1; while (readPosition >= 0) { values[writePosition] = values[readPosition]; readPosition -= valueIsNull[writePosition] ? 0 : 1; writePosition--; } return new ByteArrayBlock(0, positionCount, valueIsNull, values); }
Source:
public void testTextIn() { try { fixture.setDirectory(testResourcesDir); assertEquals("# Expected as first line of text.\n# Expected as 2nd line of text.", fixture.textIn(txtFilename)); fixture.textIn("foobar"); } catch (SlimFixtureException sfe) { assertEquals("message:<<Unable to find: " + testResourcesDir + "foobar>>", sfe.getMessage()); } catch (IOException ioe) { assertFalse("Should not happen.", true); } }

Target:
public void testTextIn() { try { fixture.setDirectory(testResourcesDir); assertEquals("# Expected as first line of text.\n# Expected as 2nd line of text.", fixture.textIn(txtFilename)); fixture.textIn("foobar"); } catch (SlimFixtureException sfe) { assertEquals("message:<<Unable to find: " + testResourcesDir + "foobar>>", sfe.getMessage()); } catch (IOException ioe) { fail("Should not happen."); } }
Source:
public Mono<Response<ShareProperties>> getPropertiesWithResponse() { try { return withContext(context -> getPropertiesWithResponse(new ShareGetPropertiesOptions(), context)); } catch (RuntimeException ex) { return monoError(logger, ex); } }

Target:
public Mono<Response<ShareProperties>> getPropertiesWithResponse() { try { return getPropertiesWithResponse(new ShareGetPropertiesOptions()); } catch (RuntimeException ex) { return monoError(logger, ex); } }
Source:
public static void main(String[] args) throws NumberFormatException, HyracksException, Exception { GenomixJobConf conf; try { conf = GenomixJobConf.fromArguments(args); String pathToConf = conf.get(GenomixJobConf.CONF_INPUT); if(pathToConf != ""){ for (String singleConf : pathToConf.split(",")) { LOG.info("Read job config from " + singleConf); conf.addResource(new Path(singleConf)); } } } catch (CmdLineException ex) { System.err.println("Usage: bin/genomix [options]\n"); ex.getParser().setUsageWidth(80); ex.getParser().printUsage(System.err); System.err.println("\nExample:"); System.err .println("\tbin/genomix -kmerLength 55 -pipelineOrder BUILD_HYRACKS,MERGE,TIP_REMOVE,MERGE,BUBBLE,MERGE -localInput /path/to/readfiledir/\n"); System.err.println(ex.getMessage()); return; } GenomixDriver driver = new GenomixDriver(); try { driver.runGenomix(conf); } catch (Exception e) { e.printStackTrace(); throw e; } finally { if (Boolean.parseBoolean(conf.get(GenomixJobConf.RUN_LOCAL))) { System.exit(0); } } }

Target:
public static void main(String[] args) throws NumberFormatException, HyracksException, Exception { GenomixJobConf conf; try { conf = GenomixJobConf.fromArguments(args); String pathToExtraConfFiles = conf.get(GenomixJobConf.EXTRA_CONF_FILES); if (pathToExtraConfFiles != "") { for (String extraConf : pathToExtraConfFiles.split(",")) { LOG.info("Read job config from " + extraConf); for (Map.Entry<String, String> entry : new JobConf(extraConf)) { conf.setIfUnset(entry.getKey(), entry.getValue()); } } } } catch (CmdLineException ex) { System.err.println("Usage: bin/genomix [options]\n"); ex.getParser().setUsageWidth(80); ex.getParser().printUsage(System.err); System.err.println("\nExample:"); System.err .println("\tbin/genomix -kmerLength 55 -pipelineOrder BUILD_HYRACKS,MERGE,TIP_REMOVE,MERGE,BUBBLE,MERGE -localInput /path/to/readfiledir/\n"); System.err.println(ex.getMessage()); return; } GenomixDriver driver = new GenomixDriver(); try { driver.runGenomix(conf); } catch (Exception e) { e.printStackTrace(); throw e; } finally { if (Boolean.parseBoolean(conf.get(GenomixJobConf.RUN_LOCAL))) { System.exit(0); } } }
Source:
public PartialList<Comment> getComments(CoreSession s, String documentId, Long pageSize, Long currentPageIndex, boolean sortAscending) { DocumentModel documentModel = s.getDocument(new IdRef(documentId)); return CoreInstance.doPrivileged(s, session -> { PageProvider<DocumentModel> pageProvider = getCommentsPageProvide(session, documentModel, pageSize, currentPageIndex, sortAscending); List<DocumentModel> commentList = pageProvider.getCurrentPage(); return commentList.stream() .map(Comments::newComment) .collect(collectingAndThen(toList(), list -> new PartialList<>(list, pageProvider.getResultsCount()))); }); }

Target:
public PartialList<Comment> getComments(CoreSession s, String documentId, Long pageSize, Long currentPageIndex, boolean sortAscending) { IdRef docRef = new IdRef(documentId); boolean exists = CoreInstance.doPrivileged(s, session -> { return session.exists(docRef); }); if (!exists) { return new PartialList<>(Collections.emptyList(), 0); } checkReadCommentPermissions(s, new IdRef(documentId)); DocumentModel documentModel = s.getDocument(docRef); return CoreInstance.doPrivileged(s, session -> { PageProvider<DocumentModel> pageProvider = getCommentsPageProvider(session, documentModel, pageSize, currentPageIndex, sortAscending); List<DocumentModel> commentList = pageProvider.getCurrentPage(); return commentList.stream() .map(Comments::newComment) .collect(collectingAndThen(toList(), list -> new PartialList<>(list, pageProvider.getResultsCount()))); }); }
Source:
public void setDigestAlgorithm(String digestMethod) { if (Arrays.stream(VALID_DIGEST_ALGORITHMS.split("\\s*,\\s*")).noneMatch(digestMethod.toUpperCase()::equals)) { throw new SlimFixtureException(false, "Invalid digest method: " + digestMethod.toUpperCase() + ". Valid options: " + Arrays.toString(VALID_DIGEST_ALGORITHMS.split("\\s*,\\s*"))); } signatureDigestAlgorithm = getStringValueFromField(DigestMethod.class, digestMethod.toUpperCase()); }

Target:
public void setDigestAlgorithm(String digestMethod) { if (Arrays.stream(VALID_DIGEST_ALGORITHMS.split("\\s*,\\s*")).noneMatch(digestMethod.toUpperCase()::equals)) { throw new SlimFixtureException(false, "Invalid digest method: " + digestMethod.toUpperCase() + ". Valid options: " + VALID_DIGEST_ALGORITHMS); } signatureDigestAlgorithm = getStringValueFromField(DigestMethod.class, digestMethod.toUpperCase()); }
Source:
public String toString() { return String.format("short@0x%x=0x%x (%d)", Pointer.nativeValue(getPointer()), getValue(), getValue()); }

Target:
public String toString() { return String.format("short@0x%1$x=0x%2$x (%2$d)", Pointer.nativeValue(getPointer()), getValue()); }
Source:
public int readFromFile(JDBCSequentialFile file, ByteBuffer bytes) throws SQLException { Object largeObject = null; long oid = getOID(file); try (Connection connection = connectionProvider.getConnection()) { try { connection.setAutoCommit(false); largeObject = largeObjectManager.open(connection, oid, PostgresLargeObjectManager.READ); int readLength = (int) calculateReadLength(largeObjectManager.size(largeObject), bytes.remaining(), file.position()); if (readLength > 0) { if (file.position() > 0) { largeObjectManager.seek(largeObject, (int) file.position()); } byte[] data = largeObjectManager.read(largeObject, readLength); bytes.put(data); } largeObjectManager.close(largeObject); connection.commit(); return readLength; } catch (SQLException e) { connection.rollback(); throw e; } } }

Target:
public int readFromFile(JDBCSequentialFile file, ByteBuffer bytes) throws SQLException { long oid = getOID(file); try (Connection connection = connectionProvider.getConnection()) { try { connection.setAutoCommit(false); Object largeObject = largeObjectManager.open(connection, oid, PostgresLargeObjectManager.READ); int readLength = (int) calculateReadLength(largeObjectManager.size(largeObject), bytes.remaining(), file.position()); if (readLength > 0) { if (file.position() > 0) { largeObjectManager.seek(largeObject, (int) file.position()); } byte[] data = largeObjectManager.read(largeObject, readLength); bytes.put(data); } largeObjectManager.close(largeObject); connection.commit(); return readLength; } catch (SQLException e) { connection.rollback(); throw e; } } }
Source:
public RemoteBitrateEstimatorAbsSendTime(RemoteBitrateObserver observer, AbsSendTimeEngine absSendTimeEngine) { super(RTPPacketPredicate.INSTANCE); this.absoluteSendTimeEngine = absSendTimeEngine; this.observer_ = observer; this.interArrival = new InterArrival(90 * kTimestampGroupLengthMs, kTimestampToMs, true); this.estimator = new OveruseEstimator(new OverUseDetectorOptions()); this.detector = new OveruseDetector(new OverUseDetectorOptions()); this.incomingBitrate = new RateStatistics(kBitrateWindowMs, 8000F); this.incomingBitrateInitialized = false; this.totalProbesReceived = 0; this.firstPacketTimeMs = -1; this.lastUpdateMs = -1; logger.info("; RemoteBitrateEstimatorAbsSendTime: Calling."); }

Target:
public RemoteBitrateEstimatorAbsSendTime(RemoteBitrateObserver observer, AbsSendTimeEngine absSendTimeEngine) { super(RTPPacketPredicate.INSTANCE); this.absoluteSendTimeEngine = absSendTimeEngine; this.observer_ = observer; this.interArrival = new InterArrival(90 * kTimestampGroupLengthMs, kTimestampToMs, true); this.estimator = new OveruseEstimator(new OverUseDetectorOptions()); this.detector = new OveruseDetector(new OverUseDetectorOptions()); this.incomingBitrate = new RateStatistics(kBitrateWindowMs, 8000F); this.incomingBitrateInitialized = false; this.totalProbesReceived = 0; this.firstPacketTimeMs = -1; this.lastUpdateMs = -1; if (logger.isDebugEnabled()) { logger.debug("RemoteBitrateEstimatorAbsSendTime: Active."); } }
Source:
public void enterWrongBlurryWord() { String word = getTimeStamp(); blurryWordField.sendKeys(word); }

Target:
public void enterWrongBlurryWord(){ String word = getTimeStamp(); blurryWordField.sendKeys(word); PageObjectLogging.log("enterWrongBlurryWord ", "Blurry word field populated incorrectly", true); }
Source:
public ObjectMapperContextResolver() { mapper = new ObjectMapper(); SimpleModule module = new SimpleModule(); module.addDeserializer(Instant.class, new InstantDeserializer()); module.addSerializer(new InstantSerializer()); mapper.registerModule(module); mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); }

Target:
public ObjectMapperContextResolver() { mapper = new ObjectMapper(); mapper.registerModule(new JavaTimeModule()); mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); }
Source:
private String getCheckYear(PaymentGroup paymentGroup) { String checkYear = KFSConstants.getDashSubAccountNumber(); try { CheckReconciliation checkReconciliation = checkReconciliationDao.findByCheckNumber(paymentGroup.getDisbursementNbr().toString()); Calendar calendar = Calendar.getInstance(); if (ObjectUtils.isNotNull(checkReconciliation) && ObjectUtils.isNotNull(checkReconciliation.getCheckDate())) { calendar.setTime(checkReconciliation.getCheckDate()); checkYear = Integer.toString(calendar.get(Calendar.YEAR)); } } catch(Exception ex) { LOG.error("getCheckYear", ex); } return StringUtils.isBlank(checkYear) ? KFSConstants.getDashSubAccountNumber() : checkYear; }

Target:
private String getCheckYear(PaymentGroup paymentGroup) { String checkYear = KFSConstants.getDashSubAccountNumber(); try { CheckReconciliation checkReconciliation = checkReconciliationDao.findByCheckNumber(paymentGroup.getDisbursementNbr().toString()); Calendar calendar = Calendar.getInstance(); if (ObjectUtils.isNotNull(checkReconciliation) && ObjectUtils.isNotNull(checkReconciliation.getCheckDate())) { calendar.setTime(checkReconciliation.getCheckDate()); checkYear = Integer.toString(calendar.get(Calendar.YEAR)); } else { LOG.error("getCheckYear", "Failed getting year check was issued, defaulting clearing subaccount to dashes."); } } catch(Exception ex) { LOG.error("getCheckYear", ex); } return checkYear; }