auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static Iterable<String> append( final Response res, final int length) throws IOException { return new RsWithHeader( res, String.format("Content-Length:%s", length) ).head(); }

Target:
private static Iterable<String> append( final Response res, final int length) throws IOException { return new RsWithHeader( res, "Content-Length", Integer.toString(length) ).head(); }
Source:
public Iterator<Entry<KeyType>> iterator(final boolean sorted) { if (!initialized) { throw new ISE("Grouper is not initialized"); } if (closed) { throw new ISE("Grouper is closed"); } final List<Iterator<Entry<KeyType>>> sortedIterators = sorted && isParallelizable() ? parallelSortAndGetGroupersIterator() : getGroupersIterator(sorted); if (sorted && spilling && isParallelizable()) { final List<String> mergedDictionary = mergeDictionary(); if (mergedDictionary != null) { return parallelCombine(sortedIterators, mergedDictionary); } } return Groupers.mergeIterators(sortedIterators, sorted ? keyObjComparator : null); }

Target:
public CloseableIterator<Entry<KeyType>> iterator(final boolean sorted) { if (!initialized) { throw new ISE("Grouper is not initialized"); } if (closed) { throw new ISE("Grouper is closed"); } final List<CloseableIterator<Entry<KeyType>>> sortedIterators = sorted && isParallelizable() ? parallelSortAndGetGroupersIterator() : getGroupersIterator(sorted); if (sorted && spilling && parallelCombiner != null) { final List<String> dictionary = tryMergeDictionary(); if (dictionary != null) { return parallelCombiner.combine(sortedIterators, dictionary); } } return sorted ? CloseableIterators.mergeSorted(sortedIterators, keyObjComparator) : CloseableIterators.concat(sortedIterators); }
Source:
public void testYellow() { SWTBotView viewBot = fBot.viewById(ColorsView.ID); viewBot.setFocus(); String insert = "Insert new color setting"; String increasePriority = "Increase priority"; String decreasePriority = "Decrease priority"; String delete = "Delete color setting"; viewBot.toolbarButton(insert).click(); viewBot.toolbarButton(insert).click(); viewBot.toolbarButton(insert).click(); viewBot.toolbarButton(insert).click(); viewBot.toolbarButton(increasePriority).click(); viewBot.toolbarButton(decreasePriority).click(); viewBot.toolbarButton(delete).click(); viewBot.bot().label(0).setFocus(); viewBot.toolbarButton(delete).click(); viewBot.bot().label(0).setFocus(); viewBot.toolbarButton(delete).click(); final RGB foreground = new RGB(0, 0, 0); final RGB background = new RGB(255, 255, 0); final ColorSetting[] cs = new ColorSetting[1]; UIThreadRunnable.syncExec(new VoidResult() { @Override public void run() { cs[0] = new ColorSetting(foreground, background, foreground, new PassAll()); ColorSettingsManager.setColorSettings(cs); } }); final SWTBotTable eventsEditor = fBot.activeEditor().bot().table(); eventsEditor.select(2); final SWTBotTableItem tableItem = eventsEditor.getTableItem(2); RGB fgc = UIThreadRunnable.syncExec(new Result<RGB>() { @Override public RGB run() { return tableItem.widget.getForeground().getRGB(); } }); RGB bgc = UIThreadRunnable.syncExec(new Result<RGB>() { @Override public RGB run() { return tableItem.widget.getBackground().getRGB(); } }); assertEquals("Fg", foreground, fgc); assertEquals("Bg", background, bgc); }

Target:
public void testYellow() { SWTBotView viewBot = fBot.viewById(ColorsView.ID); viewBot.setFocus(); final String insert = "Insert new color setting"; final String increasePriority = "Increase priority"; final String decreasePriority = "Decrease priority"; final String delete = "Delete color setting"; viewBot.toolbarButton(insert).click(); viewBot.toolbarButton(insert).click(); viewBot.toolbarButton(insert).click(); viewBot.toolbarButton(insert).click(); viewBot.toolbarButton(increasePriority).click(); viewBot.toolbarButton(decreasePriority).click(); viewBot.toolbarButton(delete).click(); viewBot.bot().label(0).setFocus(); viewBot.toolbarButton(delete).click(); viewBot.bot().label(0).setFocus(); viewBot.toolbarButton(delete).click(); final RGB foreground = new RGB(0, 0, 0); final RGB background = new RGB(255, 255, 0); final ColorSetting[] cs = new ColorSetting[1]; UIThreadRunnable.syncExec(new VoidResult() { @Override public void run() { cs[0] = new ColorSetting(foreground, background, foreground, new PassAll()); ColorSettingsManager.setColorSettings(cs); } }); final SWTBotTable eventsEditor = fBot.activeEditor().bot().table(); eventsEditor.select(2); final SWTBotTableItem tableItem = eventsEditor.getTableItem(2); RGB fgc = UIThreadRunnable.syncExec(new Result<RGB>() { @Override public RGB run() { return tableItem.widget.getForeground().getRGB(); } }); RGB bgc = UIThreadRunnable.syncExec(new Result<RGB>() { @Override public RGB run() { return tableItem.widget.getBackground().getRGB(); } }); assertEquals("Fg", foreground, fgc); assertEquals("Bg", background, bgc); }
Source:
public void testGetTicketInControlMemberOfTeam() { User user = createUser(); User teammate = createUser(); createTicketForUser(teammate); Team team = createTeamWithCaptain(user); team.addMember(teammate); given(). header(getXAuthTokenHeaderForUser(user)). when(). get(TICKETS_ENDPOINT + "/teammembers"). then(). statusCode(HttpStatus.SC_OK). body("owner.username", containsInAnyOrder(teammate.getUsername())); }

Target:
public void testGetTicketInControlMemberOfTeam() { User user = createUser(); User teammate = createUser(); createTicketForUser(teammate); Team team = createTeamWithCaptain(user); addMemberToTeam(team, teammate); given(). header(getXAuthTokenHeaderForUser(user)). when(). get(TICKETS_ENDPOINT + "/teammembers"). then(). statusCode(HttpStatus.SC_OK). body("owner.username", containsInAnyOrder(teammate.getUsername())); }
Source:
public void testServerSpanNoURLClientSpanNoURL() throws RetryAttemptException { SpanCache spanCacheMock = Mockito.mock(SpanCache.class); NodeDetailsDeriver nodeDetailsDeriver = new NodeDetailsDeriver(spanCacheMock); Annotation cs = new Annotation(); cs.setTimestamp(0); cs.setValue("cs"); Annotation cr = new Annotation(); cr.setValue("cr"); cr.setTimestamp(1000); Span clientSpan = new Span(Collections.emptyList(), Arrays.asList(cs, cr)); clientSpan.setId("2"); clientSpan.setTraceId("1"); clientSpan.setTimestamp(0L); clientSpan.setDuration(cr.getTimestamp() - cs.getTimestamp()); Annotation sr = new Annotation(); sr.setValue("sr"); sr.setTimestamp(0); Annotation ss = new Annotation(); ss.setTimestamp(1000); ss.setValue("ss"); Span serverSpan = new Span(Collections.emptyList(), Arrays.asList(sr, ss)); serverSpan.setId("2"); serverSpan.setTraceId("1"); serverSpan.setTimestamp(0L); serverSpan.setDuration(ss.getTimestamp() - sr.getTimestamp()); Mockito.when(spanCacheMock.get(null, SpanUniqueIdGenerator.getClientId(serverSpan.getId()))) .thenReturn(clientSpan); assertNull(nodeDetailsDeriver.processOneToOne(null, serverSpan)); }

Target:
public void testServerSpanNoURLClientSpanNoURL() throws RetryAttemptException { SpanCache spanCacheMock = Mockito.mock(SpanCache.class); NodeDetailsDeriver nodeDetailsDeriver = new NodeDetailsDeriver(spanCacheMock); Annotation cs = new Annotation(); cs.setValue("cs"); Annotation cr = new Annotation(); cr.setValue("cr"); Span clientSpan = new Span(Collections.emptyList(), Arrays.asList(cs, cr)); clientSpan.setId("2"); clientSpan.setTraceId("1"); Annotation sr = new Annotation(); sr.setValue("sr"); Annotation ss = new Annotation(); ss.setValue("ss"); Span serverSpan = new Span(Collections.emptyList(), Arrays.asList(sr, ss)); serverSpan.setId("2"); serverSpan.setTraceId("1"); Mockito.when(spanCacheMock.get(null, SpanUniqueIdGenerator.getClientId(serverSpan.getId()))) .thenReturn(clientSpan); assertNull(nodeDetailsDeriver.processOneToOne(null, serverSpan)); }
Source:
public void render(TankTileEntity tile, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) { FluidTankAnimated tank = tile.getInternalTank(); FluidStack liquid = tank.getFluid(); if (liquid != null) { float height = (liquid.getAmount() - tank.renderOffset) / tank.getCapacity(); if (tank.renderOffset > 1.2f || tank.renderOffset < -1.2f) { tank.renderOffset -= (tank.renderOffset / 12f + 0.1f) * partialTicks; } else { tank.renderOffset = 0; } IVertexBuilder builder = bufferIn.getBuffer(RenderUtil.FLUID_RENDER_TYPE); float d = RenderUtil.FLUID_OFFSET; if (liquid.getFluid().getAttributes().isGaseous(liquid)) { RenderUtil.renderFluidCuboid(liquid, matrixStackIn, builder, combinedLightIn, d, 1f - (d + height), d, 1f - d, 1f - d, 1f - d); } else { RenderUtil.renderFluidCuboid(liquid, matrixStackIn, builder, combinedLightIn, d, d, d, 1f - d, height - d, 1f - d); } } }

Target:
public void render(TankTileEntity tile, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) { FluidTankAnimated tank = tile.getInternalTank(); FluidStack liquid = tank.getFluid(); if (!liquid.isEmpty()) { float height = (liquid.getAmount() - tank.getRenderOffset()) / tank.getCapacity(); if (tank.getRenderOffset() > 1.2f || tank.getRenderOffset() < -1.2f) { tank.setRenderOffset(tank.getRenderOffset() - ((tank.getRenderOffset() / 12f + 0.1f) * partialTicks)); } else { tank.setRenderOffset(0); } IVertexBuilder builder = bufferIn.getBuffer(RenderUtil.getBlockRenderType()); float d = RenderUtil.FLUID_OFFSET; if (liquid.getFluid().getAttributes().isGaseous(liquid)) { RenderUtil.renderFluidCuboid(liquid, matrixStackIn, builder, combinedLightIn, d, 1f - (d + height), d, 1f - d, 1f - d, 1f - d); } else { RenderUtil.renderFluidCuboid(liquid, matrixStackIn, builder, combinedLightIn, d, d, d, 1f - d, height - d, 1f - d); } } }
Source:
public void edit(final UnitVmModel model) { driver.edit(model); model.getStorageDomain().getItemsChangedEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { addDiskAllocation(model); } }); model.getPropertyChangedEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { String propName = ((PropertyChangedEventArgs) args).propertyName; if ("Message".equals(propName)) { appendMessage(model.getMessage()); } } }); subTemplateExpanderContent.setVisible(false); model.getIsSubTemplate().getEntityChangedEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { subTemplateExpanderContent.setVisible(model.getIsSubTemplate().getEntity()); nameEditor.setEnabled(!model.getIsSubTemplate().getEntity()); if (!model.getIsSubTemplate().getEntity()) { model.getName().setEntity(""); } else { model.getBaseTemplate().setEntity(model.getTemplate().getEntity()); model.getTemplateVersionName().setEntity(model.getName().getEntity()); model.getName().setEntity(model.getBaseTemplate().getSelectedItem().getName()); } } }); model.getBaseTemplate().getSelectedItemChangedEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { if (model.getBaseTemplate().getSelectedItem() != null && model.getIsSubTemplate().getEntity()) { model.getName().setEntity(model.getBaseTemplate().getSelectedItem().getName()); } } }); }

Target:
public void edit(final UnitVmModel model) { driver.edit(model); model.getStorageDomain().getItemsChangedEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { addDiskAllocation(model); } }); model.getPropertyChangedEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { String propName = ((PropertyChangedEventArgs) args).propertyName; if ("Message".equals(propName)) { appendMessage(model.getMessage()); } } }); subTemplateExpanderContent.setVisible(false); model.getIsSubTemplate().getEntityChangedEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { subTemplateExpanderContent.setVisible(model.getIsSubTemplate().getEntity()); nameEditor.setEnabled(!model.getIsSubTemplate().getEntity()); } }); }
Source:
public void beforeTask(TaskExecution taskExecution) { this.taskExecution = taskExecution; if(this.commandLineArgsProvider == null) { SimpleCommandLineArgsProvider provider = new SimpleCommandLineArgsProvider(); provider.onTaskStartup(taskExecution); this.commandLineArgsProvider = provider; } }

Target:
public void beforeTask(TaskExecution taskExecution) { this.taskExecution = taskExecution; if(this.commandLineArgsProvider == null) { SimpleCommandLineArgsProvider provider = new SimpleCommandLineArgsProvider(taskExecution); this.commandLineArgsProvider = provider; } }
Source:
public TestObjectAsync() { try { Thread.sleep(100); Thread.sleep(100); counter = 1; } catch (InterruptedException ie) { throw new RuntimeException(ie); } }

Target:
public TestObjectAsync() { try { Thread.sleep(1); Thread.sleep(1); counter = 1; } catch (InterruptedException ie) { throw new RuntimeException(ie); } }
Source:
private boolean validateExtension(String path) { boolean isValid = false; String extension = new org.eclipse.core.runtime.Path(path).getFileExtension(); for (ImageFileFormat element : ImageFileFormat.VALUES) { if (element.getName().equalsIgnoreCase(extension)) { isValid = true; break; } } return isValid; }

Target:
private boolean validateExtension(String path) { boolean isValid = false; String extension = new Path(path).getFileExtension(); for (ImageFileFormat element : ImageFileFormat.VALUES) { if (element.getName().equalsIgnoreCase(extension)) { isValid = true; break; } } return isValid; }
Source:
public Status update(String table, String key, Map<String, ByteIterator> values) { try { User user = dataStore.get(key); List<String> allFields = Arrays.asList(FIELDS); for (String field : values.keySet()) { if (GoraBenchmarkUtils.isFieldUpdatable(field, values)) { int indexOfFieldInArray = allFields.indexOf(field); user.put(indexOfFieldInArray, values.get(field).toString()); user.setDirty(indexOfFieldInArray); } } dataStore.put(user.getUserId().toString(), user); } catch (Exception e) { LOG.info("There is a problem updating the records \n"+e.getMessage(), e); return Status.ERROR; } return Status.OK; }

Target:
public Status update(String table, String key, Map<String, ByteIterator> values) { try { User user = dataStore.get(key); List<String> allFields = Arrays.asList(FIELDS); for (String field : values.keySet()) { if (GoraBenchmarkUtils.isFieldUpdatable(field, values)) { int indexOfFieldInArray = allFields.indexOf(field); user.put(indexOfFieldInArray, values.get(field).toString()); user.setDirty(indexOfFieldInArray); } } dataStore.put(user.getUserId().toString(), user); } catch (Exception e) { LOG.info("There is a problem updating the records \n {}", e.getMessage(), e); return Status.ERROR; } return Status.OK; }
Source:
public VaultRawSecret obtainSecretInternal(String vaultSecretId) { Path secretPath = vaultPath.resolve(vaultSecretId); if (!Files.exists(secretPath)) { logger.warnf("Cannot find secret %s in %s", vaultSecretId, secretPath); return DefaultVaultRawSecret.forBuffer(Optional.empty()); } try (FileChannel fileChannel = (FileChannel) Files.newByteChannel(secretPath, EnumSet.of(StandardOpenOption.READ))) { MappedByteBuffer mappedByteBuffer = fileChannel.map(FileChannel.MapMode.READ_ONLY, 0, fileChannel.size()); return DefaultVaultRawSecret.forBuffer(Optional.of(mappedByteBuffer)); } catch (IOException e) { throw new RuntimeException(e); } }

Target:
protected VaultRawSecret obtainSecretInternal(String vaultSecretId) { Path secretPath = vaultPath.resolve(vaultSecretId); if (!Files.exists(secretPath)) { logger.warnf("Cannot find secret %s in %s", vaultSecretId, secretPath); return DefaultVaultRawSecret.forBuffer(Optional.empty()); } try (FileChannel fileChannel = (FileChannel) Files.newByteChannel(secretPath, EnumSet.of(StandardOpenOption.READ))) { MappedByteBuffer mappedByteBuffer = fileChannel.map(FileChannel.MapMode.READ_ONLY, 0, fileChannel.size()); return DefaultVaultRawSecret.forBuffer(Optional.of(mappedByteBuffer)); } catch (IOException e) { throw new RuntimeException(e); } }
Source:
public double pidGetSafely() { return pidGet(); }

Target:
public double pidGetSafely() throws InvalidSensorException { switch (pidSource) { case kDisplacement: return getDistance(); case kRate: return getRate(); default: return getDistance(); } }
Source:
public void endVisit(@Nonnull JSynchronizedBlock jSyncBock) { if (!jSyncBock.getLockExpr().getType().isSameType(ams)) { return; } JBlock newSyncBody = new JBlock(jSyncBock.getSourceInfo()); newSyncBody.addStmt(makeBoostCall(jSyncBock.getSourceInfo())); JLocal catchVar = new JLocal( jSyncBock.getSourceInfo(), "blr.ex", throwable, JModifier.SYNTHETIC, (JMethodBody) method.getBody()); JTryStatement tryStmt = makeTryStatement(jSyncBock.getSourceInfo(), jSyncBock.getSynchronizedBlock(), catchVar); newSyncBody.addStmt(tryStmt); TransformationRequest tr = new TransformationRequest(jSyncBock.getParent()); tr.append(new Replace(jSyncBock.getSynchronizedBlock(), newSyncBody)); tr.commit(); System.out.println("Inserted boost / reset Calls."); }

Target:
public void endVisit(@Nonnull JSynchronizedBlock jSyncBock) { assert ams != null && throwable != null && boostMethodId != null && resetMethodId != null; if (!jSyncBock.getLockExpr().getType().isSameType(ams)) { return; } JBlock newSyncBody = new JBlock(jSyncBock.getSourceInfo()); newSyncBody.addStmt(makeBoostCall(jSyncBock.getSourceInfo())); JLocal catchVar = new JLocal( jSyncBock.getSourceInfo(), "blr.ex", throwable, JModifier.SYNTHETIC, (JMethodBody) method.getBody()); JTryStatement tryStmt = makeTryStatement(jSyncBock.getSourceInfo(), jSyncBock.getSynchronizedBlock(), catchVar); newSyncBody.addStmt(tryStmt); tr.append(new Replace(jSyncBock.getSynchronizedBlock(), newSyncBody)); }
Source:
private boolean isConflictVsMoveAndDelete(Diff target, boolean leftToRight) { boolean moveAndDeleteConflict = false; if (!ConflictKind.REAL.equals(target.getConflict().getKind())) { return moveAndDeleteConflict; } Conflict conflict = target.getConflict(); Collection<Diff> deleteDiffs = Collections2.filter(conflict.getDifferences(), ofKind(DifferenceKind.DELETE)); Collection<Diff> moveDiffs = Collections2.filter(conflict.getDifferences(), ofKind(DifferenceKind.MOVE)); if (moveDiffs.size() == 1) { IEqualityHelper equalityHelper = target.getMatch().getComparison().getEqualityHelper(); ReferenceChange moveDiff = (ReferenceChange)moveDiffs.iterator().next(); ReferenceChange deleteDiff = null; for (Diff diff : deleteDiffs) { if (diff instanceof ReferenceChange) { ReferenceChange temp = (ReferenceChange)diff; boolean matchingAttributeValues = equalityHelper.matchingAttributeValues(moveDiff .getValue(), temp.getValue()); if (matchingAttributeValues) { deleteDiff = temp; } } } if (deleteDiff != null) { if (leftToRight && DifferenceSource.LEFT.equals(moveDiff.getSource())) { if (moveDiff.getMatch().getLeft() != null && deleteDiff.getMatch().getRight() == null) { moveAndDeleteConflict = true; } } else if (!leftToRight && DifferenceSource.RIGHT.equals(moveDiff.getSource())) { if (moveDiff.getMatch().getRight() != null && deleteDiff.getMatch().getLeft() == null) { moveAndDeleteConflict = true; } } } } return moveAndDeleteConflict; }

Target:
private boolean isConflictVsMoveAndDelete(Diff target, boolean leftToRight) { boolean result = false; if (target.getConflict().getKind() != REAL) { return false; } Conflict conflict = target.getConflict(); ReferenceChange moveDiff = null; ReferenceChange deleteDiff; if (target.getKind() == DELETE) { deleteDiff = (ReferenceChange)target; Collection<Diff> moveDiffs = Collections2.filter(conflict.getDifferences(), ofKind(MOVE)); if (moveDiffs.size() == 1) { moveDiff = (ReferenceChange)moveDiffs.iterator().next(); } } else { return false; } if (moveDiff != null) { IEqualityHelper equalityHelper = target.getMatch().getComparison().getEqualityHelper(); result = equalityHelper.matchingAttributeValues(moveDiff.getValue(), deleteDiff.getValue()); } return result; }
Source:
protected ISeries addSeries(String seriesName) { if (seriesName == null) { return null; } ISeriesSet seriesSet = getSwtChart().getSeriesSet(); int seriesCount = seriesSet.getSeries().length; ICommonXAxisModel currentModel = getModel(); IYSeries ySeries = currentModel.findSeries(seriesName); if (ySeries == null) { setSeries(seriesName, new double[currentModel.getXAxis().length]); currentModel = getModel(); ySeries = currentModel.findSeries(seriesName); } if (ySeries == null) { return null; } String colorTxt = ySeries.getColor(); Color color = getColor(seriesName, colorTxt); if (ySeries.getSeriesType() == IYSeries.BAR) { IBarSeries barSeries = (IBarSeries) seriesSet.createSeries(SeriesType.BAR, seriesName); barSeries.enableStack(true); barSeries.setBarColor(color); barSeries.setBarPadding(0); barSeries.setVisible(true); return barSeries; } ILineSeries lineSeries = (ILineSeries) seriesSet.createSeries(SeriesType.LINE, seriesName); boolean isScatter = IYSeries.SCATTER.equals(ySeries.getSeriesType()); lineSeries.enableArea(IYSeries.AREA.equals(ySeries.getSeriesType())); lineSeries.setLineStyle(!isScatter ? LINE_STYLES.get(getLineStyle(ySeries.getSeriesType(), seriesCount)) : LineStyle.NONE); lineSeries.setSymbolType(isScatter ? PlotSymbolType.DIAMOND : PlotSymbolType.NONE); lineSeries.setLineColor(color); lineSeries.setVisible(true); return lineSeries; }

Target:
protected ILineSeries addSeries(String seriesName) { if (seriesName == null) { return null; } ISeriesSet seriesSet = getSwtChart().getSeriesSet(); int seriesCount = seriesSet.getSeries().length; ICommonXAxisModel currentModel = getModel(); IYSeries ySeries = currentModel.findSeries(seriesName); if (ySeries == null) { setSeries(seriesName, new double[currentModel.getXAxis().length]); currentModel = getModel(); ySeries = currentModel.findSeries(seriesName); } if (ySeries == null) { return null; } ILineSeries series = (ILineSeries) seriesSet.createSeries(SeriesType.LINE, seriesName); boolean isScatter = IYSeries.SCATTER.equals(ySeries.getSeriesType()); series.setVisible(true); series.enableArea(IYSeries.AREA.equals(ySeries.getSeriesType())); series.setLineStyle(!isScatter ? LINE_STYLES.get(getLineStyle(ySeries.getSeriesType(), seriesCount)) : LineStyle.NONE); series.setSymbolType(isScatter ? PlotSymbolType.DIAMOND : PlotSymbolType.NONE); String colorTxt = ySeries.getColor(); series.setLineColor(getColor(seriesName, colorTxt)); return series; }
Source:
private void addCrossCompilationOptions(final ImmutableList.Builder<String> command) { if (shouldCrossCompile()) { command.add("-j"); javacOptions.appendOptionsTo(new OptionsConsumer() { @Override public void addOptionValue(String option, String value) { if (!option.equals("sourcepath")) { command.add("-J" + String.format("%s=%s", option, value)); } } @Override public void addFlag(String flagName) { command.add("-F" + flagName); } @Override public void addExtras(Collection<String> extras) { for (String extra : extras) { if (extra.startsWith("-")) { addFlag(extra.substring(1)); } else { addFlag(extra); } } } }, filesystem.getAbsolutifier()); } }

Target:
private void addCrossCompilationOptions(final ImmutableList.Builder<String> command) { if (shouldCrossCompile()) { command.add("-j"); javacOptions.appendOptionsTo(new OptionsConsumer() { @Override public void addOptionValue(String option, String value) { if (option.equals("sourcepath")) { return; } command.add("-J" + String.format("%s=%s", option, value)); } @Override public void addFlag(String flagName) { command.add("-F" + flagName); } @Override public void addExtras(Collection<String> extras) { for (String extra : extras) { if (extra.startsWith("-")) { addFlag(extra.substring(1)); } else { addFlag(extra); } } } }, filesystem.getAbsolutifier()); } }
Source:
private static boolean isHandsontableAttribute(Node attribute) { return checkForAttributeWithSpecificValue(attribute, "id", "enrollSpreadsheet") || checkForAttributeWithSpecificValue(attribute, "id", "dataSpreadsheet"); }

Target:
private static boolean isHandsontableAttribute(Node attribute) { return checkForAttributeWithSpecificValue(attribute, "id", "enrollSpreadsheet") || checkForAttributeWithSpecificValue(attribute, "id", "existingDataSpreadsheet"); }
Source:
static HAProxyMessage decodeHeader(String header) { if (header == null) { throw new HAProxyProtocolException("header"); } String[] parts = header.split(" "); int numParts = parts.length; if (numParts < 2) { throw new HAProxyProtocolException( "invalid header: " + header + " (expected: 'PROXY' and proxied protocol values)"); } if (!"PROXY".equals(parts[0])) { throw new HAProxyProtocolException("unknown identifier: " + parts[0]); } HAProxyProxiedProtocol protAndFam; try { protAndFam = HAProxyProxiedProtocol.valueOf(parts[1]); } catch (IllegalArgumentException e) { throw new HAProxyProtocolException(e); } if (protAndFam != HAProxyProxiedProtocol.TCP4 && protAndFam != HAProxyProxiedProtocol.TCP6 && protAndFam != HAProxyProxiedProtocol.UNKNOWN) { throw new HAProxyProtocolException("unsupported v1 proxied protocol: " + parts[1]); } if (protAndFam == HAProxyProxiedProtocol.UNKNOWN) { return unknownMsg(HAProxyProtocolVersion.V1, HAProxyCommand.PROXY); } if (numParts != 6) { throw new HAProxyProtocolException("invalid TCP4/6 header: " + header + " (expected: 6 parts)"); } try { return new HAProxyMessage( HAProxyProtocolVersion.V1, HAProxyCommand.PROXY, protAndFam, parts[2], parts[3], parts[4], parts[5]); } catch (Exception e) { throw new HAProxyProtocolException("invalid HAProxy message", e); } }

Target:
static HAProxyMessage decodeHeader(String header) { if (header == null) { throw new HAProxyProtocolException("header"); } String[] parts = header.split(" "); int numParts = parts.length; if (numParts < 2) { throw new HAProxyProtocolException( "invalid header: " + header + " (expected: 'PROXY' and proxied protocol values)"); } if (!"PROXY".equals(parts[0])) { throw new HAProxyProtocolException("unknown identifier: " + parts[0]); } HAProxyProxiedProtocol protAndFam; try { protAndFam = HAProxyProxiedProtocol.valueOf(parts[1]); } catch (IllegalArgumentException e) { throw new HAProxyProtocolException(e); } if (protAndFam != HAProxyProxiedProtocol.TCP4 && protAndFam != HAProxyProxiedProtocol.TCP6 && protAndFam != HAProxyProxiedProtocol.UNKNOWN) { throw new HAProxyProtocolException("unsupported v1 proxied protocol: " + parts[1]); } if (protAndFam == HAProxyProxiedProtocol.UNKNOWN) { return unknownMsg(HAProxyProtocolVersion.V1, HAProxyCommand.PROXY); } if (numParts != 6) { throw new HAProxyProtocolException("invalid TCP4/6 header: " + header + " (expected: 6 parts)"); } try { return new HAProxyMessage( HAProxyProtocolVersion.V1, HAProxyCommand.PROXY, protAndFam, parts[2], parts[3], parts[4], parts[5]); } catch (RuntimeException e) { throw new HAProxyProtocolException("invalid HAProxy message", e); } }
Source:
public void cantHandleConnectionsWithWrongDomainOnOrigin() throws Exception { final String head = new RsPrint( new TkCORS( new TkFixed(new RsText()), "<LINK_0>", "<LINK_1>" ).act( new RqWithHeaders( new RqFake(), new HashSet<String>( Arrays.asList("Origin: <LINK_2>") ) ) ) ).printHead(); MatcherAssert.assertThat( "It was expected a 403 HTTP status.", head, Matchers.containsString("HTTP/1.1 403") ); MatcherAssert.assertThat( "Wrong value on Access Control Allow Credentias param.", head, Matchers.containsString("Access-Control-Allow-Credentials: false") ); }

Target:
public void cantHandleConnectionsWithWrongDomainOnOrigin() throws Exception { MatcherAssert.assertThat( "Wrong value on header.", new RsPrint( new TkCORS( new TkFixed(new RsText()), "<LINK_0>", "<LINK_1>" ).act( new RqWithHeaders( new RqFake(), "Origin: <LINK_2>" ) ) ).printHead(), Matchers.allOf( Matchers.containsString("HTTP/1.1 403"), Matchers.containsString( "Access-Control-Allow-Credentials: false" ) ) ); }
Source:
public void prepareRun(BatchSinkContext context) throws DatasetManagementException { Map<String, String> properties = getProperties(); if (pluginConfig.containsMacro(Properties.BatchReadableWritable.NAME)) { if (!context.datasetExists(properties.get(Properties.BatchReadableWritable.NAME))) { context.createDataset(properties.get(Properties.BatchReadableWritable.NAME), properties.get(Properties.BatchReadableWritable.TYPE), DatasetProperties.builder().addAll(properties).build()); } } context.addOutput(properties.get(Properties.BatchReadableWritable.NAME)); }

Target:
public void prepareRun(BatchSinkContext context) throws DatasetManagementException { Map<String, String> properties = getProperties(); if (batchReadableWritableConfig.containsMacro(Properties.BatchReadableWritable.NAME)) { if (!context.datasetExists(properties.get(Properties.BatchReadableWritable.NAME))) { context.createDataset(properties.get(Properties.BatchReadableWritable.NAME), properties.get(Properties.BatchReadableWritable.TYPE), DatasetProperties.builder().addAll(properties).build()); } } context.addOutput(properties.get(Properties.BatchReadableWritable.NAME)); }
Source:
public boolean isValid(BashPsiBuilder builder) { IElementType token = builder.rawLookup(1); return token != null && builder.getTokenType() == WORD && "!".equals(builder.getTokenText()) && !ParserUtil.isWhitespaceOrLineFeed(token); }

Target:
public boolean isValid(BashPsiBuilder builder) { IElementType token = builder.rawLookup(1); return token != null && ParserUtil.isWord(builder, "!") && !ParserUtil.isWhitespaceOrLineFeed(token); }
Source:
public List<Attribute> getAttributesByAttributeDefinition(PerunSession sess, AttributeDefinition attributeDefinition) throws InternalErrorException, AttributeNotExistsException, WrongAttributeAssignmentException, PrivilegeException { Utils.checkPerunSession(sess); getAttributesManagerBl().checkAttributeExists(sess, attributeDefinition); if(!AuthzResolver.isAuthorized(sess, Role.PERUNADMIN) && !AuthzResolver.isAuthorized(sess, Role.PERUNOBSERVER)) { throw new PrivilegeException("For getting entityless attributes principal need to be PerunAdmin or PerunObserver."); } return getAttributesManagerBl().setWritableTrue(sess, getAttributesManagerBl().getAttributesByAttributeDefinition(sess, attributeDefinition)); }

Target:
public List<Attribute> getAttributesByAttributeDefinition(PerunSession sess, AttributeDefinition attributeDefinition) throws InternalErrorException, AttributeNotExistsException, WrongAttributeAssignmentException, PrivilegeException { Utils.checkPerunSession(sess); getAttributesManagerBl().checkAttributeExists(sess, attributeDefinition); if(!AuthzResolver.isAuthorized(sess, Role.PERUNADMIN) && !AuthzResolver.isAuthorized(sess, Role.PERUNOBSERVER)) { throw new PrivilegeException("For getting the attributes, you need to be PerunAdmin or PerunObserver."); } return getAttributesManagerBl().setWritableTrue(sess, getAttributesManagerBl().getAttributesByAttributeDefinition(sess, attributeDefinition)); }
Source:
default void addConversant(Conversant conversant) { addConversant(conversant, ExternalChatHandlers.deleteAll()); }

Target:
default void addConversant(Conversant conversant) { addConversant(conversant, getArchetype().getDefaultChatHandlerType()); }
Source:
public Object execute(ExecutionEvent event) throws ExecutionException { RepositoryGroups groups = new RepositoryGroups(); Optional<String> optionalGroupName = getNewGroupName( getActiveShell(event), UIText.RepositoriesView_AddRepoGroup_title, groups, ""); if (optionalGroupName.isPresent()) { String group = optionalGroupName.get(); Optional<UUID> groupUUID = groups.addGroup(group); if (groupUUID.isPresent()) { List<String> repoDirs = getSelectedRepositories(event); if (!repoDirs.isEmpty()) { groups.addRepositoriesToGroup(groupUUID.get(), repoDirs); } getView(event).refresh(); } } return null; }

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { RepositoryGroups groups = new RepositoryGroups(); String groupName = getNewGroupName( getActiveShell(event), UIText.RepositoriesView_RepoGroup_Add_Title, groups, ""); if (groupName != null) { UUID groupId = groups.addGroup(groupName); List<String> repoDirs = getSelectedRepositories(event); if (!repoDirs.isEmpty()) { groups.addRepositoriesToGroup(groupId, repoDirs); } getView(event).refresh(); } return null; }
Source:
void findNextHostAndQuery() { try { Host host; while (!isDone.get() && (host = queryPlan.next()) != null && !queryStateRef.get().isCancelled()) { HostConnectionPool pool = manager.pools.get(host); if (pool == null || pool.isClosed()) continue; if (logger.isTraceEnabled()) logger.trace("[{}] Querying node {}", id, host); if (query(host)) return; } reportNoMoreHosts(this); } catch (Exception e) { setFinalException(null, new DriverInternalError("An unexpected error happened while sending requests", e)); } }

Target:
void findNextHostAndQuery() { try { Host host; while (!isDone.get() && (host = queryPlan.next()) != null && !queryStateRef.get().isCancelled()) { if (query(host)) return; } reportNoMoreHosts(this); } catch (Exception e) { setFinalException(null, new DriverInternalError("An unexpected error happened while sending requests", e)); } }
Source:
public void keepDirectoryImportByHttpsUrlTest() throws Exception { currentProjectName = keepDirectoryRepo.getName() + "Https"; projectExplorer.waitProjectExplorer(); makeKeepDirectoryFromGitUrl( keepDirectoryRepo.getHtmlUrl(), currentProjectName, DIRECTORY_NAME_2); projectExplorer.waitItem(currentProjectName); projectExplorer.expandPathInProjectExplorerAndOpenFile( currentProjectName + "/my-lib/src/test/java/hello", "SayHelloTest.java"); editor.waitActive(); projectExplorer.waitItemInvisibility(currentProjectName + "/my-lib/src/main"); projectExplorer.waitItemInvisibility(currentProjectName + "/my-webapp"); projectExplorer.openContextMenuByPathSelectedItem(currentProjectName + "/my-lib/src/test"); projectExplorer.clickOnItemInContextMenu(GO_INTO); projectExplorer.waitDisappearItemByPath(currentProjectName + "/src/my-lib"); projectExplorer.waitVisibilityByName("test"); projectExplorer.waitVisibilityByName("java"); projectExplorer.waitVisibilityByName("hello"); projectExplorer.waitVisibilityByName("SayHelloTest.java"); projectExplorer.openContextMenuByPathSelectedItem(currentProjectName + "/my-lib/src/test"); projectExplorer.clickOnItemInContextMenu(GO_BACK); projectExplorer.waitItem(currentProjectName + "/my-lib/src"); }

Target:
public void keepDirectoryImportByHttpsUrlTest() throws Exception { projectExplorer.waitProjectExplorer(); currentProjectName = keepDirectoryRepo.getName() + "Https"; makeKeepDirectoryFromGitUrl(keepDirectoryRepo.getHtmlUrl(), currentProjectName, TEST_DIRECTORY); projectExplorer.waitItem(currentProjectName); projectExplorer.expandPathInProjectExplorerAndOpenFile( currentProjectName + "/my-lib/src/test/java/hello", "SayHelloTest.java"); editor.waitActive(); projectExplorer.waitItemInvisibility(currentProjectName + "/my-lib/src/main"); projectExplorer.waitItemInvisibility(currentProjectName + "/my-webapp"); projectExplorer.openContextMenuByPathSelectedItem(currentProjectName + "/my-lib/src/test"); projectExplorer.clickOnItemInContextMenu(GO_INTO); projectExplorer.waitDisappearItemByPath(currentProjectName + "/src/my-lib"); projectExplorer.waitVisibilityByName("test"); projectExplorer.waitVisibilityByName("java"); projectExplorer.waitVisibilityByName("hello"); projectExplorer.waitVisibilityByName("SayHelloTest.java"); projectExplorer.openContextMenuByPathSelectedItem(currentProjectName + "/my-lib/src/test"); projectExplorer.clickOnItemInContextMenu(GO_BACK); projectExplorer.waitItem(currentProjectName + "/my-lib/src"); }
Source:
public HttpResponse doStopBuild(@CheckForNull @QueryParameter(fixEmpty = true) String runExtId) { lock.writeLock().lock(); try { if (executable != null) { if (runExtId == null || runExtId.isEmpty() || (executable instanceof Run && runExtId.equals(((Run<?,?>) executable).getExternalizableId()))) { getParentOf(executable).getOwnerTask().checkAbortPermission(); interrupt(); } } } finally { lock.writeLock().unlock(); } return HttpResponses.forwardToPreviousPage(); }

Target:
public HttpResponse doStopBuild(@CheckForNull @QueryParameter(fixEmpty = true) String runExtId) { lock.writeLock().lock(); try { if (executable != null) { if (runExtId == null || runExtId.isEmpty() || ! (executable instanceof Run) || (executable instanceof Run && runExtId.equals(((Run<?,?>) executable).getExternalizableId()))) { getParentOf(executable).getOwnerTask().checkAbortPermission(); interrupt(); } } } finally { lock.writeLock().unlock(); } return HttpResponses.forwardToPreviousPage(); }
Source:
public MaildirMessageName delete(final MailboxSession session, final MessageUid uid) throws MailboxException { return locker.executeWithLock(session, path, () -> { File uidList = uidFile; FileReader fileReader = null; BufferedReader reader = null; PrintWriter writer = null; MaildirMessageName deletedMessage = null; try { fileReader = new FileReader(uidList); reader = new BufferedReader(fileReader); readUidListHeader(reader.readLine()); ArrayList<String> lines = new ArrayList<>(); String line; int lineNumber = 1; for (; (line = reader.readLine()) != null; lineNumber++) { int gap = line.indexOf(" "); if (gap == -1) { LOGGER.info("Corrupted entry in uid-file line {}", uidList, lineNumber); continue; } if (uid.equals(MessageUid.of(Long.valueOf(line.substring(0, line.indexOf(" ")))))) { deletedMessage = newMaildirMessageName(MaildirFolder.this, line.substring(gap + 1, line.length())); messageCount--; } else { lines.add(line); } } if (deletedMessage != null) { FileUtils.forceDelete(deletedMessage.getFile()); writer = new PrintWriter(uidList); writer.println(createUidListHeader()); for (String entry : lines) writer.println(entry); } return deletedMessage; } catch (IOException e) { throw new MailboxException("Unable to delete msg with uid " + uid, e); } finally { IOUtils.closeQuietly(writer); IOUtils.closeQuietly(reader); IOUtils.closeQuietly(fileReader); } }, true); }

Target:
public MaildirMessageName delete(final MailboxSession session, final MessageUid uid) throws MailboxException { return locker.executeWithLock(session, path, () -> { File uidList = uidFile; FileReader fileReader = null; BufferedReader reader = null; PrintWriter writer = null; MaildirMessageName deletedMessage = null; try { fileReader = new FileReader(uidList); reader = new BufferedReader(fileReader); readUidListHeader(reader.readLine()); ArrayList<String> lines = new ArrayList<>(); String line; int lineNumber = 0; while ((line = reader.readLine()) != null) { lineNumber++; int gap = line.indexOf(" "); if (gap == -1) { LOGGER.info("Corrupted entry in uid-file line {}", uidList, lineNumber); continue; } if (uid.equals(MessageUid.of(Long.valueOf(line.substring(0, line.indexOf(" ")))))) { deletedMessage = newMaildirMessageName(MaildirFolder.this, line.substring(gap + 1, line.length())); messageCount--; } else { lines.add(line); } } if (deletedMessage != null) { FileUtils.forceDelete(deletedMessage.getFile()); writer = new PrintWriter(uidList); writer.println(createUidListHeader()); for (String entry : lines) writer.println(entry); } return deletedMessage; } catch (IOException e) { throw new MailboxException("Unable to delete msg with uid " + uid, e); } finally { IOUtils.closeQuietly(writer); IOUtils.closeQuietly(reader); IOUtils.closeQuietly(fileReader); } }, true); }
Source:
public byte[] serialize() { byte[] value = new byte[0]; if (this.bool){ value = new byte[1]; } return value; }

Target:
public byte[] serialize() { if (this.bool){ return TRUE_SERIAL; } else { return FALSE_SERIAL; } }
Source:
public static Set<String> getAllProvidedQueriesNameForBusinessObject(final BusinessObject businessObject) { final Set<String> queryNames = new HashSet<String>(); if (!containsQuertWithName(businessObject, getQueryName(Field.PERSISTENCE_ID))) { final SimpleField persistenceIdField = new SimpleField(); persistenceIdField.setName(Field.PERSISTENCE_ID); persistenceIdField.setType(FieldType.LONG); queryNames.add(createQueryNameForField(persistenceIdField)); } for (final UniqueConstraint uc : businessObject.getUniqueConstraints()) { queryNames.add(createQueryNameForUniqueConstraint(uc)); } for (final Field f : businessObject.getFields()) { if (f instanceof SimpleField) { if (f.isCollection() == null || !f.isCollection()) { queryNames.add(createQueryNameForField(f)); } } } queryNames.add(createSelectAllQueryName()); return queryNames; }

Target:
public static Set<String> getAllProvidedQueriesNameForBusinessObject(final BusinessObject businessObject) { final Set<String> queryNames = new HashSet<String>(); if (!containsQueryWithName(businessObject, getQueryName(Field.PERSISTENCE_ID))) { final SimpleField persistenceIdField = new SimpleField(); persistenceIdField.setName(Field.PERSISTENCE_ID); persistenceIdField.setType(FieldType.LONG); queryNames.add(createQueryNameForField(persistenceIdField)); } for (final UniqueConstraint uc : businessObject.getUniqueConstraints()) { queryNames.add(createQueryNameForUniqueConstraint(uc)); } for (final Field f : businessObject.getFields()) { if (f instanceof SimpleField) { if (f.isCollection() == null || !f.isCollection()) { queryNames.add(createQueryNameForField(f)); } } } queryNames.add(createSelectAllQueryName()); return queryNames; }
Source:
public void run() { Set<PartitionId> partitionIds = storageManager.getPartitionIds(); Pair<StatsSnapshot, List<String>> result = collectAndAggregate(partitionIds); List<String> unreachableStores = result.getSecond(); StatsHeader statsHeader = new StatsHeader(Description.QUOTA, SystemTime.getInstance().milliseconds(), partitionIds.size(), partitionIds.size() - unreachableStores.size(), unreachableStores); try { publish(new StatsWrapper(statsHeader, result.getFirst())); logger.info("Stats snapshot published to " + statsOutputFile.getAbsolutePath()); } catch (IOException e) { logger.error("IOException when publishing stats to " + statsOutputFile.getAbsolutePath(), e); } }

Target:
public void run() { long totalFetchAndAggregateStartTimeMs = time.milliseconds(); StatsSnapshot aggregatedSnapshot = new StatsSnapshot(0L, null); List<String> unreachableStores = new ArrayList<>(); Iterator<PartitionId> iterator = totalPartitionIds.iterator(); while (!cancelled && iterator.hasNext()) { PartitionId partitionId = iterator.next(); collectAndAggregate(aggregatedSnapshot, partitionId, unreachableStores); } if (!cancelled) { metrics.totalFetchAndAggregateTime.update(time.milliseconds() - totalFetchAndAggregateStartTimeMs); StatsHeader statsHeader = new StatsHeader(Description.QUOTA, time.milliseconds(), totalPartitionIds.size(), totalPartitionIds.size() - unreachableStores.size(), unreachableStores); try { publish(new StatsWrapper(statsHeader, aggregatedSnapshot)); logger.info("Stats snapshot published to {}", statsOutputFile.getAbsolutePath()); } catch (IOException e) { metrics.statsPublishFailureCount.inc(); logger.error("IOException when publishing stats to {}", statsOutputFile.getAbsolutePath(), e); } } }
Source:
public List<String> validateQuestionDetails() { List<String> errors = new ArrayList<>(); if (recommendedLength != null && recommendedLength < 0) { errors.add(Const.FeedbackQuestion.TEXT_ERROR_INVALID_RECOMMENDED_LENGTH); } return errors; }

Target:
public List<String> validateQuestionDetails() { List<String> errors = new ArrayList<>(); if (recommendedLength != null && recommendedLength < 1) { errors.add(Const.FeedbackQuestion.TEXT_ERROR_INVALID_RECOMMENDED_LENGTH); } return errors; }
Source:
public void testParseRowKeepNullColumns() throws IOException { final JsonInputFormat format = new JsonInputFormat( new JSONPathSpec( true, ImmutableList.of( new JSONPathFieldSpec(JSONPathFieldType.PATH, "path_omg", "$.o.mg") ), true ), null ); final ByteEntity source = new ByteEntity( StringUtils.toUtf8("{\"timestamp\":\"2019-01-01\",\"bar\":null,\"foo\":\"x\",\"o\":{\"mg\":null}}") ); final InputEntityReader reader = format.createReader( new InputRowSchema( new TimestampSpec("timestamp", "iso", null), new DimensionsSpec(DimensionsSpec.getDefaultSchemas(Collections.emptyList())), Collections.emptyList() ), source, null ); final int numExpectedIterations = 1; try (CloseableIterator<InputRow> iterator = reader.read()) { int numActualIterations = 0; while (iterator.hasNext()) { final InputRow row = iterator.next(); Assert.assertEquals(Arrays.asList("path_omg", "timestamp", "bar", "foo"), row.getDimensions()); Assert.assertEquals(Collections.emptyList(), row.getDimension("bar")); Assert.assertEquals("x", Iterables.getOnlyElement(row.getDimension("foo"))); Assert.assertEquals(Collections.emptyList(), row.getDimension("path_omg")); numActualIterations++; } } }

Target:
public void testParseRowKeepNullColumns() throws IOException { final JsonInputFormat format = new JsonInputFormat( new JSONPathSpec( true, ImmutableList.of( new JSONPathFieldSpec(JSONPathFieldType.PATH, "path_omg", "$.o.mg") ) ), null, true ); final ByteEntity source = new ByteEntity( StringUtils.toUtf8("{\"timestamp\":\"2019-01-01\",\"bar\":null,\"foo\":\"x\",\"o\":{\"mg\":null}}") ); final InputEntityReader reader = format.createReader( new InputRowSchema( new TimestampSpec("timestamp", "iso", null), new DimensionsSpec(DimensionsSpec.getDefaultSchemas(Collections.emptyList())), Collections.emptyList() ), source, null ); final int numExpectedIterations = 1; try (CloseableIterator<InputRow> iterator = reader.read()) { int numActualIterations = 0; while (iterator.hasNext()) { final InputRow row = iterator.next(); Assert.assertEquals(Arrays.asList("path_omg", "timestamp", "bar", "foo"), row.getDimensions()); Assert.assertTrue(row.getDimension("bar").isEmpty()); Assert.assertEquals("x", Iterables.getOnlyElement(row.getDimension("foo"))); Assert.assertTrue(row.getDimension("path_omg").isEmpty()); numActualIterations++; } Assert.assertEquals(numExpectedIterations, numActualIterations); } }
Source:
public void abort() { try (Connection connection = this.connection; PreparedStatement statement = this.statement) { connection.rollback(); } catch (SQLException e) { throw new PrestoException(JDBC_ERROR, e); } finally { try { jdbcClient.rollbackCreateTable(handle); } catch (Exception e) { log.warn(e, format("Failed to cleanup temporary table: %s", handle.getTemporaryTableName())); } } }

Target:
public void abort() { try (Connection connection = this.connection; PreparedStatement statement = this.statement) { connection.rollback(); } catch (SQLException e) { throw new PrestoException(JDBC_ERROR, e); } }
Source:
public Map<String, String> get() { if (tags == null) { return Collections.unmodifiableMap(new HashMap<>()); } return Collections.unmodifiableMap(tags); }

Target:
public Map<String, String> get() { return Collections.unmodifiableMap(tags == null ? new HashMap<>() : tags); }