auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Void call() throws Exception { Objects.requireNonNull(acl, "New acl to be added not specified."); OzoneAddress address = new OzoneAddress(uri); address.ensureBucketAddress(); OzoneClient client = address.createClient(createOzoneConfiguration()); String volumeName = address.getVolumeName(); String bucketName = address.getBucketName(); if (isVerbose()) { System.out.printf("Volume Name : %s%n", volumeName); System.out.printf("Bucket Name : %s%n", bucketName); } OzoneObj obj = OzoneObjInfo.Builder.newBuilder() .setBucketName(bucketName) .setVolumeName(volumeName) .setResType(OzoneObj.ResourceType.BUCKET) .setStoreType(storeType == null ? OZONE : OzoneObj.StoreType.valueOf(storeType)) .build(); boolean result = client.getObjectStore().removeAcl(obj, OzoneAcl.parseAcl(acl)); System.out.printf("%s%n", JsonUtils.toJsonStringWithDefaultPrettyPrinter( <START> JsonUtils.toJsonString("Acl set successfully: " + result))); <END> return null; }</code><technical_language>removed instead of set</technical_language>

Target:
public Void call() throws Exception { Objects.requireNonNull(acl, "New acl to be added not specified."); OzoneAddress address = new OzoneAddress(uri); address.ensureBucketAddress(); OzoneClient client = address.createClient(createOzoneConfiguration()); String volumeName = address.getVolumeName(); String bucketName = address.getBucketName(); if (isVerbose()) { System.out.printf("Volume Name : %s%n", volumeName); System.out.printf("Bucket Name : %s%n", bucketName); } OzoneObj obj = OzoneObjInfo.Builder.newBuilder() .setBucketName(bucketName) .setVolumeName(volumeName) .setResType(OzoneObj.ResourceType.BUCKET) .setStoreType(storeType == null ? OZONE : OzoneObj.StoreType.valueOf(storeType)) .build(); boolean result = client.getObjectStore().removeAcl(obj, OzoneAcl.parseAcl(acl)); System.out.printf("%s%n", JsonUtils.toJsonStringWithDefaultPrettyPrinter( JsonUtils.toJsonString("Acl removed successfully: " + result))); client.close(); return null; }
Source:
<code>public void phenotypeSetup(Set<String> enabledFields) throws Exception { String sectionName = "phenotype"; String[] fieldIds = { "phenotype", "phenotype_code", "phenotype_combined", "phenotype_code_meta", "phenotype_meta", "negative_phenotype", "negative_phenotype_code", "negative_phenotype_combined", "phenotype_by_section" }; String[][] headerIds = { { "phenotype", "positive" }, { "code", "positive" }, { "phenotype", "code", "positive" }, { "meta_code", "phenotype", "positive" }, { "meta", "phenotype", "positive" }, { "negative", "phenotype" }, { "negative", "code" }, { "negative", "code", "phenotype" }, <START> { "category" } }; <END> Set<String> present = new HashSet<String>(); int counter = 0; for (String fieldId : fieldIds) { if (enabledFields.remove(fieldId)) { for (String headerId : headerIds[counter]) { present.add(headerId); } } counter++; } this.enabledHeaderIdsBySection.put(sectionName, present); this.phenotypeHelper = new ConversionHelpers(); this.phenotypeHelper .featureSetUp(present.contains("positive"), present.contains("negative"), present.contains("category")); }</code><technical_language>change is whitespace -- if case, change discarded</technical_language>

Target:
public void phenotypeSetup(Set<String> enabledFields) throws Exception { String sectionName = "phenotype"; String[] fieldIds = { "phenotype", "phenotype_code", "phenotype_combined", "phenotype_code_meta", "phenotype_meta", "negative_phenotype", "negative_phenotype_code", "negative_phenotype_combined", "phenotype_by_section" }; String[][] headerIds = { { "phenotype", "positive" }, { "code", "positive" }, { "phenotype", "code", "positive" }, { "meta_code", "phenotype", "positive" }, { "meta", "phenotype", "positive" }, { "negative", "phenotype" }, { "negative", "code" }, { "negative", "code", "phenotype" }, { "category" } }; Set<String> present = addHeaders(fieldIds, headerIds, enabledFields); this.enabledHeaderIdsBySection.put(sectionName, present); this.phenotypeHelper = new ConversionHelpers(); this.phenotypeHelper .featureSetUp(present.contains("positive"), present.contains("negative"), present.contains("category")); }
Source:
<code>public boolean apply(PacketContext pktCtx) { super.apply(pktCtx); pktCtx.jlog().debug("Redirecting flow port with ID {}.", (ingress ? "IN" : "OUT"), targetPort); <START> return true; <END> }</code><technical_language>return super.apply</technical_language>

Target:
public boolean apply(PacketContext pktCtx) { super.apply(pktCtx); pktCtx.jlog().debug("Redirecting flow port with ID {}.", (ingress ? "IN" : "OUT"), targetPort); pktCtx.redirect(failOpen); return true; }
Source:
<code>public String updatedOn() { String LOCAL_TIME_FORMAT = "dd MMM, yyyy 'at' HH:mm:ss 'Local Time'"; <START> SimpleDateFormat simpleDateFormat = new SimpleDateFormat(LOCAL_TIME_FORMAT); <END> return simpleDateFormat.format(updatedOnTimeStamp()); }</code><technical_language>This done client side</technical_language>

Target:
public String updatedOn() { return ISO8601Utils.format(updatedOnTimeStamp(), false, UTC); }
Source:
<code>public String getContingencyStateString(final TruthState truthState, final CallState callState) { return StringUtil.join(",", getConcordanceStateArray(truthState, callState)); <START> } <END></code><technical_language>good explicitly a ("MISSING" "EMPTY") for cases array is empty (i.e. empty string</technical_language>

Target:
public String getContingencyStateString(final TruthState truthState, final CallState callState) { final ContingencyState[] contingencyStateArray = getConcordanceStateArray(truthState, callState); return (contingencyStateArray.length == 0) ? "EMPTY" : StringUtil.join(",", contingencyStateArray); }
Source:
<code>void startLoadJob(IExceptionHandler handler) { new Job("load project") { @Override protected IStatus run(IProgressMonitor monitor) { try { IOpenShiftConnection connection = getConnection(); List<IResource> projects = connection.getResources(ResourceKind.PROJECT); <START> initWith(projects); <END> state.compareAndSet(LoadingState.LOADING, LoadingState.LOADED); fireChanged(); } catch (OperationCanceledException e) { state.compareAndSet(LoadingState.LOADING, LoadingState.LOAD_STOPPED); } catch (Throwable e) { state.compareAndSet(LoadingState.LOADING, LoadingState.LOAD_STOPPED); handler.handleException(e); } return Status.OK_STATUS; } }.schedule(); }</code><technical_language>a race condition here? I set state loaded I other locks. multiple threads loading time</technical_language>

Target:
private void startLoadJob(IExceptionHandler handler) { new Job("Load project") { @Override protected IStatus run(IProgressMonitor monitor) { try { IOpenShiftConnection connection = getWrapped(); List<IResource> projects = connection.getResources(ResourceKind.PROJECT); initWith(projects); state.compareAndSet(LoadingState.LOADING, LoadingState.LOADED); fireChanged(); } catch (OperationCanceledException e) { state.compareAndSet(LoadingState.LOADING, LoadingState.LOAD_STOPPED); } catch (Throwable e) { state.compareAndSet(LoadingState.LOADING, LoadingState.LOAD_STOPPED); handler.handleException(e); } return Status.OK_STATUS; } }.schedule(); }
Source:
<code>public void thingUpdated(final Thing thing, ThingTrackerEvent thingTrackerEvent) { ThingUID thingUID = thing.getUID(); Thing oldThing = getThing(thingUID); if (oldThing != thing) { this.things.remove(oldThing); this.things.add(thing); } thingLinkManager.thingUpdated(thing); final ThingHandler thingHandler = thingHandlers.get(thingUID); if (thingHandler != null) { if (oldThing != thing) { thing.setHandler(thingHandler); } if (isInitialized(thing)) { try { if (!thingUpdatedLock.contains(thingUID)) { SafeMethodCaller.call(new SafeMethodCaller.ActionWithException<Void>() { @Override public Void call() throws Exception { thingHandler.thingUpdated(thing); return null; } }); } } catch (Exception ex) { logger.error("Exception occured while calling thing updated at ThingHandler '" + thingHandler + ": " + ex.getMessage(), ex); } } else { <START> logger.warn("Cannot notify handler about updated thing {}, because thing is not initialized " <END> + "(must be in status ONLINE or OFFLINE).", thing.getThingTypeUID()); } } else { registerHandler(thing); } if (oldThing != thing) { oldThing.setHandler(null); } }</code><technical_language>I reduce this debug</technical_language>

Target:
public void thingUpdated(final Thing thing, ThingTrackerEvent thingTrackerEvent) { ThingUID thingUID = thing.getUID(); Thing oldThing = getThing(thingUID); if (oldThing != thing) { this.things.remove(oldThing); this.things.add(thing); } thingLinkManager.thingUpdated(thing); final ThingHandler thingHandler = thingHandlers.get(thingUID); if (thingHandler != null) { if (oldThing != thing) { thing.setHandler(thingHandler); } if (isInitialized(thing)) { try { if (!thingUpdatedLock.contains(thingUID)) { SafeMethodCaller.call(new SafeMethodCaller.ActionWithException<Void>() { @Override public Void call() throws Exception { thingHandler.thingUpdated(thing); return null; } }); } } catch (Exception ex) { logger.error("Exception occured while calling thing updated at ThingHandler '" + thingHandler + ": " + ex.getMessage(), ex); } } else { logger.debug("Cannot notify handler about updated thing {}, because thing is not initialized " + "(must be in status ONLINE or OFFLINE).", thing.getThingTypeUID()); } } else { registerHandler(thing); } if (oldThing != thing) { oldThing.setHandler(null); } }
Source:
<code>private JSONObject processStroke(JSONObject ret, Stroke stroke) { if (stroke == null) { return ret; } boolean stroked = false; if (stroke.getGraphicStroke() != null) { stroked = true; JSONObject jGraphic = new JSONObject(); jGraphic = processGraphic(jGraphic, stroke.getGraphicStroke()); ret.element(GRAPHIC_STROKE, jGraphic); } if (stroke.getGraphicFill() != null) { stroked = true; JSONObject jGraphic = new JSONObject(); jGraphic = processGraphic(jGraphic, stroke.getGraphicFill()); ret.element(GRAPHIC_FILL, jGraphic); } if (!stroked) { ret.element(STROKE, stroke.getColor().evaluate(feature)); ret.element(STROKE_WIDTH, stroke.getWidth().evaluate(feature)); } if (stroke.getOpacity() != null) { ret.element(STROKE_OPACITY, printExpression(stroke.getOpacity(), Number.class)); } if (stroke.getLineCap() != null) { ret.element(STROKE_LINECAP, printExpression(stroke.getLineCap(), String.class)); } if (stroke.getLineJoin() != null) { ret.element(STROKE_LINEJOIN, printExpression(stroke.getLineJoin(), String.class)); } List<Expression> dashArray = stroke.dashArray(); if (dashArray != null && !dashArray.isEmpty()) { JSONArray dArray = new JSONArray(); for (Expression e : dashArray) { <START> dArray.add(e.evaluate(feature)); <END> } ret.element(STROKE_DASHARRAY, dArray); Expression dashOffset = stroke.getDashOffset(); if (dashOffset != null) { ret.element(STROKE_DASHOFFSET, dashOffset.evaluate(feature)); } } return ret; }</code><technical_language>This a printExpression, depend attributes</technical_language>

Target:
private JSONObject processStroke(JSONObject ret, Stroke stroke) { if (stroke == null) { return ret; } boolean stroked = false; if (stroke.getGraphicStroke() != null) { stroked = true; JSONObject jGraphic = new JSONObject(); jGraphic = processGraphic(jGraphic, stroke.getGraphicStroke()); ret.element(GRAPHIC_STROKE, jGraphic); } if (stroke.getGraphicFill() != null) { stroked = true; JSONObject jGraphic = new JSONObject(); jGraphic = processGraphic(jGraphic, stroke.getGraphicFill()); ret.element(GRAPHIC_FILL, jGraphic); } if (!stroked) { ret.element(STROKE, stroke.getColor().evaluate(feature)); ret.element(STROKE_WIDTH, stroke.getWidth().evaluate(feature)); } if (stroke.getOpacity() != null) { ret.element(STROKE_OPACITY, toJSONValue(stroke.getOpacity(), Number.class)); } if (stroke.getLineCap() != null) { ret.element(STROKE_LINECAP, toJSONValue(stroke.getLineCap(), String.class)); } if (stroke.getLineJoin() != null) { ret.element(STROKE_LINEJOIN, toJSONValue(stroke.getLineJoin(), String.class)); } List<Expression> dashArray = stroke.dashArray(); if (dashArray != null && !dashArray.isEmpty()) { JSONArray dArray = new JSONArray(); for (Expression e : dashArray) { dArray.add(toJSONValue(e, Double.class)); } ret.element(STROKE_DASHARRAY, dArray); Expression dashOffset = stroke.getDashOffset(); if (dashOffset != null) { ret.element(STROKE_DASHOFFSET, toJSONValue(dashOffset, Double.class)); } } return ret; }
Source:
<code>protected void updateData(double[] x, @NonNull AnalysisBaseQueryFilter filters, IProgressMonitor monitor) { if (fXYDataProvider == null) { return; } ICommonXAxisResponse response = null; ICommonXAxisModel model = null; boolean isComplete = false; long currentEnd = 0; <START> while (!isComplete && currentEnd < filters.getQueryInterval().getEndTime()) { <END> response = fXYDataProvider.fetch(x, filters, monitor); model = response.getModel(); if (model != null) { updateDisplay(model); } isComplete = response.getStatus() == ICommonXAxisResponse.Status.COMPLETED; } }</code><technical_language>this is a great idea. add a pause denial of service attack provider</technical_language>

Target:
protected void updateData(double[] x, @NonNull AnalysisBaseQueryFilter filters, IProgressMonitor monitor) { if (fXYDataProvider == null) { return; } ICommonXAxisResponse response = null; ICommonXAxisModel model = null; boolean isComplete = false; long currentEnd = 0; while (!isComplete && currentEnd < filters.getQueryInterval().getEndTime().toNanos()) { response = fXYDataProvider.fetch(x, filters, monitor); model = response.getModel(); if (model != null) { updateDisplay(model); } isComplete = response.getStatus() == ICommonXAxisResponse.Status.COMPLETED; if(isComplete) { return; } try { finishedLatch.await(BUILD_UPDATE_TIMEOUT, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { e.printStackTrace(); return; } } }
Source:
<code>private static String dotBlockLabel(int blockId, int firstBlockId) { <START> String label = "B" + blockId; <END> String color = ""; if (blockId == 0) { label += " (EXIT)"; color = "red"; } else if (blockId == firstBlockId) { label += " (START)"; color = "green"; } StringBuilder sb = new StringBuilder(); sb.append("[label=\""); sb.append(label); sb.append("\""); if (!color.isEmpty()) { sb.append(",fillcolor=\""); sb.append(color); sb.append("\",fontcolor=\"white\""); } sb.append("]"); return sb.toString(); }</code><technical_language>This method refactored StringFormat clearer</technical_language>

Target:
private static String dotBlockLabel(int blockId, int firstBlockId) { String label = "B" + blockId; String color = ""; if (blockId == 0) { label += " (EXIT)"; color = "red"; } else if (blockId == firstBlockId) { label += " (START)"; color = "green"; } if (!color.isEmpty()) { color = MessageFormat.format(",fillcolor=\"{0}\",fontcolor=\"white\"", color); } return MessageFormat.format(DOT_PADDING + "{0}[label=\"{1}\"{2}];" + NEW_LINE, blockId, label, color); }
Source:
<code>public void apply(EntitySpec<?> entitySpec, String nodeId, ToscaApplication toscaApplication) { final Iterable<String> artifacts = getToscaFacade().getArtifacts(nodeId, toscaApplication); if (Iterables.isEmpty(artifacts)) { return; } final Map<String, String> filesToCopy = MutableMap.of(); for (final String artifactId : artifacts) { Optional<Path> optionalResourcesRootPath = getToscaFacade().getArtifactPath(nodeId, toscaApplication, artifactId); if(!optionalResourcesRootPath.isPresent()) { continue; } <START> BrooklynDslDeferredSupplier deferredRunDir = (BrooklynDslDeferredSupplier) BrooklynDslCommon.formatString("%s/%s", BrooklynDslCommon.attributeWhenReady("install.dir"), artifactId); <END> entitySpec.configure(SoftwareProcess.SHELL_ENVIRONMENT.subKey(artifactId), deferredRunDir); try { Files.walkFileTree(optionalResourcesRootPath.get(), new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { filesToCopy.put(file.toAbsolutePath().toString(), artifactId + "/" + file.getFileName().toString()); return FileVisitResult.CONTINUE; } }); } catch (IOException e) { LOG.warn("Cannot parse CSAR resources", e); } } entitySpec.configure(SoftwareProcess.PRE_INSTALL_FILES, filesToCopy); }</code><technical_language>I this is incorrect - placing files for variants of blueprint in directory. add a pre-install command create run.dir earlier happen</technical_language>

Target:
public void apply(EntitySpec<?> entitySpec, String nodeId, ToscaApplication toscaApplication) { final Iterable<String> artifacts = getToscaFacade().getArtifacts(nodeId, toscaApplication); if (Iterables.isEmpty(artifacts)) { return; } final Map<String, String> filesToCopy = MutableMap.of(); final String directoryPrefix = Identifiers.makeRandomJavaId(6); for (final String artifactId : artifacts) { Optional<Path> optionalResourcesRootPath = getToscaFacade().getArtifactPath(nodeId, toscaApplication, artifactId); if(!optionalResourcesRootPath.isPresent()) { continue; } BrooklynDslDeferredSupplier deferredInstallDir = (BrooklynDslDeferredSupplier) BrooklynDslCommon.formatString("%s/%s/%s", BrooklynDslCommon.attributeWhenReady("install.dir"), directoryPrefix, artifactId); entitySpec.configure(SoftwareProcess.SHELL_ENVIRONMENT.subKey(artifactId), deferredInstallDir); try { Files.walkFileTree(optionalResourcesRootPath.get(), new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { filesToCopy.put(file.toAbsolutePath().toString(), String.format("%s/%s/%s", directoryPrefix, artifactId, file.getFileName().toString())); return FileVisitResult.CONTINUE; } }); } catch (IOException e) { LOG.warn("Cannot parse CSAR resources", e); } } entitySpec.configure(SoftwareProcess.PRE_INSTALL_FILES, filesToCopy); }
Source:
<code>private boolean isSet(ReferenceChange diff, boolean mergeRightToLeft) { if (diff.getKind() != DifferenceKind.CHANGE) { return false; } boolean isSet = false; final Match match = diff.getMatch(); final EObject container; if (diff.getSource() == DifferenceSource.LEFT) { container = match.getLeft(); } else { container = match.getRight(); } if (container == null) { isSet = isRejecting(diff, mergeRightToLeft); } else { if (!ReferenceUtil.safeEIsSet(container, diff.getReference())) { isSet = isRejecting(diff, mergeRightToLeft); } else { if (isRejecting(diff, mergeRightToLeft)) { final EObject originContainer; if (match.getComparison().isThreeWay()) { originContainer = match.getOrigin(); } else if (mergeRightToLeft) { originContainer = match.getRight(); } else { originContainer = match.getLeft(); } isSet = originContainer != null && ReferenceUtil.safeEIsSet(originContainer, diff.getReference()); } else { <START> isSet = true; <END> } } } return isSet; }</code><technical_language>No. Set source side necessarily means a set operation. If is set in source target sides, is a set, a change. change this? Is example of fail implementation</technical_language>

Target:
private boolean isSet(ReferenceChange diff, boolean mergeRightToLeft) { if (diff.getKind() != DifferenceKind.CHANGE) { return false; } boolean isSet = false; final Match match = diff.getMatch(); final EObject container; if (diff.getSource() == DifferenceSource.LEFT) { container = match.getLeft(); } else { container = match.getRight(); } if (container == null) { isSet = isRejecting(diff, mergeRightToLeft); } else { if (!ReferenceUtil.safeEIsSet(container, diff.getReference())) { isSet = isRejecting(diff, mergeRightToLeft); } else { if (isRejecting(diff, mergeRightToLeft)) { final EObject originContainer; if (match.getComparison().isThreeWay()) { originContainer = match.getOrigin(); } else if (mergeRightToLeft) { originContainer = match.getRight(); } else { originContainer = match.getLeft(); } isSet = originContainer != null && ReferenceUtil.safeEIsSet(originContainer, diff.getReference()); } else { final EObject targetContainer; if (mergeRightToLeft) { targetContainer = match.getLeft(); } else { targetContainer = match.getRight(); } isSet = targetContainer == null || !ReferenceUtil.safeEIsSet(targetContainer, diff.getReference()); } } } return isSet; }
Source:
<code>public void subscriberContextPropagation() throws MuleException { final ContextPropagationChecker contextPropagationChecker = new ContextPropagationChecker(); MessageProcessorChain mp = newChain(empty(), contextPropagationChecker); choiceRouter.addRoute(payloadZapExpression(), mp); initialise(); <START> final CoreEvent result = just(zapEvent()) <END> .transform(choiceRouter) .subscriberContext(contextPropagationChecker.contextPropagationFlag()) .blockFirst(); assertThat(result, not(nullValue())); }</code><technical_language>duplicated code. this assertion unified. Verify if this done in tests</technical_language>

Target:
public void subscriberContextPropagation() throws MuleException { final ContextPropagationChecker contextPropagationChecker = new ContextPropagationChecker(); MessageProcessorChain mp = newChain(empty(), contextPropagationChecker); choiceRouter.addRoute(payloadZapExpression(), mp); initialise(); assertContextPropagation(zapEvent(), choiceRouter, contextPropagationChecker); }
Source:
<code>HashSet<ObjectId> listNonHEADIndexObjects() throws NoWorkTreeException, CorruptObjectException, IOException { RevWalk revWalk = null; DirCache dc = null; if (repo.isBare()) <START> return ((HashSet<ObjectId>) Collections.EMPTY_SET); <END> TreeWalk treeWalk = new TreeWalk(repo); try { dc = repo.readDirCache(); treeWalk.addTree(new DirCacheIterator(dc)); ObjectId headID = repo.resolve(Constants.HEAD); if (headID != null) { revWalk = new RevWalk(repo); treeWalk.addTree(revWalk.parseTree(headID)); revWalk.dispose(); } treeWalk.setFilter(TreeFilter.ANY_DIFF); treeWalk.setRecursive(true); HashSet<ObjectId> ret = new HashSet<ObjectId>(); while (treeWalk.next()) { ObjectId objectId = treeWalk.getObjectId(0); if (objectId != ObjectId.zeroId()) ret.add(objectId); } return ret; } finally { if (revWalk != null) revWalk.dispose(); treeWalk.release(); } }</code><technical_language>"normal", I a bare repo index, vice verse C Git complain if is index in a non-bare repo. commit, I simply consider non-precense of index files empty (EmptyTreeIterator)</technical_language>

Target:
HashSet<ObjectId> listNonHEADIndexObjects() throws CorruptObjectException, IOException { RevWalk revWalk = null; DirCache dc = null; try { if (repo.getIndexFile() == null) return ((HashSet<ObjectId>) Collections.EMPTY_SET); } catch (NoWorkTreeException e) { return ((HashSet<ObjectId>) Collections.EMPTY_SET); } TreeWalk treeWalk = new TreeWalk(repo); try { dc = repo.readDirCache(); treeWalk.addTree(new DirCacheIterator(dc)); ObjectId headID = repo.resolve(Constants.HEAD); if (headID != null) { revWalk = new RevWalk(repo); treeWalk.addTree(revWalk.parseTree(headID)); revWalk.dispose(); } treeWalk.setFilter(TreeFilter.ANY_DIFF); treeWalk.setRecursive(true); HashSet<ObjectId> ret = new HashSet<ObjectId>(); while (treeWalk.next()) { ObjectId objectId = treeWalk.getObjectId(0); if (objectId != ObjectId.zeroId()) ret.add(objectId); } return ret; } finally { if (revWalk != null) revWalk.dispose(); treeWalk.release(); } }
Source:
<code>private Resource createNewTemporalResource (final String newName, final InputStream in) { try { this.originalPath = (!this.originalPath.endsWith("/"))? this.originalPath + "/":this.originalPath; final File tempFile = this.dotDavHelper.createTempFile("/" + this.host.getHostname() + this.originalPath + newName); FileUtils.copyStreamToFile(tempFile, in, null); final Resource tempFileResource = new TempFileResourceImpl(tempFile, this.originalPath + newName, this.isAutoPub); return tempFileResource; } catch (Exception e){ <START> Logger.error(this, "Error creating temp file", e); <END> throw new DotRuntimeException(e.getMessage(), e); } }</code><technical_language>A warn well. I need stacktrace</technical_language>

Target:
private Resource createNewTemporalResource (final String newName, final InputStream in) { try { this.originalPath = (!this.originalPath.endsWith("/"))? this.originalPath + "/":this.originalPath; final File tempFile = this.dotDavHelper.createTempFile("/" + this.host.getHostname() + this.originalPath + newName); FileUtils.copyStreamToFile(tempFile, in, null); final Resource tempFileResource = new TempFileResourceImpl(tempFile, this.originalPath + newName, this.isAutoPub); return tempFileResource; } catch (Exception e){ Logger.debug(this, "Error creating temp file", e); Logger.warn(this, "Error creating temp file", e); throw new DotRuntimeException(e.getMessage(), e); } }
Source:
<code>protected void entryReplaced(long newAddress, long oldAddress) { long oldSize = sizeCalculator.applyAsLong(oldAddress); long newSize = sizeCalculator.applyAsLong(newAddress); lruLock.lock(); try { if (trace) { <START> log.tracef("Replacing LRU node: OldValue: 0x%016x NewValue: 0x%016x", oldAddress, <END> newAddress); } removeNode(oldAddress); addEntryAddressToEnd(newAddress); currentSize += newSize; currentSize -= oldSize; super.entryReplaced(newAddress, oldAddress); } finally { lruLock.unlock(); } }</code><technical_language>removeNode addEntryAddressToEnd log, remove this log ,essage</technical_language>

Target:
protected void entryReplaced(long newAddress, long oldAddress) { long oldSize = sizeCalculator.applyAsLong(oldAddress); long newSize = sizeCalculator.applyAsLong(newAddress); lruLock.lock(); try { removeNode(oldAddress); addEntryAddressToEnd(newAddress); currentSize += newSize; currentSize -= oldSize; super.entryReplaced(newAddress, oldAddress); } finally { lruLock.unlock(); } }
Source:
<code>public GroupIntoToolSectionCommand(ResourceSet set, ToolSection parent, Collection<EObject> selection) { super(set); this.selection = selection; <START> this.parent = parent; <END> }</code><technical_language>super(set, parent, selection);</technical_language>

Target:
public GroupIntoToolSectionCommand(ResourceSet set, ToolSection parent, Collection<EObject> selection) { super(set, parent, selection); }
Source:
<code>private static Integer testDecryption(AccumuloConfiguration conf, byte[] encryptedBytes) throws IOException, AEADBadTagException { CryptoModuleParameters params = CryptoModuleFactory.createParamsObjectFromAccumuloConfiguration(conf); CryptoModule cryptoModule = CryptoModuleFactory.getCryptoModule(conf); ByteArrayInputStream decryptedByteStream = new ByteArrayInputStream(encryptedBytes); params.setEncryptedInputStream(decryptedByteStream); params = cryptoModule.getDecryptingInputStream(params); DataInputStream decryptedDataStream = new DataInputStream(params.getPlaintextInputStream()); String utf; Integer in; try { utf = decryptedDataStream.readUTF(); in = decryptedDataStream.readInt(); } catch (IOException e) { final String message = "javax.crypto.AEADBadTagException:"; <START> if (e.getMessage().substring(0, message.length()).equals(message)) { <END> throw new AEADBadTagException(); } else { throw e; } } decryptedDataStream.close(); if (utf.equals(MARKER_STRING) && in.equals(MARKER_INT)) { return 1; } else { return 0; } }</code><technical_language>Do if e.getCause() return exception of type AEADBadTagException? If a cleaner check for this</technical_language>

Target:
private static Integer testDecryption(AccumuloConfiguration conf, byte[] encryptedBytes) throws IOException, AEADBadTagException { CryptoModuleParameters params = CryptoModuleFactory.createParamsObjectFromAccumuloConfiguration(conf); CryptoModule cryptoModule = CryptoModuleFactory.getCryptoModule(conf); ByteArrayInputStream decryptedByteStream = new ByteArrayInputStream(encryptedBytes); params.setEncryptedInputStream(decryptedByteStream); params = cryptoModule.getDecryptingInputStream(params); DataInputStream decryptedDataStream = new DataInputStream(params.getPlaintextInputStream()); String utf; Integer in; try { utf = decryptedDataStream.readUTF(); in = decryptedDataStream.readInt(); } catch (IOException e) { if (e.getCause().getClass().equals(AEADBadTagException.class)) { throw new AEADBadTagException(); } else { throw e; } } decryptedDataStream.close(); if (utf.equals(MARKER_STRING) && in.equals(MARKER_INT)) { return 1; } else { return 0; } }
Source:
<code>public <T extends IResource> T create(String kind, String namespace, String name, String subresource, IResource payload) { if(ResourceKind.LIST.equals(kind)) throw new UnsupportedOperationException("Generic create operation not supported for resource type 'List'"); try { <START> namespace = ResourceKind.PROJECT.equals(kind) ? "" : namespace; <END> final URL endpoint = new URLBuilder(this.baseUrl, typeMapper) .kind(kind) .name(name) .namespace(namespace) .subresource(subresource) .build(); String response = client.post(endpoint, IHttpClient.DEFAULT_READ_TIMEOUT, payload); LOGGER.debug(response); return factory.create(response); } catch (HttpClientException e){ throw createOpenShiftException(String.format("Could not create %s resource %s in namespace %s for subresource %s: %s", kind, name, namespace, subresource, e.getMessage()), e); } catch (SocketTimeoutException e) { throw new OpenShiftException(e, "Socket timeout creating resource %s", name); } }</code><technical_language>I logic (use "" for namespace if build url for a project) repeated times. Shouldnt extract a single, reusable method (so easier correct in a single location)</technical_language>

Target:
public <T extends IResource> T create(String kind, String namespace, String name, String subresource, IResource payload) { if(ResourceKind.LIST.equals(kind)) throw new UnsupportedOperationException("Generic create operation not supported for resource type 'List'"); try { namespace = ResourceKind.PROJECT.equals(kind) ? null : namespace; final URL endpoint = new URLBuilder(this.baseUrl, typeMapper) .kind(kind) .name(name) .namespace(namespace) .subresource(subresource) .build(); String response = client.post(endpoint, IHttpClient.DEFAULT_READ_TIMEOUT, payload); LOGGER.debug(response); return factory.create(response); } catch (HttpClientException e){ throw createOpenShiftException(String.format("Could not create %s resource %s in namespace %s for subresource %s: %s", kind, name, namespace, subresource, e.getMessage()), e); } catch (SocketTimeoutException e) { throw new OpenShiftException(e, "Socket timeout creating resource %s", name); } }
Source:
<code>public void put(long bucketId, @NotNull Slice key, @NotNull Slice value) { Map<Slice, Slice> bucket = store.get(bucketId); if (bucket == null) { bucket = Maps.newHashMap(); store.put(bucketId, bucket); } <START> if (key.getClass() == Slice.class) { <END> key = new SerializeSlice(key); } if (value.getClass() == Slice.class) { value = new SerializeSlice(value); } bucket.put(key, value); }</code><technical_language>This code repeats in multiple places. replace Slice, please code in SliceUtil another central place</technical_language>

Target:
public void put(long bucketId, @NotNull Slice key, @NotNull Slice value) { Map<Slice, Slice> bucket = store.get(bucketId); if (bucket == null) { bucket = Maps.newHashMap(); store.put(bucketId, bucket); } key = SliceUtils.toBufferSlice(key); value = SliceUtils.toBufferSlice(value); bucket.put(key, value); }
Source:
<code>public void initialize(RoutingRequest request, long abortTime) { Vertex target = request.rctx.target; if (target == this.target) { LOG.debug("Reusing existing heuristic, the target vertex has not changed."); return; } LOG.debug("Initializing heuristic computation."); this.graph = request.rctx.graph; long start = System.currentTimeMillis(); this.target = target; this.routingRequest = request; request.softWalkLimiting = false; request.softPreTransitLimiting = false; request.bikeWalkingOptions.softWalkLimiting = false; request.bikeWalkingOptions.softPreTransitLimiting = false; transitQueue = new BinHeap<>(); TObjectDoubleMap<Vertex> forwardStreetSearchResults = streetSearch(request, false, abortTime); if (forwardStreetSearchResults == null) { return; } preTransitVertices = forwardStreetSearchResults.keySet(); LOG.debug("end forward street search ms", System.currentTimeMillis() - start); postBoardingWeights = streetSearch(request, true, abortTime); if (postBoardingWeights == null) { return; } LOG.debug("end backward street search ms", System.currentTimeMillis() - start); <START> if (!request.modes.getCar()) request.setMaxWalkDistance(Double.POSITIVE_INFINITY); <END> request.setMaxPreTransitTime(Integer.MAX_VALUE); LOG.debug("initialized SSSP"); request.rctx.debugOutput.finishedPrecalculating(); }</code><technical_language>I liner if statements avoided code style convention. Side note, link for sun code style convention is outdated [here](<LINK_0> I new link is <LINK_1></technical_language>

Target:
public void initialize(RoutingRequest request, long abortTime) { Vertex target = request.rctx.target; if (target == this.target) { LOG.debug("Reusing existing heuristic, the target vertex has not changed."); return; } LOG.debug("Initializing heuristic computation."); this.graph = request.rctx.graph; long start = System.currentTimeMillis(); this.target = target; this.routingRequest = request; request.softWalkLimiting = false; request.softPreTransitLimiting = false; request.bikeWalkingOptions.softWalkLimiting = false; request.bikeWalkingOptions.softPreTransitLimiting = false; transitQueue = new BinHeap<>(); preTransitVertices = streetSearch(request, false, abortTime); if (preTransitVertices == null) { return; } LOG.debug("end forward street search ms", System.currentTimeMillis() - start); postTransitVertices = streetSearch(request, true, abortTime); if (postTransitVertices == null) { return; } LOG.debug("end backward street search ms", System.currentTimeMillis() - start); transitVertexWeights = new TObjectDoubleHashMap<>(100, 0.5f, Double.POSITIVE_INFINITY); remainingDistanceSpeed = request.getStreetSpeedUpperBound(); preTransitRemainingWeightEstimates = new HashMap<>(); useEuclideanRemainingWeightEstimateForPreTransitVertices = request.modes.getCar() || ( request.modes.getBicycle() && request.maxWalkDistance > PRE_TRANSIT_EUCLIDEAN_WALK_DISTANCE_THRESHOLD ); request.setMaxWalkDistance(Double.POSITIVE_INFINITY); request.setMaxPreTransitTime(Integer.MAX_VALUE); LOG.debug("initialized SSSP"); request.rctx.debugOutput.finishedPrecalculating(); }
Source:
<code>public AnnualCreditsState(ExecutionYear executionYear) { super(); setExecutionYear(executionYear); setOrientationsCalculationDate(new LocalDate(executionYear.getBeginCivilYear(), 12, 31)); setIsOrientationsCalculated(false); setIsFinalCreditsCalculated(false); setIsCreditsClosed(false); setRootDomainObject(Bennu.getInstance()); <START> <END> }</code><technical_language>space</technical_language>

Target:
public AnnualCreditsState(ExecutionYear executionYear) { super(); setExecutionYear(executionYear); setOrientationsCalculationDate(new LocalDate(executionYear.getBeginCivilYear(), 12, 31)); setIsOrientationsCalculated(false); setIsFinalCreditsCalculated(false); setIsCreditsClosed(false); setCreationDate(new DateTime()); setRootDomainObject(Bennu.getInstance()); }
Source:
<code><START> private List<GerritQueryResult> executeQueryRest(String query) throws GerritException { <END> List<GerritQueryResult> results = null; results = client.executeQueryRest(new NullProgressMonitor(), query); return results; }</code><technical_language>This is essentially line of code, prefer inline this</technical_language>

Target:
private List<GerritQueryResult> executeQueryRest(String query) throws GerritException { return client.executeQueryRest(new NullProgressMonitor(), query); }
Source:
<code>public void sendMessage(byte[] data) { try { output.write(data); output.flush(); } catch (IOException ioException) { logger.debug("sendMessage(): Writing error: {}", ioException.getMessage()); <START> connected = false; <END> } catch (Exception exception) { logger.debug("sendMessage(): Writing error: {}", exception.getMessage()); connected = false; } }</code><technical_language>setConnected(false) instead below</technical_language>

Target:
public void sendMessage(byte[] data) { try { output.write(data); output.flush(); } catch (IOException ioException) { logger.debug("sendMessage(): Writing error: {}", ioException.getMessage()); setConnected(false); } catch (Exception exception) { logger.debug("sendMessage(): Writing error: {}", exception.getMessage()); setConnected(false); } }
Source:
<code>public void whenMediaFolderFileDoesNotExist_shouldGetAllMethodReturnEmptyArray() { FormsDao formsDao = mock(FormsDao.class); <START> FileUtil fileUtil = mock(FileUtil.class); <END> File file = mock(File.class); String formMediaPath = "/samplePath/"; when(formsDao.getFormMediaPath("1", "1")).thenReturn(formMediaPath); when(fileUtil.getFileAtPath(formMediaPath)).thenReturn(file); when(file.exists()).thenReturn(false); assertThat(new DatabaseMediaFileRepository(formsDao, new FileUtil()).getAll("1", "1").size(), is(0)); }</code><technical_language>I cut out a lot of mocking formsDao.getFormMediaPath return a file path exist. create a temp dir (using File.createTempDir) return a path of a directory in (that create). need mock a File FileUtils listFiles work a static helper needing pass in util a dependency. do think</technical_language>

Target:
public void whenMediaFolderFileDoesNotExist_shouldGetAllMethodReturnEmptyArray() { FormsDao formsDao = mock(FormsDao.class); when(formsDao.getFormMediaPath("1", "1")).thenReturn("/samplePath/"); assertThat(new DatabaseMediaFileRepository(formsDao, new FileUtil()).getAll("1", "1").size(), is(0)); }
Source:
<code>public List<ResolvedTypeParameterDeclaration> getTypeParameters() { if (null == ctClass.getGenericSignature()) { <START> return new ArrayList<>(); <END> } else { try { SignatureAttribute.ClassSignature classSignature = SignatureAttribute.toClassSignature(ctClass.getGenericSignature()); return Arrays.<SignatureAttribute.TypeParameter>stream(classSignature.getParameters()) .map((tp) -> new JavassistTypeParameter(tp, JavassistFactory.toTypeDeclaration(ctClass, typeSolver), typeSolver)) .collect(Collectors.toList()); } catch (BadBytecode badBytecode) { throw new RuntimeException(badBytecode); } } }</code><technical_language>Again, why? modify this list, right</technical_language>

Target:
public List<ResolvedTypeParameterDeclaration> getTypeParameters() { if (null == ctClass.getGenericSignature()) { return Collections.emptyList(); } else { try { SignatureAttribute.ClassSignature classSignature = SignatureAttribute.toClassSignature(ctClass.getGenericSignature()); return Arrays.<SignatureAttribute.TypeParameter>stream(classSignature.getParameters()) .map((tp) -> new JavassistTypeParameter(tp, JavassistFactory.toTypeDeclaration(ctClass, typeSolver), typeSolver)) .collect(Collectors.toList()); } catch (BadBytecode badBytecode) { throw new RuntimeException(badBytecode); } } }
Source:
<code>private void stagePathConfiguration(Configuration config) { File depFH = new VoltFile(config.m_voltdbRoot, VoltDB.INITIALIZED_PATHS); try (PrintWriter pw = new PrintWriter(new FileWriter(depFH), true)) { m_pathList.store(pw, "DO NOT MODIFY THIS FILE"); <START> pw.flush(); <END> pw.close(); } catch (IOException e) { VoltDB.crashLocalVoltDB("Unable to stage configuration path destination", false, e); } }</code><technical_language>flush close done automagically get out try resource block</technical_language>

Target:
private void stagePathConfiguration(Configuration config) { File depFH = new VoltFile(config.m_voltdbRoot, VoltDB.INITIALIZED_PATHS); try (PrintWriter pw = new PrintWriter(new FileWriter(depFH), true)) { m_pathList.store(pw, "DO NOT MODIFY THIS FILE"); } catch (IOException e) { VoltDB.crashLocalVoltDB("Unable to stage configuration path destination", false, e); } }
Source:
<code>public void setCurrentPacket(ICTFPacketDescriptor currentPacket) throws CTFException { fCurrentPacket = currentPacket; if (fCurrentPacket != null) { ByteBuffer bb = null; try { bb = getByteBufferAt(fCurrentPacket.getOffsetBytes(), (fCurrentPacket.getPacketSizeBits() + BITS_PER_BYTE - 1) / BITS_PER_BYTE); } catch (IOException e) { throw new CTFIOException(e.getMessage(), e); } BitBuffer bitBuffer = new BitBuffer(bb); fBitBuffer = bitBuffer; if (fTracePacketHeaderDecl != null) { fCurrentTracePacketHeaderDef = getTracePacketHeaderDefinition(bitBuffer); } if (fStreamPacketContextDecl != null) { fCurrentStreamPacketContextDef = getStreamPacketContextDefinition(bitBuffer); if (getCurrentPacket().getTarget() != null) { fCurrentCpu = (int) getCurrentPacket().getTargetId(); } fLostEventsInThisPacket = (int) getCurrentPacket().getLostEvents(); if (fLostEventsInThisPacket != 0) { fHasLost = true; } } <START> fLastTimestamp = Math.max(currentPacket.getTimestampBegin(),fLastTimestamp); <END> } else { fBitBuffer = null; fLastTimestamp = 0; } }</code><technical_language>This change ControlFlowView SWTBot test fail. if revert line</technical_language>

Target:
public void setCurrentPacket(ICTFPacketDescriptor currentPacket) throws CTFException { fCurrentPacket = currentPacket; if (fCurrentPacket != null) { ByteBuffer bb = null; try { bb = getByteBufferAt(fCurrentPacket.getOffsetBytes(), (fCurrentPacket.getPacketSizeBits() + BITS_PER_BYTE - 1) / BITS_PER_BYTE); } catch (IOException e) { throw new CTFIOException(e.getMessage(), e); } BitBuffer bitBuffer = new BitBuffer(bb); fBitBuffer = bitBuffer; if (fTracePacketHeaderDecl != null) { fCurrentTracePacketHeaderDef = getTracePacketHeaderDefinition(bitBuffer); } if (fStreamPacketContextDecl != null) { fCurrentStreamPacketContextDef = getStreamPacketContextDefinition(bitBuffer); if (getCurrentPacket().getTarget() != null) { fCurrentCpu = (int) getCurrentPacket().getTargetId(); } fLostEventsInThisPacket = (int) getCurrentPacket().getLostEvents(); if (fLostEventsInThisPacket != 0) { fHasLost = true; } } fLastTimestamp = Math.max(currentPacket.getTimestampBegin(),0); } else { fBitBuffer = null; fLastTimestamp = 0; } }
Source:
<code>static ExternalIdentifier create(StudyIdentifier studyId, String identifier) { <START> return new DynamoExternalIdentifier(studyId == null ? null : studyId.getIdentifier(), identifier); <END> }</code><technical_language>If create externalID a studyID, error? unit tests test creating externalID a studyID is okay</technical_language>

Target:
static ExternalIdentifier create(StudyIdentifier studyId, String identifier) { checkNotNull(studyId); return new DynamoExternalIdentifier(studyId.getIdentifier(), identifier); }
Source:
<code>public void waitForAllocate() { try { if (this.instance != null) { instance = context.resourceMonitor.waitFor(instance, new ResourcePredicate<Instance>() { @Override public boolean evaluate(Instance obj) { return context.objectManager.find(InstanceHostMap.class, INSTANCE_HOST_MAP.INSTANCE_ID, instance.getId()).size() > 0; } }); } } catch (Exception ex) { <START> throw new ServiceInstanceAllocateException("Failed to allocate instance [" + instance.getId() + "]"); <END> } }</code><technical_language>want mask original exception. pass constructor</technical_language>

Target:
public void waitForAllocate() { try { if (this.instance != null) { instance = context.resourceMonitor.waitFor(instance, new ResourcePredicate<Instance>() { @Override public boolean evaluate(Instance obj) { return context.objectManager.find(InstanceHostMap.class, INSTANCE_HOST_MAP.INSTANCE_ID, instance.getId()).size() > 0; } }); } } catch (Exception ex) { throw new ServiceInstanceAllocateException("Failed to allocate instance [" + instance.getId() + "]", ex); } }
Source:
<code>void setIsEmptyDirectory(Tristate isEmptyDirectory) { this.isEmptyDirectory = isEmptyDirectory; <START> if (fileStatus.isDirectory()) { <END> fileStatus = new S3AFileStatus( isEmptyDirectory, fileStatus.getPath(), fileStatus.getOwner()); } }</code><technical_language>create a new FileStatus instead of updating? Suspect *might* losing some fields here</technical_language>

Target:
void setIsEmptyDirectory(Tristate isEmptyDirectory) { this.isEmptyDirectory = isEmptyDirectory; fileStatus.setIsEmptyDirectory(isEmptyDirectory); }
Source:
<code>public void aiMover() { this.players = this.level.getPlayers(); this.units = this.level.getUnits(); this.enemies.addAll(units.stream().filter( u -> u instanceof Enemy).map( u -> (Enemy) u).collect(Collectors.toList())); if(players.size() > 0) { this.player = this.players.get(0); for(int i = 0; i < enemies.size(); i++) { Enemy enemy = enemies.get(i); <START> enemy.setPlayer((Mover) player); <END> int moveToX = PathCalculation.calculateXPath((Mover) player, enemy); int moveToY = PathCalculation.calculateYPath((Mover) player, enemy); randomize(enemy); doMoves(enemy, moveToX, moveToY); } } }</code><technical_language>need cast. < layout</technical_language>

Target:
public void aiMover() { this.players = this.level.getPlayers(); this.units = this.level.getUnits(); this.enemies.addAll(units.stream().filter( u -> u instanceof Enemy).map( u -> (Enemy) u).collect(Collectors.toList())); if(players.size() > 0) { this.player = this.players.get(0); for(int i = 0; i < enemies.size(); i++) { Enemy enemy = enemies.get(i); enemy.setPlayer((Player) player); int moveToX = PathCalculation.calculateXPath((Mover) player, enemy); int moveToY = PathCalculation.calculateYPath((Mover) player, enemy); randomize(enemy); doMoves(enemy, moveToX, moveToY); } } }
Source:
<code><START> public void removeConnectionCallbacks(LostApiClient.ConnectionCallbacks callbacks) { <END> serviceConnectionManager.removeCallbacks(callbacks); }</code><technical_language>removeConnectionCallbacks(...) getServiceConnectionManager() package private internally</technical_language>

Target:
void removeConnectionCallbacks(LostApiClient.ConnectionCallbacks callbacks) { serviceConnectionManager.removeCallbacks(callbacks); }
Source:
<code>public void interfaceStaticMethods() throws Exception { <START> assumeTrue(isJava8()); <END> TypeSpec bar = TypeSpec.interfaceBuilder("Tacos") .addMethod(MethodSpec.methodBuilder("test") .addModifiers(Modifier.PUBLIC, Modifier.valueOf("STATIC")) .returns(int.class) .addCode(CodeBlock.builder().addStatement("return 0").build()) .build()) .build(); assertThat(toString(bar)).isEqualTo("" + "package com.squareup.tacos;\n" + "\n" + "interface Tacos {\n" + " static int test() {\n" + " return 0;\n" + " }\n" + "}\n" ); }</code><technical_language>This needed, resulting interfaces compiled</technical_language>

Target:
public void interfaceStaticMethods() throws Exception { TypeSpec bar = TypeSpec.interfaceBuilder("Tacos") .addMethod(MethodSpec.methodBuilder("test") .addModifiers(Modifier.PUBLIC, Modifier.STATIC) .returns(int.class) .addCode(CodeBlock.builder().addStatement("return 0").build()) .build()) .build(); assertThat(toString(bar)).isEqualTo("" + "package com.squareup.tacos;\n" + "\n" + "interface Tacos {\n" + " static int test() {\n" + " return 0;\n" + " }\n" + "}\n" ); }
Source:
<code>public void execute(String[] args, Console console) { <START> String subCommand = args[0]; <END> if (SUBCMD_DUMP.equals(subCommand) || args.length > 2) { switch (subCommand) { case SUBCMD_DUMP: dumpMetadata(console); break; case SUBCMD_LIST: listMetadata(console, args[1], args[2]); break; case SUBCMD_ADD: if (args.length < 4) { printUsage(console); } else { addMetadata(console, args[1], args[2], args[3], args.length > 4 ? args[4] : null); } break; case SUBCMD_REMOVE: removeMetadata(console, args[1], args[2]); break; default: console.println("Unknown command '" + subCommand + "'"); printUsage(console); break; } } else { printUsage(console); } }</code><technical_language>this ArrayIndexOutOfBounds calling smarthome metadata cli</technical_language>

Target:
public void execute(String[] args, Console console) { if (args.length > 0) { String subCommand = args[0]; switch (subCommand) { case SUBCMD_LIST: listMetadata(console, args.length > 1 ? args[1] : null, args.length > 2 ? args[2] : null, false); break; case SUBCMD_LIST_INTERNAL: listMetadata(console, args.length > 1 ? args[1] : null, args.length > 2 ? args[2] : null, true); break; case SUBCMD_ADD: if (args.length < 4) { printUsage(console); } else { addMetadata(console, args[1], args[2], args[3], args.length > 4 ? args[4] : null); } break; case SUBCMD_REMOVE: removeMetadata(console, args[1], args.length > 2 ? args[2] : null); break; default: console.println("Unknown command '" + subCommand + "'"); printUsage(console); break; } } else { printUsage(console); } }