auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private boolean CanRunOnDestinationVds(List<String> messages, boolean isMigrate) { boolean returnValue = false; if (getDestinationVdsId() != null) { VDS target_vds = DbFacade.getInstance().getVdsDAO().get(getDestinationVdsId()); log.infoFormat("Checking for a specific VDS only - id:{0}, name:{1}, host_name(ip):{2}", getDestinationVdsId(), target_vds.getvds_name(), target_vds.gethost_name()); returnValue = CanFindVdsToRun(messages, isMigrate, new ArrayList<VDS>(Arrays.asList(new VDS[] { target_vds }))); } return returnValue; }

Target:
private boolean CanRunOnDestinationVds(List<String> messages, boolean isMigrate) { boolean returnValue = false; if (getDestinationVdsId() != null) { VDS target_vds = DbFacade.getInstance().getVdsDAO().get(getDestinationVdsId()); log.infoFormat("Checking for a specific VDS only - id:{0}, name:{1}, host_name(ip):{2}", getDestinationVdsId(), target_vds.getvds_name(), target_vds.gethost_name()); returnValue = CanFindVdsToRun(messages, isMigrate, Arrays.asList(new VDS[] { target_vds })); } return returnValue; }
Source:
private void showColorPicker(View view) { AppCompatActivity activity = UiUtils.getActivityFromView(view); FragmentManager fragmentManager = activity.getSupportFragmentManager(); if (!fragmentManager.isStateSaved()) { int currentColor = getCurrentColor(); ColorPickerDialog dialog = ColorPickerDialog.newInstance(currentColor); dialog.addOnColorPickedListener(newColor -> setNewColor(activity, newColor)); dialog.setStyle(STYLE_NORMAL, R.style.AlertDialogWithTitle); dialog.show(fragmentManager, null); } }

Target:
private void showColorPicker(View view) { AppCompatActivity activity = UiUtils.getActivityFromView(view); if (activity == null) { return; } FragmentManager fragmentManager = activity.getSupportFragmentManager(); if (!fragmentManager.isStateSaved()) { int currentColor = getCurrentColor(); ColorPickerDialog dialog = ColorPickerDialog.newInstance(currentColor); dialog.addOnColorPickedListener(newColor -> setNewColor(activity, newColor)); dialog.setStyle(STYLE_NORMAL, R.style.AlertDialogWithTitle); dialog.show(fragmentManager, null); } }
Source:
public XmlTimeGraphView() { super(ID, new XmlPresentationProvider(ID), XmlTimeGraphDataProvider.ID); setWeight(fWeight); setTreeColumns(DEFAULT_COLUMN_NAMES); setTreeLabelProvider(new XmlTreeLabelProvider()); setFilterColumns(DEFAULT_FILTER_COLUMN_NAMES); setFilterLabelProvider(new XmlTreeLabelProvider()); setEntryComparator(ENTRY_COMPARATOR); addPartPropertyListener(event -> { Object newValue = event.getNewValue(); if (event.getProperty().equals(TmfXmlStrings.XML_OUTPUT_DATA) && newValue instanceof String) { String data = (String) newValue; fViewInfo.setViewData(data); rebuild(); } }); }

Target:
public XmlTimeGraphView() { super(ID, new XmlPresentationProvider(ID), XmlTimeGraphDataProvider.ID); setWeight(fWeight); setTreeColumns(DEFAULT_COLUMN_NAMES); setTreeLabelProvider(new XmlTreeLabelProvider()); setFilterColumns(DEFAULT_FILTER_COLUMN_NAMES); setFilterLabelProvider(new XmlTreeLabelProvider()); setEntryComparator(ENTRY_COMPARATOR); addPartPropertyListener(event -> { Object newValue = event.getNewValue(); if (event.getProperty().equals(TmfXmlStrings.XML_OUTPUT_DATA) && newValue instanceof String) { String data = (String) newValue; fViewInfo.setViewData(data); TimeGraphViewer timeGraphViewer = getTimeGraphViewer(); timeGraphViewer.getTimeGraphControl().colorSettingsChanged(timeGraphViewer.getTimeGraphProvider().getStateTable()); rebuild(); } }); }
Source:
public void resolveDate() throws Exception { Git git = new Git(db); writeTrashFile("file.txt", "content"); git.add().addFilepattern("file.txt").call(); git.commit().setMessage("create file").call(); try { db.resolve("master@{yesterday}"); fail("Exception not thrown"); } catch (IOException e) { assertNotNull(e); } }

Target:
public void resolveDate() throws Exception { Git git = new Git(db); writeTrashFile("file.txt", "content"); git.add().addFilepattern("file.txt").call(); git.commit().setMessage("create file").call(); try { db.resolve("master@{yesterday}"); fail("Exception not thrown"); } catch (RevisionSyntaxException e) { assertNotNull(e); } }
Source:
private void logSummary(StringBuilder sb, Deque<Item> log, String indentStr) { final int txnIdsPerLine = 15; Iterator<Item> itemator = log.iterator(); for (int lineCnt = 0; lineCnt <= (log.size() / txnIdsPerLine); lineCnt++) { sb.append(indentStr); for(int i = 0; i < txnIdsPerLine; i++) { if (itemator.hasNext()) { Item item = itemator.next(); long txnId = item.getTxnId(); String msgType = "U"; if (item.getMessage() instanceof FragmentTaskMessage) { msgType = "F"; } else if (item.getMessage() instanceof Iv2InitiateTaskMessage) { msgType = "I"; } else if (item.getMessage() instanceof CompleteTransactionMessage) { CompleteTransactionMessage ctm = (CompleteTransactionMessage)item.getMessage(); if (ctm.getTimestamp() == CompleteTransactionMessage.INITIAL_TIMESTAMP) { msgType = "C(I)"; } else if (ctm.isRollback()) { msgType = "C(R)"; } else { msgType = "C"; } } else if (item.getMessage() instanceof DummyTransactionTaskMessage) { msgType = "D"; } sb.append(" ").append(TxnEgo.txnIdSeqToString(txnId)).append(msgType); } } } }

Target:
private void logSummary(StringBuilder sb, Deque<Item> log, String indentStr) { final int txnIdsPerLine = 15; Iterator<Item> itemator = log.iterator(); for (int lineCnt = 0; lineCnt <= (log.size() / txnIdsPerLine); lineCnt++) { sb.append(indentStr); for(int i = 0; i < txnIdsPerLine; i++) { if (itemator.hasNext()) { Item item = itemator.next(); long txnId = item.getTxnId(); String msgType = "U"; VoltMessage msg = item.getMessage(); if (msg instanceof FragmentTaskMessage) { msgType = "F"; } else if (msg instanceof Iv2InitiateTaskMessage) { msgType = "I"; } else if (msg instanceof CompleteTransactionMessage) { CompleteTransactionMessage ctm = (CompleteTransactionMessage)msg; if (ctm.getTimestamp() == CompleteTransactionMessage.INITIAL_TIMESTAMP) { msgType = "C(I)"; } else if (ctm.isRollback()) { msgType = "C(R)"; } else { msgType = "C"; } } else if (msg instanceof DummyTransactionTaskMessage) { msgType = "D"; } sb.append(" ").append(TxnEgo.txnIdSeqToString(txnId)).append(msgType); } } } }
Source:
public void ifSubschemaSuccessThenSubschemaFailure() { ConditionalSchema subject = buildWithLocation(ConditionalSchema.builder().ifSchema(MAX_LENGTH_STRING_SCHEMA).thenSchema(PATTERN_STRING_SCHEMA)); TestSupport.failureOf(subject) .expectedKeyword("then") .expectedPointer("#") .expectedViolatedSchema(subject) .input("bar") .expect(); }

Target:
public void ifSubschemaSuccessThenSubschemaFailure() { ConditionalSchema.Builder subject = ConditionalSchema.builder().ifSchema(MAX_LENGTH_STRING_SCHEMA).thenSchema(PATTERN_STRING_SCHEMA); TestSupport.failureOf(subject) .expectedKeyword("then") .expectedPointer("#") .input("bar") .expect(); }
Source:
public EC2AutoScaler( @JsonProperty("minNumWorkers") int minNumWorkers, @JsonProperty("maxNumWorkers") int maxNumWorkers, @JsonProperty("envConfig") EC2EnvironmentConfig envConfig, @JacksonInject AmazonEC2 amazonEC2Client, @JacksonInject SimpleResourceManagementConfig config ) { this.minNumWorkers = minNumWorkers; this.maxNumWorkers = maxNumWorkers; this.envConfig = envConfig; this.amazonEC2Client = amazonEC2Client; this.config = config; try { amazonEC2Client.setRegion(RegionUtils.getRegion(envConfig.getRegion())); } catch (Exception e) { log.warn(String.format("Attempting to set an invalid region: %s", envConfig.getRegion()), e); } }

Target:
public EC2AutoScaler( @JsonProperty("minNumWorkers") int minNumWorkers, @JsonProperty("maxNumWorkers") int maxNumWorkers, @JsonProperty("envConfig") EC2EnvironmentConfig envConfig, @JacksonInject AmazonEC2 amazonEC2Client, @JacksonInject SimpleResourceManagementConfig config ) { this.minNumWorkers = minNumWorkers; this.maxNumWorkers = maxNumWorkers; this.envConfig = envConfig; this.amazonEC2Client = amazonEC2Client; this.config = config; }
Source:
public void close() { closed = true; super.close(); }

Target:
public void close() { if ( closed.compareAndSet( false, true ) ) { super.close(); } }
Source:
public CopyImageToHMDNode(Context context) { displayResolutionDependentFBOs = context.get(DisplayResolutionDependentFBOs.class); worldRenderer = context.get(WorldRenderer.class); vrProvider = context.get(OpenVRProvider.class); renderingConfig = context.get(Config.class).getRendering(); requiresCondition(() -> (renderingConfig.isVrSupport() && vrProvider.isInitialized())); requiresFBO(new FBOConfig(LEFT_EYE_FBO, FULL_SCALE, FBO.Type.DEFAULT).useDepthBuffer(), displayResolutionDependentFBOs); requiresFBO(new FBOConfig(RIGHT_EYE_FBO, FULL_SCALE, FBO.Type.DEFAULT).useDepthBuffer(), displayResolutionDependentFBOs); if (vrProvider != null) { vrProvider.texType[0].handle = leftEyeFbo.colorBufferTextureId; vrProvider.texType[0].eColorSpace = JOpenVRLibrary.EColorSpace.EColorSpace_ColorSpace_Gamma; vrProvider.texType[0].eType = JOpenVRLibrary.EGraphicsAPIConvention.EGraphicsAPIConvention_API_OpenGL; vrProvider.texType[0].write(); vrProvider.texType[1].handle = rightEyeFbo.colorBufferTextureId; vrProvider.texType[1].eColorSpace = JOpenVRLibrary.EColorSpace.EColorSpace_ColorSpace_Gamma; vrProvider.texType[1].eType = JOpenVRLibrary.EGraphicsAPIConvention.EGraphicsAPIConvention_API_OpenGL; vrProvider.texType[1].write(); } update(); displayResolutionDependentFBOs.subscribe(this); addDesiredStateChange(new EnableMaterial(DEFAULT_TEXTURED_MATERIAL)); }

Target:
public CopyImageToHMDNode(Context context) { super(context); worldRenderer = context.get(WorldRenderer.class); vrProvider = context.get(OpenVRProvider.class); requiresCondition(() -> (context.get(Config.class).getRendering().isVrSupport() && vrProvider.isInitialized())); displayResolutionDependentFBOs = context.get(DisplayResolutionDependentFBOs.class); requiresFBO(new FBOConfig(LEFT_EYE_FBO, FULL_SCALE, FBO.Type.DEFAULT).useDepthBuffer(), displayResolutionDependentFBOs); requiresFBO(new FBOConfig(RIGHT_EYE_FBO, FULL_SCALE, FBO.Type.DEFAULT).useDepthBuffer(), displayResolutionDependentFBOs); update(); displayResolutionDependentFBOs.subscribe(this); if (vrProvider != null) { vrProvider.texType[0].handle = leftEyeFbo.colorBufferTextureId; vrProvider.texType[0].eColorSpace = JOpenVRLibrary.EColorSpace.EColorSpace_ColorSpace_Gamma; vrProvider.texType[0].eType = JOpenVRLibrary.EGraphicsAPIConvention.EGraphicsAPIConvention_API_OpenGL; vrProvider.texType[0].write(); vrProvider.texType[1].handle = rightEyeFbo.colorBufferTextureId; vrProvider.texType[1].eColorSpace = JOpenVRLibrary.EColorSpace.EColorSpace_ColorSpace_Gamma; vrProvider.texType[1].eType = JOpenVRLibrary.EGraphicsAPIConvention.EGraphicsAPIConvention_API_OpenGL; vrProvider.texType[1].write(); } addDesiredStateChange(new EnableMaterial(DEFAULT_TEXTURED_MATERIAL)); }
Source:
public static Term sub(Term term1, Term term2, TermContext context) { if (term1.equals(UninterpretedToken.of("#Float","0.0"))) { Context context1 = context.definition().context(); return new KItem( KLabelConstant.of("'--Float_",context1), new KList(ImmutableList.<Term>of(term2),null), context).evaluate(context); } if (term2.equals(UninterpretedToken.of("#Float","0.0"))) return term1; return null; }

Target:
public static Term sub(Term term1, Term term2, TermContext context) { if (term1.equals(UninterpretedToken.of("#Float","0.0"))) { return new KItem( KLabelConstant.of("'--Float_",context), new KList(ImmutableList.<Term>of(term2),null), context).evaluate(context); } if (term2.equals(UninterpretedToken.of("#Float","0.0"))) return term1; return null; }
Source:
private void createKerberosConfiguration(DomainsConfigurationEntry gssapiDomains, Map<String, List<String>> ldapServersPerGSSAPIDomains) throws ManageDomainsResult { if (!gssapiDomains.isEntryEmpty()) { String gssapiDomainsString = gssapiDomains.getDomainsConfigurationEntry(); KrbConfCreator krbConfCreator; try { log.info("Creating kerberos configuration for domain(s): " + gssapiDomainsString); useDnsLookup = utilityConfiguration.getUseDnsLookup(); if (args.contains(ARG_LDAP_SERVERS)) { krbConfCreator = new KrbConfCreator(gssapiDomainsString, useDnsLookup, ldapServersPerGSSAPIDomains); } else { krbConfCreator = new KrbConfCreator(gssapiDomainsString, useDnsLookup, Collections.EMPTY_MAP); } StringBuffer buffer = null; buffer = krbConfCreator.parse("y"); krbConfCreator.toFile(utilityConfiguration.getkrb5confFilePath() + TESTING_KRB5_CONF_SUFFIX, buffer); log.info("Successfully created kerberos configuration for domain(s): " + gssapiDomainsString); } catch (Exception ex) { ManageDomainsResult result = new ManageDomainsResult(ManageDomainsResultEnum.FAILURE_CREATING_KERBEROS_CONFIGURATION, ex.getMessage()); throw result; } } }

Target:
private void createKerberosConfiguration(DomainsConfigurationEntry gssapiDomains, Map<String, List<String>> ldapServersPerGSSAPIDomains) throws ManageDomainsResult { if (!gssapiDomains.isEntryEmpty()) { String gssapiDomainsString = gssapiDomains.getDomainsConfigurationEntry(); KrbConfCreator krbConfCreator; try { log.info("Creating kerberos configuration for domain(s): " + gssapiDomainsString); useDnsLookup = utilityConfiguration.getUseDnsLookup(); if (!args.contains(ARG_LDAP_SERVERS) && useDnsLookup) { ldapServersPerGSSAPIDomains = Collections.emptyMap(); } krbConfCreator = new KrbConfCreator(gssapiDomainsString, useDnsLookup, ldapServersPerGSSAPIDomains); StringBuffer buffer = null; buffer = krbConfCreator.parse("y"); krbConfCreator.toFile(utilityConfiguration.getkrb5confFilePath() + TESTING_KRB5_CONF_SUFFIX, buffer); log.info("Successfully created kerberos configuration for domain(s): " + gssapiDomainsString); } catch (Exception ex) { ManageDomainsResult result = new ManageDomainsResult(ManageDomainsResultEnum.FAILURE_CREATING_KERBEROS_CONFIGURATION, ex.getMessage()); throw result; } } }
Source:
protected void parseReverseMethod(String output) { if (output.toString().contains("Processor")) { fReverseMethod = ReverseTraceMethod.PROCESSOR_TRACE; } else if (output.toString().contains("Branch")) { fReverseMethod = ReverseTraceMethod.BRANCH_TRACE; } else if (output.toString().contains("full")) { fReverseMethod = ReverseTraceMethod.FULL_TRACE; } else { fReverseMethod = ReverseTraceMethod.STOP_TRACE; } }

Target:
protected void parseReverseMethod(String output) { if (output.contains("Processor")) { fReverseMethod = ReverseTraceMethod.PROCESSOR_TRACE; } else if (output.contains("Branch")) { fReverseMethod = ReverseTraceMethod.BRANCH_TRACE; } else if (output.contains("full")) { fReverseMethod = ReverseTraceMethod.FULL_TRACE; } else { fReverseMethod = ReverseTraceMethod.STOP_TRACE; } }
Source:
public void countByIdAfter() { Long count = this.personRepository.countByIdAfter("2000"); assertThat("Oscars began in 1928", count, equalTo(15L)); }

Target:
public void countByIdAfter() { Long count = this.personRepository.countByIdAfter("2000"); assertThat("> 2000 & <= 2015 ", count, equalTo(15L)); }
Source:
public ITmfStateValue getValue(ITmfEvent event) throws AttributeNotFoundException { ITmfStateValue value = TmfStateValue.nullValue(); int quarkQuery = -1; ITmfStateSystemBuilder ss = fProvider.getAssignedStateSystem(); for (TmfXmlStateAttribute attribute : fQueryValue) { quarkQuery = attribute.getAttributeQuark(event, quarkQuery); if (quarkQuery == -1) { break; } } if (quarkQuery != -1) { value = ss.queryOngoingState(quarkQuery); } return value; }

Target:
public ITmfStateValue getValue(ITmfEvent event) throws AttributeNotFoundException { ITmfStateValue value = TmfStateValue.nullValue(); int quarkQuery = XmlStateProvider.ROOT_QUARK; ITmfStateSystem ss = fProvider.getAssignedStateSystem(); for (TmfXmlStateAttribute attribute : fQueryValue) { quarkQuery = attribute.getAttributeQuark(event, quarkQuery); if (quarkQuery == XmlStateProvider.ERROR_QUARK) { break; } } if (quarkQuery != XmlStateProvider.ERROR_QUARK) { value = ss.queryOngoingState(quarkQuery); } return value; }
Source:
private static VerifiableProperties buildFrontendVProps(File trustStoreFile) throws IOException, GeneralSecurityException { Properties properties = new Properties(); properties.put("rest.server.blob.storage.service.factory", "com.github.ambry.frontend.AmbryBlobStorageServiceFactory"); properties.put("rest.server.router.factory", "com.github.ambry.router.InMemoryRouterFactory"); properties.put("rest.server.account.service.factory", "com.github.ambry.account.InMemAccountServiceFactory"); properties.put("netty.server.port", Integer.toString(PLAINTEXT_SERVER_PORT)); properties.put("netty.server.ssl.port", Integer.toString(SSL_SERVER_PORT)); properties.put("netty.server.enable.ssl", "true"); properties.put(NettyConfig.SSL_FACTORY_KEY, NettySslFactory.class.getName()); properties.put("netty.server.request.buffer.watermark", "1"); properties.put("netty.multipart.post.max.size.bytes", Long.toString(MAX_MULTIPART_POST_SIZE_BYTES)); CommonTestUtils.populateRequiredRouterProps(properties); TestSSLUtils.addSSLProperties(properties, "", SSLFactory.Mode.SERVER, trustStoreFile, "frontend", null); properties.put("kms.default.container.key", TestUtils.getRandomKey(32)); properties.setProperty("clustermap.cluster.name", CLUSTER_NAME); properties.setProperty("clustermap.datacenter.name", DATA_CENTER_NAME); properties.setProperty("clustermap.host.name", HOST_NAME); return new VerifiableProperties(properties); }

Target:
private static VerifiableProperties buildFrontendVProps(File trustStoreFile) throws IOException, GeneralSecurityException { Properties properties = new Properties(); properties.put("rest.server.blob.storage.service.factory", "com.github.ambry.frontend.AmbryBlobStorageServiceFactory"); properties.put("rest.server.router.factory", "com.github.ambry.router.InMemoryRouterFactory"); properties.put("rest.server.account.service.factory", "com.github.ambry.account.InMemAccountServiceFactory"); properties.put("netty.server.port", Integer.toString(PLAINTEXT_SERVER_PORT)); properties.put("netty.server.ssl.port", Integer.toString(SSL_SERVER_PORT)); properties.put("netty.server.enable.ssl", "true"); properties.put(NettyConfig.SSL_FACTORY_KEY, NettySslFactory.class.getName()); properties.put("netty.server.request.buffer.watermark", "1"); properties.put("netty.multipart.post.max.size.bytes", Long.toString(MAX_MULTIPART_POST_SIZE_BYTES)); CommonTestUtils.populateRequiredRouterProps(properties); TestSSLUtils.addSSLProperties(properties, "", SSLFactory.Mode.SERVER, trustStoreFile, "frontend"); properties.put("kms.default.container.key", TestUtils.getRandomKey(32)); properties.setProperty("clustermap.cluster.name", CLUSTER_NAME); properties.setProperty("clustermap.datacenter.name", DATA_CENTER_NAME); properties.setProperty("clustermap.host.name", HOST_NAME); return new VerifiableProperties(properties); }
Source:
private PatchSetComplexDisclosurePanel(final ChangeScreen parent, final ChangeDetail detail, final PatchSet ps, boolean isOpen) { super(Util.M.patchSetHeader(ps.getPatchSetId()), isOpen); changeScreen = parent; changeDetail = detail; patchSet = ps; body = new FlowPanel(); setContent(body); final GitwebLink gw = Gerrit.getConfig().getGitwebLink(); final InlineLabel revtxt = new InlineLabel(ps.getRevision().get() + " "); revtxt.addStyleName(Gerrit.RESOURCES.css().patchSetRevision()); getHeader().add(revtxt); if (gw != null) { final Anchor revlink = new Anchor("(gitweb)", false, gw.toRevision(detail.getChange() .getProject(), ps)); revlink.addStyleName(Gerrit.RESOURCES.css().patchSetLink()); getHeader().add(revlink); } if (ps.isDraft()) { final InlineLabel draftLabel = new InlineLabel(" (DRAFT) "); draftLabel.addStyleName(Gerrit.RESOURCES.css().patchSetRevision()); getHeader().add(draftLabel); } }

Target:
private PatchSetComplexDisclosurePanel(final ChangeScreen parent, final ChangeDetail detail, final PatchSet ps, boolean isOpen) { super(Util.M.patchSetHeader(ps.getPatchSetId()), isOpen); changeScreen = parent; changeDetail = detail; patchSet = ps; body = new FlowPanel(); setContent(body); final GitwebLink gw = Gerrit.getConfig().getGitwebLink(); final InlineLabel revtxt = new InlineLabel(ps.getRevision().get() + " "); revtxt.addStyleName(Gerrit.RESOURCES.css().patchSetRevision()); getHeader().add(revtxt); if (gw != null) { final Anchor revlink = new Anchor("(gitweb)", false, gw.toRevision(detail.getChange() .getProject(), ps)); revlink.addStyleName(Gerrit.RESOURCES.css().patchSetLink()); getHeader().add(revlink); } if (ps.isDraft()) { final InlineLabel draftLabel = new InlineLabel(Util.C.draftPatchSetLabel()); draftLabel.addStyleName(Gerrit.RESOURCES.css().patchSetRevision()); getHeader().add(draftLabel); } }
Source:
private String decodeDigest(byte[] digest) { val hexString = new StringBuffer(); for (int i = 0; i < digest.length; i++) { val hex = Integer.toHexString(0xFF & digest[i]); if (hex.length() == 1) { hexString.append('0'); } hexString.append(hex); } return hexString.toString(); }

Target:
private String decodeDigest(byte[] digest) { return BaseEncoding.base16().lowerCase().encode(digest); }
Source:
void notifyForFirstChunkCreation() { if (firstChunkIdAndProperties != null) { String chunkId = firstChunkIdAndProperties.getFirst().getID(); BlobProperties chunkProperties = firstChunkIdAndProperties.getSecond(); notificationSystem.onBlobCreated(chunkId, chunkProperties, userMetadata, NotificationBlobType.DataChunk); } }

Target:
void notifyForFirstChunkCreation() { String chunkId = firstChunkIdAndProperties.getFirst().getID(); BlobProperties chunkProperties = firstChunkIdAndProperties.getSecond(); notificationSystem.onBlobCreated(chunkId, chunkProperties, userMetadata, NotificationBlobType.DataChunk); }
Source:
public void beforeCompletion() { log.infof("beforeCompletion called"); checker.setSynchronizedBefore(); }

Target:
public void beforeCompletion() { log.tracef("beforeCompletion called"); checker.setSynchronizedBefore(); }
Source:
public ZapLabel() { this.setEditable(false); setDefaults(); }

Target:
public ZapLabel() { setDefaults(); }
Source:
public CssHeaderItem setNonce(String nonce) { Args.notNull(nonce, "nonce"); this.nonce = nonce; return this; }

Target:
public CssHeaderItem setNonce(String nonce) { this.nonce = nonce; return this; }
Source:
public static boolean isCurrentAdministrator() { NuxeoPrincipal principal = getCurrentPrincipal(); return principal != null && principal.isAdministrator() || Framework.isTestModeSet() && (principal == null || ADMINISTRATOR.equals(principal.getName()) ); }

Target:
public static boolean isCurrentAdministrator() { NuxeoPrincipal principal = getCurrentPrincipal(); boolean isAdministrator = principal != null && principal.isAdministrator(); boolean isAdministratorInTests = principal == null || ADMINISTRATOR.equals(principal.getName()); return isAdministrator || (Framework.isTestModeSet() && isAdministratorInTests); }
Source:
public void updated(Dictionary<String, ?> config) throws ConfigurationException { logger.debug("updated() is called!"); if (config != null) { String portString = (String) config.get("port"); logger.debug("dsmr:port=" + portString); if (StringUtils.isNotBlank(portString)) { port = portString; } else { logger.warn("dsmr:port setting is empty"); } String portSettingsString = (String) config.get("portsettings"); logger.debug("dsmr:portsettings=" + portSettingsString); if (StringUtils.isNotBlank(portSettingsString)) { fixedPortSettings = DSMRPortSettings.getPortSettingsFromString(portSettingsString); } else { logger.info("dsmr:portsettings setting is empty. Ignored"); } dsmrMeters.clear(); for (DSMRMeterType meterType : DSMRMeterType.values()) { String channelConfigValue = (String) config.get(meterType.channelConfigKey); logger.debug("dsmr:" + meterType.channelConfigKey + "=" + channelConfigValue); if (StringUtils.isNotBlank(channelConfigValue)) { try { dsmrMeters.add(new DSMRMeter(meterType, Integer.parseInt(channelConfigValue))); } catch (NumberFormatException nfe) { logger.warn("Invalid value " + channelConfigValue + " for dsmr:" + meterType.channelConfigKey + ". Ignore mapping!", nfe); } } else { switch (meterType) { case NA: break; case ELECTRICITY: break; default: logger.info("dsmr:" + meterType.channelConfigKey + " setting is empty"); } } } if (port.length() > 0) { logger.debug("Configuration succeeded"); setProperlyConfigured(true); } else { logger.debug("Configuration failed"); setProperlyConfigured(false); } } }

Target:
public void updated(Dictionary<String, ?> config) throws ConfigurationException { logger.debug("updated() is called!"); if (config != null) { String portString = Objects.toString(config.get("port"), null); logger.debug("dsmr:port={}", portString); if (StringUtils.isNotBlank(portString)) { port = portString; } else { logger.warn("dsmr:port setting is empty"); } String portSettingsString = (String) config.get("portsettings"); logger.debug("dsmr:portsettings={}", portSettingsString); if (StringUtils.isNotBlank(portSettingsString)) { fixedPortSettings = DSMRPortSettings.getPortSettingsFromString(portSettingsString); } else { logger.info("dsmr:portsettings setting is empty. Ignored"); } dsmrMeters.clear(); for (DSMRMeterType meterType : DSMRMeterType.values()) { String channelConfigValue = Objects.toString(config.get(meterType.channelConfigKey), null); logger.debug("dsmr:{}={}", meterType.channelConfigKey, channelConfigValue); if (StringUtils.isNotBlank(channelConfigValue)) { try { dsmrMeters.add(new DSMRMeter(meterType, Integer.parseInt(channelConfigValue))); } catch (NumberFormatException nfe) { logger.warn("Invalid value for dsmr:{}. Ignore mapping!", channelConfigValue, meterType.channelConfigKey, nfe); } } else { switch (meterType) { case NA: break; case ELECTRICITY: break; default: logger.info("dsmr:{} setting is empty", meterType.channelConfigKey); } } } if (port.length() > 0) { logger.debug("Configuration succeeded"); setProperlyConfigured(true); } else { logger.debug("Configuration failed"); setProperlyConfigured(false); } } }
Source:
private URL buildAllureDownloadUrl(String version) throws MalformedURLException { return new URL( "<LINK_0>" + version + "/allure-" + version + ".zip" ); }

Target:
private URL buildAllureDownloadUrl(String version) throws MalformedURLException { return fromPath(settingsManager.getSettings().getDownloadBaseUrl()) .path(Paths.get(version, "allure-" + version + ".zip").toString()) .build().toURL(); }
Source:
private void onEvent(CoreEvent event, ExecutorCallback executorCallback) { try { SdkInternalContext sdkInternalContext = from(event); final Optional<ConfigurationInstance> configuration = sdkInternalContext.getConfiguration(getLocation()); final Map<String, Object> resolutionResult = sdkInternalContext.getResolutionResult(getLocation()); OperationExecutionFunction operationExecutionFunction = (parameters, operationEvent, callback) -> { sdkInternalContext.setOperationExecutionParams(getLocation(), configuration, parameters, operationEvent, callback); fluxSupplier.get().next(operationEvent); }; if (getLocation() != null) { ((DefaultFlowCallStack) event.getFlowCallStack()) .setCurrentProcessorPath(resolvedProcessorRepresentation); sdkInternalContext.getPolicyToApply(getLocation()) .process(event, operationExecutionFunction, () -> resolutionResult, getLocation(), executorCallback); } else { operationExecutionFunction.execute(resolutionResult, event, executorCallback); } } catch (Throwable t) { executorCallback.error(unwrap(t)); } }

Target:
private void onEvent(CoreEvent event, ExecutorCallback executorCallback) { try { SdkInternalContext sdkInternalContext = from(event); final ComponentLocation location = getLocation(); final Optional<ConfigurationInstance> configuration = sdkInternalContext.getConfiguration(location); final Map<String, Object> resolutionResult = sdkInternalContext.getResolutionResult(location); OperationExecutionFunction operationExecutionFunction = (parameters, operationEvent, callback) -> { sdkInternalContext.setOperationExecutionParams(location, configuration, parameters, operationEvent, callback); fluxSupplier.get().next(operationEvent); }; if (location != null) { ((DefaultFlowCallStack) event.getFlowCallStack()) .setCurrentProcessorPath(resolvedProcessorRepresentation); sdkInternalContext.getPolicyToApply(location) .process(event, operationExecutionFunction, () -> resolutionResult, location, executorCallback); } else { operationExecutionFunction.execute(resolutionResult, event, executorCallback); } } catch (Throwable t) { executorCallback.error(unwrap(t)); } }
Source:
private boolean updatePubKeysToRemoteHosts(final List<String> pubKeys, Set<Guid> remoteServersSet, final String userName) { List<Callable<Boolean>> slaveWritePubKeyList = new ArrayList<>(); for (final Guid currentRemoteHost : remoteServersSet) { slaveWritePubKeyList.add(new Callable<Boolean>() { @Override public Boolean call() throws Exception { return getBackend().runInternalAction(VdcActionType.UpdateGlusterHostPubKeyToSlaveInternal, new UpdateGlusterHostPubKeyToSlaveParameters(currentRemoteHost, pubKeys, userName)).getSucceeded(); } }); } List<Boolean> returnStatuses = ThreadPoolUtil.invokeAll(slaveWritePubKeyList); for (Boolean currentReturnStatus : returnStatuses) { if (!currentReturnStatus) { return false; } } return true; }

Target:
private boolean updatePubKeysToRemoteHosts(final List<String> pubKeys, Set<Guid> remoteServersSet, final String userName) { List<Callable<Boolean>> slaveWritePubKeyList = new ArrayList<>(); for (final Guid currentRemoteHostId : remoteServersSet) { slaveWritePubKeyList.add(new Callable<Boolean>() { @Override public Boolean call() throws Exception { return getBackend().runInternalAction(VdcActionType.UpdateGlusterHostPubKeyToSlaveInternal, new UpdateGlusterHostPubKeyToSlaveParameters(currentRemoteHostId, pubKeys, userName)).getSucceeded(); } }); } List<Boolean> returnStatuses = ThreadPoolUtil.invokeAll(slaveWritePubKeyList); for (Boolean currentReturnStatus : returnStatuses) { if (!currentReturnStatus) { return false; } } return true; }
Source:
public Map<String, ServiceUserInfo> apply(ConfigResource rscr) throws OrmException { Map<String, ServiceUserInfo> accounts = Maps.newTreeMap(); Config db = storage.get(); for (String username : db.getSubsections(USER)) { String createdBy = db.getString(USER, username, KEY_CREATED_BY); if (userProvider.get().getCapabilities().canAdministrateServer() || userProvider.get().getUserName().equals(createdBy)) { AccountState account = accountCache.getByUsername(username); if (account != null) { ServiceUserInfo info = new ServiceUserInfo(getAccount.get().apply( new AccountResource(userFactory.create(account.getAccount().getId())))); info.username = null; info.createdBy = createdBy; info.createdAt = db.getString(USER, username, KEY_CREATED_AT); accounts.put(username, info); } } } return accounts; }

Target:
public Map<String, ServiceUserInfo> apply(ConfigResource rscr) throws OrmException { Map<String, ServiceUserInfo> accounts = Maps.newTreeMap(); Config db = storage.get(); boolean isAdmin = userProvider.get().getCapabilities().canAdministrateServer(); String currentUser = userProvider.get().getUserName(); for (String username : db.getSubsections(USER)) { String createdBy = db.getString(USER, username, KEY_CREATED_BY); if (isAdmin || currentUser.equals(createdBy)) { AccountState account = accountCache.getByUsername(username); if (account != null) { ServiceUserInfo info = new ServiceUserInfo(getAccount.get().apply( new AccountResource(userFactory.create(account.getAccount().getId())))); info.username = null; info.createdBy = createdBy; info.createdAt = db.getString(USER, username, KEY_CREATED_AT); accounts.put(username, info); } } } return accounts; }
Source:
public void testBadTableConfigJoinType() { assertThrows(NullPointerException.class, () -> DynamicConfigValidator .main(new String[] { "--configDir", "src/test/resources/validator/bad_table_join_type" })); }

Target:
public void testBadTableConfigJoinType() { assertThrows(IOException.class, () -> DynamicConfigValidator .main(new String[] { "--configDir", "src/test/resources/validator/bad_table_join_type" })); }
Source:
public FetchConnection openFetch() throws TransportException { try { final String service = "git-upload-pack"; final HttpURLConnection c = connect(service); final InputStream in = new BufferedInputStream(c.getInputStream()); try { String expType = "application/x-" + service + "-advertisement"; String actType = c.getContentType(); if (expType.equals(actType)) { checkPacketLineStream(in, service); return new SmartHttpFetchConnection(in); } else { HttpObjectDB d = new HttpObjectDB(objectsUrl); WalkFetchConnection r = new WalkFetchConnection(this, d); BufferedReader br = new BufferedReader( new InputStreamReader(in, Constants.CHARSET)); try { r.available(d.readAdvertisedImpl(br)); } finally { br.close(); } return r; } } finally { in.close(); } } catch (IOException err) { throw new TransportException(uri, "error reading info/refs", err); } }

Target:
public FetchConnection openFetch() throws TransportException { try { final String service = "git-upload-pack"; final HttpURLConnection c = connect(service); final InputStream in = new BufferedInputStream(c.getInputStream()); try { String expType = "application/x-" + service + "-advertisement"; String actType = c.getContentType(); if (expType.equals(actType)) { checkPacketLineStream(in, service); return new SmartHttpFetchConnection(in); } else { HttpObjectDB d = new HttpObjectDB(objectsUrl); WalkFetchConnection wfc = new WalkFetchConnection(this, d); BufferedReader br = new BufferedReader( new InputStreamReader(in, Constants.CHARSET)); try { wfc.available(d.readAdvertisedImpl(br)); } finally { br.close(); } return wfc; } } finally { in.close(); } } catch (IOException err) { throw new TransportException(uri, "error reading info/refs", err); } }
Source:
public void testWithMergedRegions() throws Exception { MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster(); Admin admin = TEST_UTIL.getAdmin(); Table table = TEST_UTIL.getConnection().getTable(TABLE_NAME); List<Put> puts = new ArrayList<>(); for (int i = 0; i < 10000; i++) { puts.add(new Put(Bytes.toBytes("rowkey_" + i)) .addColumn(Bytes.toBytes("fam1"), Bytes.toBytes("q1"), Bytes.toBytes("val_" + i))); } table.put(puts); admin.flush(TABLE_NAME); HRegionServer regionServer = cluster.getRegionServer(0); String rsName = regionServer.getServerName().getAddress().toString(); int numRegions = regionServer.getNumberOfOnlineRegions(); List<HRegion> hRegions = regionServer.getRegions().stream() .filter(hRegion -> hRegion.getRegionInfo().getTable().equals(TABLE_NAME)) .collect(Collectors.toList()); RegionMover.RegionMoverBuilder rmBuilder = new RegionMover.RegionMoverBuilder(rsName, TEST_UTIL.getConfiguration()).ack(true) .maxthreads(8); try (RegionMover rm = rmBuilder.build()) { LOG.debug("Unloading " + regionServer.getServerName()); rm.unload(); Assert.assertEquals(0, regionServer.getNumberOfOnlineRegions()); LOG.debug("Successfully Unloaded\nNow Loading"); admin.mergeRegionsAsync(new byte[][] { hRegions.get(0).getRegionInfo().getRegionName(), hRegions.get(1).getRegionInfo().getRegionName() }, true) .get(5, TimeUnit.SECONDS); Assert.assertTrue(rm.load()); Assert.assertEquals(numRegions - 2, regionServer.getNumberOfOnlineRegions()); } }

Target:
public void testWithMergedRegions() throws Exception { final TableName tableName = TableName.valueOf(name.getMethodName()); MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster(); Admin admin = TEST_UTIL.getAdmin(); Table table = TEST_UTIL.getConnection().getTable(tableName); List<Put> puts = new ArrayList<>(); for (int i = 0; i < 10000; i++) { puts.add(new Put(Bytes.toBytes("rowkey_" + i)) .addColumn(Bytes.toBytes("fam1"), Bytes.toBytes("q1"), Bytes.toBytes("val_" + i))); } table.put(puts); admin.flush(tableName); HRegionServer regionServer = cluster.getRegionServer(0); String rsName = regionServer.getServerName().getAddress().toString(); int numRegions = regionServer.getNumberOfOnlineRegions(); List<HRegion> hRegions = regionServer.getRegions().stream() .filter(hRegion -> hRegion.getRegionInfo().getTable().equals(tableName)) .collect(Collectors.toList()); RegionMover.RegionMoverBuilder rmBuilder = new RegionMover.RegionMoverBuilder(rsName, TEST_UTIL.getConfiguration()).ack(true) .maxthreads(8); try (RegionMover rm = rmBuilder.build()) { LOG.debug("Unloading {}", regionServer.getServerName()); rm.unload(); Assert.assertEquals(0, regionServer.getNumberOfOnlineRegions()); LOG.debug("Successfully Unloaded, now Loading"); admin.mergeRegionsAsync(new byte[][] { hRegions.get(0).getRegionInfo().getRegionName(), hRegions.get(1).getRegionInfo().getRegionName() }, true) .get(5, TimeUnit.SECONDS); Assert.assertTrue(rm.load()); Assert.assertEquals(numRegions - 2, regionServer.getNumberOfOnlineRegions()); } }
Source:
static IllegalStateException missingRejectionHandler( Class<?> cls, Class<? extends Message> rejectionClass) { final String msg = format( "Missing handler for rejection class %s in the class %s", rejectionClass, cls ); return new IllegalStateException(msg); }

Target:
static IllegalStateException missingRejectionHandler( Class<?> cls, Class<? extends Message> rejectionClass) { return newIllegalStateException("Missing handler for rejection class %s in the class %s", rejectionClass, cls); }
Source:
public void handleDataDeleted(String dataPath) { if (_zkClientForListener == null || _zkClientForListener.isClosed()) { return; } _zkClientForListener.unsubscribeAll(); ZkRoutingDataReader.subscribeRoutingDataChanges(_zkClientForListener, this, this); resetZkResources(); }

Target:
public void handleDataDeleted(String dataPath) { }
Source:
private static List<List<Path>> buildChildPaths(VirtualFile cur, Locale locale) throws IOException { List<List<Path>> r = new ArrayList<List<Path>>(); VirtualFile[] files = cur.list(); Arrays.sort(files,new FileComparator(locale)); for( VirtualFile f : files ) { Path p = new Path(Util.rawEncode(f.getName()), f.getName(), f.isDirectory(), f.length(), f.canRead(), f.lastModified()); if(!f.isDirectory()) { r.add(Collections.singletonList(p)); } else { List<Path> l = new ArrayList<Path>(); l.add(p); String relPath = Util.rawEncode(f.getName()); while(true) { List<VirtualFile> sub = new ArrayList<VirtualFile>(); for (VirtualFile vf : f.list()) { String name = vf.getName(); if (!name.startsWith(".") && !name.equals("CVS") && !name.equals(".svn")) { sub.add(vf); } } if (sub.size() !=1 || !sub.get(0).isDirectory()) break; f = sub.get(0); relPath += '/'+Util.rawEncode(f.getName()); l.add(new Path(relPath,f.getName(),true,0, f.canRead(),0)); } r.add(l); } } return r; }

Target:
private static List<List<Path>> buildChildPaths(VirtualFile cur, Locale locale) throws IOException { List<List<Path>> r = new ArrayList<List<Path>>(); VirtualFile[] files = cur.list(); Arrays.sort(files,new FileComparator(locale)); for( VirtualFile f : files ) { Path p = new Path(Util.rawEncode(f.getName()), f.getName(), f.isDirectory(), f.length(), f.canRead(), f.lastModified()); if(!f.isDirectory()) { r.add(Collections.singletonList(p)); } else { List<Path> l = new ArrayList<Path>(); l.add(p); String relPath = Util.rawEncode(f.getName()); while(true) { List<VirtualFile> sub = new ArrayList<VirtualFile>(); for (VirtualFile vf : f.list()) { String name = vf.getName(); if (!name.startsWith(".") && !name.equals("CVS") && !name.equals(".svn")) { sub.add(vf); } } if (sub.size() !=1 || !sub.get(0).isDirectory()) break; f = sub.get(0); relPath += '/'+Util.rawEncode(f.getName()); l.add(new Path(relPath,f.getName(),true, f.length(), f.canRead(), f.lastModified())); } r.add(l); } } return r; }
Source:
protected VdcActionParametersBase getAddParameters(VmWatchdog entity, WatchDog device) { WatchdogParameters watchdogParameters = new WatchdogParameters(); watchdogParameters.setAction(getMapper(WatchdogAction.class, VmWatchdogAction.class).map(WatchdogAction.valueOf(StringUtils.upperCase(device.getAction())), null)); watchdogParameters.setModel(getMapper(WatchdogModel.class, VmWatchdogType.class).map(WatchdogModel.valueOf(StringUtils.upperCase(device.getModel())), null)); watchdogParameters.setId(parentId); watchdogParameters.setVm(isVm(parentId)); return watchdogParameters; }

Target:
protected VdcActionParametersBase getAddParameters(VmWatchdog entity, WatchDog device) { WatchdogParameters watchdogParameters = new WatchdogParameters(); validateEnums(WatchDog.class, device); watchdogParameters.setAction(getMapper(WatchdogAction.class, VmWatchdogAction.class).map(WatchdogAction.valueOf(StringUtils.upperCase(device.getAction())), null)); watchdogParameters.setModel(getMapper(WatchdogModel.class, VmWatchdogType.class).map(WatchdogModel.valueOf(StringUtils.upperCase(device.getModel())), null)); watchdogParameters.setId(parentId); watchdogParameters.setVm(isVm(parentId)); return watchdogParameters; }
Source:
public long getCheckAllLedgersCTime() throws UnavailableException { LOG.debug("getCheckAllLedgersCTime"); try { byte[] data = zkc.getData(checkAllLedgersCtimeZnode, false, null); return Long.parseLong(new String(data, UTF_8)); } catch (KeeperException.NoNodeException ne) { LOG.warn("checkAllLedgersCtimeZnode is not yet available"); return -1; } catch (KeeperException ke) { throw new ReplicationException.UnavailableException("Error contacting zookeeper", ke); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); throw new ReplicationException.UnavailableException("Interrupted while contacting zookeeper", ie); } }

Target:
public long getCheckAllLedgersCTime() throws UnavailableException { if (LOG.isDebugEnabled()) { LOG.debug("setCheckAllLedgersCTime"); } try { byte[] data = zkc.getData(checkAllLedgersCtimeZnode, false, null); CheckAllLedgersFormat checkAllLedgersFormat = CheckAllLedgersFormat.parseFrom(data); return checkAllLedgersFormat.hasCheckAllLedgersCTime() ? checkAllLedgersFormat.getCheckAllLedgersCTime() : -1; } catch (KeeperException.NoNodeException ne) { LOG.warn("checkAllLedgersCtimeZnode is not yet available"); return -1; } catch (KeeperException ke) { throw new ReplicationException.UnavailableException("Error contacting zookeeper", ke); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); throw new ReplicationException.UnavailableException("Interrupted while contacting zookeeper", ie); } catch (InvalidProtocolBufferException ipbe) { throw new ReplicationException.UnavailableException("Error while parsing ZK protobuf binary data", ipbe); } }
Source:
private TransportClient createClient() { final Settings.Builder settings = getSettings(); try { Class clazz = Class.forName("org.elasticsearch.xpack.client.PreBuiltXPackTransportClient"); Constructor<?> ctor = clazz.getConstructor(Settings.class, Class[].class); settings.put("xpack.security.user", configuration.getUser() + ":" + configuration.getPassword()) .put("xpack.security.transport.ssl.enabled", configuration.getEnableSSL()); return (TransportClient) ctor.newInstance(new Object[] {settings.build(), new Class[0]}); } catch (Exception e) { LOG.info("XPack Client was not found on the classpath, using the standard client"); return new PreBuiltTransportClient(settings.build()); } }

Target:
private TransportClient createClient() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException { final Settings.Builder settings = getSettings(); final CamelContext camelContext = getEndpoint().getCamelContext(); final Class<?> clazz = camelContext.getClassResolver().resolveClass("org.elasticsearch.xpack.client.PreBuiltXPackTransportClient"); if (clazz != null) { Constructor<?> ctor = clazz.getConstructor(Settings.class, Class[].class); settings.put("xpack.security.user", configuration.getUser() + ":" + configuration.getPassword()) .put("xpack.security.transport.ssl.enabled", configuration.getEnableSSL()); LOG.debug("XPack Client was found on the classpath"); return (TransportClient) ctor.newInstance(new Object[] {settings.build(), new Class[0]}); } else { LOG.debug("XPack Client was not found on the classpath, using the standard client"); return new PreBuiltTransportClient(settings.build()); } }
Source:
private TabletServerMutations<QCMutation> dequeue(String location) { BlockingQueue<TabletServerMutations<QCMutation>> queue = getServerQueue(location).queue; ArrayList<TabletServerMutations<QCMutation>> mutations = new ArrayList<>(); queue.drainTo(mutations); if (mutations.size() == 0) return null; if (mutations.size() == 1) { return mutations.get(0); } else { TabletServerMutations<QCMutation> tsm = mutations.get(0); for (int i = 1; i < mutations.size(); i++) { for (Entry<KeyExtent,List<QCMutation>> entry : mutations.get(i).getMutations().entrySet()) { List<QCMutation> list = tsm.getMutations().computeIfAbsent(entry.getKey(), k -> new ArrayList<>()); list.addAll(entry.getValue()); } } return tsm; } }

Target:
private TabletServerMutations<QCMutation> dequeue(String location) { BlockingQueue<TabletServerMutations<QCMutation>> queue = getServerQueue(location).queue; ArrayList<TabletServerMutations<QCMutation>> mutations = new ArrayList<>(); queue.drainTo(mutations); if (mutations.size() == 0) return null; if (mutations.size() == 1) { return mutations.get(0); } else { TabletServerMutations<QCMutation> tsm = mutations.get(0); for (int i = 1; i < mutations.size(); i++) { for (Entry<KeyExtent,List<QCMutation>> entry : mutations.get(i).getMutations().entrySet()) { tsm.getMutations().computeIfAbsent(entry.getKey(), k -> new ArrayList<>()) .addAll(entry.getValue()); } } return tsm; } }
Source:
public RecordWriter<Long, SinkRecord> getRecordWriter(Configuration conf, final String fileName, SinkRecord record, final AvroData avroData) throws IOException { DatumWriter<Object> datumWriter = new GenericDatumWriter<>(); final DataFileWriter<Object> writer = new DataFileWriter<>(datumWriter); Path path = new Path(fileName); final Schema schema = record.valueSchema(); final FSDataOutputStream out = path.getFileSystem(conf).create(path); org.apache.avro.Schema avroSchema = avroData.fromCopycatSchema(schema); int version = schema.version(); avroSchema.addProp("version", String.valueOf(version)); writer.create(avroSchema, out); return new RecordWriter<Long, SinkRecord>(){ @Override public void write(Long key, SinkRecord record) throws IOException { Object value = avroData.fromCopycatData(schema, record.value()); writer.append(value); } @Override public void close() throws IOException { writer.close(); } }; }

Target:
public RecordWriter<Long, SinkRecord> getRecordWriter(Configuration conf, final String fileName, SinkRecord record, final AvroData avroData) throws IOException { DatumWriter<Object> datumWriter = new GenericDatumWriter<>(); final DataFileWriter<Object> writer = new DataFileWriter<>(datumWriter); Path path = new Path(fileName); final Schema schema = record.valueSchema(); final FSDataOutputStream out = path.getFileSystem(conf).create(path); org.apache.avro.Schema avroSchema = avroData.fromCopycatSchema(schema); writer.create(avroSchema, out); return new RecordWriter<Long, SinkRecord>(){ @Override public void write(Long key, SinkRecord record) throws IOException { Object value = avroData.fromCopycatData(schema, record.value()); writer.append(value); } @Override public void close() throws IOException { writer.close(); } }; }
Source:
public static Object[] unwrapBinariesInArray(Object[] arr) { Class<?> compType = arr.getClass().getComponentType(); Object[] res = (Object[])Array.newInstance(compType, arr.length); for (int i = 0; i < arr.length; i++) res[i] = unwrapBinary(arr[i]); return res; }

Target:
public static Object[] unwrapBinariesInArray(Object[] arr) { if (arr.getClass().getComponentType() != Object.class) return arr; Object[] res = new Object[arr.length]; for (int i = 0; i < arr.length; i++) res[i] = unwrapBinary(arr[i]); return res; }
Source:
public long save(LibraryDilution dilution) throws IOException { long id; if (dilution.getId() == AbstractLibrary.UNSAVED_ID) { id = (long) currentSession().save(dilution); } else { currentSession().update(dilution); id = dilution.getId(); } return id; }

Target:
public long save(LibraryDilution dilution) throws IOException { long id; if (dilution.getId() == LibraryDilution.UNSAVED_ID) { id = (long) currentSession().save(dilution); } else { currentSession().update(dilution); id = dilution.getId(); } return id; }
Source:
public boolean isAvailable(SourceMonitor callback) { throw new UnsupportedOperationException( "isAvailable callbacks are not supported for " + CachedSource.class.getSimpleName()); }

Target:
public boolean isAvailable(SourceMonitor callback) { return isAvailable(); }