auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void invoke(ExtMap input, ExtMap output) { try { Object command = input.get(Base.InvokeKeys.COMMAND); if (command.equals(Base.InvokeCommands.LOAD)) { doLoad(input, output); } else if (command.equals(Base.InvokeCommands.INITIALIZE)) { doInit(input, output); } else if (command.equals(Authz.InvokeCommands.QUERY_OPEN)) { doQueryOpen(input, output); } else if (command.equals(Authz.InvokeCommands.FETCH_PRINCIPAL_RECORD)) { doFetchPrincipalRecord(input, output); } else if (command.equals(Authz.InvokeCommands.QUERY_EXECUTE)) { doQueryExecute(input, output); } else if (command.equals(Authz.InvokeCommands.QUERY_CLOSE)) { } else { output.put(Base.InvokeKeys.RESULT, Base.InvokeResult.UNSUPPORTED); } output.putIfAbsent(Base.InvokeKeys.RESULT, Base.InvokeResult.SUCCESS); } catch (Exception ex) { output.mput(Base.InvokeKeys.RESULT, Base.InvokeResult.FAILED). mput(Base.InvokeKeys.MESSAGE, ex.getMessage()); } }

Target:
public void invoke(ExtMap input, ExtMap output) { try { Object command = input.get(Base.InvokeKeys.COMMAND); if (command.equals(Base.InvokeCommands.LOAD)) { doLoad(input, output); } else if (command.equals(Authz.InvokeCommands.QUERY_OPEN)) { doQueryOpen(input, output); } else if (command.equals(Authz.InvokeCommands.FETCH_PRINCIPAL_RECORD)) { doFetchPrincipalRecord(input, output); } else if (command.equals(Authz.InvokeCommands.QUERY_EXECUTE)) { doQueryExecute(input, output); } else if (command.equals(Authz.InvokeCommands.QUERY_CLOSE)) { } else { output.put(Base.InvokeKeys.RESULT, Base.InvokeResult.UNSUPPORTED); } output.putIfAbsent(Base.InvokeKeys.RESULT, Base.InvokeResult.SUCCESS); } catch (Exception ex) { output.mput(Base.InvokeKeys.RESULT, Base.InvokeResult.FAILED). mput(Base.InvokeKeys.MESSAGE, ex.getMessage()); } }
Source:
public Query createNamedQuery(String name) { OgmSessionFactory sessionFactory = (OgmSessionFactory) factory.getSessionFactory(); NamedSQLQueryDefinition noSQLQuery = sessionFactory.getNamedSQLQuery( name ); String sqlQueryString = noSQLQuery.getQueryString(); SQLQuery noSqlQuery = ( (Session) getDelegate() ).createSQLQuery( sqlQueryString ); if ( noSQLQuery.getQueryReturns().length == 1 ) { NativeSQLQueryRootReturn rootReturn = (NativeSQLQueryRootReturn) noSQLQuery.getQueryReturns()[0]; noSqlQuery.addEntity( "alias1", rootReturn.getReturnEntityName(), LockMode.READ ); } return new OgmNativeQuery( noSqlQuery, hibernateEm ); }

Target:
public Query createNamedQuery(String name) { OgmSessionFactory sessionFactory = (OgmSessionFactory) factory.getSessionFactory(); NamedQueryDefinition queryDefinition = sessionFactory.getNamedSQLQuery( name ); if ( queryDefinition == null ) { queryDefinition = sessionFactory.getNamedQuery( name ); if ( queryDefinition == null ) { throw new IllegalArgumentException( "Named query not found: " + name ); } else { throw new NotSupportedException( "OGM-15", "named queries are not supported yet" ); } } else { return createNativeQuery( (NamedSQLQueryDefinition) queryDefinition ); } }
Source:
protected String toString(List<T> list) { final StringBuilder stringBuilder = new StringBuilder(0); for (T element : list) { final char quote = '"'; stringBuilder.append(quote) .append(element) .append(quote) .append(delimiter); } final int length = stringBuilder.length(); final String result = stringBuilder.substring(0, length - 1); return result; }

Target:
protected String toString(List<T> list) { final Converter<String, String> quoteConverter = ItemQuoter.converter(); final List<String> convertedItems = newArrayList(); for (T item : list) { final String convertedItem = elementStringifier.andThen(quoteConverter) .convert(item); convertedItems.add(convertedItem); } final String result = Joiner.on(delimiter) .join(convertedItems); return result; }
Source:
protected void preSave() { if (StringHelper.stringsEqualIgnoreCase((String) getUrl().getEntity(), oldUrl)) { actualSave(); } else { ArrayList<VdcQueryType> queryTypes = new ArrayList<VdcQueryType>(); ArrayList<VdcQueryParametersBase> queryParams = new ArrayList<VdcQueryParametersBase>(); final Set<VdcObjectType> providedTypes = provider.getType().getProvidedTypes(); if (providedTypes.contains(VdcObjectType.Network)) { queryTypes.add(VdcQueryType.GetAllNetworksForProvider); queryParams.add(new IdQueryParameters(provider.getId())); } startProgress(null); Frontend.RunMultipleQueries(queryTypes, queryParams, new IFrontendMultipleQueryAsyncCallback() { @SuppressWarnings("unchecked") @Override public void executed(FrontendMultipleQueryAsyncResult result) { stopProgress(); Iterator<VdcQueryReturnValue> i = result.getReturnValues().iterator(); if (providedTypes.contains(VdcObjectType.Network)) { providedNetworks = (Collection<Network>) (i.next()).getReturnValue(); } showConfirmation(); } }); } }

Target:
protected void preSave() { if (!StringHelper.stringsEqualIgnoreCase((String) getUrl().getEntity(), oldUrl)) { ArrayList<VdcQueryType> queryTypes = new ArrayList<VdcQueryType>(); ArrayList<VdcQueryParametersBase> queryParams = new ArrayList<VdcQueryParametersBase>(); final Set<VdcObjectType> providedTypes = provider.getType().getProvidedTypes(); if (providedTypes.contains(VdcObjectType.Network)) { queryTypes.add(VdcQueryType.GetAllNetworksForProvider); queryParams.add(new IdQueryParameters(provider.getId())); } if (!queryTypes.isEmpty()) { startProgress(null); Frontend.RunMultipleQueries(queryTypes, queryParams, new IFrontendMultipleQueryAsyncCallback() { @SuppressWarnings("unchecked") @Override public void executed(FrontendMultipleQueryAsyncResult result) { stopProgress(); Iterator<VdcQueryReturnValue> i = result.getReturnValues().iterator(); if (providedTypes.contains(VdcObjectType.Network)) { providedNetworks = (Collection<Network>) (i.next()).getReturnValue(); } showConfirmation(); } }); return; } } actualSave(); }
Source:
private static Properties loadProperties(File localeFile) throws IOException { Properties properties = new Properties(); Reader fr = null; FileInputStream fis = null; try { fis = new FileInputStream(localeFile); fr = new InputStreamReader(fis, "UTF-8"); properties.load(fr); } finally { if (fis != null) { fis.close(); } if (fr != null) { fr.close(); } } return properties; }

Target:
private static Properties loadProperties(File localeFile) throws IOException { Properties properties = new Properties(); Reader fr = null; FileInputStream fis = null; try { fis = new FileInputStream(localeFile); fr = new InputStreamReader(fis, StandardCharsets.UTF_8); properties.load(fr); } finally { if (fis != null) { fis.close(); } if (fr != null) { fr.close(); } } return properties; }
Source:
public void setVariable(final String identifier, final String content, final String description) { if (identifier == null) throw new RuntimeException("identifier must not be null"); if (identifier.isEmpty()) throw new RuntimeException("identifier must not be empty"); if (content == null) throw new RuntimeException("content must not be null"); Variable variable = getVariable(identifier); if (variable != null) { variable.setContent(content); if (description != null) variable.setDescription(description); fDirty = true; return; } this.addVariable(identifier, content, description); }

Target:
public void setVariable(final String identifier, final String content, final String description) { Variable variable = getVariable(identifier); if (variable != null) { variable.setContent(content); variable.setDescription(description); fDirty = true; return; } this.addVariable(identifier, content, description); }
Source:
public void showDialogForVideoChargesAlert(@NonNull DialerCall call) { if (call.hasProperty(Details.PROPERTY_WIFI)) { return; } if (didShowVideoChargesAlertDialog) { LogUtil.i( "InCallActivity.showDialogForVideoChargesAlert", "Video charges alert dialog had been displayed."); return; } LogUtil.enterBlock("InCallActivity.showDialogForVideoChargesAlert"); if (!VideoChargesAlertDialogFragment.shouldShow(this, call)) { LogUtil.i( "InCallActivity.showDialogForVideoChargesAlert", "VideoChargesAlertDialogFragment.shouldShow returned false"); didShowVideoChargesAlertDialog = false; return; } VideoChargesAlertDialogFragment fragment = VideoChargesAlertDialogFragment.newInstance( call.getId(), videoChargesAlertCallback); fragment.show(getSupportFragmentManager(), Tags.VIDEO_CHARGES_ALERT); didShowVideoChargesAlertDialog = true; }

Target:
public void showDialogForVideoChargesAlert(@NonNull DialerCall call) { if (call.hasProperty(Details.PROPERTY_WIFI)) { return; } if (didShowVideoChargesAlertDialog) { LogUtil.i( "InCallActivity.showDialogForVideoChargesAlert", "Video charges alert dialog had been displayed."); return; } LogUtil.enterBlock("InCallActivity.showDialogForVideoChargesAlert"); if (!VideoChargesAlertDialogFragment.shouldShow(this, call)) { LogUtil.i( "InCallActivity.showDialogForVideoChargesAlert", "VideoChargesAlertDialogFragment.shouldShow returned false"); didShowVideoChargesAlertDialog = false; return; } VideoChargesAlertDialogFragment fragment = VideoChargesAlertDialogFragment.newInstance( call.getId(), null); fragment.show(getSupportFragmentManager(), Tags.VIDEO_CHARGES_ALERT); didShowVideoChargesAlertDialog = true; }
Source:
public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; if (v == null) { LayoutInflater vi; vi = LayoutInflater.from(getContext()); v = vi.inflate(R.layout.dialog_a1c_item, parent, false); } A1cEstimate p = getItem(position); if (p != null) { TextView value = v.findViewById(R.id.dialog_a1c_item_value); TextView month = v.findViewById(R.id.dialog_a1c_item_month); TextView glucoseAverage = v.findViewById(R.id.dialog_a1c_item_glucose_value); if (value != null) { if ("percentage".equals(databaseHandler.getUser(1).getPreferred_unit_a1c())) { String stringValue = p.getValue() + " %"; value.setText(stringValue); } else { String stringValue = GlucosioConverter.a1cNgspToIfcc(p.getValue()) + " mmol/mol"; value.setText(stringValue); } } if (month != null) { month.setText(p.getMonth()); } if (glucoseAverage != null) { if (DomainConstants.MG_D_L.equals(databaseHandler.getUser(1).getPreferred_unit())) { glucoseAverage.setText(getContext().getString(R.string.mg_dL_value, p.getGlucoseAverage())); } else { double mmol = GlucosioConverter.glucoseToMgDl(Double.parseDouble(p.getGlucoseAverage())); String reading = numberFormat.format(mmol); glucoseAverage.setText(getContext().getString(R.string.mmol_L_value, reading)); } } } return v; }

Target:
public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; if (v == null) { LayoutInflater vi; vi = LayoutInflater.from(getContext()); v = vi.inflate(R.layout.dialog_a1c_item, parent, false); } A1cEstimate p = getItem(position); if (p != null) { TextView value = v.findViewById(R.id.dialog_a1c_item_value); TextView month = v.findViewById(R.id.dialog_a1c_item_month); TextView glucoseAverage = v.findViewById(R.id.dialog_a1c_item_glucose_value); if (value != null) { if ("percentage".equals(databaseHandler.getUser(1).getPreferred_unit_a1c())) { String stringValue = p.getValue() + " %"; value.setText(stringValue); } else { String stringValue = GlucosioConverter.a1cNgspToIfcc(p.getValue()) + " mmol/mol"; value.setText(stringValue); } } if (month != null) { month.setText(p.getMonth()); } if (glucoseAverage != null) { if (Constants.Units.MG_DL.equals(databaseHandler.getUser(1).getPreferred_unit())) { glucoseAverage.setText(getContext().getString(R.string.mg_dL_value, p.getGlucoseAverage())); } else { double mmol = GlucosioConverter.glucoseToMgDl(ReadingTools.safeParseDouble(p.getGlucoseAverage())); String reading = numberFormat.format(mmol); glucoseAverage.setText(getContext().getString(R.string.mmol_L_value, reading)); } } } return v; }
Source:
private void saveVmDevicesToDb() { List<VmDevice> sortedVmDevices = new ArrayList<VmDevice>(); sortedVmDevices.addAll(vmDeviceToSave.values()); sortVmDeviceList(sortedVmDevices); updateAllInTransaction(sortedVmDevices, getDbFacade().getVmDeviceDAO()); if (!removedDeviceIds.isEmpty()) { TransactionSupport.executeInScope(TransactionScopeOption.Required, new TransactionMethod<Void>() { @Override public Void runInTransaction() { getDbFacade().getVmDeviceDAO().removeAll(removedDeviceIds); return null; } }); } if (!newVmDevices.isEmpty()) { TransactionSupport.executeInScope(TransactionScopeOption.Required, new TransactionMethod<Void>() { @Override public Void runInTransaction() { getDbFacade().getVmDeviceDAO().saveAll(newVmDevices); return null; } }); } }

Target:
private void saveVmDevicesToDb() { updateAllInTransaction(vmDeviceToSave.values(), getDbFacade().getVmDeviceDAO()); if (!removedDeviceIds.isEmpty()) { TransactionSupport.executeInScope(TransactionScopeOption.Required, new TransactionMethod<Void>() { @Override public Void runInTransaction() { getDbFacade().getVmDeviceDAO().removeAll(removedDeviceIds); return null; } }); } if (!newVmDevices.isEmpty()) { TransactionSupport.executeInScope(TransactionScopeOption.Required, new TransactionMethod<Void>() { @Override public Void runInTransaction() { getDbFacade().getVmDeviceDAO().saveAll(newVmDevices); return null; } }); } }
Source:
public ColumnMetadata(String name, Type type, String comment, String extraInfo, boolean hidden, Map<String, Object> properties) { if (name == null || name.isEmpty()) { throw new NullPointerException("name is null or empty"); } if (type == null) { throw new NullPointerException("type is null"); } this.name = name.toLowerCase(ENGLISH); this.type = type; this.comment = comment; this.extraInfo = extraInfo; this.hidden = hidden; this.properties = (properties != null && !properties.isEmpty()) ? Collections.unmodifiableMap(new LinkedHashMap<>(properties)) : Collections.emptyMap(); }

Target:
public ColumnMetadata(String name, Type type, String comment, String extraInfo, boolean hidden, Map<String, Object> properties) { if (name == null || name.isEmpty()) { throw new NullPointerException("name is null or empty"); } if (type == null) { throw new NullPointerException("type is null"); } if (properties == null) { throw new NullPointerException("properties is null"); } this.name = name.toLowerCase(ENGLISH); this.type = type; this.comment = comment; this.extraInfo = extraInfo; this.hidden = hidden; this.properties = properties.isEmpty() ? emptyMap() : unmodifiableMap(new LinkedHashMap<>(properties)); }
Source:
public StreamableOperator createStreamableOperator(final PartitionInfo partitionInfo, final PortObjectSpec[] inSpecs) throws InvalidSettingsException { return new StreamableOperator() { @Override public void runFinal(PortInput[] inputs, PortOutput[] outputs, ExecutionContext exec) throws Exception { RowInput in = (RowInput) inputs[0]; RowOutput out = (RowOutput) outputs[0]; final AtomicBoolean encounteredExceptions = new AtomicBoolean(false); ReadImgTableFunction<T> readImgFunction = createImgTableFunction(exec, in.getDataTableSpec(), 1); DataRow row; while ((row = in.poll()) != null) { readImgFunction.apply(row).forEachOrdered(result -> { if (result.getSecond().isPresent()) { encounteredExceptions.set(true); LOGGER.warn("Encountered exception while reading image " + result.getFirst().getKey() + "! Caught Exception: " + result.getSecond().get().getMessage()); LOGGER.debug(result.getSecond().get()); } try { out.push(result.getFirst()); } catch (Exception exc) { encounteredExceptions.set(true); LOGGER.warn("Couldn't push result for row " + result.getFirst().getKey()); } }); } if (encounteredExceptions.get()) { setWarningMessage("Encountered errors during execution!"); } in.close(); out.close(); readImgFunction.close(); } }; }

Target:
public StreamableOperator createStreamableOperator(final PartitionInfo partitionInfo, final PortObjectSpec[] inSpecs) throws InvalidSettingsException { return new StreamableOperator() { @Override public void runFinal(PortInput[] inputs, PortOutput[] outputs, ExecutionContext exec) throws Exception { RowInput in = (RowInput) inputs[0]; RowOutput out = (RowOutput) outputs[0]; final AtomicBoolean encounteredExceptions = new AtomicBoolean(false); ReadImgTableFunction<T> readImgFunction = createImgTableFunction(exec, in.getDataTableSpec(), 1); DataRow row; while ((row = in.poll()) != null) { readImgFunction.apply(row).forEachOrdered(result -> { if (result.getSecond().isPresent()) { encounteredExceptions.set(true); LOGGER.warn("Encountered exception while reading image: " + result.getFirst().getKey() + "! view log for more info."); LOGGER.debug("Encountered exception while reading image:", result.getSecond().get()); } try { out.push(result.getFirst()); } catch (Exception exc) { encounteredExceptions.set(true); LOGGER.warn("Couldn't push row " + result.getFirst().getKey() + " into output stream."); LOGGER.debug("Encountered exception when trying to push result: ", exc); } }); } if (encounteredExceptions.get()) { setWarningMessage("Encountered errors during execution!"); } in.close(); out.close(); readImgFunction.close(); } }; }
Source:
private PRPAIN201306UV02 checkPolicyFormatResponse(PRPAIN201305UV02 request, AssertionType assertion, PRPAIN201306UV02 response) { PRPAIN201306UV02 formatResponse = response; if (checkPolicy(formatResponse, assertion)) { storeMapping(request); try { II requestPatId = providedPatientId(request); if (requestPatId != null) { createPatientCorrelation(formatResponse, assertion, request); } } catch (Exception ex) { LOG.error(ex.getMessage(), ex); } formatResponse = addAuthorOrPerformer(formatResponse); } else { LOG.warn("Policy Check Failed"); formatResponse = addPolicyDenyReasonOf(formatResponse); } return formatResponse; }

Target:
private PRPAIN201306UV02 checkPolicyFormatResponse(PRPAIN201305UV02 request, AssertionType assertion, PRPAIN201306UV02 response) { PRPAIN201306UV02 formatResponse = response; if (checkPolicy(formatResponse, assertion)) { storeMapping(request); try { II requestPatId = providedPatientId(request); if (requestPatId != null) { createPatientCorrelation(formatResponse, assertion, request); } } catch (Exception ex) { LOG.error("Exception found in policy check: ", ex.getMessage(), ex); } formatResponse = addAuthorOrPerformer(formatResponse); } else { LOG.warn("Policy Check Failed"); formatResponse = addPolicyDenyReasonOf(formatResponse); } return formatResponse; }
Source:
public void channelRead(ChannelHandlerContext ctx, Object obj) throws Exception { logger.trace("Reading on channel {}", ctx.channel()); if (obj instanceof HttpRequest && ((HttpRequest) obj).getUri().equals(healthCheckUri)) { logger.trace("Handling health check request while in state " + healthCheckService.isServiceUp()); HttpRequest request = (HttpRequest) obj; FullHttpResponse response; if (healthCheckService.isServiceUp()) { response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK, Unpooled.wrappedBuffer(goodBytes)); HttpHeaders.setKeepAlive(response, HttpHeaders.isKeepAlive(request)); HttpHeaders.setContentLength(response, goodBytes.length); } else { response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.SERVICE_UNAVAILABLE, Unpooled.wrappedBuffer(badBytes)); HttpHeaders.setKeepAlive(response, false); HttpHeaders.setContentLength(response, badBytes.length); } ReferenceCountUtil.release(obj); ctx.writeAndFlush(response); } else { super.channelRead(ctx, obj); } }

Target:
public void channelRead(ChannelHandlerContext ctx, Object obj) throws Exception { logger.trace("Reading on channel {}", ctx.channel()); boolean forwardObj = false; if (obj instanceof HttpRequest) { if(request == null && ((HttpRequest) obj).getUri().equals(healthCheckUri)) { logger.trace("Handling health check request while in state " + restServerState.isServiceUp()); request = (HttpRequest) obj; if (restServerState.isServiceUp()) { response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK, Unpooled.wrappedBuffer(goodBytes)); HttpHeaders.setKeepAlive(response, HttpHeaders.isKeepAlive(request)); HttpHeaders.setContentLength(response, goodBytes.length); } else { response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.SERVICE_UNAVAILABLE, Unpooled.wrappedBuffer(badBytes)); HttpHeaders.setKeepAlive(response, false); HttpHeaders.setContentLength(response, badBytes.length); } } else { forwardObj = true; } } if (obj instanceof LastHttpContent) { if (response != null) { ChannelFuture future = ctx.writeAndFlush(response); if(!HttpHeaders.isKeepAlive(response)){ future.addListener(ChannelFutureListener.CLOSE); } request = null; } else { forwardObj = true; } } else { forwardObj = true; } if (forwardObj) { super.channelRead(ctx, obj); } else{ ReferenceCountUtil.release(obj); } }
Source:
public void testGetEntityNameByIdAndTypeForCpuProfile() { CpuProfile cpuProfile = dbFacade.getCpuProfileDao().get(FixturesTool.CPU_PROFILE_1); assertNotNull(cpuProfile); String name = cpuProfile.getName(); assertTrue(name.equals(dbFacade.getEntityNameByIdAndType(FixturesTool.CPU_PROFILE_1, VdcObjectType.CpuProfile))); }

Target:
public void testGetEntityNameByIdAndTypeForCpuProfile() { CpuProfile cpuProfile = dbFacade.getCpuProfileDao().get(FixturesTool.CPU_PROFILE_1); assertNotNull(cpuProfile); String name = cpuProfile.getName(); assertEquals(name, dbFacade.getEntityNameByIdAndType(FixturesTool.CPU_PROFILE_1, VdcObjectType.CpuProfile)); }
Source:
public void delete(int itemDataId) { String query = " delete from " + getDomainClassName() + " where itemDataId =:itemDataId "; org.hibernate.Query q = getCurrentSession().createQuery(query); q.setInteger("itemDataId", itemDataId); q.executeUpdate(); }

Target:
public void delete(int itemDataId) { String query = " delete from " + getDomainClassName() + " where itemDataId =:itemDataId "; Query q = getCurrentSession().createQuery(query); q.setInteger("itemDataId", itemDataId); q.executeUpdate(); }
Source:
private Map<Type, Object> createValueAdapter() { Map<Type, Object> valueAdapter = new HashMap<>(); valueAdapter.put(Observation.ObservationValue.class, new Observation.ObservationValueSerializer()); return valueAdapter; }

Target:
private Map<Type, Object> createValueAdapter() { Map<Type, Object> valueAdapter = new HashMap<>(); valueAdapter.put(Observation.ObservationValue.class, new Observation.ObservationValueDeserializer()); return valueAdapter; }
Source:
protected List<List<MetricSchemaRecord>> _fracture(List<Metric> metrics) { List<List<MetricSchemaRecord>> fracturedList = new ArrayList<>(); List<MetricSchemaRecord> records = new ArrayList<>(_bulkIndexingSize); for(Metric metric : metrics) { if(metric.getTags().isEmpty()) { MetricSchemaRecord msr = new MetricSchemaRecord(metric.getScope(), metric.getMetric()); msr.setNamespace(metric.getNamespace()); records.add(msr); if(records.size() == _bulkIndexingSize) { fracturedList.add(records); records = new ArrayList<>(_bulkIndexingSize); } continue; } String retention = metric.getMetatagsRecord()==null?null:metric.getMetatagsRecord().getMetatagValue(MetricSchemaRecord.RETENTION_DISCOVERY); Integer retentionInt = null; if (retention != null) { try { retentionInt = Integer.parseInt(retention); } catch(NumberFormatException e) { _logger.warn("expect _retention_discovery_ to be a numeric value; is invalid", retention); } } for(Map.Entry<String, String> entry : metric.getTags().entrySet()) { records.add(new MetricSchemaRecord(metric.getNamespace(), metric.getScope(), metric.getMetric(), entry.getKey(), entry.getValue(), retentionInt)); if(records.size() == _bulkIndexingSize) { fracturedList.add(records); records = new ArrayList<>(_bulkIndexingSize); } } } if(!records.isEmpty()) { fracturedList.add(records); } return fracturedList; }

Target:
protected List<List<MetricSchemaRecord>> _fracture(List<Metric> metrics) { List<List<MetricSchemaRecord>> fracturedList = new ArrayList<>(); List<MetricSchemaRecord> records = new ArrayList<>(_bulkIndexingSize); for(Metric metric : metrics) { if(metric.getTags().isEmpty()) { MetricSchemaRecord msr = new MetricSchemaRecord(metric.getScope(), metric.getMetric()); msr.setNamespace(metric.getNamespace()); records.add(msr); if(records.size() == _bulkIndexingSize) { fracturedList.add(records); records = new ArrayList<>(_bulkIndexingSize); } continue; } String retention = metric.getMetatagsRecord()==null?null:metric.getMetatagsRecord().getMetatagValue(MetricSchemaRecord.RETENTION_DISCOVERY); Integer retentionInt = null; if (retention != null) { try { retentionInt = Integer.parseInt(retention); } catch(NumberFormatException e) { _logger.debug("expect _retention_discovery_ to be a numeric value; is invalid", retention); } } for(Map.Entry<String, String> entry : metric.getTags().entrySet()) { records.add(new MetricSchemaRecord(metric.getNamespace(), metric.getScope(), metric.getMetric(), entry.getKey(), entry.getValue(), retentionInt)); if(records.size() == _bulkIndexingSize) { fracturedList.add(records); records = new ArrayList<>(_bulkIndexingSize); } } } if(!records.isEmpty()) { fracturedList.add(records); } return fracturedList; }
Source:
private static String convert (String className) { if (className.startsWith("[")) { int dimensions = 0; char c = className.charAt(0); StringBuilder suffix = new StringBuilder(); while (c == '[') { dimensions++; suffix.append("[]"); c = className.charAt(dimensions); } char t = className.charAt(dimensions); switch (t) { case 'Z': return "boolean" + suffix; case 'B': return "byte" + suffix; case 'C': return "char" + suffix; case 'L': return className.substring(dimensions + 1, className.length() - 1).replace('$', '.') + suffix; case 'D': return "double" + suffix; case 'F': return "float" + suffix; case 'I': return "int" + suffix; case 'J': return "long" + suffix; case 'S': return "short" + suffix; default: throw new IllegalArgumentException("Couldn't transform '" + className + "' to qualified source name"); } } else { return className.replace('$', '.'); } }

Target:
private static String convert (String className) { if (className.startsWith("[")) { int dimensions = 0; char c = className.charAt(0); StringBuilder stringBuilder = new StringBuilder(); while (c == '[') { dimensions++; c = className.charAt(dimensions); } char t = className.charAt(dimensions); switch (t) { case 'Z': stringBuilder.append("boolean"); break; case 'B': stringBuilder.append("byte"); break; case 'C': stringBuilder.append("char"); break; case 'L': stringBuilder.append(className.substring(dimensions + 1, className.length() - 1).replace('$', '.')); break; case 'D': stringBuilder.append("double"); break; case 'F': stringBuilder.append("float"); break; case 'I': stringBuilder.append("int"); break; case 'J': stringBuilder.append("long"); break; case 'S': stringBuilder.append("short"); break; default: throw new IllegalArgumentException("Couldn't transform '" + className + "' to qualified source name"); } for(int i=0;i<dimensions;i++){ stringBuilder.append("[]"); } return stringBuilder.toString(); } else { return className.replace('$', '.'); } }
Source:
public void testTextFiles() throws IOException { Configuration conf = new Configuration(); setConf(conf); conf.set("test.partfile.dir", partFileTextDir.toString()); conf.set(GrillConfConstants.QUERY_OUTPUT_FILE_EXTN, ".txt"); conf.set(GrillConfConstants.QUERY_OUTPUT_HEADER, "firstcolformat(secondcol,2)thirdcolfourthcolfifthcolsixthcolseventhcol"); testFormatter(conf, "UTF8", GrillConfConstants.GRILL_RESULT_SET_PARENT_DIR_DEFAULT, ".txt",getMockedResultSetWithoutComma()); Assert.assertEquals(readFinalOutputFile( new Path(formatter.getFinalOutputPath()), conf, "UTF-8"), getExpectedTextRows()); }

Target:
public void testTextFiles() throws IOException { Configuration conf = new Configuration(); setConf(conf); conf.set("test.partfile.dir", partFileTextDir.toString()); conf.set(GrillConfConstants.QUERY_OUTPUT_FILE_EXTN, ".txt"); conf.set(GrillConfConstants.QUERY_OUTPUT_HEADER, "firstcolsecondcolthirdcolfourthcolfifthcolsixthcolseventhcol"); testFormatter(conf, "UTF8", GrillConfConstants.GRILL_RESULT_SET_PARENT_DIR_DEFAULT, ".txt",getMockedResultSetWithoutComma()); Assert.assertEquals(readFinalOutputFile( new Path(formatter.getFinalOutputPath()), conf, "UTF-8"), getExpectedTextRowsWithoutComma()); }
Source:
private String getSpecifiedSection(ExecutionHandlerContext context, List<ByteArrayWrapper> commands) { String result = ""; String section = commands.get(1).toString().toLowerCase(); switch (section) { case "server": result = getServerSection(context); break; case "cluster": result = getClusterSection(); break; case "persistence": result = getPersistenceSection(); break; case "default": case "all": result = getAllSections(context); break; } return result; }

Target:
private String getSpecifiedSection(ExecutionHandlerContext context, List<ByteArrayWrapper> commands) { String result; String section = commands.get(1).toString().toLowerCase(); switch (section) { case "server": result = getServerSection(context); break; case "cluster": result = getClusterSection(); break; case "persistence": result = getPersistenceSection(); break; case "default": case "all": result = getAllSections(context); break; default: result = ""; break; } return result; }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_contact_us); initViewFields(); send.setOnClickListener(v -> { String name_str = name.getText().toString(); String subject_str = subject.getText().toString(); String msg_str = message.getText().toString(); Intent sendMail = new Intent(Intent.ACTION_SEND); sendMail.putExtra(Intent.EXTRA_EMAIL, new String[]{"helpdesk@openmrs.com"}); sendMail.putExtra(Intent.EXTRA_SUBJECT, name_str + " wants to get in touch."); sendMail.putExtra(Intent.EXTRA_TEXT, "Regarding: " + subject_str + "\n" + msg_str); sendMail.setType("message/rfc822"); startActivity(Intent.createChooser(sendMail, "Choose an Email Client")); }); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_contact_us); initViewFields(); sendButton.setOnClickListener(view -> { String name_str = nameTIET.getText().toString(); String subject_str = subjectTIET.getText().toString(); String msg_str = messageTIET.getText().toString(); Intent sendMail = new Intent(Intent.ACTION_SEND); sendMail.putExtra(Intent.EXTRA_EMAIL, new String[]{getString(R.string.contact_us_helpdesk)}); sendMail.putExtra(Intent.EXTRA_SUBJECT, name_str + getString(R.string.contact_us_get_in_touch)); sendMail.putExtra(Intent.EXTRA_TEXT, getString(R.string.contact_us_regarding) + subject_str + "\n" + msg_str); sendMail.setType(getString(R.string.contact_email_type)); startActivity(Intent.createChooser(sendMail, getString(R.string.choose_a_email_client))); }); forumButton.setOnClickListener(view -> { Uri forumUri = Uri.parse(getString(R.string.contact_forum_url)); Intent forumIntent = new Intent(Intent.ACTION_VIEW, forumUri); startActivity(forumIntent); }); ircButton.setOnClickListener(view -> { Uri ircUri = Uri.parse(getString(R.string.contact_irc_url)); Intent ircIntent = new Intent(Intent.ACTION_VIEW, ircUri); startActivity(ircIntent); }); }
Source:
public Answer execute(final OvsVpcPhysicalTopologyConfigCommand command, final LibvirtComputingResource libvirtComputingResource) { try { final Script scriptCommand = new Script(libvirtComputingResource.getOvsTunnelPath(), libvirtComputingResource.getTimeout().getMillis(), s_logger); scriptCommand.add("configure_ovs_bridge_for_network_topology"); scriptCommand.add("--bridge", command.getBridgeName()); scriptCommand.add("--config", command.getVpcConfigInJson()); final String result = scriptCommand.execute(); if (result.equalsIgnoreCase("SUCCESS")) { return new Answer(command, true, result); } else { return new Answer(command, false, result); } } catch (final Exception e) { s_logger.warn("caught exception while updating host with latest routing polcies", e); return new Answer(command, false, e.getMessage()); } }

Target:
public Answer execute(final OvsVpcPhysicalTopologyConfigCommand command, final LibvirtComputingResource libvirtComputingResource) { try { final Script scriptCommand = new Script(libvirtComputingResource.getOvsTunnelPath(), libvirtComputingResource.getTimeout(), s_logger); scriptCommand.add("configure_ovs_bridge_for_network_topology"); scriptCommand.add("--bridge", command.getBridgeName()); scriptCommand.add("--config", command.getVpcConfigInJson()); final String result = scriptCommand.execute(); if (result.equalsIgnoreCase("SUCCESS")) { return new Answer(command, true, result); } else { return new Answer(command, false, result); } } catch (final Exception e) { s_logger.warn("caught exception while updating host with latest routing polcies", e); return new Answer(command, false, e.getMessage()); } }
Source:
private Properties getAssociatedDataProperties() { try (InputStream inputStream = getAssociatedDataPropertiesInputStream()) { if (inputStream == null) { return new Properties(); } Properties properties = new Properties(); properties.load(inputStream); return properties; } catch (IOException e) { return new Properties(); } }

Target:
private Properties getAssociatedDataProperties() { try (InputStream inputStream = getAssociatedDataPropertiesInputStream()) { Properties properties = new Properties(); if (inputStream != null) { properties.load(inputStream); } return properties; } catch (IOException e) { return new Properties(); } }
Source:
public void testStaticInnerClasses() { try { ReflectData.get().getSchema(Meta.class); } catch (AvroTypeException ex) { fail("Should have no exception"); } }

Target:
public void testStaticInnerClasses() { ReflectData.get().getSchema(Meta.class); }
Source:
public void testDeployRoot() throws Exception { TestApplication app = new TestApplication(); ManagedApplication ma = new ManagedApplication( app ); this.managerWrapper.getNameToManagedApplication().put( app.getName(), ma ); String targetId = this.manager.targetsMngr().createTarget( "id:tid\nprop: ok\nhandler: test" ); this.manager.targetsMngr().associateTargetWith( targetId, app, null ); File dir = new File( this.manager.configurationMngr().getWorkingDirectory(), ConfigurationUtils.TARGETS + "/" + targetId ); Utils.createDirectory( dir ); Utils.writeStringInto( "#!/bin/bash\necho Bonjour le monde cruel > toto.txt", new File( dir, Constants.TARGET_SCRIPT_FILE_NAME )); Assert.assertNotNull( this.manager.targetsMngr().findScriptResources(targetId) ); Assert.assertEquals( 0, this.targetResolver.instancePathToRunningStatus.size()); this.manager.instancesMngr().changeInstanceState( ma, app.getMySqlVm(), InstanceStatus.DEPLOYED_STARTED ); Assert.assertEquals( 1, this.targetResolver.instancePathToRunningStatus.size()); Assert.assertTrue( this.targetResolver.isRunning( app.getMySqlVm())); Assert.assertEquals( 1, ma.getScopedInstanceToAwaitingMessages().size()); List<Message> messages = ma.getScopedInstanceToAwaitingMessages().get( app.getMySqlVm()); Assert.assertEquals( 1, messages.size()); Message msg = messages.get( 0 ); Assert.assertEquals( MsgCmdSetScopedInstance.class, msg.getClass()); Assert.assertEquals( app.getMySqlVm(), ((MsgCmdSetScopedInstance) msg).getScopedInstance()); }

Target:
public void testDeployRoot() throws Exception { TestApplication app = new TestApplication(); ManagedApplication ma = new ManagedApplication( app ); this.managerWrapper.getNameToManagedApplication().put( app.getName(), ma ); String targetId = this.manager.targetsMngr().createTarget( "id:tid\nprop: ok\nhandler: test" ); this.manager.targetsMngr().associateTargetWith( targetId, app, null ); Assert.assertEquals( 0, this.targetResolver.instancePathToRunningStatus.size()); this.manager.instancesMngr().changeInstanceState( ma, app.getMySqlVm(), InstanceStatus.DEPLOYED_STARTED ); Assert.assertEquals( 1, this.targetResolver.instancePathToRunningStatus.size()); Assert.assertTrue( this.targetResolver.isRunning( app.getMySqlVm())); Assert.assertEquals( 1, ma.getScopedInstanceToAwaitingMessages().size()); List<Message> messages = ma.getScopedInstanceToAwaitingMessages().get( app.getMySqlVm()); Assert.assertEquals( 1, messages.size()); Message msg = messages.get( 0 ); Assert.assertEquals( MsgCmdSetScopedInstance.class, msg.getClass()); Assert.assertEquals( app.getMySqlVm(), ((MsgCmdSetScopedInstance) msg).getScopedInstance()); }
Source:
FeedbackSessionAttributes() { isOpeningEmailEnabled = true; isClosingEmailEnabled = true; isPublishedEmailEnabled = true; respondingInstructorList = new HashSet<>(); respondingStudentList = new HashSet<>(); timeZone = ZoneId.of("UTC"); instructions = new Text(""); }

Target:
FeedbackSessionAttributes() { isOpeningEmailEnabled = true; isClosingEmailEnabled = true; isPublishedEmailEnabled = true; respondingInstructorList = new HashSet<>(); respondingStudentList = new HashSet<>(); timeZone = Const.DEFAULT_TIME_ZONE; instructions = new Text(""); }
Source:
public Optional tileentityinventory$getCarrier() { return Optional.of(this); }

Target:
public Optional<? extends TileEntityCarrier> tileentityinventory$getCarrier() { return Optional.of(this); }
Source:
protected Exchange getExchange() { if (exchange == null) { exchange = ExchangeFactory.INSTANCE.createExchange(exchangeSpecification); } return exchange; }

Target:
protected synchronized Exchange getExchange() { if (exchange == null) { exchange = ExchangeFactory.INSTANCE.createExchange(exchangeSpecification); } return exchange; }
Source:
public IAEItemStack injectItems( final IAEItemStack input, final Actionable type, final IActionSource src ) { if( this.hasPermission( src ) ) { if( AEApi.instance().definitions().items().biometricCard().isSameAs( input.getDefinition() ) ) { if( this.canAccept( input ) ) { if( type == Actionable.SIMULATE ) { return null; } this.getStoredItems().add( input ); this.securityTile.inventoryChanged(); return null; } } } return input; }

Target:
public IAEItemStack injectItems( final IAEItemStack input, final Actionable type, final IActionSource src ) { if( this.hasPermission( src ) ) { if( AEApi.instance().definitions().items().biometricCard().isSameAs( input.createItemStack() ) ) { if( this.canAccept( input ) ) { if( type == Actionable.SIMULATE ) { return null; } this.getStoredItems().add( input ); this.securityTile.inventoryChanged(); return null; } } } return input; }
Source:
public void FBButton_004_ForcedLoginButton_Visible() { WikiBasePageObject base = new WikiBasePageObject(driver); SpecialNewFilesPageObject specialPage = base .openSpecialNewFiles(wikiURL); specialPage.verifySpecialPage(); specialPage.addPhoto(); specialPage.verifyModalLoginAppeared(); base.verifyFBButtonVisible(); }

Target:
public void FBButton_004_ForcedLoginButton_Visible() { WikiBasePageObject base = new WikiBasePageObject(driver); SpecialNewFilesPageObject specialPage = base.openSpecialNewFiles(wikiURL); specialPage.verifySpecialPage(); specialPage.addPhoto(); specialPage.verifyModalLoginAppeared(); specialPage.verifyModalFBButtonVisible(); }
Source:
public void freeTicketWhenExists(TicketsInteractor mockedTicketsInteractor) throws RecordNotFoundException, UpdateTicketStateUnauthorizedException { long ticketId = 1; ObjectNode json = Json.newObject(); ArrayNode node = json.putArray(ConstantsManager.TICKET_IDS_FIELD_NAME); node.add(ticketId); when(mockedBody.asJson()).thenReturn(json); Result result = ticketsController.free(); assertEquals(Helpers.OK, Helpers.status(result)); verify(mockedTicketsInteractor, times(1)).freeATicket(ticketId); }

Target:
public void freeTicketWhenExists(TicketsInteractor mockedTicketsInteractor) throws RecordNotFoundException, UpdateTicketStateUnauthorizedException { long ticketId = 1; ObjectNode json = Json.newObject(); ArrayNode node = json.putArray(ConstantsManager.TICKET_IDS_FIELD_NAME); node.add(ticketId); when(mockedBody.asJson()).thenReturn(json); Result result = ticketsController.free(); assertEquals(Helpers.OK, Helpers.status(result)); verify(mockedTicketsInteractor).freeATicket(ticketId); }
Source:
public final Loader<? extends BenchmarkModule> loadDatabase() { Loader<? extends BenchmarkModule> loader = null; try { loader = this.makeLoaderImpl(); if (loader != null) { List<? extends LoaderThread> loaderThreads = loader.createLoaderThreads(); if (loaderThreads != null) { int maxConcurrent = workConf.getLoaderThreads(); assert (maxConcurrent > 0); if (LOG.isDebugEnabled()) LOG.debug(String.format("Starting %d %s.LoaderThreads [maxConcurrent=%d]", loaderThreads.size(), loader.getClass().getSimpleName(), maxConcurrent)); ThreadUtil.runNewPool(loaderThreads, maxConcurrent); if (loader.getTableCounts().isEmpty() == false) { LOG.info("Table Counts:\n" + loader.getTableCounts()); } } for (LoaderThread t : loaderThreads) { t.getConn().close(); } } } catch (SQLException ex) { String msg = String.format("Unexpected error when trying to load the %s database", this.benchmarkName.toUpperCase()); throw new RuntimeException(msg, ex); } if (LOG.isDebugEnabled()) LOG.debug(String.format("Finished loading the %s database", this.getBenchmarkName().toUpperCase())); return (loader); }

Target:
public final Loader<? extends BenchmarkModule> loadDatabase() { Loader<? extends BenchmarkModule> loader = null; try { loader = this.makeLoaderImpl(); if (loader != null) { List<? extends LoaderThread> loaderThreads = loader.createLoaderThreads(); if (loaderThreads != null) { try{ int maxConcurrent = workConf.getLoaderThreads(); assert (maxConcurrent > 0); if (LOG.isDebugEnabled()) LOG.debug(String.format("Starting %d %s.LoaderThreads [maxConcurrent=%d]", loaderThreads.size(), loader.getClass().getSimpleName(), maxConcurrent)); ThreadUtil.runNewPool(loaderThreads, maxConcurrent); if (loader.getTableCounts().isEmpty() == false) { LOG.info("Table Counts:\n" + loader.getTableCounts()); } } catch (Exception ex){ String msg = String.format("Unexpected error when trying to load the %s database", this.benchmarkName.toUpperCase()); throw new RuntimeException(msg, ex); } finally { for (LoaderThread t : loaderThreads) { t.getConnection().close(); } } } } } catch (SQLException ex) { String msg = String.format("Unexpected error when trying to load the %s database", this.benchmarkName.toUpperCase()); throw new RuntimeException(msg, ex); } if (LOG.isDebugEnabled()) LOG.debug(String.format("Finished loading the %s database", this.getBenchmarkName().toUpperCase())); return (loader); }
Source:
private long getNumInstancesWithAttribute(List<SingularityTaskId> taskIds, String attrKey, String attrValue) { return taskIds.stream() .map(id -> slaveManager.getSlave(taskManager.getTask(id).get().getMesosTask().getSlaveId().getValue()).get().getAttributes().get(attrKey)) .filter(Objects::nonNull) .filter(x -> x.equals(attrValue)) .count(); }

Target:
private long getNumInstancesWithAttribute(List<SingularityTaskId> taskIds, String attrKey, String attrValue) { return taskIds.stream() .map(id -> leaderCache.getSlave(taskManager.getTask(id).get().getMesosTask().getSlaveId().getValue()).get().getAttributes().get(attrKey)) .filter(Objects::nonNull) .filter(x -> x.equals(attrValue)) .count(); }
Source:
public LiveData<List<Provider>> getProviders(RestApi restApi) { final MutableLiveData<List<Provider>> providerLiveData = new MutableLiveData<>(); if (NetworkUtils.isOnline()) { restApi.getProviderList().enqueue(new Callback<Results<Provider>>() { @Override public void onResponse(@NotNull Call<Results<Provider>> call, Response<Results<Provider>> response) { if (response.isSuccessful()) { if (!response.body().getResults().isEmpty()) { providerLiveData.setValue(response.body().getResults()); } else { providerLiveData.setValue(null); } } else { Log.d(TAG, "Response Unsuccessful!" + response.errorBody()); ToastUtil.error(OpenMRS.getInstance().getString(R.string.unable_to_fetch_providers)); providerLiveData.setValue(null); } } @Override public void onFailure(@NotNull Call<Results<Provider>> call, @NotNull Throwable t) { Log.d(TAG, "Call Failed! Error: " + t.getMessage()); ToastUtil.error(OpenMRS.getInstance().getString(R.string.unable_to_fetch_providers)); providerLiveData.setValue(null); } }); } else { ToastUtil.error(OpenMRS.getInstance().getString(R.string.device_offline_msg)); } return providerLiveData; }

Target:
public LiveData<List<Provider>> getProviders(RestApi restApi) { final MutableLiveData<List<Provider>> providerLiveData = new MutableLiveData<>(); if (NetworkUtils.isOnline()) { restApi.getProviderList().enqueue(new Callback<Results<Provider>>() { @Override public void onResponse(@NotNull Call<Results<Provider>> call, @NotNull Response<Results<Provider>> response) { if (response.isSuccessful()) { if (!response.body().getResults().isEmpty()) { providerLiveData.setValue(response.body().getResults()); } else { providerLiveData.setValue(null); } } else { Log.d(TAG, "Response Unsuccessful!" + response.errorBody()); ToastUtil.error(OpenMRS.getInstance().getString(R.string.unable_to_fetch_providers)); providerLiveData.setValue(null); } } @Override public void onFailure(@NotNull Call<Results<Provider>> call, @NotNull Throwable t) { Log.d(TAG, "Call Failed! Error: " + t.getMessage()); ToastUtil.error(OpenMRS.getInstance().getString(R.string.unable_to_fetch_providers)); providerLiveData.setValue(null); } }); } else { ToastUtil.error(OpenMRS.getInstance().getString(R.string.device_offline_msg)); } return providerLiveData; }
Source:
public static void restartAlarmManagerTimeOfDay(Context context, Calendar alarm) { AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); PendingIntent updateIntent = PendingIntent.getBroadcast(context, 0, new Intent(context, FeedUpdateReceiver.class), 0); if (alarmManager == null) { Log.d(TAG, "AlarmManager was null"); return; } alarmManager.cancel(updateIntent); Log.d(TAG, "Alarm set for: " + alarm.toString() + " : " + alarm.getTimeInMillis()); alarmManager.set(AlarmManager.RTC_WAKEUP, alarm.getTimeInMillis(), updateIntent); Log.d(TAG, "Changed alarm to new time of day " + alarm.get(Calendar.HOUR_OF_DAY) + ":" + alarm.get(Calendar.MINUTE)); }

Target:
private static void restartAlarmManagerTimeOfDay(Context context, Calendar alarm) { AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); if (alarmManager == null) { Log.d(TAG, "AlarmManager was null"); return; } PendingIntent updateIntent = PendingIntent.getBroadcast(context, 0, new Intent(context, FeedUpdateReceiver.class), 0); alarmManager.cancel(updateIntent); Log.d(TAG, "Alarm set for: " + alarm.toString() + " : " + alarm.getTimeInMillis()); alarmManager.set(AlarmManager.RTC_WAKEUP, alarm.getTimeInMillis(), updateIntent); Log.d(TAG, "Changed alarm to new time of day " + alarm.get(Calendar.HOUR_OF_DAY) + ":" + alarm.get(Calendar.MINUTE)); }
Source:
public static PointValue fromMap( MapValue map ) { AnyValue[] fields = new Value[PointValueField.__MAX_VALUE__.ordinal()]; for ( PointValueField f : PointValueField.values() ) { if ( f != PointValueField.__MAX_VALUE__ ) { AnyValue fieldValue = map.get( f.name().toLowerCase() ); fields[f.ordinal()] = fieldValue != Values.NO_VALUE ? fieldValue : null; } } return fromInputFields( fields ); }

Target:
public static PointValue fromMap( MapValue map ) { AnyValue[] fields = new Value[PointValueField.values().length]; for ( PointValueField f : PointValueField.values() ) { AnyValue fieldValue = map.get( f.name().toLowerCase() ); fields[f.ordinal()] = fieldValue != Values.NO_VALUE ? fieldValue : null; } return fromInputFields( fields ); }
Source:
private void getCorrelationTypesFromCr() throws CentralRepoException { typeCache.invalidateAll(); Connection conn = connect(); PreparedStatement preparedStatement = null; ResultSet resultSet = null; String sql = "SELECT * FROM correlation_types"; try { preparedStatement = conn.prepareStatement(sql); resultSet = preparedStatement.executeQuery(); while (resultSet.next()) { CorrelationAttributeInstance.Type aType = getCorrelationTypeFromResultSet(resultSet); typeCache.put(aType.getId(), aType); } } catch (SQLException ex) { throw new CentralRepoException("Error getting correlation types.", ex); } finally { CentralRepoDbUtil.closeStatement(preparedStatement); CentralRepoDbUtil.closeResultSet(resultSet); CentralRepoDbUtil.closeConnection(conn); } }

Target:
private void getCorrelationTypesFromCr() throws CentralRepoException { typeCache.invalidateAll(); String sql = "SELECT * FROM correlation_types"; try ( Connection conn = connect(); PreparedStatement preparedStatement = conn.prepareStatement(sql); ResultSet resultSet = preparedStatement.executeQuery();) { while (resultSet.next()) { CorrelationAttributeInstance.Type aType = getCorrelationTypeFromResultSet(resultSet); typeCache.put(aType.getId(), aType); } } catch (SQLException ex) { throw new CentralRepoException("Error getting correlation types.", ex); } }